/* ==========================================================================
   MedX rankings panel
   Palette: validated categorical slots 1-2 (blue / orange) in both modes,
   status ramp for the quota meter, recessive chrome for grid & axes.
   ========================================================================== */

:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --surface-2: #f4f3ef;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --critical: #d03b3b;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 8px 24px -16px rgba(11, 11, 11, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --surface-2: #222220;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --series-1: #3987e5;
    --series-2: #d95926;
    --critical: #d03b3b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -18px rgba(0, 0, 0, .8);
  }

}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --surface-2: #222220;
  --page: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --series-1: #3987e5;
  --series-2: #d95926;
  --critical: #d03b3b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -18px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--series-1); }
[hidden] { display: none !important; }

/* ── buttons & controls ─────────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.btn-primary:hover { background: var(--series-1); filter: brightness(1.07); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }

input {
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  min-width: 0;
}
input:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 1px;
}

.theme-toggle {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-1);
  cursor: pointer;
  position: relative;
  flex: none;
}
.theme-toggle::before {
  content: "";
  position: absolute; inset: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  box-shadow: inset -4px -3px 0 0 var(--surface-1);
}
.theme-toggle:hover::before { background: var(--text-primary); }
.theme-toggle-float { position: fixed; top: 18px; right: 18px; }

/* ── shell ──────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 22px;
  padding: 0 24px;
  height: 56px;
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
#app {
  display: flex;
  min-height: 100%;
  align-items: stretch;
}
.topbar-title { font-weight: 600; letter-spacing: -0.02em; }
.whoami { font-size: 12.5px; color: var(--text-secondary); }
.whoami b { color: var(--text-primary); font-weight: 600; }
.badge {
  display: inline-block; margin-left: 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  padding: 1px 6px; border-radius: 999px;
  color: var(--series-1);
  background: color-mix(in srgb, var(--series-1) 14%, transparent);
}

.user-picker { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); }

/* ── account combobox ───────────────────────────────────────────────
   A <select> cannot be searched, and by name — display name, login or email — is how
   people actually look for each other. */
.combo { position: relative; }
.combo input { width: 240px; max-width: 42vw; padding: 5px 9px; font-size: 12.5px; }
.combo-list {
  position: absolute; z-index: 60; top: calc(100% + 4px); right: 0;
  width: min(360px, 86vw); max-height: 320px; overflow-y: auto;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px;
  scrollbar-width: thin;
}
.combo-opt {
  display: grid; grid-template-columns: 1fr auto; gap: 0 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; line-height: 1.35;
}
.combo-opt:hover { background: var(--surface-2); }
.combo-opt.is-current { background: color-mix(in srgb, var(--series-1) 8%, var(--surface-2)); }
.combo-name {
  /* every cell is placed explicitly: an item with a definite grid-row (the id below)
     is placed in an earlier pass, and auto-placement then put it in column 1 — which
     read as "#24 … Max" instead of "Max … #24" */
  grid-column: 1; grid-row: 1;
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.combo-sub {
  grid-column: 1; grid-row: 2; font-size: 11.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.combo-id {
  grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 11px;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.combo-empty { padding: 10px 8px; font-size: 12px; color: var(--text-muted); text-align: center; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 24px 72px; }
html[data-app="medx-board"] #app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
html[data-app="medx-board"] .topbar { gap: 16px; }
html[data-app="medx-board"] .wrap.is-flush {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 14px 16px 40px;
}
.people-head, .ptrend {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
}
.people-head { margin-bottom: 2px; }
.people-scale {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.3;
  margin-bottom: 1px;
}
.people-axis { position: relative; height: 15px; }
.people-axis span {
  position: absolute;
  top: 0;
  font-size: 10.5px;
  line-height: 15px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.people-axis .is-start { transform: translateX(0); }
.people-axis .is-mid { transform: translateX(-50%); }
.people-axis .is-end { transform: translateX(-100%); }
.ptrend { padding: 10px 0 12px; }
.people .ptrend + .ptrend { border-top: 1px solid var(--border); }
.ptrend.is-me .ptrend-name,
.ptrend.is-me .ptrend-n { font-weight: 650; }
.ptrend.is-me .ptrend-n { color: var(--series-1); }
.ptrend-n { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.ptrend-main { min-width: 0; }
.ptrend-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ptrend-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grain-tag {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-muted);
}
.mix-chips { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 6px; }
.mix-chip { font-size: 11.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.mix-chip i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 99px;
  vertical-align: 0px;
}
.mix-chip b { font-weight: 600; color: var(--text-primary); }
.mix-chip.is-quiet,
.mix-chip.is-quiet b { color: var(--text-muted); font-weight: 500; }
.mix-empty { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.quota-pools { display: grid; gap: 12px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; font-size: 11.5px; color: var(--text-secondary); }
.chart-legend .lg { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.ptrend-bars {
  display: flex;
  align-items: flex-end;
  height: 44px;
  margin-top: 6px;
  min-width: 0;
  background: linear-gradient(to top, var(--grid) 1px, transparent 1px);
}
.pt-cell {
  flex: 1 1 0;
  min-width: 1px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  cursor: crosshair;
  background: transparent;
}
.pt-stack {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  min-height: 2px;
  border-radius: 1px 1px 0 0;
  overflow: hidden;
}
.pt-cell.is-zero .pt-stack { display: none; }
.pt-stack i { display: block; width: 100%; }
.pt-stack i.is-solid { background: var(--series-1); }
.group-board.medai .pt-stack i.is-solid { background: var(--series-2); }
.pt-cell:hover .pt-stack { box-shadow: 0 0 0 1px var(--text-primary); }
.ptrend-usd {
  flex: none;
  text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600;
  white-space: nowrap;
}
.group-board.is-flat { padding: 14px 16px 16px; }
.group-board.is-flat .gb-body { padding: 12px 0 0; }
.group-board.is-flat .gb-head { padding: 0 0 12px; }
.view { display: flex; flex-direction: column; gap: 18px; }

/* ── cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  #app { flex-direction: column; }
  .topbar { gap: 10px; padding: 0 14px; }
  .wrap { padding: 16px 14px 60px; }
  .whoami { display: none; }
}
@media (max-width: 560px) {
  .topbar { gap: 6px; padding: 0 8px; height: 52px; }
}

/* ── charts ─────────────────────────────────────────────────────── */

.empty {
  display: grid; place-items: center; height: 100%; min-height: 120px;
  color: var(--text-muted); font-size: 13px; text-align: center;
}
.dim { color: var(--text-muted); }

/* ── toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 90;
  background: var(--text-primary); color: var(--surface-1);
  padding: 9px 16px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 8px 30px -10px rgba(0,0,0,.5);
  animation: rise .18s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px) } to { opacity: 1; transform: translate(-50%, 0) } }
.toast.is-error { background: var(--critical); color: #fff; }

.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 4px 0 14px; flex-wrap: wrap; }
.subtab {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 14px; font-size: 13px; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--text-primary); }
.subtab.is-active { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--series-1); }

@media (forced-colors: active) {
  .card { border: 1px solid CanvasText; }
}

/* Wide layout for the rankings time series. */
.wrap.is-wide { max-width: min(1920px, 96vw); }
@media (max-width: 760px) { .wrap.is-wide { max-width: none; } 
}

/* ── overview KPIs ──────────────────────────────────────────────── */
.plan-card { padding: 0; overflow: hidden; }
.plan-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 22px 14px;
}
.plan-title { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.plan-headline { font-size: 28px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.plan-caption { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.plan-right { font-size: 12px; color: var(--text-muted); text-align: right; white-space: nowrap; }
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border-top: 1px solid var(--border);
}
.kpi {
  background: var(--surface-1);
  padding: 14px 18px 16px;
}
.kpi-label { font-size: 12px; color: var(--text-muted); }
.kpi-value { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi-note { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.kpi.tone-warning .kpi-value { color: #b45309; }
.kpi.tone-info .kpi-value { color: var(--series-1); }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: 1fr; } }

.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; }
.card-sub { font-size: 12.5px; color: var(--text-muted); }
.lane-meta { font-size: 12px; color: var(--text-muted); }

.meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; background: var(--series-1); }

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px;
}
.seg button {
  font: inherit; font-size: 12.5px; font-weight: 500;
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-secondary); padding: 4px 12px; border-radius: 999px;
}
.seg button:hover { color: var(--text-primary); }
.seg button.is-on { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); }
.seg button.is-on[data-group="medx"] { color: var(--series-1); }
.seg button.is-on[data-group="medai"] { color: var(--series-2); }

.tchart {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: 200px 22px;
  column-gap: 8px;
  width: 100%;
}
.tchart-y {
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 11px; color: var(--text-muted); text-align: right;
  padding: 0 0 2px;
  font-variant-numeric: tabular-nums;
}
.tchart-plot {
  display: flex; align-items: stretch; gap: 1px;
  border-bottom: 1px solid var(--grid);
  min-width: 0;
}
.tbar {
  flex: 1; min-width: 3px; height: 100%;
  display: flex; flex-direction: row; align-items: flex-end; gap: 1px;
  cursor: crosshair;
}
.tstack {
  flex: 1; min-width: 0; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.tstack i { display: block; width: 100%; min-height: 0; }
.chart-legend .legend-label { font-weight: 650; color: var(--text-primary); }
.chart-legend .lg.medx { background: #2563eb; }
.chart-legend .lg.medai { background: #f97316; }
.tbar:hover { filter: brightness(1.08); }
.tchart-x {
  grid-column: 2;
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
}
.tchart-x span { flex: 1; text-align: center; min-width: 0; overflow: hidden; }
.tchart-x span:first-child { text-align: left; }
.tchart-x span:last-child { text-align: right; }
#view-overview { position: relative; }
.chart-tip, .live-tip {
  position: absolute; z-index: 8; min-width: 148px;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: var(--shadow); pointer-events: none; line-height: 1.45;
}
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; font-size: 12px; color: var(--text-secondary); }
.chart-legend .lg {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 6px; vertical-align: -1px;
}
.chart-legend .lg.medx { background: var(--series-1); }
.chart-legend .lg.medai { background: var(--series-2); }

.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 980px) { .boards { grid-template-columns: 1fr; } }

.group-board {
  padding: 0; overflow: hidden;
  border: 1px solid var(--border);
}
.gb-head {
  padding: 16px 18px 12px; display: flex; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--grid);
}
.gb-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.group-board.medx .gb-kicker { color: var(--series-1); }
.group-board.medai .gb-kicker { color: var(--series-2); }
.gb-title { font-size: 16px; margin-top: 2px; }
.gb-usd { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.gb-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.gb-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 16px; }
.gb-section h3 { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; margin: 0 0 8px; }
.section-note { font-size: 11.5px; color: var(--text-muted); margin: -3px 0 10px; line-height: 1.45; }
.model-line {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; padding: 3px 0;
  font-variant-numeric: tabular-nums;
}
.model-name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }
.channel-tabs {
  margin: 0 0 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.channel-tabs::-webkit-scrollbar { display: none; }
.channel-tabs .subtab {
  flex: none;
  white-space: nowrap;
  border-bottom: 0;
  margin: 0;
  border-radius: 999px;
  padding: 6px 14px;
}
.channel-tabs .subtab.is-active {
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: var(--shadow);
  border-bottom-color: transparent;
}
.group-board.medai .channel-tabs .subtab.is-active { color: var(--series-2); }
.rank {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; margin: 0 -8px;
  border-bottom: 1px solid var(--grid);
  border-radius: 6px;
}
.rank:last-child { border-bottom: 0; }
.rank.is-me { background: color-mix(in srgb, var(--series-2) 7%, transparent); }
.rank-n { width: 18px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.rank-name.is-me { font-weight: 700; }
.rank-usd { font-variant-numeric: tabular-nums; font-size: 12.5px; }
.rank-bar {
  flex: none; width: clamp(48px, 18%, 120px); height: 4px;
  border-radius: 999px; background: var(--surface-2); overflow: hidden;
}
.rank-bar > span {
  display: block; height: 100%; border-radius: inherit;
  background: color-mix(in srgb, var(--series-2) 50%, var(--surface-2));
}
.lab-box {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--series-2) 8%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--series-2) 22%, transparent);
}
.lab-box .gb-usd { font-size: 20px; }
.err-soft { font-size: 12.5px; color: var(--text-muted); }

.quota-box {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--series-1) 7%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--series-1) 22%, transparent);
}
.quota-summary-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin: 3px 0 14px;
}
.quota-remaining {
  color: var(--series-1); font-size: 25px; font-weight: 650;
  line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.quota-window + .quota-window { margin-top: 16px; }
.quota-window-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 12px; color: var(--text-muted);
}
.quota-window-head b { flex: none; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.quota-window-head span { min-width: 0; text-align: right; }
.quota-track {
  position: relative; height: 10px; margin: 8px 1px 7px;
  border-radius: 999px; background: var(--surface-1);
  box-shadow: inset 0 0 0 1px var(--border);
}
.quota-track.has-now { margin-top: 22px; }
.quota-used {
  position: absolute; inset: 0 auto 0 0; border-radius: inherit;
  background: var(--series-1);
}
.quota-time {
  position: absolute; top: -4px; width: 2px; height: 18px;
  margin-left: -1px; background: var(--text-primary); border-radius: 2px;
  box-shadow: 0 0 0 2px var(--surface-1);
}
.quota-time::after {
  content: ""; position: absolute; left: 50%; top: -3px; transform: translateX(-50%);
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 4px solid var(--text-primary);
}
.quota-time b {
  position: absolute; left: 50%; top: -16px; transform: translateX(-50%);
  font-style: normal; font-weight: 650; font-size: 11px; line-height: 1;
  color: var(--text-primary); white-space: nowrap;
}
.quota-time.is-start b { left: 0; transform: none; }
.quota-time.is-end b { left: auto; right: 0; transform: none; }
.quota-axis {
  position: relative; height: 16px; margin: 1px 1px 6px;
  font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.quota-axis-start, .quota-axis-end {
  position: absolute; top: 0; white-space: nowrap; line-height: 16px;
}
.quota-axis-start { left: 0; }
.quota-axis-end { right: 0; }
.quota-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.quota-legend i { display: inline-block; margin-right: 5px; vertical-align: -1px; }
.quota-used-key { width: 9px; height: 9px; border-radius: 2px; background: var(--series-1); }
.quota-time-key { width: 2px; height: 10px; background: var(--text-primary); }
.quota-empty { padding: 8px 0; font-size: 12px; color: var(--text-muted); }
.quota-box > .section-note { margin: 14px 0 0; }

.login-gate {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.login-gate h1 { font-size: 28px; letter-spacing: -0.03em; }
.login-gate p {
  margin: 12px 0 0;
  color: var(--text-secondary);
  max-width: 28em;
}
.login-gate-actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.login-gate-actions a { text-decoration: none; }

@media (max-width: 760px) {
  html[data-app="medx-board"] .topbar {
    height: auto; min-height: 52px; flex-wrap: wrap; padding: 8px 10px; gap: 8px;
  }
  html[data-app="medx-board"] #win-seg {
    order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
  }
  html[data-app="medx-board"] #win-seg::-webkit-scrollbar { display: none; }
  html[data-app="medx-board"] #win-seg button { flex: none; }
  html[data-app="medx-board"] .wrap.is-flush { padding: 10px 10px 32px; }
}

@media (max-width: 520px) {
  html[data-app="medx-board"] .topbar-title { display: none; }
  html[data-app="medx-board"] .topbar-actions { margin-left: 0; width: 100%; overflow-x: auto; }
  .group-board.is-flat { padding: 12px; }
  .group-board.is-flat .gb-body { padding-top: 8px; }
  .people-head, .ptrend { grid-template-columns: 18px minmax(0, 1fr); column-gap: 6px; }
  .ptrend-bars { height: 36px; }
  .ptrend-usd { font-size: 12px; }
  .quota-window-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .quota-window-head span { text-align: left; }
}
