:root {
  color: #111827;
  background: #f7f7f8;
  color-scheme: light;
  font-family: "Alibaba PuHuiTi", "Alibaba PuHuiTi 2.0", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-strong: #f3f4f6;
  --line: #e5e7eb;
  --line-strong: #cfd4dc;
  --text: #111827;
  --muted: #667085;
  --muted-strong: #344054;
  --brand: #f38020;
  --brand-hover: #d96f17;
  --brand-soft: #fff3e6;
  --green: #0e9f6e;
  --green-soft: #ecfdf3;
  --amber: #b7791f;
  --amber-soft: #fffaeb;
  --red: #d92d20;
  --red-soft: #fef3f2;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --neutral-soft: #f2f4f7;
  --control-bg: #ffffff;
  --control-hover: #f8fafc;
  --selected-bg: #fff3e6;
  --selected-text: #b54708;
  --code-bg: #f8fafc;
  --code-border: #e4e7ec;
  --code-text: #344054;
  --sidebar-bg: rgba(255, 255, 255, 0.98);
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --topbar-border: rgba(229, 231, 235, 0.96);
  --notice-warning-border: #fedf89;
  --notice-warning-bg: #fff8ec;
  --notice-success-border: #abefc6;
  --notice-success-bg: #f6fef9;
  --focus-ring: rgba(243, 128, 32, 0.34);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

html[data-theme="dark"] {
  color: #f4f6f8;
  background: #0f1113;
  color-scheme: dark;
  --bg: #0f1113;
  --surface: #151719;
  --surface-soft: #1b1e21;
  --surface-strong: #22262b;
  --line: #353a40;
  --line-strong: #4a525c;
  --text: #f4f6f8;
  --muted: #a0a8b3;
  --muted-strong: #d6dce4;
  --brand: #f48120;
  --brand-hover: #ff9b45;
  --brand-soft: rgba(244, 129, 32, 0.15);
  --green: #7ccf9a;
  --green-soft: rgba(39, 174, 96, 0.17);
  --amber: #f2c66d;
  --amber-soft: rgba(194, 126, 24, 0.18);
  --red: #ff8f86;
  --red-soft: rgba(213, 79, 69, 0.18);
  --blue: #78a8f8;
  --blue-soft: rgba(68, 122, 203, 0.2);
  --neutral-soft: #24282d;
  --control-bg: #181b1f;
  --control-hover: #22272d;
  --selected-bg: rgba(244, 129, 32, 0.14);
  --selected-text: #ffad63;
  --code-bg: #191d21;
  --code-border: #3f4650;
  --code-text: #edf0f3;
  --sidebar-bg: rgba(18, 20, 23, 0.98);
  --topbar-bg: rgba(18, 20, 23, 0.94);
  --topbar-border: rgba(53, 58, 64, 0.98);
  --notice-warning-border: #765329;
  --notice-warning-bg: #241e16;
  --notice-success-border: #2f6d4e;
  --notice-success-bg: #142219;
  --focus-ring: rgba(244, 129, 32, 0.44);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: var(--brand-soft); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .6; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
code { display: inline-block; max-width: 100%; overflow: hidden; border: 1px solid var(--code-border); border-radius: 6px; background: var(--code-bg); color: var(--code-text); font-size: .8rem; padding: .12rem .36rem; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }

.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; transform: translateY(-140%); border-radius: 8px; background: var(--brand); color: #fff; padding: 8px 12px; text-decoration: none; transition: transform 140ms ease; }
.skip-link:focus { transform: translateY(0); }

.app-shell { display: grid; grid-template-columns: 276px minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--sidebar-bg); padding: 24px 16px; }
.brand { display: flex; align-items: center; min-width: 0; gap: 12px; padding: 0 8px 22px; }
.brand__mark { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 8px; background: var(--brand); color: #fff; }
.brand__mark svg { width: 22px; height: 22px; }
.brand__copy { min-width: 0; }
.brand strong, .brand span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand strong { color: var(--text); font-size: 1.04rem; }
.brand span { color: var(--muted); font-size: .82rem; }
.sidebar__nav { display: grid; gap: 18px; }
.nav-group { display: grid; gap: 4px; }
.nav-group h2 { margin: 0 0 4px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.nav-item { display: flex; align-items: center; width: 100%; min-width: 0; min-height: 42px; gap: 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted-strong); padding: 0 12px; text-align: left; text-decoration: none; transition: background-color 150ms ease, color 150ms ease; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover, .nav-item.is-active { background: var(--selected-bg); color: var(--selected-text); }
.sidebar__foot { display: flex; align-items: center; min-width: 0; gap: 9px; margin-top: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--muted-strong); font-size: .86rem; padding: 12px; }
.sidebar__foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-width: 0; gap: 24px; border-bottom: 1px solid var(--topbar-border); background: var(--topbar-bg); padding: 18px 32px; backdrop-filter: blur(14px); }
.topbar__heading { min-width: 0; }
.topbar h1 { margin: 0; overflow: hidden; color: var(--text); font-size: 1.34rem; line-height: 1.2; text-overflow: ellipsis; text-wrap: balance; white-space: nowrap; }
.topbar__eyebrow, .eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; }
.topbar__tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.topbar__tools form { margin: 0; }
.workspace__content { padding: 26px 32px 44px; }
.page-stack { display: grid; gap: 18px; scroll-margin-top: 100px; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; width: min(380px, calc(100vw - 40px)); gap: 10px; pointer-events: none; }
.toast-region:empty { display: none; }
.toast { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 11px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; background: var(--surface); box-shadow: 0 14px 42px rgb(0 0 0 / 18%); padding: 12px 12px 12px 11px; pointer-events: auto; animation: toast-enter 180ms ease-out both; }
.toast--success { border-left-color: var(--green); }
.toast--error { border-left-color: var(--red); }
.toast--neutral { border-left-color: var(--brand); }
.toast__icon { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 999px; background: var(--neutral-soft); color: var(--muted-strong); font-size: .76rem; font-weight: 900; }
.toast--success .toast__icon { background: var(--green-soft); color: var(--green); }
.toast--error .toast__icon { background: var(--red-soft); color: var(--red); }
.toast--neutral .toast__icon { background: var(--brand-soft); color: var(--brand); }
.toast__body { display: grid; min-width: 0; gap: 2px; }
.toast__body strong { color: var(--text); font-size: .84rem; }
.toast__body > span { overflow-wrap: anywhere; color: var(--muted); font-size: .79rem; line-height: 1.4; }
.toast__close { display: grid; width: 24px; height: 24px; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 1.1rem; line-height: 1; }
.toast__close:hover { background: var(--control-hover); color: var(--text); }
.toast--leaving { opacity: 0; transform: translateX(16px); transition: opacity 150ms ease, transform 150ms ease; }
@keyframes toast-enter { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--muted-strong); font-weight: 700; text-decoration: none; transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease; }
.button { padding: 0 12px; }
.button:hover, .icon-button:hover { border-color: var(--line-strong); background: var(--control-hover); color: var(--text); }
.button:active, .icon-button:active { transform: translateY(1px); }
.button--primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.button--primary:hover { border-color: var(--brand-hover); background: var(--brand-hover); color: #fff; }
.button--danger { border-color: var(--red-soft); background: var(--red-soft); color: var(--red); }
.button--small { min-height: 32px; font-size: .82rem; }
.icon-button { flex: 0 0 38px; width: 38px; padding: 0; }
.theme-icon--sun { display: none; }
html[data-theme="dark"] .theme-icon--moon { display: none; }
html[data-theme="dark"] .theme-icon--sun { display: block; }

.connection-indicator { position: relative; display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 8px; text-decoration: none; transition: background-color 150ms ease; }
.connection-indicator:hover { background: var(--control-hover); }
.connection-indicator__dot { width: 11px; height: 11px; border-radius: 999px; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 16%, transparent); }
.connection-indicator--up { color: var(--green); }
.connection-indicator--down { color: var(--red); }
.connection-indicator--down .connection-indicator__dot { animation: connection-pulse 1.7s ease-out infinite; }
.connection-popover { position: absolute; top: calc(100% + 9px); right: 0; z-index: 40; display: grid; width: 190px; gap: 5px; visibility: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 14px 42px rgb(0 0 0 / 18%); color: var(--text); opacity: 0; padding: 11px 12px; pointer-events: none; transform: translateY(-4px); transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease; }
.connection-indicator:hover .connection-popover, .connection-indicator:focus-visible .connection-popover { visibility: visible; opacity: 1; transform: translateY(0); }
.connection-popover strong { font-size: .82rem; }
.connection-popover small { color: var(--muted); font-size: .74rem; }
.connection-popover__state { display: flex; align-items: center; gap: 7px; color: var(--muted-strong); font-size: .78rem; }
.connection-popover__state i { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
@keyframes connection-pulse { 0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 16%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }

.stack { display: grid; gap: 14px; margin-top: 18px; }
.compact-stack { gap: 11px; }
label { display: grid; gap: 6px; color: var(--muted-strong); font-size: .82rem; font-weight: 750; }
input, select, textarea { width: 100%; min-width: 0; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); padding: 8px 10px; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--brand); }
input[type="checkbox"] { width: 17px; min-height: 17px; margin: 2px 0 0; accent-color: var(--brand); }
.check-label { display: flex; align-items: flex-start; gap: 9px; font-weight: 650; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.order-list { display: grid; gap: 8px; }
.order-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.remove-order { width: 40px; border: 1px solid var(--red-soft); border-radius: 8px; background: var(--red-soft); color: var(--red); font-weight: 800; }

.alert, .notice { border-radius: 8px; padding: 11px 13px; }
.alert { border: 1px solid var(--red-soft); background: var(--red-soft); color: var(--red); }
.notice { border: 1px solid var(--notice-success-border); background: var(--notice-success-bg); color: var(--green); }
.inline-alert { margin-top: 14px; }

.page-header, .hero-strip { display: flex; align-items: flex-start; justify-content: space-between; min-width: 0; gap: 18px; }
.page-header h2, .hero-strip h2 { margin: 0; color: var(--text); font-size: 1.34rem; line-height: 1.22; text-wrap: balance; }
.page-header p, .hero-strip p { margin: 6px 0 0; color: var(--muted); }
.hero-strip { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 18px; }

.metric-grid { display: grid; gap: 12px; }
.metric-grid--four { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.metric-grid--three { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.metric-tile, .small-stat { display: flex; align-items: center; min-width: 0; min-height: 112px; gap: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 14px; text-align: left; }
.metric-tile__icon { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 8px; background: var(--surface-strong); color: var(--brand); }
.metric-tile--warning .metric-tile__icon { background: var(--amber-soft); color: var(--amber); }
.metric-tile--success .metric-tile__icon { background: var(--green-soft); color: var(--green); }
.metric-tile--info .metric-tile__icon { background: var(--blue-soft); color: var(--blue); }
.metric-tile > span:last-child { min-width: 0; }
.metric-tile small, .small-stat span { display: block; color: var(--muted); font-size: .78rem; font-weight: 700; }
.metric-tile strong, .small-stat strong { display: block; margin-top: 4px; overflow: hidden; color: var(--text); font-size: 1.45rem; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.metric-tile em { display: block; overflow: hidden; margin-top: 7px; color: var(--muted); font-size: .78rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.metric-value--compact { font-size: .88rem !important; line-height: 1.35 !important; }
.small-stat { display: grid; align-content: center; min-height: 88px; }
.small-stat--wide strong { white-space: normal; }

.content-grid { display: grid; gap: 18px; align-items: start; }
.content-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 16px; }
.panel--warning { border-color: var(--notice-warning-border); background: var(--notice-warning-bg); }
.panel--narrow { width: min(100%, 760px); }
.panel__header { display: flex; align-items: flex-start; justify-content: space-between; min-width: 0; gap: 12px; margin-bottom: 14px; }
.panel h3 { margin: 0; color: var(--text); font-size: 1rem; line-height: 1.25; text-wrap: balance; }
.panel h4 { margin: 0; color: var(--text); font-size: .9rem; }
.panel p { margin: 6px 0 0; color: var(--muted); font-size: .86rem; }
.conflict-list { margin: 8px 0 0; padding-left: 20px; color: var(--red); }

.status-chip, .plan-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; max-width: 100%; border-radius: 999px; font-size: .74rem; font-weight: 800; padding: 0 8px; white-space: nowrap; }
.status-chip--success { border: 1px solid var(--notice-success-border); background: var(--green-soft); color: var(--green); }
.status-chip--warning { border: 1px solid var(--notice-warning-border); background: var(--amber-soft); color: var(--amber); }
.status-chip--danger { border: 1px solid var(--red-soft); background: var(--red-soft); color: var(--red); }
.status-chip--neutral { border: 1px solid var(--line); background: var(--neutral-soft); color: var(--muted-strong); }
.status-chip--pulse::before { width: 6px; height: 6px; margin-right: 6px; border-radius: 999px; background: currentColor; content: ""; }
.plan-pill { border: 1px solid var(--notice-warning-border); background: var(--brand-soft); color: var(--selected-text); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.users-toolbar { display: flex; align-items: center; justify-content: space-between; min-width: 0; gap: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 12px 14px; }
.users-toolbar div { display: grid; min-width: 0; gap: 2px; }
.users-toolbar strong { color: var(--text); font-size: .92rem; }
.users-toolbar span { overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.users-panel { overflow: hidden; padding: 0; }
.table-wrap--users { border: 0; border-radius: 0; }
.users-table { min-width: 1160px; }
.users-table th, .users-table td { vertical-align: middle; }
.user-row { cursor: pointer; }
.user-row:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }
.user-cell { display: flex !important; align-items: center; min-width: 240px; gap: 10px; }
.user-cell > span:last-child { min-width: 0; }
.user-avatar { display: grid !important; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.user-avatar svg { width: 17px; height: 17px; }
.user-cell strong { display: block; max-width: 220px; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.user-cell code { max-width: 220px; margin-top: 3px !important; border: 0; background: transparent; color: var(--muted); padding: 0; }
.masked-token { letter-spacing: .035em; }
.token-inline { display: flex; align-items: center; min-width: 250px; gap: 6px; margin: 0; }
.token-inline code { max-width: 190px; }
.token-action { min-height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--selected-text); font-size: .76rem; font-weight: 800; padding: 0 6px; }
.token-action:hover { background: var(--brand-soft); }
.row-menu { width: 34px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 900; letter-spacing: .08em; }
.row-menu:hover { background: var(--surface-strong); color: var(--text); }

.modal { width: min(calc(100% - 32px), 760px); max-width: none; max-height: min(86vh, 920px); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 28px 80px rgba(16, 24, 40, .26); padding: 0; }
.modal--wide { width: min(calc(100% - 32px), 980px); }
.modal::backdrop { background: rgba(15, 17, 19, .48); backdrop-filter: blur(3px); }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding: 18px 20px; }
.modal__header > div { min-width: 0; }
.modal__header h2 { margin: 3px 0 0; color: var(--text); font-size: 1.15rem; }
.modal__header p { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.modal__header code { margin-top: 6px; }
.modal__close { flex: 0 0 34px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--surface-strong); color: var(--muted-strong); font-size: 1.25rem; }
.modal__close:hover { background: var(--control-hover); color: var(--text); }
.modal__body { display: grid; max-height: calc(86vh - 82px); overflow-y: auto; gap: 16px; padding: 20px; }
.modal__body--split { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.modal-section { min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); padding: 16px; }
.modal-section h3 { margin: 0; font-size: .95rem; }
.modal-section > p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.token-control { display: flex; align-items: center; justify-content: space-between; min-width: 0; gap: 18px; border: 1px solid var(--notice-warning-border); border-radius: 9px; background: var(--brand-soft); padding: 15px; }
.token-control__secret { min-width: 0; }
.token-control__secret > span { display: block; color: var(--muted); font-size: .74rem; font-weight: 800; }
.token-control__secret code { display: block; width: fit-content; max-width: min(100%, 520px); margin-top: 5px; }
.token-control__secret p { margin: 7px 0 0; color: var(--muted); font-size: .8rem; }
.token-control__actions { display: flex; flex: 0 0 auto; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.token-control__actions form { display: flex; gap: 8px; margin: 0; }
.detail-list--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.operation-grid--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.usage-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.credential-list { display: grid; gap: 8px; }
.credential-disclosure { overflow: clip; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.credential-disclosure summary { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(190px, 1fr) minmax(170px, .8fr) auto auto; align-items: center; gap: 14px; min-height: 68px; padding: 12px 14px; cursor: pointer; list-style: none; transition: background-color 150ms ease; }
.credential-disclosure summary::-webkit-details-marker { display: none; }
.credential-disclosure summary:hover { background: var(--surface-soft); }
.credential-disclosure[open] summary { border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.credential-disclosure summary > span { min-width: 0; }
.credential-disclosure summary small { display: block; margin-bottom: 3px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.credential-disclosure summary strong { display: block; overflow: hidden; color: var(--text); font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.disclosure-label { color: var(--selected-text); font-size: .8rem; font-weight: 800; }
.disclosure-label::after { display: inline-block; margin-left: 6px; content: "›"; transition: transform 150ms ease; }
.credential-disclosure[open] .disclosure-label::after { transform: rotate(90deg); }
.credential-detail { display: grid; gap: 16px; padding: 16px; }
.detail-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.detail-list div { min-width: 0; border-radius: 8px; background: var(--surface-soft); padding: 10px; }
.detail-list dt { color: var(--muted); font-size: .74rem; font-weight: 750; }
.detail-list dd { overflow-wrap: anywhere; margin: 4px 0 0; color: var(--text); font-size: .84rem; }
.operation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.operation-box { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); padding: 14px; }
.operation-box--wide { grid-column: span 2; }
.operation-box--danger { border-color: var(--red-soft); background: color-mix(in srgb, var(--red-soft) 55%, var(--surface)); }
.operation-box .button { margin-top: 12px; }
.operation-box .stack .button, .operation-box .row-actions .button { margin-top: 0; }

.empty-state { display: grid; place-items: center; min-height: 150px; gap: 5px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--text); }
.empty-state span { font-size: .84rem; }

.usage-heading { align-items: flex-end; }
.usage-range-form { display: grid; grid-template-columns: repeat(2, minmax(190px, 1fr)) auto; align-items: end; gap: 10px; }
.table-title { margin: 22px 0 9px !important; }
.table-wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.data-table { width: 100%; min-width: 920px; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
.data-table--audit { min-width: 1260px; }
.data-table--usage-detail { min-width: 1080px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 12px 14px; text-align: left; vertical-align: top; white-space: nowrap; }
.data-table th { background: var(--surface-strong); color: var(--muted-strong); font-size: .76rem; font-weight: 800; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-soft); }
.data-table td > strong, .data-table td > span { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table td code { display: block; width: fit-content; margin-top: 4px; }
.maintenance-state { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); padding: 12px; }
.maintenance-state span { color: var(--muted); font-size: .78rem; font-weight: 750; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at top left, var(--brand-soft), transparent 34%), var(--bg); }
.login-card { width: min(100%, 430px); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 24px 60px rgba(16, 24, 40, .12); padding: 34px; }
.login-card .brand { padding: 0 0 24px; }
.login-card h1 { margin: 10px 0 6px; color: var(--text); font-size: 1.5rem; text-wrap: balance; }
.login-card .muted { margin: 0; color: var(--muted); font-size: .88rem; }
.login-card .alert { margin-top: 16px; }
.login-card .button { width: 100%; }

html[data-theme="dark"] .panel, html[data-theme="dark"] .hero-strip, html[data-theme="dark"] .metric-tile, html[data-theme="dark"] .small-stat, html[data-theme="dark"] .credential-disclosure { border-color: #363d45; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { color-scheme: dark; }
html[data-theme="dark"] .data-table th { background: #20252a; color: #dce2ea; }
html[data-theme="dark"] .data-table tbody tr:hover { background: #1b2025; }

@media (max-width: 1180px) {
  .metric-grid--four { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .operation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credential-disclosure summary { grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto; }
  .credential-disclosure summary > span:nth-child(3) { display: none; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar__nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar__foot { margin-top: 18px; }
  .topbar { padding: 18px; }
  .workspace__content { padding: 18px; }
  .content-grid--two { grid-template-columns: 1fr; }
  .usage-heading { align-items: stretch; flex-direction: column; }
  .usage-range-form { width: 100%; }
  .modal__body--split, .detail-list--four { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .sidebar { padding: 18px 12px; }
  .sidebar__nav { grid-template-columns: 1fr; gap: 10px; }
  .nav-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-group h2 { grid-column: 1 / -1; }
  .topbar { align-items: center; gap: 12px; padding: 14px; }
  .topbar__eyebrow { display: none; }
  .topbar h1 { font-size: 1.05rem; }
  .workspace__content { padding: 14px; }
  .page-header, .hero-strip { align-items: stretch; flex-direction: column; }
  .metric-grid--four, .metric-grid--three, .detail-list, .operation-grid, .usage-range-form { grid-template-columns: 1fr; }
  .metric-tile, .small-stat { min-height: 92px; }
  .operation-box--wide { grid-column: auto; }
  .panel, .hero-strip { padding: 14px; }
  .credential-disclosure summary { grid-template-columns: minmax(0, 1fr) auto auto; }
  .credential-disclosure summary > span:nth-child(2), .credential-disclosure summary > span:nth-child(3) { display: none; }
  .maintenance-state { grid-template-columns: 1fr; }
  .users-toolbar, .token-control { align-items: stretch; flex-direction: column; }
  .modal { width: min(calc(100% - 20px), 760px); max-height: 92vh; }
  .modal__body { max-height: calc(92vh - 78px); padding: 14px; }
  .modal__body--split, .detail-list--four, .operation-grid--compact { grid-template-columns: 1fr; }
  .token-control__actions { align-items: stretch; flex-direction: column; }
  .token-control__actions form { width: 100%; }
  .token-control__actions .button { flex: 1; }
  .login-card { padding: 28px 22px; }
  .toast-region { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
