:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1e2935;
  background: #fff;
  font-synthesis: none;
  --line: #e3e8ed;
  --line-strong: #cdd6df;
  --muted: #607080;
  --subtle: #5c6d7d;
  --blue: #225ba8;
  --blue-hover: #174985;
  --blue-wash: #edf4fc;
  --surface: #f7f9fb;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-width: 320px; }
::selection { background: #c9dcf5; color: #172b43; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, input:focus-visible, select:focus-visible, .record:focus-visible, summary:focus-visible { outline: 2px solid #4f89ce; outline-offset: 2px; }
.hidden { display: none !important; }
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 28px; border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-symbol { display: grid; grid-template-columns: repeat(2, 5px); grid-template-rows: repeat(2, 5px); gap: 3px; align-content: center; justify-content: center; width: 28px; height: 28px; flex: none; border-radius: 6px; background: #244f82; }
.brand-symbol span { border-radius: 1px; background: #fff; }
.brand-symbol span:last-child { background: #9dc4ef; }
.brand-name { white-space: nowrap; font-size: 14px; font-weight: 700; letter-spacing: -.015em; color: #1e2935; }
.brand-name span { margin-left: 4px; padding-left: 9px; border-left: 1px solid var(--line-strong); font-weight: 500; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 20px; min-width: 0; color: var(--muted); font-size: 12px; }
.environment { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #9aa8b5; }
.env-dot.connected { background: #3a9867; }
.user-label { padding-left: 20px; border-left: 1px solid var(--line); white-space: nowrap; color: #344557; font-weight: 500; }
.text-button { padding: 6px 0; border: 0; background: none; color: var(--blue); font-size: 12px; font-weight: 600; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.language-switch { display: inline-flex; flex: none; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; }
.language-switch button { min-width: 32px; padding: 5px 6px; border: 0; background: #fff; color: var(--muted); font-size: 11px; font-weight: 650; }
.language-switch button + button { border-left: 1px solid var(--line-strong); }
.language-switch button[aria-pressed="true"] { background: var(--blue-wash); color: var(--blue); }
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 20px; padding: 16px 24px; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }
.site-footer a { color: var(--blue); }

.login-screen { flex: 1; min-height: 0; overflow-y: auto; padding: clamp(44px, 8vh, 90px) 24px 60px; background: var(--surface); }
.login-intro { width: min(100%, 440px); margin: 0 auto 25px; }
.login-intro h1 { margin: 0 0 10px; color: #1b2c3e; font-size: clamp(26px, 4vw, 32px); line-height: 1.2; font-weight: 650; letter-spacing: -.03em; }
.login-intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.login-card { width: min(100%, 440px); margin: 0 auto; padding: 26px 28px 24px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.form-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 20px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.form-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; font-weight: 650; }
.form-heading span { color: var(--subtle); font-size: 11px; font-variant-numeric: tabular-nums; }
.login-card label { display: block; margin: 18px 0 7px; color: #344557; font-size: 12px; font-weight: 650; }
.login-card input, .search-input, select { height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; background: #fff; color: #243445; }
.login-card input { width: 100%; }
input::placeholder { color: #81909e; opacity: 1; }
.login-card input:focus, .search-input:focus, select:focus { border-color: #4f89ce; box-shadow: 0 0 0 3px #dceafa; }
.field-hint { margin: 6px 0 0; color: var(--subtle); font-size: 12px; }
.separator { display: flex; align-items: center; gap: 11px; margin: 24px 0 0; color: var(--subtle); font-size: 12px; }
.separator::before, .separator::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 40px; margin-top: 24px; padding: 0 13px; border: 1px solid var(--blue); border-radius: 6px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 650; }
.primary-button:hover:not(:disabled) { background: var(--blue-hover); border-color: var(--blue-hover); }
.primary-button span { font-size: 16px; font-weight: 400; }
.security-note { margin: 15px 0 0; color: var(--subtle); font-size: 12px; line-height: 1.5; }
.form-error { margin-top: 18px; padding: 10px 12px; border: 1px solid #efc5c5; border-radius: 6px; background: #fff5f5; color: #9f3131; font-size: 12px; line-height: 1.4; }

.workspace { display: grid; grid-template-columns: 250px minmax(0,1fr); flex: 1; min-height: 0; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 22px 14px 14px; border-right: 1px solid var(--line); background: #fbfcfd; }
.sidebar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 9px; margin-bottom: 17px; }
.sidebar-head h2 { margin: 0; color: #28394a; font-size: 14px; font-weight: 700; }
.count-badge { color: var(--subtle); font-size: 11px; font-variant-numeric: tabular-nums; }
.sidebar > .search-input { width: 100%; background: #fff; font-size: 12px; }
.sidebar-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 0 2px; color: var(--subtle); font-size: 11px; font-variant-numeric: tabular-nums; }
.subtle-button, .icon-button, .page-button { border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: #33495f; font-size: 12px; font-weight: 550; }
.subtle-button { min-height: 32px; padding: 6px 10px; }
.subtle-button:hover:not(:disabled), .icon-button:hover:not(:disabled), .page-button:hover:not(:disabled) { border-color: #a9bfd5; background: var(--blue-wash); color: var(--blue-hover); }
.icon-button { width: 34px; height: 34px; font-size: 18px; line-height: 1; }
.entity-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.entity-group { margin: 18px 9px 8px; color: var(--subtle); font-size: 11px; font-weight: 700; }
.entity-btn { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 6px 9px; border: 0; border-radius: 5px; background: transparent; text-align: left; color: #415469; font-size: 12px; font-weight: 500; }
.entity-btn:hover { background: #eef2f6; }
.entity-btn.active { background: #e8f1fb; color: #174985; font-weight: 650; }
.entity-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #d5dce3; }
.access-dot.ok { background: #3a9867; }
.access-dot.denied { background: #bc6a55; }
.access-dot.error { background: #c39a3a; }
.sidebar-foot { padding: 15px 9px 0; border-top: 1px solid var(--line); color: var(--subtle); font-size: 11px; }
.entity-list::-webkit-scrollbar, .records::-webkit-scrollbar, .detail-body::-webkit-scrollbar { width: 9px; }
.entity-list::-webkit-scrollbar-thumb, .records::-webkit-scrollbar-thumb, .detail-body::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 9px; background: #c2ccd6; background-clip: padding-box; }

.content { min-width: 0; min-height: 0; overflow-y: auto; padding: 26px 28px; background: #fff; }
.content-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; min-height: 86px; margin-bottom: 22px; }
.breadcrumb { margin-bottom: 7px; color: var(--subtle); font-size: 11px; }
.breadcrumb > span:first-child { margin: 0 4px; color: #aab4bf; }
.content-head h1 { margin: 0 0 5px; color: #1c2b3b; font-size: clamp(22px, 2.4vw, 27px); line-height: 1.2; font-weight: 650; letter-spacing: -.025em; }
.content-head p { margin: 0; color: var(--muted); font-size: 12px; }
.head-controls { display: flex; align-items: center; gap: 9px; padding-bottom: 2px; white-space: nowrap; }
.head-controls label, .page-size { color: var(--muted); font-size: 12px; font-weight: 550; }
.head-controls select { max-width: 200px; min-width: 105px; height: 34px; font-size: 12px; }
.notice { margin-bottom: 16px; padding: 11px 13px; border: 1px solid #efd4c4; border-radius: 6px; background: #fff8f4; color: #884e32; font-size: 12px; line-height: 1.45; }
.notice.info { border-color: #bfd9c9; background: #f3faf5; color: #326449; }
.data-layout { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(310px, .82fr); min-height: max(450px, calc(100vh - 224px)); gap: 16px; }
.records-panel, .detail-panel { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.panel-toolbar, .detail-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; padding: 11px 17px; border-bottom: 1px solid var(--line); }
.panel-toolbar strong { display: block; font-size: 13px; font-weight: 650; }
.muted { display: block; margin-top: 4px; color: var(--subtle); font-size: 12px; font-variant-numeric: tabular-nums; }
.page-size { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.page-size select { width: 58px; height: 32px; font-size: 12px; }
.api-search { display: grid; grid-template-columns: minmax(95px, .65fr) minmax(100px, 1fr) auto auto; align-items: center; gap: 7px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.api-search select, .api-search .search-input { min-width: 0; width: 100%; height: 34px; font-size: 12px; }
.api-search .subtle-button { height: 34px; }
.sort-controls { display: flex; align-items: end; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.sort-option { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; color: var(--muted); font-size: 11px; }
.sort-option select { width: 100%; height: 34px; min-width: 0; font-size: 12px; }
.sort-direction { flex: 0 0 125px; }
.records { flex: 1; min-height: 250px; max-height: calc(100vh - 410px); overflow-y: auto; }
.record { padding: 12px 17px; border-bottom: 1px solid #edf0f3; cursor: pointer; }
.record:hover { background: #f8fafc; }
.record.active { background: #edf4fc; box-shadow: inset 2px 0 #225ba8; }
.record-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.record-title { overflow: hidden; color: #243748; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.record-code { flex: none; color: #637b92; font-size: 11px; font-variant-numeric: tabular-nums; }
.record-sub { overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 47px; padding: 7px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pager-top { border-top: 0; border-bottom: 1px solid var(--line); }
.page-numbers { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.page-button { min-width: 30px; height: 30px; flex: none; padding: 0 6px; font-variant-numeric: tabular-nums; }
.page-button.active { border-color: var(--blue); background: var(--blue); color: #fff; opacity: 1; }
.page-gap { padding: 0 2px; }
.page-arrow { white-space: nowrap; }
.detail-label { display: block; margin-bottom: 3px; color: var(--subtle); font-size: 11px; }
.detail-header h2 { max-width: 300px; overflow: hidden; margin: 0; color: #243748; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.detail-body { flex: 1; min-height: 250px; max-height: calc(100vh - 225px); overflow-y: auto; padding: 18px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 220px; height: 100%; padding: 26px; text-align: center; }
.empty strong { color: #41566b; font-size: 13px; font-weight: 650; }
.empty p { max-width: 245px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty-icon { display: none; }
.section-title { margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 650; }
.field { display: grid; grid-template-columns: minmax(110px, 37%) minmax(0,1fr); gap: 14px; padding: 9px 0; border-bottom: 1px solid #edf0f3; font-size: 12px; line-height: 1.45; }
.field-key { overflow-wrap: anywhere; color: var(--muted); }
.field-value { overflow-wrap: anywhere; color: #243748; white-space: pre-wrap; }
.field-value.null { color: #97a3ae; }
.details { margin-top: 22px; }
.details summary { color: var(--blue); font-size: 12px; font-weight: 650; cursor: pointer; }
.json-block { max-height: 450px; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #f6f8fa; color: #263b50; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.loading { padding: 20px 17px; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .data-layout { grid-template-columns: 1fr; }
  .records, .detail-body { max-height: 420px; }
}
@media (max-width: 700px) {
  .shell { height: auto; min-height: 100dvh; }
  .topbar { height: 56px; padding: 0 16px; }
  .topbar-right { gap: 12px; }
  .environment, .user-label { display: none; }
  .workspace { display: block; min-height: calc(100dvh - 56px); overflow: visible; }
  .sidebar { height: 250px; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { margin-bottom: 11px; }
  .sidebar-actions { min-height: 46px; }
  .sidebar-foot { display: none; }
  .entity-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start; column-gap: 5px; }
  .entity-group { grid-column: 1/-1; margin-top: 12px; }
  .content { overflow: visible; padding: 21px 16px 30px; }
  .content-head { align-items: start; flex-direction: column; gap: 16px; min-height: 0; }
  .head-controls { padding: 0; }
  .data-layout { min-height: 0; }
  .records, .detail-body { min-height: 180px; max-height: 390px; }
  .login-screen { padding: 48px 16px; }
}
@media (max-width: 480px) {
  .login-card { padding: 21px 19px; }
  .api-search { grid-template-columns: minmax(100px,1fr) minmax(120px,1.5fr) 34px; }
  .api-search button[type="submit"] { grid-column: 2; grid-row: 2; }
  .api-search .icon-button { grid-column: 3; grid-row: 2; }
  .sort-controls { gap: 8px; padding: 9px 12px; }
  .sort-direction { flex-basis: 116px; }
  .pager { gap: 5px; padding: 7px 6px; }
  .page-arrow { font-size: 0; width: 32px; padding: 0; }
  .page-arrow:first-child::after { content: "←"; font-size: 13px; }
  .page-arrow:last-child::after { content: "→"; font-size: 13px; }
}
