@font-face {
  font-family: "DINish";
  src: url("/fonts/DINish-variable.woff2") format("woff2-variations");
  font-style: oblique -15deg 0deg;
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --bg: #f1f3ef;
  --panel: #ffffff;
  --panel-soft: #f7f8f5;
  --line: #dfe3dc;
  --line-strong: #c9cec5;
  --text: #17201b;
  --muted: #66706a;
  --navy: #111c2e;
  --navy-soft: #1b2a42;
  --blue: #2457d6;
  --blue-dark: #1945b6;
  --green: #168153;
  --red: #c63838;
  --amber: #b96b09;
  --warning: #a95a00;
  --warning-rgb: 169, 90, 0;
  --yellow: #e4b62c;
  --shadow: 0 10px 30px rgba(18, 32, 25, 0.07);
  --font-numeric: "DINish", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select { letter-spacing: 0; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
.lucide { width: 16px; height: 16px; flex: 0 0 16px; stroke-width: 1.8; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--navy);
  color: #fff;
  overflow: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  background: var(--yellow);
  color: #151a18;
  font: 800 13px/1 "Bahnschrift", "Avenir Next", sans-serif;
}
.brand-name { font-size: 13px; font-weight: 750; }
.brand-sub { margin-top: 2px; color: #8795a8; font-size: 10px; }

.nav { display: grid; gap: 5px; }
.nav-label, .sidebar-label, .panel-kicker, .page-eyebrow, .stat-code {
  color: var(--muted);
  font: 700 10px/1.2 "Bahnschrift", "Avenir Next", sans-serif;
}
.nav-label { padding: 0 10px 8px; color: #68778d; }
.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #aeb9c8;
  text-align: left;
  cursor: pointer;
}
.nav-item > .lucide { color: #71819a; }
.nav-item span { min-width: 0; font-weight: 650; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active {
  border-color: rgba(255,255,255,0.08);
  background: var(--navy-soft);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--yellow);
}
.nav-item.active > .lucide { color: var(--yellow); }

.sidebar-foot {
  margin-top: auto;
  padding: 13px;
  display: grid;
  gap: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  background: rgba(255,255,255,0.035);
}
.sidebar-label { color: #718097; }
.main { min-width: 0; padding: 20px 22px 30px; }
.topbar {
  min-height: 76px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.page-eyebrow { margin-bottom: 6px; color: #7b847e; }
.page-title {
  margin: 0;
  font: 780 24px/1.15 "Avenir Next", "PingFang SC", sans-serif;
}
.page-subtitle { margin-top: 5px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; }

.btn, .input, .icon-btn {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
}
.btn {
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover, .input:focus, .icon-btn:hover {
  border-color: #8ba6e5;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(36,87,214,0.10);
}
.btn-primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.btn-primary:hover { border-color: var(--blue-dark); background: var(--blue-dark); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-tertiary { height: 32px; border-color: transparent; background: transparent; color: var(--blue); }
.btn-danger-subtle { border-color: #edc5c5; background: #fff7f7; color: var(--red); }
.btn-danger-subtle:hover { border-color: #df9d9d; background: #fff0f0; }
.input { width: 100%; padding: 0 10px; }

.control-strip {
  min-height: 58px;
  margin-bottom: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #cfe1d5;
  border-left: 4px solid var(--green);
  border-radius: 5px;
  background: #f3faf6;
}
.control-strip.attention {
  border-color: #ead4ba;
  border-left-color: var(--amber);
  background: #fff9f0;
}
.control-state { display: flex; align-items: center; gap: 11px; }
.control-state strong, .control-state span { display: block; }
.control-state strong { font-size: 13px; }
.control-state span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.control-pulse {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22,129,83,0.12);
}
.control-pulse.attention { background: var(--amber); box-shadow: 0 0 0 4px rgba(185,107,9,0.12); }
.control-meta { color: #77817b; font: 700 10px/1 "Bahnschrift", sans-serif; }

.stats-grid {
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.stat-card {
  position: relative;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  box-shadow: 0 5px 18px rgba(18,32,25,0.04);
}
.stat-code { color: #949c97; }
.stat-label { margin-top: 11px; color: var(--muted); font-size: 11px; }
.stat-value {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font: 800 25px/1 "Bahnschrift", "Avenir Next", sans-serif;
}
.stat-value.ok { color: var(--green); }
.stat-value.bad { color: var(--red); }
.stat-value.verified { color: var(--blue); }

.view { display: none; }
.view.active { display: block; animation: view-in 180ms ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.overview-grid {
  display: grid;
  grid-template-columns: minmax(600px, 1.15fr) minmax(400px, 0.85fr);
  gap: 10px;
  align-items: start;
}
.overview-stack { min-width: 0; display: grid; gap: 10px; }
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel-head {
  min-height: 62px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.panel-kicker { margin-bottom: 5px; color: #8a938d; }
.panel-head h2 { margin: 0; font-size: 15px; line-height: 1.2; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.text-action {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.text-action { display: inline-flex; align-items: center; gap: 5px; }
.text-action .lucide { width: 14px; height: 14px; }
.text-action:hover { color: var(--blue-dark); }
.panel-list, .detail-panel { overflow: hidden; }
.view > .panel, .view > .detail-panel { min-height: min(620px, calc(100vh - 130px)); }
.overview-grid .panel { min-height: 0; }
.panel-list, .detail-panel { display: flex; flex-direction: column; max-height: calc(100vh - 126px); }
.panel-list .table-wrap, .detail-panel #detailPane { overflow: auto; }
.detail-panel #detailPane { flex: 1 1 auto; min-height: 0; }

.toolbar { display: flex; gap: 7px; flex-wrap: wrap; }
.toolbar .input[type="search"] { width: 240px; }
.toolbar select { width: 120px; }
.segmented-control {
  padding: 3px;
  display: inline-flex;
  gap: 2px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-soft);
}
.segment {
  min-width: 76px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.segment:hover { color: var(--text); }
.segment.active { background: var(--navy); color: #fff; }

.table-wrap { min-width: 0; overflow: auto; }
.overview-changes-wrap { max-height: 300px; }
#changes .table-wrap { max-height: calc(100vh - 194px); }
.table { width: 100%; min-width: 840px; border-collapse: collapse; }
.site-table { min-width: 1020px; }
.overview-stack .site-table { min-width: 650px; }
.overview-stack .site-table th:nth-child(7),
.overview-stack .site-table td:nth-child(7) { display: none; }
.overview-stack .action-row .btn:nth-child(n+2) { display: none; }
.change-table { min-width: 760px; }
.table th, .table td {
  padding: 9px 11px;
  border-bottom: 1px solid #e8ebe6;
  text-align: left;
  vertical-align: middle;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f8f5;
  color: #7b847e;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.table td { font-size: 12px; }
.table tbody tr:hover td { background: #fafbf8; }
.table tbody tr.selected td { background: #f2f6ff; }
.empty-table-row td { height: 92px; color: var(--muted); text-align: center; }

.badge, .verification {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.verification .lucide { width: 13px; height: 13px; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok, .verification.ok { border-color: #bfe0cc; background: #eef8f2; color: var(--green); }
.badge.bad, .verification.bad { border-color: #edc5c5; background: #fff2f2; color: var(--red); }
.badge.warn { border-color: #ecd3ae; background: #fff8ec; color: var(--amber); }
.badge.neutral, .verification.neutral { border-color: #d7dcd6; background: #f5f6f4; color: var(--muted); }
.verification.pending { border-color: #cbd7f3; background: #f0f4ff; color: var(--blue); }

.tag-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  display: inline-flex;
  min-height: 22px;
  margin: 1px 3px 1px 0;
  padding: 2px 7px;
  align-items: center;
  border: 1px solid #dbe0da;
  border-radius: 4px;
  background: #f5f6f3;
  color: #5d6761;
  font-size: 10px;
  font-weight: 700;
}
.tag.strong { border-color: #bddfca; background: #eff9f3; color: var(--green); }
.tag.login { border-color: #e5cfaa; background: #fff8ea; color: #8d590e; }
.site-identity { display: grid; gap: 2px; }
.link-cell {
  width: 100%;
  padding: 0;
  display: grid;
  gap: 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.link-cell strong { font-size: 12px; }
.site-domain {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  text-decoration: none;
}
.site-domain span { min-width: 0; word-break: break-all; }
.site-domain .lucide { width: 11px; height: 11px; margin-top: 1px; flex: 0 0 auto; }
.site-domain:hover { color: var(--blue); text-decoration: underline; }
.site-domain:focus-visible { border-radius: 2px; outline: 2px solid var(--blue); outline-offset: 2px; }
.action-row { display: flex; flex-wrap: nowrap; gap: 5px; }
.action-row .btn { height: 30px; padding: 0 8px; font-size: 10px; }
.action-row .lucide { width: 13px; height: 13px; }
.action-row .table-check-btn {
  width: 34px;
  min-width: 34px;
  padding: 0;
}
.action-row .table-check-btn span { display: none; }
.action-row .table-check-btn .lucide { margin: 0; }
.balance-cell { display: grid; gap: 1px; font-variant-numeric: tabular-nums; }
.balance-cell strong { color: var(--text); font-size: 12px; }
.balance-cell span, .balance-empty { color: var(--muted); font-size: 10px; }
.muted { color: var(--muted); }

.cheapest-panel { max-height: calc(100vh - 240px); overflow: auto; }
.cheapest-row {
  min-height: 116px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.cheapest-row:last-child { border-bottom: 0; }
.cheapest-row:hover { background: #fafbf8; }
.cheapest-row.empty { background: #fafaf8; }
.cheapest-row strong, .cheapest-row span, .cheapest-row small { display: block; }
.cheapest-row strong { font-size: 12px; }
.cheapest-row span { margin-top: 4px; font-size: 13px; font-weight: 750; word-break: break-word; }
.cheapest-row small { margin-top: 3px; color: var(--muted); font-size: 10px; word-break: break-word; }
.cheapest-side { min-width: 125px; display: grid; justify-items: end; gap: 8px; }
.cheapest-ratio {
  min-width: 76px;
  padding: 7px 9px;
  border: 1px solid #cdd9f5;
  border-radius: 4px;
  background: #f0f4ff;
  color: var(--blue);
  font: 800 19px/1 "Bahnschrift", sans-serif;
  text-align: center;
}
.cheapest-actions { display: grid; justify-items: end; gap: 6px; }
.api-action-row { display: flex; gap: 6px; }
.api-config-btn { height: 30px; padding: 0 9px; font-size: 10px; }
.api-test-btn { height: 30px; padding: 0 9px; font-size: 10px; }
.api-state { color: var(--muted); font-size: 10px; line-height: 1.3; text-align: right; }
.api-state.ok { color: var(--green); }
.api-state.failed { color: var(--red); }
.api-state.warning { color: var(--amber); }
.model-results { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.model-result {
  min-height: 22px;
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}
.model-result .lucide { width: 11px; height: 11px; }
.model-result.ok { border-color: #bfe0cc; background: #eff9f3; color: var(--green); }
.model-result.bad { border-color: #edc5c5; background: #fff3f3; color: var(--red); }

.detail-empty {
  min-height: 420px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}
.detail-empty strong { color: var(--text); font-size: 15px; }
.detail-box { padding: 16px; display: grid; grid-auto-rows: max-content; align-content: start; gap: 14px; }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.detail-title { font-size: 21px; font-weight: 780; }
.detail-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.detail-meta { min-height: 59px; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.meta-card { min-width: 0; padding: 10px; border-right: 1px solid var(--line); background: var(--panel-soft); }
.meta-card:last-child { border-right: 0; }
.meta-card .k { color: var(--muted); font-size: 10px; }
.meta-card .v { margin-top: 4px; font-size: 12px; font-weight: 750; word-break: break-word; }
.meta-card.wide { grid-column: 1 / -1; }
.mode-note {
  padding: 9px 11px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-left: 3px solid #8ba6e5;
  background: #f3f6fc;
  color: #435064;
}
.mode-note.enabled { border-left-color: var(--amber); background: #fff8ec; color: #754d16; }
.mode-note span { color: var(--muted); font-size: 10px; }
.mode-note strong { font-size: 11px; }
.detail-section { display: grid; gap: 8px; padding-top: 2px; }
.section-title { display: flex; align-items: baseline; gap: 8px; color: #37413b; font-size: 12px; font-weight: 800; }
.section-title span { color: #909992; font: 700 9px/1 "Bahnschrift", sans-serif; }
.provider-list { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.provider-row {
  min-height: 54px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.provider-row:last-child { border-bottom: 0; }
.provider-identity strong, .provider-identity span { display: block; }
.provider-identity span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.provider-models { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.provider-models code { padding: 2px 5px; border-radius: 3px; background: #eef1ed; color: #46514a; font: 600 9px/1.4 "Bahnschrift", monospace; }
.provider-health { min-width: 0; display: grid; gap: 5px; }
.provider-health .model-results { justify-content: flex-start; }
.provider-state { color: var(--muted); font-size: 11px; word-break: break-word; }
.provider-state.ok { color: var(--green); }
.provider-state.failed { color: var(--red); }
.provider-state.warning { color: var(--amber); }
.provider-actions { display: flex; gap: 6px; }
.group-list, .info-list, .history-list { display: grid; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.group-row, .info-row, .history-row { padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fff; }
.group-row:last-child, .info-row:last-child, .history-row:last-child { border-bottom: 0; }
.group-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.group-row strong, .group-row span { display: block; }
.group-row strong { font-size: 12px; }
.group-row span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.group-ratio { color: var(--blue); font: 800 14px/1.4 "Bahnschrift", sans-serif; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.info-row strong, .info-row span { display: block; }
.info-row span { color: var(--muted); font-size: 10px; }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.history-row strong { margin-left: 6px; }
.history-row p { margin: 5px 0 0; color: #3f4943; font-size: 11px; }
.history-row time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.empty-inline { padding: 14px; border: 1px dashed var(--line-strong); border-radius: 5px; background: #fafbf9; color: var(--muted); }
.error-box { padding: 10px 12px; border-left: 3px solid var(--red); background: #fff3f3; color: #8f2d2d; word-break: break-word; }

.notify-form { padding: 12px; display: grid; grid-template-columns: minmax(320px, 0.8fr) minmax(480px, 1.2fr); gap: 10px; }
.form-section { margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-soft); }
.dialog-card > .form-section { margin: 11px 0; border-left: 3px solid #b9c6e7; }
.form-section .field { margin-bottom: 8px; }
.field { display: grid; gap: 5px; margin-bottom: 11px; }
.field > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
input[type="checkbox"] { accent-color: var(--blue); }
.field-help { margin: 0 0 8px; color: var(--muted); font-size: 10px; }
.login-fields { display: grid; gap: 2px; padding-top: 3px; }
.notify-compact-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.notify-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) 94px; gap: 8px 10px; }
.notify-footer { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.notify-footer .field-help { margin-bottom: 5px; }
.notify-status { min-height: 34px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: #4b554f; font-size: 11px; word-break: break-word; }
.notify-status.error { border-color: #edc5c5; background: #fff3f3; color: #8f2d2d; }

.hidden { display: none !important; }
.dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 6px;
  background: transparent;
}
.dialog::backdrop { background: rgba(8,17,28,0.58); backdrop-filter: blur(2px); }
.dialog-card { padding: 17px; border: 1px solid #d9ddd7; border-radius: 6px; background: #fff; box-shadow: 0 24px 70px rgba(8,17,28,0.24); }
.dialog-head { margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head > div { min-width: 0; }
.dialog-head h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.dialog-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 10px; word-break: break-all; }
.icon-btn { width: 34px; padding: 0; display: grid; place-items: center; font-size: 17px; cursor: pointer; }
.dialog-actions { margin-top: 8px; display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.dialog-msg { min-height: 18px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.api-config-dialog { width: min(620px, calc(100vw - 28px)); }
.model-config-field { margin-top: 4px; }
.model-config-head { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.model-config-head > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.model-list { display: grid; gap: 7px; }
.model-input-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 36px; align-items: center; gap: 7px; }
.model-index { color: #8b948e; font: 700 10px/1 "Bahnschrift", monospace; text-align: center; }
.model-remove-btn { width: 36px; }
.model-remove-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.api-test-status { min-height: 40px; margin-top: 3px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-soft); color: var(--muted); font-size: 11px; word-break: break-word; }
.api-test-status.ok { border-color: #bfe0cc; background: #eff9f3; color: #146b46; }
.api-test-status.bad { border-color: #edc5c5; background: #fff3f3; color: #8f2d2d; }
.api-test-status.loading { border-color: #cbd7f3; background: #f1f5ff; color: var(--blue); }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: min(420px, calc(100vw - 32px)); min-height: 44px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--text); box-shadow: 0 16px 40px rgba(8,17,28,0.20); font-size: 12px; }
.toast.ok { border-color: #bfe0cc; color: #146b46; }
.toast.bad { border-color: #edc5c5; color: #8f2d2d; }
[data-lucide="loader-circle"] { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .cheapest-panel { max-height: 430px; }
  .notify-form { grid-template-columns: 1fr; }
  .detail-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .meta-card:nth-child(3n) { border-right: 0; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar {
    position: sticky;
    z-index: 20;
    width: 100%;
    height: auto;
    padding: 9px 12px;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    overflow: visible;
  }
  .brand { padding: 0; flex: 0 0 auto; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .brand-sub { display: none; }
  .nav { min-width: 0; display: flex; gap: 3px; overflow-x: auto; }
  .nav { scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-label, .sidebar-foot { display: none; }
  .nav-item { width: auto; min-height: 44px; padding: 0 10px; flex: 0 0 auto; }
  .nav-item span { display: inline; font-size: 11px; }
  .nav-item.active { box-shadow: inset 0 -2px 0 var(--yellow); }
  .main { padding: 15px; }
  .btn, .icon-btn { min-height: 44px; }
  .input { height: 44px; font-size: 16px; }
  .panel-list, .detail-panel { max-height: none; }
  .view > .panel, .view > .detail-panel { min-height: 0; }
}

@media (max-width: 640px) {
  .sidebar { align-items: stretch; }
  .brand > div:last-child { display: none; }
  .nav-item { padding: 0 9px; font-size: 12px; }
  .main { padding: 11px; }
  .topbar { min-height: 0; margin-bottom: 12px; align-items: flex-end; }
  .page-title { font-size: 20px; }
  .page-subtitle { display: none; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .btn { padding: 0 9px; }
  .control-strip { align-items: flex-start; }
  .control-meta { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 82px; }
  .panel-head { align-items: flex-start; }
  .segmented-control { width: 100%; }
  .segment { min-width: 0; flex: 1; }
  .overview-grid > .panel > .panel-head { flex-direction: column; }
  .toolbar { width: 100%; }
  .toolbar .input[type="search"], .toolbar select { width: 100%; }
  .cheapest-row { align-items: start; }
  .cheapest-side { min-width: 108px; }
  .detail-title-row { display: grid; }
  .detail-actions { justify-content: flex-start; }
  .detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta-card, .meta-card:nth-child(3n) { border-right: 1px solid var(--line); }
  .meta-card:nth-child(2n) { border-right: 0; }
  .provider-row { grid-template-columns: 1fr; align-items: start; }
  .provider-actions { width: 100%; }
  .provider-actions .btn { flex: 1; }
  .notify-grid, .notify-footer { grid-template-columns: 1fr; }
  .notify-compact-head { grid-template-columns: 1fr; }
  .dialog-card { padding: 14px; }
  .model-input-row { grid-template-columns: 24px minmax(0, 1fr) 44px; }
  .toast-region { right: 12px; bottom: 12px; }
}

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

/* Warm minimal workspace theme inspired by the supplied dashboard reference. */
:root {
  --bg: #e9e8e6;
  --panel: #ffffff;
  --panel-soft: #f5f5f3;
  --line: #ebeae7;
  --line-strong: #deddd9;
  --text: #171714;
  --muted: #706f6a;
  --navy: #1c1c18;
  --navy-soft: #292923;
  --blue: #e84d27;
  --blue-dark: #c93c1c;
  --green: #21845b;
  --red: #c9403c;
  --amber: #bd6b17;
  --warning: #b83a1f;
  --warning-rgb: 184, 58, 31;
  --yellow: #ff633d;
  --shadow: 0 12px 32px rgba(40, 37, 31, 0.055);
}

body {
  min-width: 320px;
  padding: clamp(14px, 3.2vw, 52px);
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app-shell {
  width: min(1500px, 100%);
  min-height: calc(100vh - clamp(28px, 6.4vw, 104px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 20px;
  background: #fafaf9;
  box-shadow: 0 28px 80px rgba(42, 39, 32, 0.08);
}

.sidebar {
  position: relative;
  top: auto;
  width: auto;
  height: auto;
  min-height: 76px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 18px;
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--text);
}

.brand { padding: 0; gap: 10px; }
.brand-mark {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--yellow);
  color: #fff;
  box-shadow: inset 0 -5px 10px rgba(150, 37, 12, 0.14);
}
.brand-name { color: var(--text); font-size: 13px; font-weight: 750; }
.brand-sub { color: #9b9993; font-size: 9px; }

.nav {
  padding: 5px;
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid #f0efec;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(46, 42, 35, 0.035);
}
.nav-label { display: none; }
.nav-item {
  width: auto;
  min-height: 34px;
  padding: 0 14px;
  gap: 7px;
  border: 0;
  border-radius: 999px;
  color: #65635e;
  white-space: nowrap;
}
.nav-item > .lucide { width: 14px; height: 14px; color: #8c8982; }
.nav-item span { font-size: 11px; font-weight: 600; }
.nav-item:hover { background: #f3f3f1; color: var(--text); }
.nav-item.active {
  border: 0;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 5px 14px rgba(28, 28, 24, 0.17);
}
.nav-item.active > .lucide { color: #fff; }

.sidebar-foot {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border: 0;
  background: transparent;
}
.sidebar-foot > .community-meta {
  min-height: 40px;
  padding: 5px 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
.sidebar-label { color: #96938d; font-size: 9px; }
.community-meta { white-space: nowrap; }
.community-meta span { color: #77746e; font-size: 11px; font-weight: 600; }
.community-meta strong {
  color: var(--text);
  font: 700 13px/1 "DINish", "Bahnschrift", sans-serif;
  font-variant-numeric: tabular-nums;
}
.community-meta:hover { border-color: #bdb9b0; background: #f7f6f3; }
.community-meta:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.main { min-width: 0; padding: 24px clamp(18px, 2.4vw, 36px) 34px; }
.topbar { min-height: 82px; margin-bottom: 18px; align-items: flex-start; }
.page-eyebrow { display: none; }
.page-title { font-size: 30px; font-weight: 680; letter-spacing: 0; }
.page-subtitle { margin-top: 6px; color: #77756f; font-size: 13px; }
.topbar-actions { padding-top: 2px; }

.btn, .input, .icon-btn {
  height: 40px;
  border-color: var(--line-strong);
  border-radius: 999px;
  background: #fff;
}
.btn { padding: 0 15px; font-size: 12px; font-weight: 650; }
.btn:hover, .input:focus, .icon-btn:hover {
  border-color: #f0a18c;
  box-shadow: 0 0 0 3px rgba(232, 77, 39, 0.10);
}
.btn-primary { border-color: var(--navy); background: var(--navy); color: #fff; }
.btn-primary:hover { border-color: #32322c; background: #32322c; }
.btn-tertiary { border-color: transparent; background: transparent; color: var(--blue); }
.btn-danger-subtle { border-color: #f0d1cb; background: #fff8f6; }
.input { padding: 0 14px; }
select.input { padding-right: 32px; }

.control-strip {
  min-height: 58px;
  margin-bottom: 14px;
  padding: 10px 16px;
  border: 1px solid #e1eee6;
  border-left: 1px solid #e1eee6;
  border-radius: 8px;
  background: #f4faf6;
}
.control-strip.attention {
  border-color: #f3d8cb;
  border-left-color: #f3d8cb;
  background: #fff7f3;
}
.control-state strong { font-size: 12px; }
.control-pulse { width: 8px; height: 8px; flex-basis: 8px; box-shadow: 0 0 0 5px rgba(33,132,91,0.10); }
.control-pulse.attention { background: var(--yellow); box-shadow: 0 0 0 5px rgba(255,99,61,0.11); }
.control-meta { color: #9b9892; }

.stats-grid { margin-bottom: 14px; gap: 10px; }
.stat-card {
  min-height: 104px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0,0,0,0.025);
}
.stat-card.attention {
  border-color: rgba(var(--warning-rgb), 0.22);
  background: rgba(var(--warning-rgb), 0.10);
  color: var(--warning);
  box-shadow: none;
}
.stat-card.attention::after { background: rgba(var(--warning-rgb), 0.05); }
.stat-card.attention .stat-code,
.stat-card.attention .stat-label,
.stat-card.attention .stat-value { color: var(--warning); }
.stat-code { color: #a09d96; font-size: 9px; }
.stat-label { color: #67655f; font-size: 11px; }
.stat-value { right: 14px; bottom: 13px; font-size: 27px; font-weight: 700; }
.stat-value.ok, .stat-value.bad, .stat-value.verified { color: var(--text); }

.view > .status-monitor-panel {
  min-height: 0;
  height: auto;
  margin-bottom: 14px;
  overflow: hidden;
}
.status-monitor-head {
  min-height: 64px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.status-monitor-head h2 { margin: 0; font-size: 15px; font-weight: 680; }
.status-monitor-meta {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f2ef;
  color: #77746d;
  font-size: 10px;
  white-space: nowrap;
}
.status-site-tabs {
  min-width: 0;
  padding: 10px 16px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fafaf9;
  scrollbar-width: thin;
}
.status-site-tab {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: #64615b;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.status-site-tab:hover { border-color: #f0a18c; background: #fff8f5; color: var(--text); }
.status-site-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.status-site-tab.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.status-monitor-body { padding: 16px; }
.status-monitor-loading, .status-monitor-empty {
  min-height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.status-overall {
  min-height: 62px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid #d9ece1;
  border-radius: 8px;
  background: #f4faf6;
}
.status-overall.warning { border-color: #f0dfc2; background: #fff9ef; }
.status-overall.failed { border-color: #f0d1cb; background: #fff5f2; }
.status-overall.paused, .status-overall.unknown { border-color: var(--line); background: #f7f7f5; }
.status-overall-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e2f3e9;
  color: var(--green);
}
.status-overall.warning .status-overall-icon { background: #f8ead1; color: var(--amber); }
.status-overall.failed .status-overall-icon { background: #f8ded9; color: var(--red); }
.status-overall.paused .status-overall-icon,
.status-overall.unknown .status-overall-icon { background: #e9e8e5; color: var(--muted); }
.status-overall strong, .status-overall span { display: block; }
.status-overall > div:nth-child(2) > strong { font-size: 13px; }
.status-overall > div:nth-child(2) > span { margin-top: 2px; color: var(--muted); font-size: 10px; word-break: break-all; }
.status-uptime { padding-left: 14px; border-left: 1px solid rgba(36,73,54,0.12); text-align: right; }
.status-uptime strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.status-uptime span { color: var(--muted); font-size: 9px; }
.status-component-row {
  padding: 14px 2px 5px;
  display: grid;
  grid-template-columns: 170px minmax(180px, 1fr) 120px;
  align-items: center;
  gap: 14px;
}
.status-component-name strong, .status-component-name span { display: block; }
.status-component-name strong { font-size: 11px; }
.status-component-name span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.status-timeline {
  height: 32px;
  display: grid;
  grid-template-columns: repeat(var(--status-points), minmax(3px, 1fr));
  align-items: stretch;
  gap: 3px;
}
.status-point { min-width: 3px; border-radius: 3px; background: #42b87d; }
.status-point.failed { background: #e5665f; }
.status-point.empty { background: #dfdedb; }
.status-current {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}
.status-current i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-current.warning { color: var(--amber); }
.status-current.failed { color: var(--red); }
.status-current.paused, .status-current.unknown { color: var(--muted); }
.status-monitor-foot {
  margin-left: 186px;
  padding-right: 134px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #a09d96;
  font-size: 8px;
}
.status-model-monitor {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.status-model-head {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 9px;
}
.status-model-head > div { display: flex; align-items: baseline; gap: 7px; }
.status-model-head strong { color: var(--text); font-size: 11px; }
.status-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px; }
.status-model-item {
  min-width: 0;
  min-height: 52px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf9;
}
.status-model-state {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e5f4eb;
  color: var(--green);
}
.status-model-item.failed .status-model-state { background: #fae5e1; color: var(--red); }
.status-model-item.pending .status-model-state { background: #ecebe8; color: var(--muted); }
.status-model-state .lucide { width: 14px; height: 14px; }
.status-model-name, .status-model-result { min-width: 0; display: grid; gap: 1px; }
.status-model-name strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.status-model-name span, .status-model-result span { color: var(--muted); font-size: 8px; }
.status-model-result { text-align: right; }
.status-model-result strong { font-size: 10px; font-variant-numeric: tabular-nums; }
.status-model-item.ok .status-model-result strong { color: var(--green); }
.status-model-item.failed .status-model-result strong { color: var(--red); }
.status-model-empty { padding: 10px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-size: 10px; }

.overview-grid { grid-template-columns: minmax(600px, 1.18fr) minmax(360px, 0.82fr); gap: 14px; }
.overview-stack { gap: 14px; }
.panel {
  border-color: var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}
.panel-head { min-height: 66px; padding: 14px 16px; border-color: var(--line); }
.panel-kicker { margin-bottom: 4px; color: #aaa69f; font-size: 9px; }
.panel-head h2 { font-size: 15px; font-weight: 680; }
.text-action { color: var(--text); font-size: 11px; font-weight: 650; }
.text-action:hover { color: var(--blue); }

.segmented-control {
  padding: 4px;
  border-color: var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
}
.segment { height: 30px; border-radius: 999px; font-weight: 650; }
.segment.active { background: var(--navy); color: #fff; box-shadow: 0 3px 9px rgba(28,28,24,0.12); }

.table th, .table td { padding: 10px 12px; border-color: #efeeeb; }
.table th {
  background: #f7f7f5;
  color: #94918a;
  font-size: 9px;
  font-weight: 700;
}
.table td { font-size: 11px; }
.table tbody tr:hover td { background: #fbf7f5; }
.table tbody tr.selected td { background: #fff4ef; }
.link-cell strong { font-size: 12px; }
.site-domain { color: #908d86; }
.site-domain:hover { color: var(--blue); }

.badge, .verification { min-height: 24px; border-radius: 999px; font-size: 10px; }
.tag { border-radius: 999px; }
.tag.login { border-color: #f0d6c6; background: #fff7f1; color: #9b5527; }
.action-row .btn, .api-config-btn, .api-test-btn { border-radius: 999px; }
.balance-cell strong { font-size: 12px; }

.cheapest-panel { padding: 8px; }
.cheapest-row {
  min-height: 118px;
  margin-bottom: 7px;
  padding: 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f7f5;
}
.cheapest-row:last-child { margin-bottom: 0; }
.cheapest-row:hover { border-color: #f1d7cd; background: #fff8f5; }
.cheapest-ratio {
  border-color: #ffd0c3;
  border-radius: 8px;
  background: #fff0ea;
  color: var(--blue);
}
.model-result { border-radius: 999px; background: #fff; }

.detail-site-switcher {
  min-width: 0;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #fafaf9;
}
.detail-switcher-label {
  min-width: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}
.detail-switcher-label span { display: inline-flex; align-items: center; gap: 6px; }
.detail-switcher-label .lucide { width: 13px; height: 13px; }
.detail-switcher-label strong {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #efeeeb;
  color: var(--text);
  font-size: 11px;
}
.detail-site-tabs {
  min-width: 0;
  padding: 1px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.detail-site-tab {
  min-width: 148px;
  min-height: 48px;
  padding: 7px 11px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}
.detail-site-tab:hover { border-color: #f0a18c; background: #fff8f5; }
.detail-site-tab:active { transform: scale(0.98); }
.detail-site-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.detail-site-tab > span { min-width: 0; display: grid; gap: 1px; }
.detail-site-tab strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.detail-site-tab small { color: #99968f; font-size: 9px; }
.detail-site-tab > .lucide { width: 13px; height: 13px; }
.detail-site-tab.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 14px rgba(28,28,24,0.14);
}
.detail-site-tab.active small { color: #bbb8b1; }
.site-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #aaa; }
.site-status-dot.ok { background: #49bd87; }
.site-status-dot.bad { background: #ef6b64; }
.site-status-dot.warn { background: #e0a249; }
.detail-site-switcher-empty { padding: 6px 0; color: var(--muted); font-size: 11px; }

.view[data-view="detail"] .detail-panel {
  height: clamp(460px, calc(100dvh - 280px), 860px);
  min-height: 0;
  max-height: none;
  overflow: hidden;
}
.detail-box { padding: 18px; }
.detail-title { font-size: 22px; }
.detail-meta, .provider-list, .group-list, .info-list, .history-list { border-radius: 8px; }
.meta-card { background: #f7f7f5; }
.mode-note { border-left: 0; border-radius: 8px; }
.provider-row, .group-row, .info-row, .history-row { border-color: var(--line); }
.provider-models code { border-radius: 999px; background: #f1f0ed; }
.group-ratio { color: var(--blue); }

.notify-form { gap: 14px; padding: 16px; }
.form-section { border-color: var(--line); border-radius: 8px; background: #f7f7f5; }
.dialog-card > .form-section { border-left: 1px solid var(--line); }
.field > span { color: #696761; }
input[type="checkbox"] { accent-color: var(--blue); }

.dialog { border-radius: 12px; }
.dialog::backdrop { background: rgba(29, 27, 23, 0.34); backdrop-filter: blur(5px); }
.dialog-card {
  padding: 20px;
  border-color: rgba(255,255,255,0.9);
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(38,34,28,0.22);
}
.dialog-head h3 { font-size: 18px; }
.icon-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
  flex: 0 0 40px;
  aspect-ratio: 1;
  border-radius: 50%;
}
.model-remove-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 50%;
}
.api-test-status, .notify-status { border-radius: 8px; }
.toast { border-radius: 8px; }

@media (max-width: 1180px) {
  body { padding: 18px; }
  .app-shell { min-height: calc(100vh - 36px); }
  .sidebar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .brand > div:last-child, .sidebar-foot > .community-meta { display: none; }
  .nav { justify-self: center; }
  .nav-item { padding: 0 11px; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  body { padding: 0; }
  .app-shell { min-height: 100dvh; border: 0; border-radius: 0; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    min-height: 66px;
    padding: 10px 14px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    overflow: visible;
    border-bottom: 1px solid var(--line);
    background: rgba(250,250,249,0.94);
    backdrop-filter: blur(12px);
  }
  .brand { flex: 0 0 auto; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .nav {
    min-width: 0;
    padding: 3px;
    flex: 1;
    justify-content: flex-start;
    overflow-x: auto;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .nav-item { min-height: 40px; padding: 0 11px; }
  .nav-item.active { box-shadow: 0 4px 10px rgba(28,28,24,0.14); }
  .sidebar-foot { display: none; }
  .main { padding: 20px 16px 28px; }
  .btn, .icon-btn { min-height: 44px; }
  .icon-btn, .model-remove-btn { width: 44px; min-width: 44px; flex-basis: 44px; }
  .input { height: 44px; font-size: 16px; }
}

@media (max-width: 640px) {
  .sidebar { align-items: center; }
  .nav-item { min-width: 42px; justify-content: center; padding: 0 10px; }
  .nav-item span { display: none; }
  .main { padding: 18px 12px 24px; }
  .topbar { min-height: 76px; align-items: flex-start; }
  .page-title { font-size: 24px; }
  .topbar-actions .btn { width: 44px; padding: 0; }
  .topbar-actions .btn > .lucide { margin: 0; }
  .topbar-actions .btn { font-size: 0; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 92px; }
  .status-monitor-head { align-items: flex-start; }
  .status-monitor-meta { white-space: normal; text-align: right; }
  .status-site-tabs { padding: 9px 12px; }
  .status-monitor-body { padding: 12px; }
  .status-overall { grid-template-columns: 34px minmax(0, 1fr); }
  .status-overall-icon { width: 34px; height: 34px; }
  .status-uptime { grid-column: 1 / -1; padding: 8px 0 0; display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid rgba(36,73,54,0.10); border-left: 0; text-align: left; }
  .status-component-row { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .status-timeline { grid-column: 1 / -1; grid-row: 2; height: 28px; gap: 2px; }
  .status-monitor-foot { margin-left: 0; padding-right: 0; }
  .status-model-head { align-items: flex-start; }
  .status-model-head > span { max-width: 140px; text-align: right; }
  .status-model-grid { grid-template-columns: 1fr; }
  .panel-head { padding: 13px 14px; }
  .detail-site-switcher { padding: 10px 12px; display: grid; gap: 8px; }
  .detail-switcher-label { width: 100%; }
  .detail-site-tab { min-width: 136px; min-height: 48px; }
  .cheapest-panel { padding: 6px; }
  .cheapest-row { padding: 12px; }
  .dialog-card { padding: 16px; }
}

/* Full-width operations layout and compact multi-site status matrix. */
body { padding: 0; background: #fafaf9; }
.app-shell {
  width: 100%;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  background: #fafaf9;
  box-shadow: none;
  overflow: visible;
}
.sidebar {
  min-height: 62px;
  padding: 9px clamp(16px, 2vw, 30px);
  border-bottom: 1px solid var(--line);
  background: rgba(250,250,249,0.96);
}
.main { padding: 14px clamp(16px, 2vw, 30px) 24px; }
.topbar { min-height: 58px; margin-bottom: 9px; align-items: center; }
.page-title { font-size: 24px; }
.page-subtitle { margin-top: 3px; font-size: 11px; }
.primary-site-monitor {
  min-width: 0;
  min-height: 106px;
  margin-bottom: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) 88px minmax(220px, 1.15fr) minmax(190px, 1.35fr) minmax(220px, 1.2fr) 36px;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid #cfe4d8;
  border-radius: 8px;
  background: #f7fbf8;
}
.primary-site-monitor.configured {
  grid-template-columns: minmax(170px, 0.9fr) 88px minmax(220px, 1.15fr) minmax(190px, 1.3fr) minmax(230px, 1.25fr) 36px;
}
.primary-site-monitor.empty { min-height: 92px; background: #fff; border-color: var(--line); }
.personal-site-empty-state {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.personal-site-empty-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f7f7f5;
  color: var(--muted);
}
.personal-site-empty-icon .lucide { width: 17px; height: 17px; }
.personal-site-empty-state > div { min-width: 0; }
.personal-site-empty-state > div strong, .personal-site-empty-state > div span { display: block; }
.personal-site-empty-state strong { font-size: 12px; }
.personal-site-empty-state > div > span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.personal-site-empty-state > .btn { justify-self: end; position: relative; z-index: 1; }
.primary-site-monitor.warning { border-color: #ead8b8; background: #fffaf1; }
.primary-site-monitor.failed { border-color: #efc6bf; background: #fff8f6; }
.primary-site-monitor.paused, .primary-site-monitor.unknown { border-color: var(--line); background: #fff; }
.primary-site-loading, .primary-site-empty {
  grid-column: 1 / -1;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.primary-site-loading .lucide { width: 16px; height: 16px; animation: spin 1s linear infinite; }
.primary-site-identity { min-width: 0; }
.primary-site-kicker { display: block; margin-bottom: 6px; color: #8d8a83; font-size: 8px; font-weight: 720; }
.primary-site-title-row { min-width: 0; display: flex; align-items: center; gap: 7px; }
.primary-site-title-row strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.primary-site-state-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(33,132,91,0.10); }
.primary-site-monitor.warning .primary-site-state-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(224,162,73,0.12); }
.primary-site-monitor.failed .primary-site-state-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(229,102,95,0.12); }
.primary-site-monitor.paused .primary-site-state-dot, .primary-site-monitor.unknown .primary-site-state-dot { background: #aaa69f; box-shadow: 0 0 0 4px rgba(170,166,159,0.12); }
.primary-site-status { flex: 0 0 auto; color: var(--green); font-size: 9px; }
.primary-site-monitor.warning .primary-site-status { color: var(--amber); }
.primary-site-monitor.failed .primary-site-status { color: var(--red); }
.primary-site-monitor.paused .primary-site-status, .primary-site-monitor.unknown .primary-site-status { color: var(--muted); }
.primary-site-identity > a {
  max-width: 100%;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.primary-site-identity > a:hover { color: var(--blue); }
.primary-site-identity > a .lucide { width: 11px; height: 11px; flex: 0 0 11px; }
.primary-site-uptime { padding-left: 12px; border-left: 1px solid rgba(45,115,78,0.14); }
.primary-site-uptime span, .primary-site-uptime strong { display: block; }
.primary-site-uptime span { margin-bottom: 4px; color: var(--muted); font-size: 8px; }
.primary-site-uptime strong { font-size: 22px; line-height: 1; }
.primary-site-metrics { min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid rgba(42,80,59,0.12); border-radius: 6px; background: rgba(255,255,255,0.66); overflow: hidden; }
.primary-site-metrics > span { min-width: 0; padding: 8px; display: grid; gap: 3px; border-right: 1px solid rgba(42,80,59,0.10); }
.primary-site-metrics > span:last-child { border-right: 0; }
.primary-site-metrics small { color: #96938c; font-size: 7px; white-space: nowrap; }
.primary-site-metrics strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.primary-site-chart-wrap { min-width: 0; }
.primary-site-chart-label, .primary-site-models-head { margin-bottom: 6px; display: flex; justify-content: space-between; color: #8f8c85; font-size: 8px; }
.primary-site-chart-wrap .status-column-chart { height: 34px; }
.primary-site-models { min-width: 0; }
.primary-site-models .status-card-model-list { max-height: 52px; overflow-y: auto; scrollbar-width: thin; }
.primary-model-actions { display: inline-flex; align-items: center; gap: 4px; }
.primary-model-actions button {
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.primary-model-actions button:hover { color: var(--text); border-color: #bbb8b1; }
.primary-model-actions .lucide { width: 11px; height: 11px; }
.personal-api-section { display: grid; gap: 10px; }
.personal-api-section-head strong, .personal-api-section-head span { display: block; }
.personal-api-section-head strong { font-size: 12px; }
.personal-api-section-head span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.personal-api-provider-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.personal-api-provider-actions .btn { width: 100%; }
.primary-site-detail {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.primary-site-detail:hover { border-color: #bbb8b1; background: #f4f3f0; }
.primary-site-detail .lucide { width: 15px; height: 15px; }
.stats-grid { margin-bottom: 8px; gap: 7px; }
.stat-card { min-height: 76px; padding: 10px 12px; }
.stat-code { font-size: 8px; }
.stat-label { font-size: 10px; }
.stat-value { right: 12px; bottom: 9px; font-size: 23px; }

.view > .status-monitor-panel { margin-bottom: 9px; }
.status-monitor-head { min-height: 48px; padding: 9px 12px; }
.status-monitor-head h2 { font-size: 14px; }
.status-monitor-meta { padding: 5px 9px; font-size: 9px; }
.status-monitor-body {
  min-height: 0;
  padding: 9px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--line);
}
.status-monitor-loading, .status-monitor-empty { min-height: 210px; grid-column: 1 / -1; }
.status-site-column {
  min-width: 0;
  height: 226px;
  padding: 11px;
  display: grid;
  grid-template-rows: auto auto 28px auto minmax(0, 1fr);
  gap: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.status-site-column.warning { border-color: #eed8b4; background: #fffdf8; }
.status-site-column.failed { border-color: #efc9c2; background: #fffaf8; }
.status-site-column-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.status-site-column-head > div:first-child { min-width: 0; }
.status-site-column-head button {
  max-width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.status-site-column-head button:hover { color: var(--blue); }
.status-site-column-head button .lucide { width: 13px; height: 13px; }
.status-site-column-head > div:first-child > span { display: block; margin-top: 1px; color: var(--muted); font-size: 8px; }
.status-column-uptime { flex: 0 0 auto; text-align: right; }
.status-column-uptime strong, .status-column-uptime span { display: block; }
.status-column-uptime strong { font-size: 18px; line-height: 1; font-variant-numeric: tabular-nums; }
.status-column-uptime span { margin-top: 3px; color: var(--green); font-size: 8px; }
.status-site-column.warning .status-column-uptime span { color: var(--amber); }
.status-site-column.failed .status-column-uptime span { color: var(--red); }
.status-column-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.status-column-metrics > span { min-width: 0; padding: 5px 6px; display: grid; gap: 1px; border-right: 1px solid var(--line); }
.status-column-metrics > span:last-child { border-right: 0; }
.status-column-metrics small { color: #96938c; font-size: 7px; white-space: nowrap; }
.status-column-metrics strong { overflow: hidden; font-size: 9px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.status-column-chart {
  min-width: 0;
  height: 28px;
  display: grid;
  grid-template-columns: repeat(var(--status-points), minmax(2px, 1fr));
  align-items: stretch;
  gap: 2px;
}
.status-column-chart .status-point { min-width: 2px; border-radius: 2px; transition: transform 150ms ease, filter 150ms ease; }
.status-column-chart .status-point:hover { z-index: 1; filter: saturate(1.25); transform: scaleY(1.16); transform-origin: bottom; }
.status-column-chart-label { margin-top: -5px; display: flex; justify-content: space-between; color: #aaa69f; font-size: 7px; }
.status-column-models { min-height: 0; padding-top: 6px; overflow-y: auto; border-top: 1px solid var(--line); scrollbar-width: thin; }
.status-column-models-head { margin-bottom: 3px; display: flex; justify-content: space-between; color: #8f8c85; font-size: 8px; }
.status-card-model-list { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.status-card-model {
  min-width: 0;
  min-height: 24px;
  padding: 3px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fafaf9;
  color: var(--muted);
  font-size: 8px;
}
.status-card-model i { width: 6px; height: 6px; border-radius: 50%; background: #aaa; }
.status-card-model.ok i { background: #42b87d; }
.status-card-model.failed i { background: #e5665f; }
.status-card-model strong { overflow: hidden; max-width: 120px; color: var(--text); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.status-card-model span::before, .status-card-model b::before { content: "·"; margin-right: 5px; color: #aaa69f; }
.status-card-model b { color: var(--text); font-size: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-card-model.ok b { color: var(--green); }
.status-card-model.failed b { color: var(--red); }
.status-card-model-empty { padding: 8px 0; color: var(--muted); font-size: 8px; }

.overview-grid { gap: 9px; }
.overview-stack { gap: 9px; }
.panel-head { min-height: 54px; padding: 10px 12px; }

/* Compact price comparison rows: identity, price, API health, actions. */
.cheapest-panel { max-height: 520px; padding: 6px; }
.cheapest-row {
  min-height: 78px;
  margin-bottom: 5px;
  padding: 10px 11px;
  grid-template-columns: minmax(120px, 1fr) 68px minmax(120px, 0.9fr) auto;
  align-items: center;
  gap: 10px;
}
.cheapest-main { min-width: 0; }
.cheapest-row .cheapest-main strong { font-size: 11px; }
.cheapest-row .cheapest-main span {
  margin-top: 3px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cheapest-row .cheapest-main small {
  margin-top: 2px;
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cheapest-ratio { min-width: 64px; padding: 8px 7px; font-size: 17px; }
.cheapest-health { min-width: 0; display: grid; justify-items: start; gap: 5px; }
.cheapest-health .api-state { width: 100%; overflow: hidden; font-size: 8px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.cheapest-health .model-results { max-width: 100%; justify-content: flex-start; flex-wrap: nowrap; overflow: hidden; }
.cheapest-health .model-result { min-height: 20px; padding: 2px 5px; font-size: 8px; white-space: nowrap; }
.cheapest-row > .api-action-row { flex-wrap: nowrap; align-items: center; }
.cheapest-row > .api-action-row .btn { width: 34px; height: 34px; min-height: 34px; padding: 0; justify-content: center; font-size: 0; }
.cheapest-row > .api-action-row .btn .lucide { margin: 0; }
.cheapest-row > .api-action-row .btn span { display: none; }

@media (max-width: 700px) {
  .cheapest-row {
    grid-template-columns: minmax(0, 1fr) 68px;
    align-items: center;
  }
  .cheapest-health { grid-column: 1; }
  .cheapest-row > .api-action-row { grid-column: 2; grid-row: 2; justify-self: end; }
  .cheapest-row .cheapest-main span, .cheapest-row .cheapest-main small { white-space: normal; }
}

@media (max-width: 1100px) {
  .primary-site-monitor {
    grid-template-columns: minmax(180px, 1fr) 90px minmax(250px, 1.4fr) 36px;
  }
  .primary-site-monitor.configured { grid-template-columns: minmax(180px, 1fr) 90px minmax(250px, 1.4fr) 36px; }
  .primary-site-chart-wrap { grid-column: 1 / 3; }
  .primary-site-monitor.configured .primary-site-detail { grid-column: 4; grid-row: 1; }
  .primary-site-models { grid-column: 3 / 5; }
  .status-monitor-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .main { padding: 12px 14px 22px; }
  .topbar { min-height: 64px; }
  .status-monitor-body { grid-template-columns: 1fr; }
  .status-site-column { height: 218px; }
}

@media (max-width: 640px) {
  .main { padding: 12px 10px 20px; }
  .topbar { min-height: 66px; }
  .primary-site-monitor {
    min-height: 0;
    padding: 11px;
    grid-template-columns: minmax(0, 1fr) 74px 36px;
    align-items: start;
    gap: 10px;
  }
  .primary-site-monitor.configured { grid-template-columns: minmax(0, 1fr) 74px 36px; }
  .personal-site-empty-state { grid-template-columns: 36px minmax(0, 1fr); }
  .personal-site-empty-icon { width: 36px; height: 36px; }
  .personal-site-empty-state .btn { grid-column: 1 / -1; width: 100%; }
  .primary-site-uptime { padding-left: 8px; }
  .primary-site-uptime strong { font-size: 19px; }
  .primary-site-detail, .primary-site-monitor.configured .primary-site-detail { grid-column: 3; grid-row: 1; justify-self: end; }
  .primary-site-metrics { grid-column: 1 / -1; width: 100%; }
  .primary-site-chart-wrap { grid-column: 1 / -1; width: 100%; }
  .primary-site-models { grid-column: 1 / -1; width: 100%; }
  .primary-site-models .status-card-model-list { max-height: none; }
  .stats-grid { gap: 6px; }
  .stat-card { min-height: 72px; }
  .status-monitor-head { min-height: 46px; }
  .status-monitor-body { padding: 7px; }
}

.notify-form { grid-template-columns: repeat(2, minmax(320px, 1fr)); }
.notify-rules-section, .notify-save-bar { grid-column: 1 / -1; }
.notify-event-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.notify-event-item {
  min-height: 58px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.notify-event-item > span { min-width: 0; display: grid; gap: 2px; }
.notify-event-item strong { font-size: 11px; }
.notify-event-item small { color: var(--muted); font-size: 8px; }
.balance-event-item { display: grid; grid-template-columns: minmax(0, 1fr) auto 86px; }
.compact-number { height: 34px; min-width: 0; }
.notify-save-bar {
  min-height: 58px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line);
}
.notify-save-bar span { color: var(--muted); font-size: 10px; }

.auth-locked .app-shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}
.auth-dialog .dialog-card {
  width: min(420px, calc(100vw - 28px));
}
.auth-card {
  display: grid;
  gap: 12px;
}
.auth-card .dialog-actions {
  margin-top: 2px;
}
.auth-card .btn-primary {
  min-width: 128px;
}
.field[hidden],
.btn[hidden] {
  display: none;
}
.auth-dialog::backdrop {
  background: rgba(12, 20, 31, 0.72);
  backdrop-filter: blur(7px);
}

@media (max-width: 1100px) {
  .notify-form { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
  .notify-event-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .notify-form { grid-template-columns: 1fr; }
  .notify-event-grid { grid-template-columns: 1fr; }
  .notify-save-bar { align-items: stretch; flex-direction: column; }
  .notify-save-bar .btn { width: 100%; }
}

.stat-value,
.cheapest-ratio,
.group-ratio,
.balance-cell,
.numeric,
time,
.status-column-uptime strong,
.status-column-metrics strong,
.primary-site-uptime strong,
.primary-site-metrics strong,
.status-card-model b,
.status-uptime strong,
.detail-meta .v,
.model-index,
.api-state,
.provider-state,
.verification,
.control-meta,
input[type="number"] {
  font-family: var(--font-numeric);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
