/* AVA console · design tokens, after the AstrBot dashboard
   (dashboard/src/theme/*.ts, scss/_variables.scss, layouts/full/*) */
:root {
  --chrome: #f2f2f7;            /* sidebar, toolbar and the gaps around the content panel */
  --bg: var(--chrome);
  --panel: #ffffff;              /* containerBg: the rounded content panel */
  --surface: #ffffff;
  --surface-2: #f7f7f9;
  --surface-3: #eef0f3;
  --hover: rgba(27, 28, 29, 0.05);
  --border: rgba(208, 208, 208, 0.62);
  --border-strong: #d0d0d0;
  --input-border: rgba(27, 28, 29, 0.24);
  --text: #1b1c1d;
  --text-2: rgba(27, 28, 29, 0.76);
  --text-3: rgba(27, 28, 29, 0.5);
  --primary: #3c96ca;
  --primary-2: #2f86bd;
  --primary-soft: rgba(60, 150, 202, 0.1);
  --primary-text: #2f86bd;
  --success: #1f9d55;
  --success-soft: rgba(0, 200, 83, 0.12);
  --warning: #c98a00;
  --warning-soft: #fff8e1;
  --danger: #f44336;
  --danger-soft: #f9d8d8;
  --info: #0397a3;
  --info-soft: rgba(3, 201, 215, 0.12);
  --snack-success: #457c3c;
  --shadow-sm: none;
  --shadow: 0 1px 20px rgba(0, 0, 0, 0.08);
  --shadow-menu: 0 12px 28px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius: 20px;                /* --astrbot-radius-card */
  --radius-sm: 12px;             /* --astrbot-radius-control */
  --radius-nav: 12px;
  --radius-menu: 16px;
  --radius-dialog: 28px;
  --radius-panel: 16px;
  --sidebar: 256px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", Consolas, monospace;
  --font: "Outfit", "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --chrome: #1a1a1a;
  --panel: #1a1a1a;
  --surface: #242424;
  --surface-2: #2a2a2a;
  --surface-3: #313131;
  --hover: rgba(232, 234, 237, 0.06);
  --border: rgba(58, 58, 58, 0.95);
  --border-strong: #3a3a3a;
  --input-border: rgba(232, 234, 237, 0.26);
  --text: #e8eaed;
  --text-2: rgba(255, 255, 255, 0.78);
  --text-3: rgba(255, 255, 255, 0.5);
  --primary: #5ba4d4;
  --primary-2: #4a95c4;
  --primary-soft: rgba(91, 164, 212, 0.14);
  --primary-text: #84c9ea;
  --success: #52c41a;
  --success-soft: #1a3a1a;
  --warning: #faad14;
  --warning-soft: #3d351a;
  --danger: #ff4d4f;
  --danger-soft: #3d1a1a;
  --info: #03c9d7;
  --info-soft: rgba(3, 201, 215, 0.14);
  --snack-success: #457c3c;
  --shadow: 0 1px 20px rgba(0, 0, 0, 0.35);
  --shadow-menu: 0 12px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; word-break: break-all; color: var(--text); }
pre {
  margin: 0; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: auto; white-space: pre-wrap; word-break: break-word; max-height: 460px;
}
svg { flex: none; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.boot { display: grid; place-items: center; height: 100vh; }

/* buttons (Vuetify flat / tonal / text variants, 12px corners, no borders) */
button, .btn {
  font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 0;
  background: var(--surface-3); color: var(--text); cursor: pointer; white-space: nowrap; text-transform: none;
  transition: background .15s, color .15s, box-shadow .15s, filter .15s;
}
button:hover, .btn:hover { background: color-mix(in srgb, var(--text) 10%, var(--surface)); text-decoration: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
button:disabled { opacity: .5; cursor: not-allowed; }
button .icon, .btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary); filter: brightness(1.07); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 22%, var(--surface)); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger); filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn-icon { width: 36px; padding: 0; border-radius: 50%; }
.btn-sm.btn-icon { width: 30px; border-radius: 50%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.busy { position: relative; color: transparent !important; pointer-events: none; }
.busy::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--text-3); border-top-color: transparent; animation: spin .7s linear infinite;
}
.btn-primary.busy::after { border-color: #fff; border-top-color: transparent; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--primary); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* forms */
input, select, textarea {
  font: inherit; width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--input-border);
  border-radius: var(--radius-sm); padding: 8px 12px; min-height: 40px; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text) 55%, transparent); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
input[type="checkbox"] { width: auto; min-height: 0; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 17px) 15px, calc(100% - 12px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
label.field { display: grid; gap: 6px; }
label.field > span { font-weight: 500; font-size: 13px; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: -2px; }
.form-grid { display: grid; gap: 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 44px; height: 24px; border-radius: 12px; background: color-mix(in srgb, var(--text) 26%, transparent); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }

/* layout: the sidebar sits on the chrome surface, pages scroll inside a rounded panel */
html, body { overflow: hidden; }
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); height: 100vh; height: 100dvh; background: var(--chrome); }
.shell.collapsed { --sidebar: 76px; }
.sidebar {
  height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 4px 16px 14px;
  background: var(--chrome); overflow-y: auto; z-index: 30; user-select: none; scrollbar-width: none;
}
.brand { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 8px; }
.brand img { width: 28px; height: 28px; border-radius: 22%; display: block; }
.brand b { font-size: 18px; font-weight: 800; letter-spacing: 0; display: flex; align-items: center; line-height: 28px; white-space: nowrap; }
.brand small { color: var(--text-3); font-size: 11px; font-weight: 500; }
.sidebar .brand { position: relative; }
.brand-logo { display: inline-flex; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.brand-logo:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.shell.collapsed .brand.has-update::after { content: ""; position: absolute; top: 12px; left: calc(50% + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--chrome); pointer-events: none; }
.ver-chip { position: relative; margin-left: 6px; padding: 1px 7px; border: 0; border-radius: 9999px; background: var(--surface-3); color: var(--text-2);
  font: 600 11px/16px var(--mono); vertical-align: 2px; cursor: pointer; }
.ver-chip:hover { background: var(--primary-soft); color: var(--primary-text); }
.ver-chip.has-update { background: var(--primary); color: #fff; }
.ver-chip i { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--chrome); }
.update-progress { display: flex; align-items: center; gap: 10px; margin: 0; }
.update-log { max-height: 220px; overflow: auto; margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; }
.update-changes { max-height: 200px; overflow: auto; margin-top: 6px; }
.nav-group > p { margin: 0; padding: 16px 10px 8px; font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .08em; line-height: 16px; text-transform: uppercase; }
.nav-group:first-child > p { padding-top: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 36px; margin-bottom: 2px; padding: 0 10px;
  border-radius: var(--radius-nav); color: var(--text-2); font-weight: 500; font-size: 14px;
}
.nav-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.nav-link .icon { width: 20px; height: 20px; }
.nav-badge { margin-left: auto; font-size: 11px; padding: 0 7px; border-radius: 10px; background: var(--danger); color: #fff; line-height: 18px; }
.shell.collapsed .brand div, .shell.collapsed .nav-group > p, .shell.collapsed .nav-link span, .shell.collapsed .nav-badge, .shell.collapsed .sidebar-foot span { display: none; }
.shell.collapsed .nav-link { justify-content: center; padding: 0; }
.shell.collapsed .brand { justify-content: center; padding: 0; }
.sidebar-foot { margin-top: auto; padding: 8px 0 0; display: grid; gap: 2px; }
.sidebar-foot .status-line { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 11px; font-weight: 500; padding: 4px 10px; }
.sidebar-foot .status-line .icon { width: 15px; height: 15px; }
.sidebar-foot .btn { justify-content: flex-start; min-height: 36px; padding: 0 10px; border-radius: var(--radius-nav); font-size: 14px; }
.shell.collapsed .sidebar-foot .btn, .shell.collapsed .sidebar-foot .status-line { justify-content: center; }
.main {
  min-width: 0; display: flex; flex-direction: column; margin: 6px 6px 6px 0; border-radius: var(--radius-panel);
  background: var(--panel); overflow-y: auto; overflow-x: hidden; height: calc(100vh - 12px); height: calc(100dvh - 12px);
}
:root[data-theme="dark"] .main { box-shadow: inset 0 0 0 1px var(--border); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 16px 24px 12px;
  background: var(--panel); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; }
.topbar .subtitle { color: var(--text-3); font-size: 12.5px; }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; }
.content { padding: 4px 24px 32px; display: grid; gap: 16px; align-content: start; }
.scrim { display: none; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card-head .desc { color: var(--text-3); font-size: 12.5px; width: 100%; margin-top: -4px; }
.card-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px 22px 20px; }
.card-body.flush { padding: 10px 0 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat .label .dot-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.stat .label .dot-icon .icon { width: 15px; height: 15px; }
.stat .value { font-size: 26px; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.stat .foot { color: var(--text-3); font-size: 12px; }
.tone-success .dot-icon { background: var(--success-soft) !important; color: var(--success) !important; }
.tone-warning .dot-icon { background: var(--warning-soft) !important; color: var(--warning) !important; }
.tone-danger .dot-icon { background: var(--danger-soft) !important; color: var(--danger) !important; }
.tone-info .dot-icon { background: var(--info-soft) !important; color: var(--info) !important; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 9999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary-text); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-family: var(--mono); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface); white-space: nowrap; height: 48px; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
td.actions { text-align: right; white-space: nowrap; }
td.num { white-space: nowrap; }
.weight-input { width: 110px; }
.setting .unit { display: inline-block; min-width: 2.2em; }
td.actions .btn-row { justify-content: flex-end; flex-wrap: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); display: grid; gap: 8px; justify-items: center; }
.empty .icon { width: 34px; height: 34px; opacity: .55; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .search { position: relative; flex: 1 1 220px; max-width: 340px; }
.toolbar .search .icon { position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; color: var(--text-3); }
.toolbar .search input { padding-left: 36px; }
.toolbar select, .toolbar .vselect { width: auto; min-width: 150px; }
.segmented { display: inline-flex; flex-wrap: wrap; max-width: 100%; padding: 4px; border-radius: var(--radius-sm); background: var(--surface-3); gap: 2px; }
.segmented button { height: 30px; border: 0; background: transparent; color: var(--text-2); border-radius: 10px; padding: 0 13px; font-size: 13px; }
.segmented button.active { background: var(--primary); color: #fff; font-weight: 500; }
.segmented button:not(.active):hover { background: var(--hover); color: var(--text); }
.provider-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.provider-tabs button { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 0; background: transparent; height: 44px; padding: 0 14px;
  color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.provider-tabs button:hover { background: transparent; color: var(--text); }
.provider-tabs button.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.provider-tabs svg { width: 18px; height: 18px; flex: none; }
.provider-tabs .count { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 18px; }
.tabs button { border: 0; border-radius: 0; background: transparent; height: 42px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 0 12px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabs button:hover { background: transparent; color: var(--text); }

/* account cards */
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.account .foot .btn-row { gap: 6px; }
.account { display: flex; flex-direction: column; }
.account .head { display: flex; gap: 12px; padding: 16px 18px 12px; align-items: flex-start; }
.account .who { min-width: 0; flex: 1; }
.account .who b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .who .name { display: flex; align-items: center; gap: 8px; }
.account .who .name b { min-width: 0; flex: 1; }
.account .head .badge { flex: none; }
.account .who > span { display: block; color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.account .meta div { background: var(--surface); padding: 10px 14px; display: grid; gap: 2px; }
.account .meta small { color: var(--text-3); font-size: 11.5px; }
.account .meta b { font-size: 14px; font-variant-numeric: tabular-nums; }
.account .body { padding: 12px 18px; display: grid; gap: 10px; flex: 1; align-content: start; }
.account .foot { padding: 12px 18px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--border); }
.account .foot .enable { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; }
.account .head .side { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.account .head .side .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.account .who .note { color: var(--text-2); margin-top: 2px; }

/* account selection and batch actions */
.pick { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: none; cursor: pointer; margin-top: 1px; }
.pick input, .pick-all input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--primary); cursor: pointer; }
.account.picked { box-shadow: 0 0 0 2px var(--primary); }
tr.picked td { background: var(--primary-soft); }
.batch-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 8px 12px; margin: 12px 0 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.batch-bar.active { border-color: var(--primary); background: var(--primary-soft); }
.batch-bar .batch-left { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; min-width: 0; }
.batch-bar .pick-all { padding: 4px 8px; }
.batch-bar .batch-quick { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.batch-bar .quick-problem { color: var(--danger); }
.batch-bar .quick-cooling { color: var(--warning); }
.batch-bar .quick-ok { color: var(--success); }
.batch-bar .batch-actions { gap: 6px; }
.batch-form .batch-field { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px 10px; display: grid; gap: 6px; }
.batch-form .batch-field.on { border-color: var(--primary); }
.batch-form .batch-field > .check-row { padding: 4px 0; }
.batch-form fieldset { border: 0; margin: 0; padding: 0 0 0 24px; display: grid; gap: 8px; min-width: 0; }
.batch-form fieldset:disabled { display: none; }
.batch-form .batch-models { max-height: 200px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.account.disabled > :not(.foot) { opacity: .6; }
.pills { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .icon { width: 13px; height: 13px; flex: none; }
/* account editor drawer */
.dialog header.stacked { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.dialog header.stacked .crumb { grid-column: 1; margin: 0; color: var(--text-3); font-size: 12.5px; }
.dialog header.stacked h3 { grid-column: 1; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog header.stacked button { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.drawer.dialog { width: min(640px, 100%); }
.drawer footer { align-items: center; }
.drawer footer [data-dirty-hint] { margin-right: auto; }
.editor { display: grid; gap: 16px; padding-top: 6px; }
.editor section { display: grid; gap: 6px; }
.section-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--text-3); }
.json-box { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; background: var(--surface-2); color: var(--text-2); resize: vertical; white-space: pre; overflow: auto; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fingerprint { border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 14px; gap: 12px !important; background: var(--surface-2); }
.fingerprint .section-label { display: inline-flex; align-items: center; gap: 4px; }
.fp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fp-row > div { display: grid; gap: 2px; min-width: 0; }
.fp-row small { color: var(--text-3); font-size: 12px; }
.fp-row b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.fingerprint select + input { margin-top: 6px; }
.fingerprint .form-2 { align-items: start; }
.input-btn { display: flex; gap: 8px; align-items: center; min-width: 0; }
.input-btn > input, .input-btn > code { flex: 1; min-width: 0; }
.fp-id { font-family: var(--mono); font-size: 12px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.field-title { font-weight: 600; font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
div.field { display: grid; gap: 6px; }
label.field > span { display: inline-flex; align-items: center; gap: 4px; }
.tip { display: inline-flex; color: var(--text-3); cursor: help; }
.tip .icon { width: 14px; height: 14px; }
.tip:hover, .tip:focus-visible { color: var(--primary-text); }
.editor .setting { padding: 0; border: 0; }
.editor .setting b { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); }
.multi-select { border: 1px solid var(--input-border); border-radius: var(--radius-sm); background: var(--surface); }
.multi-select summary { list-style: none; cursor: pointer; padding: 9px 36px 9px 12px; position: relative; min-height: 40px; }
.multi-select summary::-webkit-details-marker { display: none; }
.multi-select summary::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3); transform: translateY(-70%) rotate(45deg); transition: transform .15s; }
.multi-select[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.multi-select[open] summary { border-bottom: 1px solid var(--border); }
.multi-options { max-height: 240px; overflow: auto; padding: 6px; display: grid; gap: 2px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; cursor: pointer; min-width: 0; }
.check-row:hover { background: var(--hover); }
.check-row input { width: 16px; height: 16px; min-height: 0; flex: none; accent-color: var(--primary); }
.check-row .muted { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alias-table { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.alias-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.alias-row:last-child { border-bottom: 0; }
.alias-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; padding: 0; }
.alias-row input { min-height: 32px; padding: 5px 9px; }
.history-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.history-dots i { width: 8px; height: 14px; border-radius: 3px; background: var(--surface-3); }
.history-dots i.ok { background: var(--success); opacity: .8; }
.history-dots i.err { background: var(--danger); opacity: .85; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }

/* quota bars */
.quota-list { display: grid; gap: 12px; }
.quota-item { display: grid; gap: 6px; }
.quota-item .row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.cooldown-list { display: grid; gap: 10px; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; background: var(--warning-soft, rgba(245, 158, 11, .1)); }
.cooldown-item { display: grid; gap: 4px; }
.cooldown-item .row, .cooldown-list > .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.cooldown-item .row > span:first-child { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.cooldown-item .row svg { width: 15px; height: 15px; color: var(--warning, #d97706); flex: none; }
.cooldown-item .reason { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { width: 100%; height: 8px; display: block; border-radius: 4px; overflow: hidden; }
.bar .track { fill: var(--surface-3); }
.bar .fill { fill: var(--success); }
.bar .fill.mid { fill: var(--warning); }
.bar .fill.low { fill: var(--danger); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .b-ok { fill: var(--primary); opacity: .85; }
.chart .b-err { fill: var(--danger); opacity: .9; }
.chart .b-in { fill: var(--primary); opacity: .8; }
.chart .b-out { fill: var(--primary-2); opacity: .55; }
.chart rect:hover { opacity: 1; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l-ok { background: var(--primary); } .legend .l-err { background: var(--danger); } .legend .l-out { background: var(--primary-2); opacity: .6; }
.rank { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: 13px; }
.rank-row .bar { grid-column: 1 / -1; height: 6px; }
.rank-row .bar .fill { fill: var(--primary); }

/* code/doc blocks */
.code-block { position: relative; }
.code-block .copy { position: absolute; top: 8px; right: 8px; }
.endpoint { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.endpoint:last-child { border-bottom: 0; }
.method { font: 700 11px var(--mono); padding: 2px 7px; border-radius: 6px; background: var(--info-soft); color: var(--info); }
.method.post { background: var(--success-soft); color: var(--success); }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--text); font-size: 13px; align-items: flex-start; }
.callout .icon { color: var(--primary); margin-top: 1px; }
.callout.warning { background: var(--warning-soft); } .callout.warning .icon { color: var(--warning); }
.callout.danger { background: var(--danger-soft); } .callout.danger .icon { color: var(--danger); }
.callout.success { background: var(--success-soft); } .callout.success .icon { color: var(--success); }
.callout p { margin: 0; }
.steps { counter-reset: s; display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); font-weight: 700; font-size: 13px; }
.steps li > div { display: grid; gap: 8px; padding-top: 3px; }

/* setting rows */
.setting-list { display: grid; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; padding: 15px 22px; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting b { font-weight: 600; }
.setting p { margin: 2px 0 0; color: var(--text-3); font-size: 12.5px; }
.setting input[type="number"] { width: 120px; text-align: right; }
.setting select[data-setting], .setting input[type="text"][data-setting], .setting .vselect { width: 280px; max-width: 100%; }
.setting .unit { color: var(--text-3); font-size: 12.5px; margin-left: 6px; }

/* dialog */
.overlay { position: fixed; inset: 0; background: rgba(33, 33, 33, .46); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .15s ease; }
.dialog { width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-dialog); box-shadow: var(--shadow-lg); border: 0; animation: pop .18s ease; }
.dialog.wide { width: min(860px, 100%); }
.dialog.xwide { width: min(1100px, 100%); }
.dialog header { display: flex; align-items: center; gap: 10px; padding: 22px 24px 8px; }
.dialog header h3 { margin: 0; font-size: 18px; font-weight: 600; }
.dialog header button { margin-left: auto; }
.dialog .dialog-body { padding: 8px 24px 18px; overflow-y: auto; display: grid; gap: 14px; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; border-top: 0; background: transparent; border-radius: 0 0 var(--radius-dialog) var(--radius-dialog); }
.dialog footer .btn { border-radius: 9999px; padding: 0 18px; }
.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer { width: min(560px, 100%); height: 100vh; max-height: 100vh; border-radius: var(--radius-dialog) 0 0 var(--radius-dialog); animation: slide .2s ease; }
.drawer footer { border-radius: 0 0 0 var(--radius-dialog); border-top: 1px solid var(--border); padding-top: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

.dot-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex: none; }
.dot-icon .icon { width: 16px; height: 16px; }
.tool-card .row .btn-row { margin-left: auto; }
.dialog .setting { padding: 10px 0; border-bottom: 0; }
details summary { cursor: pointer; padding: 4px 0; }
details pre { margin-top: 8px; }

/* toasts */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 10px; justify-items: center; z-index: 200; pointer-events: none; }
.toast { min-width: 300px; max-width: min(560px, calc(100vw - 28px)); min-height: 52px; display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 8px;
  background: #333; color: #fff; box-shadow: 0 10px 24px rgba(16, 24, 40, 0.16); animation: snack .22s ease; font-size: 14px; font-weight: 600; line-height: 1.35; pointer-events: auto; }
.toast .icon { opacity: .95; }
.toast.success { background: var(--snack-success); } .toast.error { background: #f44336; } .toast.info { background: #2f86bd; }
@keyframes snack { from { opacity: 0; transform: translateY(12px); } }

/* login */
.login { height: 100vh; height: 100dvh; overflow-y: auto; display: grid; place-items: center; padding: 24px; background: var(--chrome); }
.login-card { width: min(420px, 100%); padding: 32px 30px 28px; display: grid; gap: 18px; border: 0; box-shadow: var(--shadow); }
.login-card .brand { padding: 0; }
.login-card h2 { margin: 0; font-size: 20px; }
.login-card p { margin: 0; color: var(--text-2); }

/* playground */
.play-out { min-height: 160px; max-height: 520px; overflow: auto; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.play-out .thought { color: var(--text-3); font-style: italic; }
.play-out img { max-width: 100%; border-radius: 10px; margin: 8px 0; display: block; }
.generated-image { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }

/* misc */
.progress-line { height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.list-plain { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; display: inline-block; vertical-align: bottom; }
.err-text { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 9px; cursor: pointer; font-size: 13px; user-select: none; }
.chip input { margin: 0; }
.chip:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tool-card { padding: 16px 18px; display: grid; gap: 10px; }
.tool-card .row { display: flex; align-items: center; gap: 10px; }
.tool-card b { font-size: 14.5px; }
.tool-card p { margin: 0; color: var(--text-3); font-size: 12.5px; }

@media (max-width: 1180px) {
  .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .form-2 { grid-template-columns: 1fr; }
  .alias-row { grid-template-columns: 1fr auto; }
  .alias-row code { grid-column: 1 / -1; }
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); --sidebar: 260px; }
  .main { margin: 0; border-radius: 0; height: 100vh; height: 100dvh; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 15, 30, .4); z-index: 25; }
  .shell.collapsed .brand div, .shell.collapsed .nav-group > p, .shell.collapsed .nav-link span { display: initial; }
  .shell.collapsed .nav-link { justify-content: flex-start; padding: 0 10px; }
  .shell.collapsed .brand { justify-content: flex-start; padding: 0 8px; }
  .menu-btn { display: inline-flex; }
  .collapse-btn { display: none !important; }
  .topbar { padding: 10px 16px; }
  .content { padding: 4px 14px 30px; }
  .grid-2, .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .account-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar .subtitle { display: none; }
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar h1 { white-space: nowrap; }
  .topbar .actions { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none !important; }
  .setting { grid-template-columns: minmax(0, 1fr); }
  #toasts { left: 14px; right: 14px; transform: none; }
  .toast { max-width: none; min-width: 0; width: 100%; }
}

/* model mapping rows */
.map-rows { display: grid; gap: 8px; }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .map-row { grid-template-columns: minmax(0, 1fr) auto; } .map-row > span { display: none; } }

/* select: an outlined field that opens a v-menu style list (the native select stays as the value source) */
.vselect { position: relative; display: block; width: 100%; min-width: 0; }
.vselect > select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.vselect-btn {
  width: 100%; height: auto; min-height: 40px; justify-content: space-between; gap: 8px; padding: 8px 12px; text-align: left; font-weight: 400;
  background: var(--surface); color: var(--text); border: 1px solid var(--input-border); border-radius: var(--radius-sm);
}
.vselect-btn:hover { background: var(--surface); border-color: color-mix(in srgb, var(--text) 55%, transparent); }
.vselect-btn[aria-expanded="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.vselect-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vselect-btn .icon { width: 18px; height: 18px; color: var(--text-3); transition: transform .15s; }
.vselect-btn[aria-expanded="true"] .icon { transform: rotate(180deg); color: var(--primary); }
.vselect-menu {
  position: fixed; z-index: 300; max-height: min(320px, 50vh); overflow-y: auto; padding: 6px; display: grid; gap: 1px;
  background: var(--surface); border-radius: var(--radius-menu); box-shadow: var(--shadow-menu), 0 0 0 1px var(--border); animation: fade .12s ease;
}
.vselect-option {
  display: block; width: 100%; height: auto; min-height: 38px; padding: 8px 12px; border-radius: 10px; text-align: left; font-weight: 400;
  background: transparent; color: var(--text); white-space: normal; word-break: break-word; justify-content: flex-start;
}
.vselect-option:hover, .vselect-option.focused { background: var(--hover); }
.vselect-option[aria-selected="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.vselect-option:disabled { opacity: .45; }
.vselect-group { padding: 8px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--text-3); text-transform: uppercase; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--primary) 55%, transparent); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--primary) 84%, transparent); }
.setting-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.text-danger { color: var(--danger); }
/* Proxy URLs carry a password: shown as dots until the field is being edited. */
input.masked:not(:focus) { -webkit-text-security: disc; text-security: disc; }
