:root {
  --bg: #0b1220;
  --surface: #111a2c;
  --surface-2: #0f1727;
  --surface-3: #162238;
  --border: #23324a;
  --border-soft: #1c2940;
  --text: #e6edf7;
  --muted: #8ea1ba;
  --accent: #14b8a6;
  --accent-dark: #0f9488;
  --accent-2: #6366f1;
  --good: #22c55e;
  --ok: #34d399;
  --warn: #f59e0b;
  --bad: #ef4444;
  --none: #8b99ad;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #06151d;
  background: linear-gradient(135deg, #5eead4, #14b8a6 55%, #6366f1);
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.brand-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 20px 0;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--border);
}

.tab {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tab:hover {
  color: var(--accent);
  background: rgba(20, 184, 166, 0.08);
}

.tab.is-active {
  color: #e6fffa;
  background: var(--surface);
  border-color: var(--border);
  box-shadow: inset 0 2px 0 var(--accent);
}

main {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 14px 20px 28px;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.monitor-subtabs {
  display: flex;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 12px;
  padding: 5px;
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.monitor-subtab {
  min-width: 108px;
  min-height: 34px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.monitor-subtab:hover {
  color: var(--text);
  background: rgba(20, 184, 166, 0.08);
}

.monitor-subtab.is-active {
  color: #eafff9;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.9), rgba(99, 102, 241, 0.82));
  border-color: rgba(20, 184, 166, 0.68);
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.18);
}

.monitor-view {
  display: none;
}

.monitor-view.is-active {
  display: block;
}

.monitor-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #101c31, #0b1220 62%, #101a30);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.hero-copy {
  min-width: 220px;
  flex: 0 0 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.hero-copy h2 {
  margin: 4px 0 6px;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.summary-item,
.stat-item {
  min-width: 0;
  background: rgba(17, 26, 44, 0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  padding: 10px 12px;
}

.summary-item .label,
.stat-item .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-item .value,
.stat-item .value {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f0f6ff;
}

.monitor-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.channel-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(108px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.channel-metric {
  min-width: 0;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.channel-metric-good {
  border-top-color: var(--good);
}

.channel-metric-ok {
  border-top-color: var(--ok);
}

.channel-metric-warn {
  border-top-color: var(--warn);
}

.channel-metric-bad {
  border-top-color: var(--bad);
}

.channel-metric-none {
  border-top-color: var(--border);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-metric-good .metric-value {
  color: #86efac;
}

.channel-metric-ok .metric-value {
  color: #6ee7b7;
}

.channel-metric-warn .metric-value {
  color: #fcd34d;
}

.channel-metric-bad .metric-value {
  color: #fca5a5;
}

.channel-metric-none .metric-value {
  color: var(--muted);
}

.model-context {
  padding: 10px 12px;
  margin-bottom: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.monitor-rail {
  position: sticky;
  top: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.rail-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  min-height: 30px;
  max-width: 100%;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.filter-chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.filter-chip.is-active {
  color: #eafff9;
  background: rgba(20, 184, 166, 0.18);
  border-color: rgba(20, 184, 166, 0.72);
}

.monitor-main {
  min-width: 0;
}

.toolbar,
.usage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.field {
  min-width: 130px;
}

.field label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.search-field {
  flex: 2 1 220px;
}

.key-field {
  flex: 2 1 300px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
}

input::placeholder {
  color: #60758f;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.18);
}

button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary {
  min-width: 92px;
  color: #eafff9;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.primary:hover:not(:disabled) {
  color: #fff;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  color: var(--text);
  white-space: nowrap;
}

.check-field input {
  width: 16px;
  height: 16px;
}

#refreshInterval {
  width: 86px;
}

.toolbar-status {
  min-width: 150px;
  min-height: 36px;
  display: flex;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.result-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.model-card {
  min-width: 0;
  position: relative;
  padding: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.model-card-good {
  border-left-color: var(--good);
}

.model-card-ok {
  border-left-color: var(--ok);
}

.model-card-warn {
  border-left-color: var(--warn);
}

.model-card-bad {
  border-left-color: var(--bad);
}

.model-card-none {
  border-left-color: var(--none);
}

.model-card-head,
.model-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.channel-ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
}

.channel-warn {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.12);
}

.channel-bad {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.12);
}

.channel-muted {
  color: var(--muted);
}

.model-name {
  margin: 12px 0 4px;
  color: #f4f8ff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.model-meta {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-pricing {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 9px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.26);
  border-radius: 8px;
  font-size: 11px;
}

.price-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 800;
}

.price-value {
  min-width: 0;
  color: #c7d2fe;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.model-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 10px;
}

.model-stat {
  min-width: 0;
  padding: 8px 9px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.stat-value {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value.success-rate,
.stat-value.availability {
  color: #86efac;
}

.model-perf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.perf-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.perf-bar {
  width: 5px;
  border-radius: 999px;
  background: #33415a;
}

.perf-good {
  height: 15px;
  background: var(--good);
}

.perf-ok {
  height: 12px;
  background: var(--ok);
}

.perf-warn {
  height: 9px;
  background: var(--warn);
}

.perf-bad {
  height: 7px;
  background: var(--bad);
}

.perf-none {
  height: 7px;
  background: var(--none);
}

.group-badge,
.rate-badge,
.type-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rate-badge {
  color: #5eead4;
  border-color: rgba(20, 184, 166, 0.3);
  background: rgba(20, 184, 166, 0.1);
}

.type-badge {
  margin-left: auto;
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.32);
  background: rgba(99, 102, 241, 0.12);
}

.empty-card {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.channel-panel {
  margin-top: 4px;
}

.channel-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.channel-card {
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.channel-card-good {
  border-left-color: var(--good);
}

.channel-card-ok {
  border-left-color: var(--ok);
}

.channel-card-warn {
  border-left-color: var(--warn);
}

.channel-card-bad {
  border-left-color: var(--bad);
}

.channel-card-none {
  border-left-color: var(--none);
}

.channel-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.channel-name-wrap {
  min-width: 0;
}

.channel-card-name {
  margin: 0 0 6px;
  color: #f4f8ff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.channel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.channel-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  max-width: 100%;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.channel-stat {
  min-width: 0;
  padding: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.channel-stat .label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-stat strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-stat strong.value-good {
  color: #86efac;
}

.channel-stat strong.value-ok {
  color: #6ee7b7;
}

.channel-stat strong.value-warn {
  color: #fcd34d;
}

.channel-stat strong.value-bad {
  color: #fca5a5;
}

.channel-stat strong.value-none {
  color: var(--none);
}

.channel-availability {
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.channel-availability-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.channel-progress {
  height: 10px;
  overflow: hidden;
  background: #0a111f;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.channel-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #33415a;
  transition: width 0.4s ease;
}

.channel-fill-good {
  background: linear-gradient(90deg, #22c55e, #14b8a6);
}

.channel-fill-ok {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.channel-fill-warn {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.channel-fill-bad {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.channel-fill-none {
  background: #33415a;
}

.channel-card-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.channel-state-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.channel-states {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.channel-state-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.state-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--none);
}

.state-good {
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.state-warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}

.state-bad {
  background: var(--bad);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.state-none {
  background: var(--none);
  box-shadow: 0 0 0 3px rgba(139, 153, 173, 0.14);
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #131e31;
  font-size: 12px;
  font-weight: 800;
}

.data-table tbody tr:hover {
  background: rgba(20, 184, 166, 0.05);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.channel-table {
  min-width: 760px;
}

.model-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-good {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
}

.pill-ok {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.12);
}

.pill-warn {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.14);
}

.pill-bad {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
}

.pill-none {
  color: var(--none);
  background: rgba(139, 153, 173, 0.14);
}

.error-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
}

.error-banner[hidden] {
  display: none;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.info-card {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.key-card,
.usage-card {
  grid-column: 1 / -1;
}

.card-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.quota-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #142038, #0f1727 58%, #101c31);
  border-top: 2px solid var(--accent);
}

.quota-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.quota-status.level-good {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.quota-status.level-warn {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
}

.quota-status.level-danger {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.4);
}

.quota-status.level-critical {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
}

.quota-status.level-none {
  color: var(--none);
  background: rgba(139, 153, 173, 0.14);
  border-color: rgba(139, 153, 173, 0.34);
}

.quota-main {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.quota-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quota-stat {
  min-width: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.quota-stat.is-used {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.28);
}

.quota-stat .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.quota-stat strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quota-stat.is-used strong {
  color: #fcd34d;
}

.quota-progress {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.progress-meta strong {
  color: var(--text);
  font-size: 18px;
}

.progress-track {
  height: 18px;
  overflow: hidden;
  background: #0a111f;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #14b8a6);
  transition: width 0.4s ease;
}

.progress-fill.level-warn {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.progress-fill.level-danger {
  background: linear-gradient(90deg, #f97316, #fbbf24);
}

.progress-fill.level-critical {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.progress-fill.is-empty {
  background: #33415a;
}

.progress-scale {
  display: flex;
  justify-content: space-between;
  color: #60758f;
  font-size: 11px;
}

.quota-foot {
  min-height: 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.key-tile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.key-tile {
  min-width: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.key-tile .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.key-tile .value {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.usage-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.usage-group {
  min-width: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.usage-group-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.usage-tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.usage-tile {
  min-width: 0;
  padding: 9px 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.usage-tile .label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usage-tile .value {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logs-panel {
  margin-top: 2px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  color: var(--muted);
}

.pager span {
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1250px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .channel-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .monitor-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .monitor-hero {
    flex-direction: column;
  }

  .hero-copy {
    flex: 0 0 auto;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .channel-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .monitor-layout {
    grid-template-columns: 1fr;
  }

  .monitor-rail {
    position: static;
  }

  .usage-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .tabs {
    padding: 10px 14px 0;
    overflow-x: auto;
  }

  .monitor-subtabs {
    width: 100%;
  }

  .tab {
    min-width: 130px;
  }

  main {
    padding: 12px 14px 24px;
  }

  .monitor-hero {
    padding: 14px;
  }

  .quota-main {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .key-tile-grid,
  .usage-groups,
  .channel-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .channel-card-grid {
    grid-template-columns: 1fr;
  }

  .model-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .usage-toolbar {
    align-items: stretch;
  }

  .field,
  .search-field,
  .key-field {
    min-width: 100%;
  }

  .toolbar-status {
    min-height: 0;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 420px) {
  .summary-grid,
  .key-tile-grid,
  .usage-groups,
  .usage-tile-grid,
  .channel-metrics {
    grid-template-columns: 1fr;
  }

  .quota-numbers {
    grid-template-columns: 1fr;
  }

  .channel-card-stats {
    grid-template-columns: 1fr;
  }

  .brand-sub {
    white-space: normal;
  }

  .hero-copy h2 {
    font-size: 22px;
  }
}
