:root {
  color: #24354d;
  background: #f6f9fe;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
  text-rendering: auto;
  --navy: #17243a;
  --muted: #73839a;
  --blue: #2868e8;
  --blue-dark: #174fc2;
  --teal: #0ba991;
  --amber: #d58a16;
  --red: #d64e61;
  --line: rgba(125, 151, 184, .2);
  --glass: rgba(255, 255, 255, .94);
  --shadow: 0 26px 80px rgba(65, 91, 126, .12), 0 4px 15px rgba(65, 91, 126, .05);
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100vh; min-height: 100svh; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.admin-atmosphere { position: fixed; z-index: -2; inset: 0; overflow: hidden; background: radial-gradient(58% 58% at 4% 2%,rgba(102,165,255,.18),transparent 68%),radial-gradient(50% 55% at 96% 28%,rgba(101,224,200,.13),transparent 70%),radial-gradient(45% 45% at 50% 100%,rgba(154,158,255,.11),transparent 72%),linear-gradient(145deg,#f9fbff 0%,#f2f7ff 48%,#f9fffd 100%); }
.admin-atmosphere::before { content: ""; position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(rgba(64,106,170,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(64,106,170,.18) 1px,transparent 1px); background-size: 34px 34px; mask-image: linear-gradient(130deg,rgba(0,0,0,.82),transparent 72%); }
.admin-topbar { flex: 0 0 auto; position: sticky; z-index: 30; top: 0; border-bottom: 1px solid rgba(226,232,240,.75); background: rgba(255,255,255,.96); box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.admin-topbar-inner { width: min(1440px,100%); height: 72px; margin: 0 auto; padding: 0 26px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand-shell-start { display: flex; align-items: center; gap: 13px; }
.admin-brand { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; text-decoration: none; color: var(--navy); }
.admin-brand-mark, .admin-brand > span:last-child { pointer-events: none; }
.admin-brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #2563eb; background: rgba(219,234,254,.9); box-shadow: 0 6px 20px rgba(37,99,235,.14); }
.admin-brand-mark svg { width: 23px; height: 23px; transform: rotate(-20deg); transition: transform 260ms ease; }
.admin-brand:hover .admin-brand-mark svg, .admin-brand:focus-visible .admin-brand-mark svg { transform: rotate(-34deg); }
.admin-brand-mark path { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.admin-brand > span:last-child { display: flex; flex-direction: column; gap: 5px; font-family: inherit; line-height: 1; }
.admin-brand strong { font-size: 18px; letter-spacing: -.035em; }
.admin-brand small { color: #718198; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.admin-top-actions { display: flex; align-items: center; gap: 4px; }
.theme-toggle { width: 34px; height: 34px; flex: 0 0 auto; padding: 0; display: grid; place-items: center; border: 1px solid rgba(148,163,184,.22); border-radius: 9px; color: #596980; background: rgba(255,255,255,.72); box-shadow: 0 2px 8px rgba(15,23,42,.04); font-weight: 500; transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease; }
.theme-toggle:hover { color: var(--blue); border-color: rgba(37,99,235,.24); background: rgba(255,255,255,.94); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,70,111,.08); }
.theme-toggle:focus-visible { outline: 2px solid rgba(59,130,246,.3); outline-offset: 3px; }
.theme-icon { grid-area: 1 / 1; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
.admin-health { min-height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; color: #657991; background: rgba(248,251,255,.8); font-size: 10px; font-weight: 800; }
.admin-health i { width: 7px; height: 7px; border-radius: 50%; background: #e5a323; box-shadow: 0 0 0 4px rgba(229,163,35,.11); }
.admin-health.online i { background: #18af88; box-shadow: 0 0 0 4px rgba(24,175,136,.11); }
.admin-health.offline i { background: #e55262; box-shadow: 0 0 0 4px rgba(229,82,98,.11); }
.admin-top-actions .admin-quiet-link,
.admin-top-actions .admin-quiet-button { min-height: 34px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 9px; color: #68788d; background: transparent; box-shadow: none; text-decoration: none; font-size: 12px; font-weight: 700; transition: color .18s ease, border-color .18s ease, background .18s ease; }
.admin-top-actions .admin-quiet-button:hover,
.admin-top-actions .admin-quiet-link:hover { color: #2563eb; border-color: rgba(147,197,253,.24); background: rgba(239,246,255,.64); box-shadow: none; transform: none; }

.admin-layout { width: min(1540px,calc(100% - 28px)); min-height: calc(100vh - var(--footer-dock-header, 72px) - 22px); min-height: calc(100dvh - var(--footer-dock-header, 72px) - 22px); margin: 11px auto; display: grid; flex: 1 0 auto; grid-template-columns: 260px minmax(0,1fr); gap: 12px; }
.admin-rail { min-height: calc(100vh - 134px); padding: 22px 14px 14px; display: flex; flex-direction: column; position: sticky; top: 83px; align-self: start; border: 1px solid rgba(255,255,255,.9); border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.rail-intro { padding: 5px 10px 19px; border-bottom: 1px solid var(--line); }
.rail-kicker, .page-index { color: #6983a8; font-size: 10px; font-weight: 900; letter-spacing: .17em; }
.rail-intro strong { margin-top: 8px; display: block; color: var(--navy); font-size: 17px; letter-spacing: -.025em; }
.rail-intro p { margin: 8px 0 0; color: #8694a8; font-size: 10px; line-height: 1.65; }
.admin-nav { margin-top: 13px; display: grid; gap: 3px; }
.admin-nav-item { width: 100%; min-height: 52px; padding: 8px 9px; display: grid; grid-template-columns: 28px minmax(0,1fr); grid-template-rows: 1fr 1fr; align-items: center; border: 1px solid transparent; border-radius: 13px; color: #61738b; background: transparent; text-align: left; transition: .18s ease; }
.admin-nav-item > span { grid-row: 1 / 3; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: #8698af; background: rgba(235,241,248,.82); font-size: 10px; font-weight: 900; }
.admin-nav-item b { align-self: end; font-size: 11px; letter-spacing: -.01em; }
.admin-nav-item small { align-self: start; margin-top: 2px; color: #9aa7b8; font-size: 10px; }
.admin-nav-item:hover { color: var(--blue); background: rgba(247,250,255,.86); transform: translateX(2px); }
.admin-nav-item.active { color: #1e57ca; border-color: rgba(111,158,236,.23); background: linear-gradient(100deg,rgba(229,240,255,.93),rgba(255,255,255,.7)); box-shadow: inset 3px 0 #3474ec,0 6px 17px rgba(61,109,190,.06); }
.admin-nav-item.active > span { color: white; background: #3474ec; box-shadow: 0 5px 13px rgba(52,116,236,.22); }
.rail-admin { margin-top: auto; padding: 14px 9px 5px; display: grid; grid-template-columns: 35px minmax(0,1fr) 8px; align-items: center; gap: 9px; border-top: 1px solid var(--line); }
.admin-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: white; background: linear-gradient(145deg,#3377ef,#695fe5); box-shadow: 0 7px 15px rgba(51,119,239,.23); font-size: 11px; font-weight: 900; }
.rail-admin span:nth-child(2) { min-width: 0; }
.rail-admin strong, .rail-admin small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rail-admin strong { color: var(--navy); font-size: 11px; }
.rail-admin small { margin-top: 3px; color: #94a2b5; font-size: 10px; }
.rail-admin > i { width: 7px; height: 7px; border-radius: 50%; background: #15b78a; box-shadow: 0 0 0 4px rgba(21,183,138,.1); }

.admin-main { min-width: 0; padding: 13px clamp(10px,2.5vw,32px) 60px; }
.admin-page-heading { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.admin-page-heading h1 { margin: 7px 0 4px; color: var(--navy); font-size: clamp(28px,3vw,42px); line-height: 1; letter-spacing: -.055em; }
.admin-page-heading p { margin: 0; color: #7c8ba0; font-size: 12px; line-height: 1.6; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.button-primary, .button-secondary, .button-danger, .button-plain { min-height: 38px; padding: 0 14px; border-radius: 11px; font-weight: 800; font-size: 10px; transition: .16s ease; }
.button-primary { border: 0; color: white; background: linear-gradient(135deg,#2868e8,#3d7af0); box-shadow: 0 10px 24px rgba(40,104,232,.23); }
.button-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 29px rgba(40,104,232,.28); }
.button-secondary { border: 1px solid var(--line); color: #566b85; background: rgba(255,255,255,.75); }
.button-secondary:hover, .button-plain:hover { color: var(--blue); border-color: rgba(40,104,232,.28); background: #fff; }
.button-danger { border: 1px solid rgba(222,91,108,.2); color: #bd3348; background: #fff4f5; }
.button-danger:hover { border-color: rgba(222,91,108,.34); background: #ffeaed; }
.button-plain { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); color: #667a92; background: rgba(255,255,255,.68); border-radius: 9px; }
button:disabled { cursor: wait; opacity: .48; transform: none !important; }

.admin-content { min-height: 420px; }
.admin-loading { min-height: 420px; display: grid; place-items: center; align-content: center; gap: 12px; color: #7e8ea4; font-size: 11px; }
.admin-loading i { width: 34px; height: 34px; border: 2px solid rgba(40,104,232,.13); border-top-color: #3474ec; border-radius: 50%; animation: admin-spin .8s linear infinite; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.metric-card, .admin-panel, .entity-card { border: 1px solid rgba(255,255,255,.9); background: var(--glass); box-shadow: var(--shadow); }
.metric-card { min-height: 136px; padding: 20px; position: relative; overflow: hidden; border-radius: 19px; }
.metric-card::after { content: attr(data-code); position: absolute; right: 13px; bottom: -9px; color: rgba(42,91,166,.055); font-size: 64px; font-weight: 900; letter-spacing: -.08em; }
.metric-label { display: flex; align-items: center; justify-content: space-between; color: #74869e; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.metric-label i { width: 8px; height: 8px; border-radius: 50%; background: #3c7bef; box-shadow: 0 0 0 5px rgba(60,123,239,.09); }
.metric-card strong { margin-top: 18px; display: block; color: var(--navy); font-size: 34px; letter-spacing: -.05em; }
.metric-card p { margin: 4px 0 0; color: #8b99ac; font-size: 10px; }
.metric-card.has-action p { padding-right: 74px; }
.metric-card-action { min-height: 28px; padding: 0 9px; position: absolute; z-index: 2; right: 15px; bottom: 13px; border: 1px solid rgba(40,104,232,.18); border-radius: 9px; color: #245fcf; background: rgba(238,245,255,.92); font-size: 10px; font-weight: 900; }
.metric-card-action:hover { border-color: rgba(40,104,232,.34); background: #fff; transform: translateY(-1px); }
.dashboard-grid { margin-top: 11px; display: grid; grid-template-columns: minmax(0,1.15fr) minmax(320px,.85fr); gap: 11px; }
.admin-panel { min-width: 0; padding: 19px; border-radius: 20px; }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-title h2 { margin: 5px 0 0; color: var(--navy); font-size: 16px; letter-spacing: -.025em; }
.panel-title p { margin: 5px 0 0; color: #8b99ac; font-size: 10px; }
.status-stack { margin-top: 16px; display: grid; gap: 8px; }
.status-line { min-height: 48px; padding: 9px 11px; display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 10px; border: 1px solid rgba(157,177,202,.16); border-radius: 13px; background: rgba(248,251,255,.62); }
.status-line > i { width: 8px; height: 8px; border-radius: 50%; background: #19af88; box-shadow: 0 0 0 4px rgba(25,175,136,.1); }
.status-line.warn > i { background: #e4a127; box-shadow: 0 0 0 4px rgba(228,161,39,.1); }
.status-line.error > i { background: #dc5365; box-shadow: 0 0 0 4px rgba(220,83,101,.1); }
.status-line strong { display: block; color: #42566f; font-size: 10px; }
.status-line small { margin-top: 3px; display: block; color: #94a1b2; font-size: 10px; }
.status-line > span:last-child { color: #70829a; font-size: 10px; font-weight: 800; }
.activity-stack { margin-top: 16px; display: grid; gap: 16px; }
.activity-group { min-width: 0; display: grid; gap: 8px; }
.activity-group-title { min-height: 22px; padding: 0 3px 7px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(145,166,193,.13); }
.activity-group-title strong { color: #60748e; font-size: 10px; letter-spacing: .08em; }
.activity-group-title span { min-width: 21px; height: 21px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; color: #5375a7; background: #edf3fb; font-size: 10px; font-weight: 900; }
.activity-list { display: grid; gap: 8px; }

.data-table-wrap { overflow: hidden; border: 1px solid rgba(255,255,255,.92); border-radius: 20px; background: var(--glass); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 14px; color: #8493a7; background: rgba(244,248,253,.72); border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid rgba(145,166,193,.12); color: #52667f; font-size: 10px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(249,252,255,.7); }
.mobile-user-list { display: none; }
.mobile-user-card { padding: 14px; border: 1px solid rgba(255,255,255,.92); border-radius: 17px; background: var(--glass); box-shadow: var(--shadow); }
.mobile-user-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mobile-user-facts { margin-top: 13px; padding: 10px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid rgba(144,167,196,.16); border-radius: 12px; background: rgba(248,251,255,.68); }
.mobile-user-facts span { min-width: 0; text-align: center; }
.mobile-user-facts small, .mobile-user-facts strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mobile-user-facts small { color: #95a2b3; font-size: 10px; }
.mobile-user-facts strong { margin-top: 4px; color: #50647c; font-size: 10px; }
.table-primary { display: flex; align-items: center; gap: 10px; }
.table-avatar { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: #2d66cf; background: #eaf2ff; font-size: 10px; font-weight: 900; }
.table-primary strong, .table-primary small { display: block; }
.table-primary strong { color: #2f435d; font-size: 10px; }
.table-primary small { margin-top: 3px; color: #93a0b1; font-size: 10px; }
.table-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.state-chip, .tag-chip { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border: 1px solid rgba(88,133,210,.15); border-radius: 999px; color: #2761c4; background: #edf4ff; font-size: 10px; font-weight: 800; }
.state-chip.active, .state-chip.ready, .state-chip.ok, .state-chip.succeeded { color: #087c61; border-color: rgba(22,163,123,.15); background: #eaf9f4; }
.state-chip.disabled, .state-chip.archived { color: #68788c; background: #f0f3f7; }
.state-chip.error, .state-chip.failed { color: #bd3549; border-color: rgba(210,70,91,.16); background: #fff0f2; }
.state-chip.provisioning, .state-chip.creating, .state-chip.running, .state-chip.queued, .state-chip.drifted { color: #9a650d; border-color: rgba(213,138,22,.16); background: #fff7e7; }
.state-chip.concurrency-limit { color: #5847b8; border-color: rgba(103,82,196,.16); background: #f1efff; }
.protected-mark { margin-left: 6px; color: #725bd1; font-size: 10px; font-weight: 900; }

.entity-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.entity-card { min-width: 0; padding: 18px; border-radius: 19px; }
.entity-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.entity-card-head h3 { margin: 4px 0 0; color: var(--navy); font-size: 15px; letter-spacing: -.025em; }
.entity-card-head p { margin: 5px 0 0; color: #8795a8; font-size: 10px; }
.entity-card-body { margin-top: 15px; display: grid; gap: 8px; }
.property-line { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 12px; align-items: baseline; }
.property-line span { color: #93a0b1; font-size: 10px; font-weight: 800; }
.property-line strong, .property-line code { min-width: 0; overflow: hidden; color: #4c6079; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.property-line code { padding: 5px 7px; border-radius: 7px; background: rgba(235,241,248,.72); }
.entity-card-actions { margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.model-card-preview { margin-top: 13px; padding: 15px; display: grid; grid-template-columns: 46px minmax(0,1fr); gap: 13px; position: relative; overflow: hidden; border: 1px solid rgba(142,166,198,.18); border-radius: 16px; background: linear-gradient(135deg,rgba(249,252,255,.95),rgba(242,247,255,.7)); }
.model-card-preview::after { content: ""; width: 3px; position: absolute; inset: 12px auto 12px 0; border-radius: 0 999px 999px 0; background: #4c81ed; opacity: .72; }
.model-card-preview.tone-mint::after { background: #0fa989; }
.model-card-preview.tone-cyan::after { background: #168db4; }
.model-card-preview.tone-indigo::after { background: #6658db; }
.model-brand { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: #2868e8; background: #eaf2ff; box-shadow: inset 0 0 0 1px rgba(58,113,213,.1); font-size: 10px; font-weight: 900; }
.model-brand.xiaomi { color: #e76512; background: #fff2e9; }
.model-brand.deepseek { color: #246bfd; background: #edf4ff; }
.model-brand.openai { color: #273244; background: #eef1f5; }
.model-brand .model-brand-icon { width: 70%; height: 70%; display: block; }
.model-brand .model-brand-icon[class*="brand-asset-"] { background: currentColor; -webkit-mask-position: center; mask-position: center; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; }
.model-brand .brand-asset-xiaomi { -webkit-mask-image: url("/assets/brands/xiaomi.svg?v=20260826-brand2"); mask-image: url("/assets/brands/xiaomi.svg?v=20260826-brand2"); }
.model-brand .model-brand-icon.brand-asset-deepseek { width: 78%; height: 78%; -webkit-mask-image: url("/assets/brands/deepseek.svg?v=20260826-brand2"); mask-image: url("/assets/brands/deepseek.svg?v=20260826-brand2"); -webkit-mask-position: left center; mask-position: left center; -webkit-mask-size: auto 100%; mask-size: auto 100%; }
.model-brand .brand-asset-openai { -webkit-mask-image: url("/assets/brands/openai.svg?v=20260826-brand2"); mask-image: url("/assets/brands/openai.svg?v=20260826-brand2"); }
.model-preview-title { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.model-preview-title strong { margin-right: 2px; color: #263b56; font-size: 13px; letter-spacing: -.02em; }
.model-preview-tags { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.model-preview-copy p { margin: 7px 0 0; color: #8090a5; font-size: 10px; line-height: 1.55; }
.tag-chip { min-height: 22px; padding: 0 7px; border-color: rgba(107,126,154,.16); color: #64748b; background: #f1f5f9; font-size: 10px; }
.tag-chip.tag-value { color: #067647; background: #e8f8ef; border-color: #c8edd8; }
.tag-chip.tag-default { color: #245dc7; background: #eaf2ff; border-color: #cfe0ff; }
.tag-chip.tag-modality { color: #6d4cc7; background: #f2edff; border-color: #dfd3ff; }
.tag-chip.tag-beta { color: #a4540b; background: #fff4df; border-color: #f6dfb2; }
.tag-chip.tag-speed { color: #087b98; background: #e5f8fb; border-color: #c5ebf1; }
.tag-chip.tag-stable { color: #087b6b; background: #e5f8f3; border-color: #c7eee4; }
.tag-chip.tag-depth { color: #4c51bf; background: #eeeeff; border-color: #d8d8ff; }
.tag-chip.tag-complex { color: #a13c67; background: #fff0f6; border-color: #f8d5e4; }
.credential-missing { color: #bd3549 !important; }

.filter-bar { margin-bottom: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.9); border-radius: 16px; background: rgba(255,255,255,.68); box-shadow: 0 8px 24px rgba(65,91,126,.055); }
.filter-bar label { color: #8493a7; font-size: 10px; font-weight: 800; }
.filter-bar select { min-height: 34px; min-width: 220px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: #50647d; background: rgba(255,255,255,.9); font-size: 10px; }
.empty-panel { min-height: 260px; padding: 40px; display: grid; place-items: center; align-content: center; gap: 7px; border: 1px dashed rgba(119,151,195,.27); border-radius: 19px; color: #8c9aad; background: rgba(255,255,255,.47); text-align: center; }
.empty-panel strong { color: #61748c; font-size: 13px; }
.empty-panel p { max-width: 420px; margin: 0; font-size: 10px; line-height: 1.65; }
.error-panel { color: #bd3549; background: rgba(255,241,243,.7); border-style: solid; border-color: rgba(213,78,99,.2); }

.admin-dialog { width: min(650px,calc(100% - 28px)); max-height: min(860px,calc(100vh - 32px)); padding: 0; overflow: visible; border: 0; border-radius: 24px; color: #40546d; background: transparent; }
.admin-dialog:focus { outline: 0; }
.admin-dialog.is-model-access { width: min(860px,calc(100% - 28px)); }
.admin-dialog.is-channel-access { width: min(760px,calc(100% - 28px)); }
.admin-dialog.is-model-template { width: min(920px,calc(100% - 28px)); }
.admin-dialog::backdrop { background: rgba(22,34,53,.64); }
.admin-dialog-shell { max-height: min(860px,calc(100vh - 32px)); overflow-y: auto; padding: 27px; position: relative; border: 1px solid rgba(255,255,255,.92); border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: 0 34px 100px rgba(21,40,70,.24); }
.admin-dialog-shell:focus { outline: 0; }
.dialog-close { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; position: absolute; right: 19px; top: 19px; border: 1px solid var(--line); border-radius: 10px; color: #7d8da2; background: #f7f9fc; }
.dialog-close svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.dialog-head { padding-right: 42px; }
.dialog-head h2 { margin: 8px 0 5px; color: var(--navy); font-size: 24px; letter-spacing: -.045em; }
.dialog-head p { margin: 0; color: #8593a6; font-size: 10px; line-height: 1.6; }
.dialog-body { margin-top: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.form-field { display: block; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field > span { margin-bottom: 7px; display: block; color: #62758d; font-size: 10px; font-weight: 800; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid rgba(154,176,204,.35); border-radius: 11px; outline: none; color: #344a63; background: #f8fafd; font-size: 10px; transition: .16s ease; }
.form-field textarea { min-height: 82px; resize: vertical; line-height: 1.55; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: rgba(40,104,232,.42); background: #fff; box-shadow: 0 0 0 4px rgba(40,104,232,.07); }
.form-field small { margin-top: 5px; display: block; color: #9aa6b6; font-size: 10px; line-height: 1.5; }
.check-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.check-item { min-height: 42px; padding: 9px 11px; display: flex; align-items: center; gap: 9px; border: 1px solid rgba(154,176,204,.24); border-radius: 11px; background: #fafcff; color: #52677f; cursor: pointer; font-size: 10px; transition: border-color .16s ease,background .16s ease,box-shadow .16s ease; }
.check-item:hover, .check-item:focus-within { border-color: rgba(47,112,233,.3); background: #f7faff; box-shadow: 0 7px 18px rgba(47,91,163,.06); }
.form-field.check-item > span { margin: 0; color: #52677f; font-size: 10px; }
.check-item > input[type="checkbox"] { appearance: none; width: 18px; min-width: 18px; height: 18px; min-height: 18px; margin: 0; padding: 0; display: grid; place-items: center; border: 1px solid rgba(117,143,178,.42); border-radius: 6px; background: #fff; box-shadow: inset 0 1px 2px rgba(44,70,105,.05); transition: .16s ease; }
.check-item > input[type="checkbox"]::after { content: ""; width: 4px; height: 8px; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0; opacity: 0; transform: rotate(45deg) scale(.65); transition: .16s ease; }
.check-item > input[type="checkbox"]:checked { border-color: #3474ec; background: linear-gradient(145deg,#3f7df0,#2868e8); box-shadow: 0 5px 12px rgba(40,104,232,.22); }
.check-item > input[type="checkbox"]:checked::after { opacity: 1; transform: rotate(45deg) scale(1); }
.check-item > input[type="checkbox"]:focus-visible { outline: 0; box-shadow: 0 0 0 4px rgba(40,104,232,.12); }
.control-switch { min-height: 54px; padding: 10px 12px; justify-content: space-between; background: linear-gradient(145deg,#fafcff,#f6f9fd); }
.control-switch > span { min-width: 0; order: 1; }
.control-switch > span strong, .control-switch > span small { display: block; }
.control-switch > span strong { color: #41566f; font-size: 10px; }
.control-switch > span small { margin-top: 3px; color: #94a1b2; font-size: 10px; font-weight: 600; line-height: 1.45; }
.form-field.control-switch > input[type="checkbox"] { width: 38px; min-width: 38px; height: 22px; min-height: 22px; order: 2; display: block; position: relative; border: 0; border-radius: 999px; background: #dbe3ee; box-shadow: inset 0 0 0 1px rgba(92,119,153,.08); }
.form-field.control-switch > input[type="checkbox"]::after { width: 18px; height: 18px; margin: 0; position: absolute; left: 2px; top: 2px; border: 0; border-radius: 50%; opacity: 1; background: #fff; box-shadow: 0 2px 6px rgba(42,65,96,.24); transform: none; }
.form-field.control-switch > input[type="checkbox"]:checked { background: linear-gradient(135deg,#3d7cf0,#2464df); box-shadow: 0 7px 15px rgba(40,104,232,.22); }
.form-field.control-switch > input[type="checkbox"]:checked::after { opacity: 1; transform: translateX(16px); }
.control-switch:has(input:checked) { border-color: rgba(52,116,236,.27); background: linear-gradient(145deg,#f8fbff,#eef5ff); }
.custom-select { width: 100%; display: block; position: relative; }
.form-field select.custom-select-native, .tag-editor-row select.custom-select-native { width: 1px; min-width: 1px; height: 1px; min-height: 1px; margin: 0; padding: 0; position: absolute; left: 50%; bottom: 0; overflow: hidden; border: 0; opacity: 0; pointer-events: none; }
.custom-select-trigger { width: 100%; min-height: 42px; padding: 8px 10px 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid rgba(154,176,204,.35); border-radius: 11px; outline: 0; color: #344a63; background: linear-gradient(145deg,#fbfcfe,#f6f9fd); text-align: left; font-size: 10px; transition: .16s ease; }
.custom-select-trigger:hover { border-color: rgba(91,130,191,.34); background: #fff; }
.custom-select-trigger:focus-visible, .custom-select-trigger.is-open { border-color: rgba(40,104,232,.45); background: #fff; box-shadow: 0 0 0 4px rgba(40,104,232,.08); }
.custom-select-trigger svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: #7186a3; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .16s ease,color .16s ease; }
.custom-select-trigger.is-open svg { color: #2868e8; transform: rotate(180deg); }
.custom-select-value { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.custom-select-menu { max-height: min(310px,calc(100vh - 24px)); padding: 6px; overflow-y: auto; position: fixed; z-index: 1000; border: 1px solid rgba(135,160,193,.26); border-radius: 14px; background: rgba(255,255,255,.99); box-shadow: 0 22px 60px rgba(31,54,86,.22),0 4px 14px rgba(31,54,86,.08); animation: custom-select-in .14s ease-out; }
.custom-select-option { width: 100%; min-height: 38px; padding: 8px 9px; display: grid; grid-template-columns: minmax(0,1fr) 18px; align-items: center; gap: 9px; border: 0; border-radius: 9px; color: #536981; background: transparent; text-align: left; }
.custom-select-option:hover, .custom-select-option:focus-visible { outline: 0; color: #245dc7; background: #f0f5ff; }
.custom-select-option.is-selected { color: #245dc7; background: linear-gradient(100deg,#edf4ff,#f7faff); }
.custom-select-option > span { min-width: 0; }
.custom-select-option strong, .custom-select-option small { display: block; }
.custom-select-option strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; }
.custom-select-option small { margin-top: 3px; color: #8b9aab; font-size: 10px; line-height: 1.35; }
.custom-select-option b { color: transparent; font-size: 11px; text-align: center; }
.custom-select-option.is-selected b { color: #3474ec; }
.custom-select-option:has(.custom-select-swatch) { grid-template-columns: 12px minmax(0,1fr) 18px; }
.custom-select-swatch { width: 10px; height: 10px; border-radius: 50%; background: #9aa6b6; box-shadow: 0 0 0 4px rgba(154,166,182,.12); }
.custom-select-swatch.tag-value { background: #20a86b; box-shadow: 0 0 0 4px rgba(32,168,107,.12); }
.custom-select-swatch.tag-default { background: #3474ec; box-shadow: 0 0 0 4px rgba(52,116,236,.12); }
.custom-select-swatch.tag-modality { background: #7b5bd1; box-shadow: 0 0 0 4px rgba(123,91,209,.12); }
.custom-select-swatch.tag-beta { background: #df8b22; box-shadow: 0 0 0 4px rgba(223,139,34,.12); }
.custom-select-swatch.tag-speed { background: #1699b6; box-shadow: 0 0 0 4px rgba(22,153,182,.12); }
.custom-select-swatch.tag-stable { background: #11a48a; box-shadow: 0 0 0 4px rgba(17,164,138,.12); }
.custom-select-swatch.tag-depth { background: #5960cf; box-shadow: 0 0 0 4px rgba(89,96,207,.12); }
.custom-select-swatch.tag-complex { background: #c2517e; box-shadow: 0 0 0 4px rgba(194,81,126,.12); }
@keyframes custom-select-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
.model-access-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.model-access-card { min-width: 0; overflow: hidden; position: relative; border: 1px solid rgba(145,169,201,.24); border-radius: 17px; background: linear-gradient(145deg,#fbfdff,#f6f9fd); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.model-access-card:hover { transform: translateY(-2px); border-color: rgba(58,116,222,.28); box-shadow: 0 12px 28px rgba(47,83,136,.09); }
.model-access-card.is-selected { border-color: rgba(47,112,233,.46); background: linear-gradient(145deg,#f7fbff,#eef5ff); box-shadow: inset 3px 0 #3474ec,0 12px 30px rgba(47,101,196,.1); }
.model-access-main { min-height: 132px; padding: 16px; display: grid; grid-template-columns: 46px minmax(0,1fr) 24px; align-items: start; gap: 12px; cursor: pointer; }
.model-access-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.model-access-copy { min-width: 0; }
.model-access-copy strong { display: block; color: #2b405b; font-size: 13px; letter-spacing: -.02em; }
.model-access-copy small { min-height: 34px; margin: 5px 0 8px; display: -webkit-box; overflow: hidden; color: #7c8da3; font-size: 10px; line-height: 1.55; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.model-access-check { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid rgba(125,151,184,.24); border-radius: 8px; color: transparent; background: #fff; font-size: 12px; font-weight: 900; transition: .16s ease; }
.model-access-card.is-selected .model-access-check { color: #fff; border-color: #3474ec; background: #3474ec; box-shadow: 0 6px 14px rgba(52,116,236,.23); }
.model-default-choice { min-height: 40px; padding: 0 15px; display: flex; align-items: center; justify-content: flex-end; gap: 7px; border-top: 1px solid rgba(143,165,193,.15); color: #74869d; background: rgba(255,255,255,.55); cursor: pointer; font-size: 10px; font-weight: 800; }
.model-default-choice input { width: 14px; height: 14px; accent-color: #3474ec; }
.model-default-choice:has(input:checked) { color: #245dc7; background: #edf4ff; }
.model-access-note { margin: 12px 2px 0; color: #8b99ab; font-size: 10px; line-height: 1.6; }
.model-access-channel-summary { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 7px; }
.credential-editor, .credential-access-list { display: grid; gap: 10px; }
.credential-editor { grid-template-columns: repeat(2,minmax(0,1fr)); }
.credential-input-card { min-width: 0; padding: 13px; display: grid; gap: 10px; border: 1px solid rgba(145,169,201,.25); border-radius: 14px; background: linear-gradient(145deg,#fbfdff,#f6f9fd); }
.credential-input-card > span { display: grid; gap: 3px; }
.credential-input-card strong { color: #2b405b; font-size: 11px; }
.credential-input-card small { color: #8796aa; font-size: 10px; line-height: 1.45; }
.credential-input-card input { width: 100%; }
.credential-access-card { padding: 15px; border: 1px solid rgba(145,169,201,.25); border-radius: 16px; background: linear-gradient(145deg,#fbfdff,#f7faff); }
.credential-access-card.is-ready { border-color: rgba(69,185,144,.28); box-shadow: inset 3px 0 rgba(69,185,144,.75); }
.credential-access-card.is-missing { border-color: rgba(211,89,107,.25); box-shadow: inset 3px 0 rgba(211,89,107,.7); }
.credential-access-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.credential-access-head > span:first-child { display: grid; gap: 3px; }
.credential-access-head strong { color: #2b405b; font-size: 12px; }
.credential-access-head small { color: #8796aa; font-size: 10px; }
.credential-access-card .form-field { margin-top: 13px; }
.credential-access-note { margin: 13px 0 0; color: #7d8ea3; font-size: 10px; line-height: 1.55; }
.credential-test-actions { align-items: center; }
.credential-test-status { min-height: 30px; margin: 0 auto 0 0; padding: 7px 10px; display: inline-flex; flex: 1 1 240px; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 10px; color: #708199; background: rgba(242,246,251,.78); font-size: 10px; font-weight: 700; line-height: 1.45; }
.credential-test-status[hidden] { display: none; }
.credential-test-status::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 999px; background: currentColor; opacity: .8; }
.credential-test-status.is-testing { color: #2868c7; border-color: rgba(56,113,211,.15); background: #edf4ff; }
.credential-test-status.is-testing::before { width: 10px; height: 10px; border: 2px solid rgba(40,104,199,.22); border-top-color: #2868c7; background: transparent; animation: admin-spin .7s linear infinite; }
.credential-test-status.is-success { color: #087c61; border-color: rgba(22,163,123,.14); background: #eaf9f4; }
.credential-test-status.is-error { color: #bd3549; border-color: rgba(210,70,91,.16); background: #fff0f2; }
.model-template-live-preview { margin-bottom: 16px; padding: 8px; border: 1px solid rgba(112,151,216,.2); border-radius: 19px; background: radial-gradient(circle at 12% 0%,rgba(107,165,255,.14),transparent 38%),linear-gradient(145deg,#f8fbff,#f5f9ff); }
.model-template-live-preview .model-card-preview { margin: 0; min-height: 92px; border-color: rgba(255,255,255,.88); background: rgba(255,255,255,.83); box-shadow: 0 12px 30px rgba(52,88,139,.08); }
.tag-editor { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.tag-editor-row { min-width: 0; padding: 7px; display: grid; grid-template-columns: 24px minmax(0,1fr) 120px; align-items: center; gap: 7px; border: 1px solid rgba(154,176,204,.24); border-radius: 12px; background: #f8fafd; }
.tag-editor-row > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: #6f83a0; background: #edf2f8; font-size: 10px; font-weight: 900; }
.tag-editor-row input, .tag-editor-row select { min-width: 0; min-height: 34px; padding: 6px 8px; border: 0; border-radius: 8px; outline: none; color: #40546d; background: #fff; font-size: 10px; }
.tag-editor-row input:focus, .tag-editor-row select:focus { box-shadow: 0 0 0 3px rgba(40,104,232,.08); }
.dialog-error { min-height: 18px; margin: 10px 0 0; color: #cb3f55; font-size: 10px; }
.dialog-actions { margin-top: 11px; padding-top: 15px; display: flex; justify-content: flex-end; gap: 7px; border-top: 1px solid var(--line); }
.secret-card { padding: 18px; border: 1px solid rgba(89,137,216,.22); border-radius: 15px; background: linear-gradient(130deg,#edf5ff,#f8fbff); }
.secret-card code { display: block; overflow-wrap: anywhere; color: #1c52b9; font-size: 15px; font-weight: 800; letter-spacing: .035em; }
.secret-card p { margin: 10px 0 0; color: #71839a; font-size: 10px; line-height: 1.6; }
.session-list-admin, .message-list-admin { display: grid; gap: 7px; }
.session-row-admin { padding: 11px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fafcff; }
.session-row-admin strong, .session-row-admin small { display: block; }
.session-row-admin strong { color: #435872; font-size: 10px; }
.session-row-admin small { margin-top: 4px; color: #94a1b2; font-size: 10px; }
.message-admin { padding: 11px 13px; border: 1px solid rgba(143,165,193,.18); border-radius: 12px; background: #fafcff; }
.message-admin.user { margin-left: 8%; background: #edf5ff; border-color: rgba(73,125,217,.16); }
.message-admin label { display: block; margin-bottom: 5px; color: #6d81a0; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.message-admin pre { margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: #485c74; font: 9px/1.6 "SFMono-Regular",Consolas,monospace; }
.file-list { display: grid; gap: 6px; }
.file-item { padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fafcff; }
.file-item strong { color: #496078; font-size: 10px; }
.file-item pre { max-height: 230px; margin: 7px 0 0; overflow: auto; padding: 9px; border-radius: 8px; color: #52647a; background: #f0f4f9; font: 8px/1.55 "SFMono-Regular",Consolas,monospace; white-space: pre-wrap; }

.admin-toast { min-width: 190px; max-width: min(420px,calc(100% - 28px)); padding: 11px 14px; position: fixed; z-index: 80; right: 20px; bottom: 20px; opacity: 0; pointer-events: none; transform: translateY(12px); border: 1px solid rgba(111,147,195,.24); border-radius: 12px; color: #465d77; background: rgba(255,255,255,.94); box-shadow: 0 16px 50px rgba(32,57,91,.17); font-size: 10px; transition: .2s ease; }
.admin-toast.show { opacity: 1; transform: translateY(0); }
.admin-toast.error { color: #bd3549; border-color: rgba(210,70,91,.2); background: #fff6f7; }

html[data-theme="dark"] {
  color: #d7e0ec;
  background: #020617;
  --navy: #e5edf7;
  --muted: #94a3b8;
  --blue: #60a5fa;
  --blue-dark: #93c5fd;
  --teal: #5eead4;
  --amber: #fbbf24;
  --red: #fda4af;
  --line: rgba(148,163,184,.2);
  --glass: rgba(15,23,42,.94);
  --shadow: 0 26px 80px rgba(0,0,0,.34),0 4px 16px rgba(0,0,0,.2);
}
html[data-theme="dark"] .admin-atmosphere { background: linear-gradient(145deg,#020617 0%,#081026 50%,#06131b 100%); }
html[data-theme="dark"] .admin-atmosphere::before { opacity: .11; background-image: linear-gradient(rgba(96,165,250,.22) 1px,transparent 1px),linear-gradient(90deg,rgba(96,165,250,.22) 1px,transparent 1px); }
html[data-theme="dark"] .admin-topbar { border-bottom-color: rgba(51,65,85,.72); background: rgba(2,6,23,.96); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
html[data-theme="dark"] .admin-brand-mark { color: #60a5fa; background: rgba(30,58,138,.42); box-shadow: 0 6px 20px rgba(37,99,235,.16); }
html[data-theme="dark"] .admin-brand small,
html[data-theme="dark"] .admin-health { color: #94a3b8; }
html[data-theme="dark"] .admin-health,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .admin-quiet-link,
html[data-theme="dark"] .admin-quiet-button { color: #cbd5e1; background: rgba(15,23,42,.74); border-color: rgba(100,116,139,.3); }
html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .admin-quiet-button:hover,
html[data-theme="dark"] .admin-quiet-link:hover { color: #93c5fd; background: rgba(30,41,59,.94); border-color: rgba(96,165,250,.4); }
html[data-theme="dark"] .admin-top-actions .admin-quiet-link,
html[data-theme="dark"] .admin-top-actions .admin-quiet-button { color: #94a3b8; border-color: transparent; background: transparent; box-shadow: none; }
html[data-theme="dark"] .admin-top-actions .admin-quiet-button:hover,
html[data-theme="dark"] .admin-top-actions .admin-quiet-link:hover { color: #93c5fd; border-color: rgba(96,165,250,.22); background: rgba(30,64,175,.2); }
html[data-theme="dark"] .admin-rail,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .admin-panel,
html[data-theme="dark"] .entity-card,
html[data-theme="dark"] .data-table-wrap,
html[data-theme="dark"] .mobile-user-card { border-color: rgba(71,85,105,.58); }
html[data-theme="dark"] .admin-rail { background: rgba(15,23,42,.82); }
html[data-theme="dark"] .rail-kicker,
html[data-theme="dark"] .page-index { color: #8da9ce; }
html[data-theme="dark"] .rail-intro p,
html[data-theme="dark"] .admin-page-heading p,
html[data-theme="dark"] .metric-card p,
html[data-theme="dark"] .panel-title p,
html[data-theme="dark"] .entity-card-head p,
html[data-theme="dark"] .model-preview-copy p { color: #8f9db0; }
html[data-theme="dark"] .admin-nav-item { color: #aab7c8; }
html[data-theme="dark"] .admin-nav-item > span { color: #9cabc0; background: rgba(30,41,59,.82); }
html[data-theme="dark"] .admin-nav-item small { color: #7f8da2; }
html[data-theme="dark"] .admin-nav-item:hover { color: #93c5fd; background: rgba(30,41,59,.72); }
html[data-theme="dark"] .admin-nav-item.active { color: #bfdbfe; border-color: rgba(96,165,250,.28); background: linear-gradient(100deg,rgba(30,64,175,.3),rgba(15,23,42,.72)); box-shadow: inset 3px 0 #60a5fa,0 6px 17px rgba(0,0,0,.16); }
html[data-theme="dark"] .rail-admin strong { color: #d7e0ec; }
html[data-theme="dark"] .rail-admin small { color: #8291a5; }

html[data-theme="dark"] .metric-label,
html[data-theme="dark"] .status-line > span:last-child,
html[data-theme="dark"] .activity-group-title strong,
html[data-theme="dark"] .data-table td,
html[data-theme="dark"] .filter-bar label { color: #9bacbf; }
html[data-theme="dark"] .metric-card-action,
html[data-theme="dark"] .button-plain,
html[data-theme="dark"] .button-secondary { color: #bfdbfe; background: rgba(30,41,59,.76); border-color: rgba(96,165,250,.25); }
html[data-theme="dark"] .metric-card-action:hover,
html[data-theme="dark"] .button-secondary:hover,
html[data-theme="dark"] .button-plain:hover { color: #dbeafe; background: rgba(30,64,175,.27); border-color: rgba(96,165,250,.42); }
html[data-theme="dark"] .button-danger { color: #fda4af; background: rgba(136,19,55,.25); border-color: rgba(251,113,133,.28); }
html[data-theme="dark"] .button-danger:hover { background: rgba(159,18,57,.34); }
html[data-theme="dark"] .status-line,
html[data-theme="dark"] .mobile-user-facts { background: rgba(8,15,30,.58); border-color: rgba(100,116,139,.22); }
html[data-theme="dark"] .status-line strong,
html[data-theme="dark"] .mobile-user-facts strong,
html[data-theme="dark"] .table-primary strong,
html[data-theme="dark"] .property-line strong,
html[data-theme="dark"] .property-line code,
html[data-theme="dark"] .model-preview-title strong,
html[data-theme="dark"] .entity-card-head h3 { color: #d7e0ec; }
html[data-theme="dark"] .status-line small,
html[data-theme="dark"] .mobile-user-facts small,
html[data-theme="dark"] .table-primary small,
html[data-theme="dark"] .property-line span { color: #8291a5; }
html[data-theme="dark"] .activity-group-title span { color: #bfdbfe; background: rgba(30,64,175,.28); }
html[data-theme="dark"] .data-table th { color: #8f9db0; background: rgba(8,15,30,.68); }
html[data-theme="dark"] .data-table td { border-bottom-color: rgba(100,116,139,.18); }
html[data-theme="dark"] .data-table tbody tr:hover { background: rgba(30,41,59,.62); }
html[data-theme="dark"] .state-chip.concurrency-limit { color: #c4b5fd; border-color: rgba(167,139,250,.28); background: rgba(76,29,149,.28); }
html[data-theme="dark"] .table-avatar { color: #93c5fd; background: rgba(30,64,175,.3); }
html[data-theme="dark"] .property-line code { background: rgba(30,41,59,.82); }
html[data-theme="dark"] .model-card-preview { border-color: rgba(100,116,139,.28); background: linear-gradient(135deg,rgba(15,23,42,.94),rgba(30,41,59,.7)); }
html[data-theme="dark"] .model-brand { background: rgba(30,64,175,.3); }
html[data-theme="dark"] .model-brand.openai { color: #e2e8f0; background: #1e293b; }
html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .empty-panel { background: rgba(15,23,42,.66); border-color: rgba(71,85,105,.52); box-shadow: 0 8px 24px rgba(0,0,0,.16); }
html[data-theme="dark"] .filter-bar select { color: #d7e0ec; background: rgba(15,23,42,.9); }
html[data-theme="dark"] .empty-panel { color: #8f9db0; }
html[data-theme="dark"] .empty-panel strong { color: #cbd5e1; }
html[data-theme="dark"] .error-panel { color: #fda4af; background: rgba(136,19,55,.2); border-color: rgba(251,113,133,.28); }

html[data-theme="dark"] .admin-dialog-shell { color: #cbd5e1; border-color: rgba(71,85,105,.68); background: rgba(8,15,30,.98); box-shadow: 0 34px 100px rgba(0,0,0,.58); }
html[data-theme="dark"] .dialog-close { color: #9aa8ba; background: #1e293b; }
html[data-theme="dark"] .dialog-head p,
html[data-theme="dark"] .form-field small { color: #8f9db0; }
html[data-theme="dark"] .form-field > span,
html[data-theme="dark"] .form-field.check-item > span,
html[data-theme="dark"] .control-switch > span strong { color: #cbd5e1; }
html[data-theme="dark"] .form-field input,
html[data-theme="dark"] .form-field select,
html[data-theme="dark"] .form-field textarea,
html[data-theme="dark"] .tag-editor-row input,
html[data-theme="dark"] .tag-editor-row select { color: #d7e0ec; background: #0f172a; border-color: rgba(100,116,139,.4); }
html[data-theme="dark"] .form-field input:focus,
html[data-theme="dark"] .form-field select:focus,
html[data-theme="dark"] .form-field textarea:focus { background: #111c31; }
html[data-theme="dark"] .check-item,
html[data-theme="dark"] .control-switch { color: #cbd5e1; border-color: rgba(100,116,139,.3); background: linear-gradient(145deg,#0f172a,#111c31); }
html[data-theme="dark"] .check-item:hover,
html[data-theme="dark"] .check-item:focus-within,
html[data-theme="dark"] .control-switch:has(input:checked) { background: linear-gradient(145deg,#111c31,rgba(30,64,175,.22)); }
html[data-theme="dark"] .check-item > input[type="checkbox"] { background: #1e293b; }
html[data-theme="dark"] .custom-select-trigger { color: #d7e0ec; background: linear-gradient(145deg,#0f172a,#111c31); border-color: rgba(100,116,139,.4); }
html[data-theme="dark"] .custom-select-trigger:hover,
html[data-theme="dark"] .custom-select-trigger:focus-visible,
html[data-theme="dark"] .custom-select-trigger.is-open { background: #172033; }
html[data-theme="dark"] .custom-select-menu { border-color: rgba(100,116,139,.4); background: rgba(8,15,30,.98); box-shadow: 0 22px 60px rgba(0,0,0,.55); }
html[data-theme="dark"] .custom-select-option { color: #bdc8d7; }
html[data-theme="dark"] .custom-select-option:hover,
html[data-theme="dark"] .custom-select-option:focus-visible,
html[data-theme="dark"] .custom-select-option.is-selected { color: #bfdbfe; background: rgba(30,64,175,.26); }
html[data-theme="dark"] .custom-select-option small { color: #8f9db0; }

html[data-theme="dark"] .model-access-card,
html[data-theme="dark"] .credential-input-card,
html[data-theme="dark"] .credential-access-card { border-color: rgba(100,116,139,.3); background: linear-gradient(145deg,#0f172a,#111c31); }
html[data-theme="dark"] .model-access-card.is-selected { background: linear-gradient(145deg,rgba(30,64,175,.27),#0f172a); }
html[data-theme="dark"] .model-access-copy strong,
html[data-theme="dark"] .credential-input-card strong,
html[data-theme="dark"] .credential-access-head strong { color: #d7e0ec; }
html[data-theme="dark"] .model-access-copy small,
html[data-theme="dark"] .credential-input-card small,
html[data-theme="dark"] .credential-access-head small,
html[data-theme="dark"] .credential-access-note { color: #8f9db0; }
html[data-theme="dark"] .model-access-check { background: #1e293b; }
html[data-theme="dark"] .model-default-choice { color: #9bacbf; background: rgba(8,15,30,.5); }
html[data-theme="dark"] .model-default-choice:has(input:checked) { color: #bfdbfe; background: rgba(30,64,175,.25); }
html[data-theme="dark"] .credential-test-status { color: #aebbd0; background: rgba(30,41,59,.72); }
html[data-theme="dark"] .model-template-live-preview { background: radial-gradient(circle at 12% 0,rgba(37,99,235,.2),transparent 38%),linear-gradient(145deg,#0f172a,#111c31); }
html[data-theme="dark"] .model-template-live-preview .model-card-preview { border-color: rgba(100,116,139,.3); background: rgba(15,23,42,.84); }
html[data-theme="dark"] .tag-editor-row { background: #0f172a; border-color: rgba(100,116,139,.3); }
html[data-theme="dark"] .tag-editor-row > span { color: #aebbd0; background: #1e293b; }
html[data-theme="dark"] .secret-card { background: linear-gradient(130deg,rgba(30,64,175,.28),#0f172a); }
html[data-theme="dark"] .secret-card code { color: #bfdbfe; }
html[data-theme="dark"] .secret-card p { color: #94a3b8; }
html[data-theme="dark"] .session-row-admin,
html[data-theme="dark"] .message-admin,
html[data-theme="dark"] .file-item { background: #0f172a; }
html[data-theme="dark"] .message-admin.user { background: rgba(30,64,175,.23); }
html[data-theme="dark"] .session-row-admin strong,
html[data-theme="dark"] .file-item strong { color: #cbd5e1; }
html[data-theme="dark"] .message-admin pre,
html[data-theme="dark"] .file-item pre { color: #bdc8d7; background: #070d1b; }
html[data-theme="dark"] .admin-toast { color: #d7e0ec; background: rgba(15,23,42,.96); border-color: rgba(100,116,139,.38); box-shadow: 0 16px 50px rgba(0,0,0,.42); }
html[data-theme="dark"] .admin-toast.error { color: #fda4af; background: rgba(76,5,25,.94); }

.site-footer {
  min-height: 40px;
  padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-top: 1px solid rgba(203,213,225,.46);
  color: #98a5b5;
  background: rgba(255,255,255,.94);
}
.site-footer p { margin: 0; font-size: 10px; letter-spacing: .02em; }
html[data-theme="dark"] .site-footer { color: #718096; border-top-color: rgba(51,65,85,.56); background: rgba(2,6,23,.94); }

@keyframes admin-spin { to { transform: rotate(360deg); } }

@media (max-width: 1080px) {
  .admin-layout { grid-template-columns: 210px minmax(0,1fr); }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid, .entity-grid { grid-template-columns: 1fr; }
  .data-table-wrap { overflow-x: auto; }
  .data-table { min-width: 940px; }
}

@media (max-width: 900px) {
  .admin-topbar-inner { height: 64px; padding: 0 16px; }
}

@media (max-width: 760px) {
  .admin-topbar-inner { height: 64px; min-height: 64px; padding: 0 16px; }
  .admin-health, .admin-quiet-link { display: none; }
  .admin-layout { width: calc(100% - 16px); min-height: calc(100vh - var(--footer-dock-header, 64px) - 16px); min-height: calc(100dvh - var(--footer-dock-header, 64px) - 16px); margin: 8px auto; display: block; }
  .admin-rail { min-height: 0; padding: 10px; position: static; border-radius: 18px; }
  .rail-intro, .rail-admin { display: none; }
  .admin-nav { margin: 0; display: flex; overflow-x: auto; gap: 5px; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav-item { min-width: 94px; min-height: 43px; padding: 7px 9px; display: flex; justify-content: center; gap: 6px; }
  .admin-nav-item > span { width: 22px; height: 22px; }
  .admin-nav-item small { display: none; }
  .admin-nav-item b { align-self: auto; font-size: 10px; }
  .admin-main { padding: 10px 2px 50px; }
  .admin-page-heading { min-height: 100px; align-items: flex-end; }
  .admin-page-heading h1 { font-size: 29px; }
  .admin-page-heading p { max-width: 330px; }
  .page-actions { align-self: center; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .metric-card { min-height: 120px; padding: 15px; border-radius: 16px; }
  .metric-card strong { font-size: 29px; }
  .metric-card-action { right: 12px; bottom: 11px; }
  .entity-grid { grid-template-columns: 1fr; }
  .desktop-users { display: none; }
  .mobile-user-list { display: grid; gap: 8px; }
  .form-grid, .check-grid { grid-template-columns: 1fr; }
  .model-access-list, .tag-editor, .credential-editor { grid-template-columns: 1fr; }
  .credential-access-head { align-items: stretch; flex-direction: column; }
  .model-access-main { min-height: 120px; }
  .tag-editor-row { grid-template-columns: 24px minmax(0,1fr) 112px; }
  .admin-dialog-shell { padding: 23px 18px 18px; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar select { width: 100%; min-width: 0; }
}

@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 108px; }
  .metric-card strong { margin-top: 12px; font-size: 26px; }
  .metric-card.has-action p { padding-right: 0; }
  .metric-card-action { min-height: 25px; padding: 0 7px; right: 10px; bottom: 9px; }
  .admin-page-heading { min-height: 112px; gap: 8px; }
  .admin-page-heading p { font-size: 10px; }
  .button-primary, .button-secondary { padding: 0 10px; }
  .mobile-user-facts { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 0; }
}

@media (max-width: 390px) {
  .admin-topbar-inner { padding: 0 10px; }
  .admin-brand { gap: 7px; }
  .admin-brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .admin-brand-mark svg { width: 20px; height: 20px; }
  .admin-brand strong { font-size: 14px; }
}

/* Readable admin tables with one consistent management entry per account. */
.data-table-wrap { overflow-x: auto; border-color: var(--line); border-radius: 14px; }
.data-table th { white-space: nowrap; font-size: 11px; letter-spacing: .04em; }
.data-table td { font-size: 12px; padding: 16px 14px; }
.data-table .state-chip, .data-table button { white-space: nowrap; }
.desktop-users .data-table { min-width: 750px; }
.desktop-users .table-primary { min-width: 130px; }
.desktop-users .table-primary strong { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.desktop-users .protected-mark { margin-left: 0; font-size: 10px; }
.desktop-users td:nth-child(3) { min-width: 110px; }
.desktop-users td:nth-child(4) small { display: inline-block; max-width: 150px; margin-top: 4px; }
.user-management-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.user-management-actions button { min-height: 44px; }
.chat-table { min-width: 680px; }
.chat-table td:first-child { width: 45%; }
.chat-table .table-primary { overflow-wrap: anywhere; }
.chat-pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 18px 0; font-size: 12px; color: var(--muted); }
.chat-pagination > div { display: flex; gap: 8px; }
.chat-pagination button:disabled { opacity: .45; cursor: not-allowed; }
@media (min-width: 1081px) {
  .admin-layout { grid-template-columns: 220px minmax(0,1fr); }
  .admin-main { padding-left: 18px; padding-right: 18px; }
}

/* Native details keeps tool calls collapsed and keyboard accessible. */
.message-list-admin, .message-admin { min-width: 0; }
.tool-call-admin summary { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; list-style: none; }
.tool-call-admin summary::-webkit-details-marker { display: none; }
.tool-call-admin summary::before { content: "▸"; flex: 0 0 auto; color: #6d81a0; }
.tool-call-admin[open] summary::before { content: "▾"; }
.tool-call-admin summary:focus-visible { outline: 2px solid #497dd9; outline-offset: 4px; border-radius: 4px; }
.tool-call-name { flex: 0 1 auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 800; }
.tool-call-preview { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; color: #6d81a0; }
.tool-call-detail { margin-top: 12px; border-top: 1px solid rgba(143,165,193,.18); padding-top: 10px; }
.tool-call-detail label:not(:first-child) { margin-top: 12px; }
.tool-call-detail pre + pre { margin-top: 8px; }

.chat-assets-admin { margin-bottom: 18px; padding: 13px; border: 1px solid rgba(143,165,193,.25); border-radius: 12px; }
.chat-assets-admin h3 { margin: 0 0 12px; font-size: 14px; }
.chat-assets-turn + .chat-assets-turn { margin-top: 14px; }
.chat-assets-admin h4, .chat-assets-admin h5 { margin: 8px 0; color: #6d81a0; font-size: 11px; }
.chat-asset-admin { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.chat-asset-info { flex: 1; min-width: 0; }
.chat-asset-info strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.chat-asset-info small { color: #6d81a0; font-size: 10px; }
.chat-asset-actions { display: flex; flex: 0 0 auto; gap: 10px; font-size: 12px; }
.chat-asset-actions a { color: #497dd9; }

.analytics-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.analytics-results { display: grid; gap: 20px; min-width: 0; }
.analytics-panel + .analytics-results { margin-top: 20px; }
.analytics-panel h2 { margin: 0 0 16px; font-size: 16px; }
.analytics-note { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 12px 0 0; overflow-wrap: anywhere; }
.analytics-filters, .analytics-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.analytics-filters label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; min-width: 0; }
.analytics-date-field { display: flex; align-items: center; gap: 8px; min-width: 0; }
.analytics-date-field > label { flex-shrink: 0; }
.analytics-auto { margin-left: auto; }
.analytics-status { color: var(--muted); font-size: 12px; line-height: 1.8; margin-bottom: 0; }
.analytics-error { color: #c95050; font-size: 12px; line-height: 1.8; }
html[data-theme=dark] .analytics-error { color: #fca5a5; }
.analytics-chart { display: block; width: 100%; height: auto; max-height: 280px; overflow: visible; }
.analytics-chart text { fill: var(--muted); font: 12px system-ui; }
.analytics-axis { stroke: var(--line); fill: none; }
.analytics-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.analytics-line.pv { stroke: var(--blue); }
.analytics-line.visitDau { stroke: #8b5cf6; }
.analytics-line.useDau { stroke: #0d9488; }
.analytics-dot.pv { fill: var(--blue); }
.analytics-dot.visitDau { fill: #8b5cf6; }
.analytics-dot.useDau { fill: #0d9488; }
.analytics-legend { display: flex; gap: 20px; margin: 0 0 10px; }
.analytics-legend .pv { color: var(--blue); }
.analytics-legend .visitDau { color: #8b5cf6; }
.analytics-legend .useDau { color: #0d9488; }
.analytics-panel .data-table td { white-space: nowrap; }
@media (max-width: 760px) {
  .analytics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-auto { margin-left: 0; }
  .analytics-date-field { flex: 1 1 220px; }
  .analytics-date-field .calendar-date-picker { flex: 1; }
}

.calendar-range-trigger { white-space: nowrap; }
.analytics-date-field > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.calendar-range-layer { position: fixed; z-index: 1000; overflow: auto; padding: 16px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 18px; background: var(--surface, #fff); color: var(--text); box-shadow: 0 16px 48px #10234526; }
html[data-theme=dark] .calendar-range-layer { background: #172338; }
.range-header, .range-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.range-header button, .range-footer button { border: 1px solid var(--line); border-radius: 8px; background: transparent; color: inherit; padding: 8px 12px; cursor: pointer; }
.range-months { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.range-months h3 { text-align: center; font-size: 14px; }
.range-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; gap: 3px 0; }
.range-weekdays { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.range-grid button { min-height: 34px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.range-grid button.in-range { background: #3478f620; border-radius: 0; }
.range-grid button:hover:not(:disabled) { background: #3478f640; }
.range-grid button.is-selected { background: #3478f6; color: white; }
.range-grid button:disabled { opacity: .3; cursor: default; }
.range-grid button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.range-footer { margin-top: 14px; font-size: 12px; color: var(--muted); }
.range-footer button { flex-shrink: 0; }
.analytics-chart-wrap { position: relative; }
.analytics-tooltip { width: max-content; max-width: 100%; box-sizing: border-box; position: absolute; top: 0; pointer-events: none; background: #172338; color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 12px; box-shadow: 0 4px 16px #10234526; }
.analytics-tooltip span { display: block; line-height: 1.8; white-space: nowrap; }
.analytics-highlight { pointer-events: none; }
.analytics-highlight path { stroke: var(--muted); stroke-dasharray: 4 4; }
@media (max-width: 560px) {
  .range-months { grid-template-columns: 1fr; gap: 4px; }
  .range-grid button { min-height: 30px; }
  .calendar-range-layer { padding: 12px; }
  .analytics-date-field { flex-wrap: wrap; }
}
