:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --surface: #131821;
  --surface-2: #191f2a;
  --line: #28303d;
  --text: #edf1f7;
  --muted: #929dad;
  --accent: #7c9cff;
  --accent-2: #9bb1ff;
  --good: #4fc58b;
  --warn: #e7b35b;
  --bad: #ef6b73;
  --shadow: 0 18px 45px rgba(0, 0, 0, .22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 26px; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 17px; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: 10px; font-weight: 700; }
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 15px; border-right: 1px solid var(--line); background: #0f131a; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: 11px; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; color: #0b1020; background: linear-gradient(145deg, #9fb3ff, #657ee8); font-size: 20px; font-weight: 900; box-shadow: 0 10px 28px rgba(92, 120, 225, .25); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
nav { display: grid; gap: 4px; }
nav button { border: 0; padding: 10px 12px; border-radius: 8px; text-align: left; color: var(--muted); background: transparent; cursor: pointer; }
nav button:hover { color: var(--text); background: var(--surface); }
nav button.active { color: #fff; background: #20283a; box-shadow: inset 2px 0 var(--accent); }
.sidebar-footer { margin-top: auto; padding: 16px 9px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); }
.content { min-width: 0; padding: 28px 34px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.icon-button { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; }
.live { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px rgba(231,179,91,.1); }
.dot.online { background: var(--good); box-shadow: 0 0 0 4px rgba(79,197,139,.1); }
.dot.offline { background: var(--bad); }
.page { display: none; }
.page.active { display: block; animation: enter .16s ease-out; }
@keyframes enter { from { opacity: .4; transform: translateY(3px); } }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { padding: 17px 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font-size: 27px; letter-spacing: -.04em; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-head, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.toolbar { margin-bottom: 15px; }
.toolbar p { margin-bottom: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.card-head, .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card .model-list { margin: 15px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); line-height: 1.75; font-family: ui-monospace, monospace; font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; background: #222a35; color: var(--muted); font-size: 11px; white-space: nowrap; }
.status.good { color: var(--good); background: rgba(79,197,139,.1); }
.status.bad { color: var(--bad); background: rgba(239,107,115,.1); }
.status.warn { color: var(--warn); background: rgba(231,179,91,.1); }
.button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface-2); cursor: pointer; }
.button:hover { border-color: #465164; }
.button:disabled { opacity: .45; cursor: wait; }
.button.primary { border-color: #718fec; background: #718fec; color: #0d1321; font-weight: 750; }
.button.danger { border-color: rgba(239,107,115,.55); background: var(--bad); color: #1a090a; font-weight: 700; }
.button.danger.subtle { color: var(--bad); background: rgba(239,107,115,.08); }
.link-button { padding: 0; border: 0; color: var(--accent-2); background: none; cursor: pointer; }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.actions .button { padding: 6px 9px; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.015); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.compact-input, input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; color: var(--text); background: #0e1218; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,156,255,.1); }
textarea { width: 100%; resize: vertical; font-family: ui-monospace, monospace; }
.filters { justify-content: flex-start; }
.logs-view { height: 62vh; overflow: auto; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #090c11; font-family: ui-monospace, monospace; font-size: 12px; line-height: 1.65; }
.log-line { display: grid; grid-template-columns: 150px 72px 160px minmax(300px, 1fr); gap: 10px; padding: 3px 6px; border-bottom: 1px solid rgba(255,255,255,.025); }
.log-line.error { color: #ff9ca2; }
.notice { position: fixed; right: 25px; top: 22px; z-index: 30; max-width: 420px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); box-shadow: var(--shadow); }
.notice.error { border-color: var(--bad); }
dialog { width: min(510px, calc(100vw - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--surface); box-shadow: 0 30px 90px #000; }
dialog::backdrop { background: rgba(3, 5, 8, .76); backdrop-filter: blur(3px); }
dialog:focus { outline: none; }
.dialog-form { display: grid; gap: 15px; padding: 20px; }
.dialog-form.wide { width: min(740px, calc(100vw - 30px)); }
dialog:has(.wide) { width: min(740px, calc(100vw - 30px)); }
.wizard-dialog { width: min(820px, calc(100vw - 30px)); }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-subtitle { margin: 5px 0 0; font-size: 12px; }
.dialog-head button { border: 0; background: none; color: var(--muted); font-size: 23px; cursor: pointer; }
.dialog-actions { justify-content: flex-end; padding-top: 4px; }
.stack, label { display: grid; gap: 7px; }
label { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 13px; }
legend { color: var(--muted); padding: 0 6px; }
.segmented { display: flex; gap: 8px; margin-bottom: 13px; flex-wrap: wrap; }
.segmented label { display: flex; align-items: center; gap: 5px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; }
.scope-field { display: grid; gap: 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice-grid.models { max-height: 250px; overflow-y: auto; padding-right: 3px; }
.choice { display: flex; align-items: flex-start; gap: 9px; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #0e1218; cursor: pointer; }
.choice:hover { border-color: #465164; background: #121821; }
.choice:has(input:checked) { border-color: rgba(124,156,255,.7); background: rgba(124,156,255,.1); }
.choice input { width: 16px; height: 16px; margin: 1px 0 0; padding: 0; accent-color: var(--accent); }
.choice span { min-width: 0; }
.choice strong, .choice small { display: block; overflow: hidden; text-overflow: ellipsis; }
.choice strong { color: var(--text); font-size: 12px; }
.choice small { margin-top: 3px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.choice-all { width: fit-content; min-width: 230px; }
.scope-summary { min-height: 16px; margin: 0; font-size: 11px; }
.wizard-form { min-height: min(690px, calc(100vh - 34px)); grid-template-rows: auto auto minmax(0, 1fr) auto; }
.wizard-form h3 { margin: 0 0 7px; font-size: 18px; }
.wizard-stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 0; padding: 0; list-style: none; }
.wizard-stepper li { display: flex; align-items: center; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 11px; }
.wizard-stepper li span { display: grid; place-items: center; flex: 0 0 23px; height: 23px; border-radius: 50%; background: var(--surface-2); font-weight: 800; }
.wizard-stepper li.active { border-color: var(--accent); color: var(--text); background: rgba(124,156,255,.08); }
.wizard-stepper li.done span { color: #08140e; background: var(--good); }
#account-wizard-body { min-height: 0; overflow-y: auto; padding: 2px; }
.wizard-step { animation: enter .16s ease-out; }
.provider-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.provider-option { position: relative; display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #0e1218; cursor: pointer; }
.provider-option:hover { border-color: #465164; }
.provider-option:has(input:checked) { border-color: var(--accent); background: rgba(124,156,255,.1); }
.provider-option input { position: absolute; top: 14px; right: 14px; width: 17px; height: 17px; accent-color: var(--accent); }
.provider-option strong { padding-right: 25px; }
.provider-meta { display: flex; gap: 7px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.auth-modes { margin: 15px 0; }
.auth-fields { padding-top: 4px; }
.file-drop { min-height: 150px; place-content: center; justify-items: center; padding: 24px; border: 1px dashed #465164; border-radius: 10px; background: #0e1218; cursor: pointer; text-align: center; }
.file-drop.dragging { border-color: var(--accent); background: rgba(124,156,255,.08); }
.file-drop input { width: min(360px, 100%); margin-bottom: 10px; }
.file-drop strong { color: var(--text); }
.file-drop span { color: var(--muted); }
.password-input { display: flex; align-items: center; gap: 9px; }
.password-input input { min-width: 0; flex: 1; }
.form-note { align-self: end; margin: 0; padding: 9px 11px; border-radius: 8px; color: var(--warn); background: rgba(231,179,91,.08); font-size: 11px; }
.advanced-panel { margin-top: 14px; border: 1px solid var(--line); border-radius: 9px; background: #0e1218; }
.advanced-panel summary { padding: 12px 13px; cursor: pointer; color: var(--text); }
.advanced-panel summary span { color: var(--muted); font-size: 11px; }
.advanced-fields { padding: 3px 13px 13px; }
label small { color: var(--muted); font-size: 10px; }
.review-list { display: grid; gap: 0; margin-top: 15px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.review-row { display: grid; grid-template-columns: 155px minmax(0, 1fr); gap: 15px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.review-row:last-child { border-bottom: 0; }
.review-row span:first-child { color: var(--muted); }
.review-row strong { word-break: break-word; }
.notice-inline { margin: 13px 0 0; padding: 10px 12px; border-radius: 8px; color: var(--muted); background: rgba(124,156,255,.07); }
.wizard-actions .action-spacer { flex: 1; }
.wizard-success { place-items: center; align-content: center; min-height: 410px; text-align: center; }
.wizard-success:not([hidden]) { display: grid; }
.success-mark { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 12px; border-radius: 50%; color: #07150e; background: var(--good); font-size: 28px; font-weight: 900; }
.secret-box { overflow: auto; padding: 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent-2); background: #090c11; white-space: pre-wrap; word-break: break-all; }
.form-error { padding: 9px 10px; border-radius: 7px; color: #ffabb0; background: rgba(239,107,115,.1); }
.login-page { display: grid; place-items: center; padding: 25px; background: radial-gradient(circle at 50% 20%, #171d2c, var(--bg) 45%); }
.login-card { width: min(400px, 100%); display: grid; gap: 24px; padding: 30px; border: 1px solid var(--line); border-radius: 15px; background: rgba(19,24,33,.94); box-shadow: 0 30px 90px rgba(0,0,0,.4); }
.empty { padding: 22px; color: var(--muted); text-align: center; }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 20; width: 245px; transform: translateX(-105%); transition: transform .18s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 20px 15px 45px; }
  .icon-button { display: block; }
  .topbar { justify-content: flex-start; gap: 14px; }
  .topbar .live { margin-left: auto; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric { padding: 14px; }
  .metric strong { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .wizard-form { min-height: calc(100vh - 30px); }
  .wizard-stepper { grid-template-columns: repeat(4, minmax(42px, 1fr)); }
  .wizard-stepper li { justify-content: center; padding: 7px 4px; font-size: 0; }
  .wizard-stepper li span { font-size: 11px; }
  .provider-picker { grid-template-columns: 1fr; }
  .review-row { grid-template-columns: 1fr; gap: 4px; }
  .toolbar { align-items: flex-start; flex-wrap: wrap; }
  .log-line { grid-template-columns: 120px 55px minmax(220px, 1fr); }
  .log-line span:nth-child(3) { display: none; }
}
