:root {
  --bg: #0D1117;
  --card: #141B24;
  --card-2: #18212C;
  --border: #263140;
  --border-strong: #33404F;
  --text: #E6EDF3;
  --muted: #8B98A5;
  --accent: #C7355A;
  --accent-dark: #7A1620;
  --accent-soft: rgba(199, 53, 90, .14);
  --platinum: #D9DEE5;
  --ok: #3FB950;
  --err: #F85149;
  --warn: #FFB020;
  --r: 6px;
  --r-lg: 8px;
  --pill: 20px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --row-h: 40px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: env(safe-area-inset-top, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::selection { background: var(--accent-soft); }

/* scrollbars: same thin look on mac and windows */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- layout */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { width: 30px; height: 30px; display: block; }
.brand span { font-family: var(--mono); font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.topbar .spacer { flex: 1; }

.main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px 20px 0; gap: 12px; }

/* ---------- buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13.5px;
  transition: border-color .12s, color .12s, background .12s;
}
.btn:hover { border-color: var(--border-strong); color: var(--text); }
.btn.active { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn-primary {
  border: 0; color: #fff; font-weight: 600;
  background: linear-gradient(180deg, #D9455F 0%, #C7355A 55%, #7A1620 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--card); border-color: transparent; }
.btn-danger:hover { color: var(--err); border-color: var(--err); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.icon-btn {
  width: 28px; height: 28px; display: inline-grid; place-items: center;
  border-radius: var(--r); border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--card-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--err); }
.icon-btn svg { width: 15px; height: 15px; }

.input, .select {
  height: 34px; width: 100%; padding: 0 10px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none;
  transition: border-color .12s;
}
.input::placeholder, textarea::placeholder { color: #5D6A77; }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, textarea:focus { border-color: var(--accent); }
.input.invalid { border-color: var(--err); background-color: rgba(248, 81, 73, .07); }
.input.warn { border-color: var(--warn); background-color: rgba(255, 176, 32, .07); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238B98A5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
textarea.input { height: auto; padding: 10px; resize: vertical; line-height: 1.5; }

.search { position: relative; width: 280px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 32px; padding-right: 30px; }
.search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font: 11px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px;
}

/* ---------- toolbar (≈5% larger than base controls) */
.toolbar .btn { height: 36px; padding: 0 13px; font-size: 14.2px; }
.toolbar .btn svg { width: 16px; height: 16px; }
.toolbar .input { height: 36px; font-size: 14.5px; }
.toolbar .search svg { width: 16px; height: 16px; }
.toolbar-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- page tabs */
.page-tabs { display: flex; gap: 4px; margin-left: 28px; }
.page-tab {
  height: 34px; padding: 0 13px; border-radius: var(--r); border: 1px solid transparent; background: transparent;
  color: var(--muted); font-weight: 500; font-size: 14.2px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.page-tab:hover { color: var(--text); background: var(--card); }
.page-tab.active { color: var(--text); background: var(--card); border-color: var(--border); }
.page-tab .cnt { font-size: 12px; color: var(--muted); min-width: 18px; padding: 0 6px; height: 19px; line-height: 19px; border-radius: var(--pill); background: var(--bg); text-align: center; }
.page-tab.active .cnt { color: var(--accent); background: var(--accent-soft); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 28px; padding: 0 11px; border-radius: var(--pill); border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.chip.active .count { color: var(--accent); opacity: .8; }
.divider-v { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

.split { position: relative; display: inline-flex; }
.split .btn-primary:first-child { border-radius: var(--r) 0 0 var(--r); }
.split .btn-primary:last-child { border-radius: 0 var(--r) var(--r) 0; padding: 0 9px; border-left: 1px solid rgba(0,0,0,.25); }

/* ---------- popover menus */
.pop {
  position: fixed; z-index: 60; min-width: 200px; max-width: 340px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: 0 12px 32px rgba(0,0,0,.45); padding: 5px;
  animation: pop-in .12s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 0; background: transparent; border-radius: 5px; cursor: pointer; text-align: left; color: var(--text);
}
.menu-item:hover, .menu-item.hl { background: var(--card-2); }
.menu-item .sub { color: var(--muted); font-size: 12px; display: block; }
.menu-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu-item kbd { margin-left: auto; color: var(--muted); font: 11px var(--font); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 2px; }
.menu-label { padding: 6px 10px 4px; color: var(--muted); font-size: 12px; }
.check { width: 15px; height: 15px; border-radius: 4px; border: 1px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on::after { content: ""; width: 7px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.pop .scroll { max-height: 300px; overflow: auto; }
.pop .search-in { padding: 4px 4px 6px; }

/* ---------- table */
.table-wrap {
  flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--card);
}
table.caps { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 980px; }
table.caps th, table.caps td { padding: 0 14px; height: var(--row-h); white-space: nowrap; text-align: left; border-bottom: 1px solid var(--border); }
table.caps thead th {
  position: sticky; top: 0; z-index: 3; background: var(--card); height: 38px;
  color: var(--muted); font-weight: 500; font-size: 12.5px; user-select: none; cursor: pointer;
  border-bottom: 1px solid var(--border-strong);
}
table.caps thead th:hover { color: var(--text); }
table.caps thead th.sorted { color: var(--text); }
table.caps thead th .arrow { display: inline-block; width: 10px; margin-left: 4px; color: var(--accent); }
table.caps th.r, table.caps td.r { text-align: right; }
table.caps tbody tr { transition: background .08s; }
table.caps tbody tr:hover td { background: #19222D; }
table.caps tbody tr.selected td { background: #1F1820; }
table.caps tbody tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(199,53,90,.22); } }
table.caps td { font-variant-numeric: tabular-nums; }
/* sticky left: checkbox + geo */
table.caps .c-sel { width: 40px; padding: 0 0 0 14px; position: sticky; left: 0; z-index: 2; background: var(--card); }
table.caps .c-geo { position: sticky; left: 40px; z-index: 2; background: var(--card); box-shadow: inset -1px 0 0 var(--border); }
table.caps thead .c-sel, table.caps thead .c-geo { z-index: 4; }
table.caps .c-act { width: 1%; padding-right: 8px; text-align: right; }
table.caps .c-act .acts { visibility: hidden; display: inline-flex; gap: 2px; }
table.caps tbody tr:hover .acts, table.caps tbody tr:focus-within .acts { visibility: visible; }
table.caps tbody tr:last-child td { border-bottom: 0; }
.geo { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.flag {
  width: 22px; height: 16px; border-radius: 3px; object-fit: cover; flex: none; display: block;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08); background: var(--card-2);
}
.flag-sm { width: 18px; height: 13px; border-radius: 2px; }
.geo .cname { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.cur { color: var(--muted); margin-left: 3px; }
.dim { color: var(--muted); }
.web { color: var(--platinum); font-weight: 500; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--pill); font-size: 12px; font-weight: 500; border: 1px solid var(--border); color: var(--platinum); }
.pill.fb { border-color: #2D4A7A; color: #8FB4F0; }
.pill.uac { border-color: #2F5D3A; color: #7FD18F; }
.cbx { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; vertical-align: middle; }

.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty img { width: 54px; opacity: .9; margin-bottom: 14px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.empty p { margin: 0 0 18px; }

.footer { display: flex; align-items: center; gap: 18px; padding: 10px 2px 14px; color: var(--muted); font-size: 12.5px; }
.footer b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.footer .spacer { flex: 1; }
.selbar { display: flex; align-items: center; gap: 10px; color: var(--text); }

/* ---------- modal */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(5, 8, 12, .68);
  display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 16px; overflow: auto;
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.55);
  animation: rise .16s ease-out;
}
.modal.wide { max-width: 860px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.modal-body { padding: 16px 20px 6px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
.modal-foot .hint { margin-right: auto; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; padding: 14px 20px 0; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 10px 10px; border: 0; background: none; color: var(--muted); cursor: pointer; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.field .help { margin-top: 5px; font-size: 12px; color: var(--muted); }
.field .help.warn { color: var(--warn); }
.field .help.err { color: var(--err); }
.row { display: flex; gap: 8px; align-items: center; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; height: 34px; flex: none; }
.seg button { border: 0; background: var(--bg); color: var(--muted); padding: 0 12px; cursor: pointer; font-weight: 600; min-width: 38px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.seg.sm { height: 30px; }
.seg.sm button { padding: 0 8px; min-width: 30px; font-size: 12.5px; }

.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- combobox */
.combo { position: relative; }
.combo .input.has-flag { padding-left: 38px; }
.combo .lead-flag { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.combo-list {
  position: fixed; z-index: 70; background: var(--card); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: 0 14px 34px rgba(0,0,0,.5); padding: 4px; max-height: 280px; overflow: auto;
}
.opt { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 5px; cursor: pointer; }
.opt.hl { background: var(--card-2); }
.opt .code { font-weight: 600; width: 24px; }
.opt .meta { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.opt .new { color: var(--accent); }
.opt mark { background: none; color: var(--accent); }
.combo-empty { padding: 8px 10px; color: var(--muted); font-size: 12.5px; }

/* ---------- date picker */
.dp-btn { justify-content: flex-start; width: 100%; color: var(--text); font-variant-numeric: tabular-nums; }
.dp-btn svg { color: var(--muted); }
.dp-btn .tag { margin-left: auto; color: var(--muted); font-size: 12px; }
.dp { padding: 10px; width: 260px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head b { font-weight: 600; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-grid .dow { color: var(--muted); font-size: 11.5px; padding: 4px 0; }
.dp-day { height: 32px; border: 0; border-radius: 5px; background: transparent; cursor: pointer; font-variant-numeric: tabular-nums; color: var(--text); }
.dp-day:hover:not(:disabled) { background: var(--card-2); }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--border-strong); }
.dp-day.sel { background: var(--accent); color: #fff; font-weight: 600; }
.dp-day:disabled { color: #3C4855; cursor: default; }
.dp-foot { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- batch editor (text import / mass) */
.common-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.alts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.alt { height: 22px; padding: 0 8px; font-size: 11.5px; border-radius: var(--pill); border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); cursor: pointer; }
.alt:hover { color: var(--text); border-color: var(--muted); }
.alt.on { border-style: solid; border-color: var(--accent); color: var(--accent); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; font-weight: 600; font-size: 13.5px; }
.section-title .dim { font-weight: 400; font-size: 12.5px; }
.geo-rows { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.geo-rows table { width: 100%; border-collapse: collapse; }
.geo-rows th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; background: var(--bg); border-bottom: 1px solid var(--border); }
.geo-rows td { padding: 6px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.geo-rows tr:last-child td { border-bottom: 0; }
.geo-rows td:first-child { padding-left: 10px; }
.geo-rows .input { height: 30px; }
.geo-rows .w-geo { width: 30%; }
.geo-rows .w-cur { width: 1%; }
.geo-rows .w-rate { width: 110px; }
.geo-rows .w-cap { width: 150px; }
.notes { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.note { font-size: 12.5px; padding: 8px 10px; border-radius: var(--r); border: 1px solid rgba(255,176,32,.35); color: var(--warn); background: rgba(255,176,32,.06); }
.quick { display: flex; gap: 8px; }

/* ---------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; }
.auth-card .brand img { width: 40px; height: 40px; }
.auth-card .brand span { font-size: 22px; }
.auth-card p.lead { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; height: 38px; margin-top: 4px; }
.form-err { color: var(--err); font-size: 12.5px; min-height: 18px; margin-top: 8px; text-align: center; }

/* ---------- users admin */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.users-table td { padding: 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: var(--pill); border: 1px solid var(--border-strong); color: var(--muted); margin-left: 6px; }
.badge.accent { color: var(--accent); border-color: var(--accent); }
.badge.err { color: var(--err); border-color: var(--err); }

/* ---------- toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 35; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--card); border: 1px solid var(--border-strong); border-left: 3px solid var(--ok);
  border-radius: var(--r); padding: 10px 14px; box-shadow: 0 10px 28px rgba(0,0,0,.45); max-width: 380px;
  animation: rise .16s ease-out; display: flex; align-items: center; gap: 12px;
}
.toast.err { border-left-color: var(--err); }
.toast button { margin-left: auto; }

.user-btn { display: inline-flex; align-items: center; gap: 8px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }

@media (max-width: 760px) {
  .topbar, .main { padding-left: 12px; padding-right: 12px; }
  .search { width: 100%; order: -1; }
  .form-grid, .common-grid { grid-template-columns: 1fr; }
  .overlay { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- v0.2 */
.na { color: var(--muted); font-size: 12.5px; letter-spacing: .02em; }
.na-box { height: 34px; display: flex; align-items: center; padding: 0 10px; border: 1px dashed var(--border); border-radius: var(--r); color: var(--muted); font-size: 12.5px; }
.status-row { margin-bottom: 16px; }
.status-seg button { padding: 0 14px; font-weight: 500; font-size: 13.5px; }

.date-field { position: relative; }
.date-field .input { padding-right: 120px; }
.date-tag { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12.5px; pointer-events: none; white-space: nowrap; }
.date-cal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.date-cal:hover { background: var(--card-2); color: var(--text); }
.date-cal svg { width: 16px; height: 16px; }
.date-quick { display: flex; gap: 6px; margin-top: 7px; }
.date-quick .chip { height: 24px; font-size: 12px; padding: 0 9px; }

table.caps .acts .go { visibility: visible; }
.icon-btn.go { color: var(--ok); }
.icon-btn.go svg { width: 18px; height: 18px; stroke-width: 2.6; }
.icon-btn.go:hover { color: var(--ok); background: rgba(63, 185, 80, .12); }
.btn-go { color: var(--ok); border-color: rgba(63, 185, 80, .4); }
.btn-go:hover { color: var(--ok); border-color: var(--ok); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 0 0 8px; font: inherit; font-size: 12.5px; }
.link-btn:hover { text-decoration: underline; }
.activate-top { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.geo-rows .w-web { width: 38%; }
.geo-rows td.r, .geo-rows th.r { text-align: right; }
.web-cell { display: flex; align-items: center; flex-wrap: wrap; }
@media (max-width: 760px) {
  .page-tabs { margin-left: 8px; overflow-x: auto; }
  .page-tab { padding: 0 9px; font-size: 13px; }
  .activate-top { grid-template-columns: 1fr; }
}

/* ---------- v0.4 */
.flag-none { visibility: hidden; }
.geo-rows .w-rweb { width: 190px; }
.geo-rows .w-geo { width: 30%; }
a.btn { text-decoration: none; }

/* ---------- v0.6 prolongation */
.icon-btn.prolong:hover { color: var(--accent); background: var(--accent-soft); }
.cap-cell { display: inline-flex; align-items: center; gap: 8px; }
.hist-badge {
  height: 20px; padding: 0 7px; border-radius: var(--pill); border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--muted); font: 600 11.5px var(--font); font-variant-numeric: tabular-nums; cursor: pointer;
}
.hist-badge:hover, .hist-badge.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
table.caps tbody tr.open td { background: #17202B; }
table.caps > tbody > tr.detail-row > td { padding: 0; height: auto; background: var(--bg); white-space: normal; }
table.caps > tbody > tr.detail-row:hover > td { background: var(--bg); }
.hist-panel { padding: 14px 18px 16px 54px; border-left: 2px solid var(--accent); }
.hist-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 10px; }
.hist-stat { display: flex; flex-direction: column; gap: 2px; }
.hist-stat span { color: var(--muted); font-size: 11.5px; }
.hist-stat b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hist-stat b.accent { color: var(--accent); }
.under { color: var(--warn); }
.over { color: var(--ok); }
.now { color: var(--accent); font-size: 12px; }
table.caps .hist-table { border-collapse: collapse; font-size: 12.5px; min-width: 640px; width: auto; }
table.caps .hist-table th, table.caps .hist-table td {
  position: static; height: auto; background: none; cursor: default; box-shadow: none;
  padding: 6px 18px 6px 0; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left;
}
table.caps .hist-table th { color: var(--muted); font-weight: 500; font-size: 12px; padding-top: 2px; border-bottom-color: var(--border-strong); }
table.caps .hist-table th.r, table.caps .hist-table td.r { text-align: right; }
table.caps .hist-table td:last-child, table.caps .hist-table th:last-child { padding-right: 0; }
table.caps .hist-table tr.current td { color: var(--text); }
table.caps .hist-table tbody tr:last-child td { border-bottom: 0; }
table.caps .hist-table tbody tr:hover td { background: none; }
.prolong-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); font-size: 13px; }
