/* Doghowl Analytics — dashboard styles. Dark-first, light theme via media query. */
:root {
  --bg: #0e1116;
  --bg-elevated: #161b23;
  --bg-hover: #1d242f;
  --border: #252d3a;
  --text: #e6e9ef;
  --text-dim: #8b95a6;
  --accent: #4f8ef7;
  --accent-text: #ffffff;
  --positive: #34d399;
  --negative: #f87171;
  --apple: #0a84ff;
  --google: #34a853;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --radius: 12px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fa;
    --bg-elevated: #ffffff;
    --bg-hover: #eef1f6;
    --border: #dfe4ec;
    --text: #1a2230;
    --text-dim: #647082;
    --shadow: 0 6px 20px rgba(20, 30, 50, 0.08);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px 44px;
  text-align: center;
  max-width: 360px;
}
.login-card h1 { margin: 8px 0 4px; font-size: 22px; }
.login-card p { color: var(--text-dim); margin: 0 0 24px; }
#google-btn { margin-top: 22px; display: inline-block; min-height: 20px; }
.login-wordmark { width: 210px; max-width: 100%; height: auto; display: block; margin: 4px auto 0; filter: brightness(0) invert(1); }
.login-card .login-sub { margin: 12px 0 26px; color: var(--text-dim); font-size: 13px; letter-spacing: 4px; text-transform: uppercase; }
.login-error { color: var(--negative); margin-top: 14px; min-height: 18px; font-size: 13px; }

/* ---------- Shell ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.topbar .brand-mark { height: 24px; width: auto; display: block; }
.topbar .spacer { flex: 1; }
.sync-note { color: var(--text-dim); font-size: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.user-chip img { width: 26px; height: 26px; border-radius: 50%; }

.page { max-width: 1240px; margin: 0 auto; padding: 18px 20px 60px; }

/* ---------- Controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.seg {
  display: inline-flex; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.seg button {
  border: 0; background: transparent; padding: 7px 13px; cursor: pointer; color: var(--text-dim);
  white-space: nowrap;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent); color: var(--accent-text); }
.custom-range { display: inline-flex; align-items: center; gap: 6px; }
.range-dash { color: var(--text-dim); }

/* Metric toggle above the Store-health trend chart */
.trend-seg { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.trend-seg button {
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-dim);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.trend-seg button:hover { color: var(--text); }
.trend-seg button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.trend-chart { margin-bottom: 16px; }

/* Date fields (readonly text + custom calendar popup). */
.date-field {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); cursor: pointer; min-width: 130px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b95a6' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; padding-right: 30px;
}
.date-field:focus { outline: none; border-color: var(--accent); }

.dp-pop {
  position: absolute; z-index: 100; width: 250px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 10px;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-title { font-weight: 600; font-size: 13.5px; }
.dp-nav {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 15px; line-height: 1;
}
.dp-nav:hover { background: var(--bg-hover); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-week { margin-bottom: 2px; }
.dp-wd { text-align: center; color: var(--text-dim); font-size: 11px; padding: 2px 0; }
.dp-cell {
  text-align: center; padding: 6px 0; border-radius: 7px; cursor: pointer; font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.dp-cell:hover:not(.dp-empty) { background: var(--bg-hover); }
.dp-empty { cursor: default; }
.dp-is-today { box-shadow: inset 0 0 0 1px var(--border); }
.dp-selected { background: var(--accent); color: var(--accent-text); }
.dp-selected:hover { background: var(--accent); }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; }
.dp-link { border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 12.5px; padding: 2px 4px; }
.dp-link:hover { text-decoration: underline; }
.btn {
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text);
  border-radius: 10px; padding: 7px 14px; cursor: pointer;
}
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn.danger { color: var(--negative); }
.btn[disabled] { opacity: 0.55; cursor: default; }

.app-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.app-chip {
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; cursor: pointer;
  background: var(--bg-elevated); color: var(--text-dim); font-size: 13px;
}
.app-chip.active { border-color: var(--accent); color: var(--text); background: var(--bg-hover); }

/* ---------- KPI ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.kpi {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi .label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi .delta { font-size: 12px; margin-top: 2px; }
.delta.up { color: var(--positive); }
.delta.down { color: var(--negative); }
/* Crash/ANR rate above Play Console's bad-behaviour threshold. */
td.rate-bad { color: var(--negative); font-weight: 600; }

/* Engagement: per-store active-devices metric caption (full width in the legend) */
.eng-note { flex-basis: 100%; color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.eng-note b { color: var(--text); font-weight: 600; }

/* Per-view "how it's calculated" methodology footnote */
.methodology { margin-top: 18px; }
.m-details { border-top: 1px solid var(--border); }
.m-details > summary { cursor: pointer; padding: 12px 2px; color: var(--text-dim); font-size: 13px; list-style: none; user-select: none; }
.m-details > summary::-webkit-details-marker { display: none; }
.m-details > summary::before { content: 'ⓘ '; }
.m-details[open] > summary { color: var(--text); }
.m-details > summary:hover { color: var(--text); }
.m-body { color: var(--text-dim); font-size: 13px; line-height: 1.6; padding: 4px 2px 14px; max-width: 900px; }
.m-body b { color: var(--text); font-weight: 600; }
.m-body i { color: var(--text); font-style: normal; background: var(--bg-hover); padding: 0 4px; border-radius: 4px; font-size: 12px; }
.m-note { display: inline-block; margin-top: 6px; color: var(--text-dim); opacity: 0.85; }

/* ---------- Chart card ---------- */
.card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head .spacer { flex: 1; }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
#playpass-chart svg { display: block; width: 100%; height: auto; }
#playpass-chart rect { transition: opacity 0.1s; }
#playpass-chart rect:hover { opacity: 0.85; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 10px 12px; font-size: 12.5px; min-width: 180px;
  display: none;
}
.chart-tooltip .tt-date { font-weight: 700; margin-bottom: 6px; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; }
.chart-tooltip .tt-row .name { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.chart-tooltip .dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-tooltip .tt-total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; font-weight: 700; }
.chart-tooltip .tt-event { margin-top: 6px; color: var(--text-dim); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.legend .item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Two-column bottom ---------- */
.bottom { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .bottom { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.share-bar { height: 4px; border-radius: 2px; background: var(--accent); margin-top: 4px; }

/* ---------- LiveOps ---------- */
.event-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.event-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.event-item .type-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }
.event-item .meta { flex: 1; min-width: 0; }
.event-item .title { font-weight: 600; font-size: 13.5px; }
.event-item .sub { color: var(--text-dim); font-size: 12px; margin-top: 1px; }
.event-item .actions { display: flex; gap: 4px; }
.event-item .actions button {
  border: 0; background: transparent; cursor: pointer; color: var(--text-dim); padding: 2px 5px; border-radius: 6px;
}
.event-item .actions button:hover { background: var(--bg-hover); color: var(--text); }

.event-form { display: grid; gap: 9px; margin-top: 12px; }
.event-form .row { display: flex; gap: 8px; }
.event-form select, .event-form input, .event-form textarea {
  width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.event-form textarea { resize: vertical; min-height: 48px; }
.form-title { font-weight: 700; margin-top: 4px; }

/* LiveOps table filter bar */
.events-count { color: var(--text-dim); font-size: 12px; }
.ev-filter-select, .ev-filter-search {
  padding: 7px 9px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); font: inherit;
}
.ev-filter-select { min-width: 170px; }
.ev-filter-search { min-width: 200px; flex: 1; max-width: 320px; }

.empty { color: var(--text-dim); text-align: center; padding: 26px 0; }
.hint { color: var(--text-dim); font-size: 13px; margin: 0 0 16px; max-width: 640px; }

/* ---------- Apps page ---------- */
.game-group {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--bg);
}
.game-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.game-title { font-weight: 700; font-size: 15px; }
.game-badge {
  font-size: 11px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px;
}
.game-badge.single { color: var(--negative); border-color: var(--negative); }
.listing-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.listing-row + .listing-row { border-top: 1px solid var(--border); }
.platform-tag {
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 7px; white-space: nowrap; min-width: 92px; text-align: center;
}
.platform-tag.apple { background: rgba(10, 132, 255, 0.18); color: #4aa3ff; }
.platform-tag.google { background: rgba(52, 168, 83, 0.18); color: #46c266; }
.listing-row .store-id { flex: 1; color: var(--text-dim); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.app-name-input {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text); font: inherit; min-width: 220px;
}
.app-name-input:focus { outline: none; border-color: var(--accent); }

/* ---------- Nav ---------- */
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  color: var(--text-dim); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 13.5px;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav a.active { background: var(--bg-hover); color: var(--text); font-weight: 600; }
.link { color: var(--accent); text-decoration: none; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* ---------- Dashboard sub-tabs ---------- */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.subtab {
  border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
  padding: 10px 4px; margin-right: 18px; font-size: 15px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Countries view ---------- */
.country-table td.country-cell { position: relative; }
.country-table .flag { margin-right: 8px; font-size: 15px; }
.country-table tbody tr:hover { background: var(--bg-hover); }
.country-table .share-bar { background: var(--accent); opacity: 0.5; }

/* ---------- Cross-promo matrix ---------- */
.cp-wrap { overflow-x: auto; }
.cp-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.cp-matrix th, .cp-matrix td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.cp-matrix thead th { color: var(--text-dim); font-weight: 600; text-align: right; }
.cp-matrix thead th.cp-corner { text-align: left; color: var(--text-dim); font-weight: 500; }
.cp-matrix .cp-rowhead { text-align: left; font-weight: 600; color: var(--text); }
.cp-matrix td.cp-diag { color: var(--text-dim); text-align: center; opacity: 0.5; }
.cp-matrix .cp-total { font-weight: 600; color: var(--text-dim); border-left: 1px solid var(--border); }
.cp-matrix tfoot .cp-total, .cp-matrix .cp-grand { border-top: 1px solid var(--border); }
.cp-matrix .cp-grand { font-weight: 700; border-left: 1px solid var(--border); }
.cp-matrix tfoot .cp-rowhead { color: var(--text-dim); }
.cp-trend-title { font-size: 13px; color: var(--text-dim); font-weight: 600; margin: 22px 0 8px; }

/* ---------- Cross-promo manifest editor ---------- */
.cp-dim { color: var(--text-dim); font-size: 11.5px; }
.cp-err { color: var(--negative); font-size: 12.5px; }
.cp-note { color: var(--positive); font-size: 12.5px; }
.cp-dirty {
  color: var(--negative); border: 1px solid var(--negative); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.cp-list { width: 100%; border-collapse: collapse; font-size: 13px; }
.cp-list td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cp-list tr:hover { background: var(--bg-hover); }
.cp-acts { text-align: right; white-space: nowrap; }
.cp-row-danger td { background: color-mix(in srgb, var(--negative) 8%, transparent); }
.cp-row-danger .cp-err { margin-right: 8px; white-space: normal; }
.cp-acts .btn + .btn { margin-left: 6px; }

.cp-field { display: flex; flex-direction: column; gap: 4px; }
/* Only the field's own caption and text box — radios/checkboxes nested in a
   field (the platform picker) keep their native look. */
.cp-field > label { color: var(--text-dim); font-size: 11.5px; font-weight: 600; }
.cp-field input:not([type='radio']):not([type='checkbox']) {
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; width: 100%;
}
.cp-field input:focus { outline: none; border-color: var(--accent); }
.cp-chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.cp-chk code, .cp-list code { font-size: 11.5px; }
.cp-span { grid-column: 1 / -1; }
.cp-variant { display: flex; align-items: center; gap: 14px; min-height: 33px; }

.cp-top-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.cp-newform {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 16px;
}
.cp-newform .cp-field { flex: 0 1 220px; }
.cp-newform .hint { flex-basis: 100%; margin: 0; }
.cp-newform .cp-list { flex-basis: 100%; }
.cp-newform .cp-item-head { flex-basis: 100%; }

.cp-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.cp-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cp-item-head .spacer { flex: 1; }
.cp-item-no {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--bg-hover); color: var(--text-dim); font-size: 12px; font-weight: 700;
}
.cp-item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

.cp-art-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.cp-art-slot {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  flex: 1 1 260px; border-top: 1px solid var(--border); padding-top: 12px;
}
.cp-art-label { color: var(--text-dim); font-size: 11.5px; font-weight: 600; }
.cp-thumb {
  max-width: 220px; max-height: 130px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-elevated); object-fit: contain;
}
.cp-thumb-empty {
  display: flex; align-items: center; justify-content: center; width: 160px; height: 90px;
  color: var(--text-dim); font-size: 12px; border-style: dashed;
}
.cp-thumb-broken { outline: 1px solid var(--negative); }
.cp-thumb-mini { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.cp-art-path {
  color: var(--text-dim); font-size: 11px; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cp-art-url {
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 8px; padding: 5px 8px; font-size: 11.5px; width: 100%; max-width: 260px;
}
.cp-art-url:focus { outline: none; border-color: var(--accent); color: var(--text); }

.cp-upload { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 18px; }
.cp-upload-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.cp-upload-row select, .cp-upload-row input[type="text"] {
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px;
}
.cp-upload-row input[type="file"] { font-size: 12.5px; color: var(--text-dim); max-width: 260px; }
.cp-upload .hint { margin: 0; }

.cp-art-group h4 { margin: 18px 0 10px; font-size: 13px; color: var(--text-dim); }
.cp-art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cp-tile {
  display: flex; flex-direction: column; gap: 4px; align-items: center; cursor: pointer;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; color: var(--text); font: inherit; font-size: 12px;
}
.cp-tile:hover { border-color: var(--accent); }
.cp-tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cp-tile img { max-width: 100%; max-height: 90px; object-fit: contain; border-radius: 6px; }
.cp-tile-name { word-break: break-all; text-align: center; }

/* Store-health drill-downs + Play Pass */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 20px; }
.mini-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--bg); }
.mini-card h4 { margin: 0 0 10px; font-size: 13.5px; }
.mini-card table { font-size: 13px; }
.mini-note { color: var(--text-dim); font-weight: 400; font-size: 11.5px; }
.mini-total td { border-top: 1px solid var(--border); font-weight: 700; }

/* ---------- Dashboard selected-event widget ---------- */
.event-picker {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; margin-bottom: 12px;
}
.type-chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px; color: #fff;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.event-detail .detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.event-detail .detail-game { font-weight: 700; font-size: 15px; }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 14px; }
.detail-grid dt { color: var(--text-dim); font-size: 12.5px; }
.detail-grid dd { margin: 0; font-size: 13.5px; }
.detail-actions { display: flex; gap: 8px; }

/* Event impact / uplift */
.event-impact { border-top: 1px solid var(--border); margin: 4px 0 14px; padding-top: 12px; }
.impact-title { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.impact-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.impact-label { color: var(--text-dim); min-width: 62px; }
.impact-vals { flex: 1; }
.impact-vals .per-day { color: var(--text-dim); }
.up-badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.up-badge.up { background: rgba(52, 211, 153, 0.16); color: var(--positive); }
.up-badge.down { background: rgba(248, 113, 113, 0.16); color: var(--negative); }
.up-badge.muted { background: var(--bg-hover); color: var(--text-dim); font-weight: 600; }
.impact-cell { white-space: nowrap; }

/* ---------- LiveOps page ---------- */
.event-form-wide {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 8px;
}
.event-form-wide .field { display: flex; flex-direction: column; gap: 4px; }
.event-form-wide .field > label { color: var(--text-dim); font-size: 12px; }
.event-form-wide .field select { min-width: 160px; }
.event-form-wide .field-grow { flex: 1; min-width: 200px; }
.event-form-wide .field-actions { flex-direction: row; gap: 8px; }
.desc-cell { color: var(--text-dim); max-width: 320px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions button {
  border: 0; background: transparent; cursor: pointer; color: var(--text-dim); padding: 3px 6px; border-radius: 6px;
}
.row-actions button:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- Steam scout ---------- */
.steam-add { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.steam-add input {
  flex: 1; min-width: 220px; max-width: 440px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 12px; font-size: 13.5px;
}
.steam-add input:focus { outline: none; border-color: var(--accent); }
.steam-add-result { font-size: 13px; color: var(--text-dim); }
.steam-add-result.ok { color: var(--text); }
.steam-add-result.err { color: var(--negative); }
.steam-add-result a { color: var(--accent); text-decoration: none; }
.steam-add-result a:hover { text-decoration: underline; }
.steam-onmobile { color: var(--text-dim); }
.owners-est { color: var(--text-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
/* scoring weights editor */
.w-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 14px; }
.w-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.w-card h4 { margin: 0 0 12px; font-size: 14px; }
.w-hint { display: block; color: var(--text-dim); font-size: 11.5px; font-weight: 400; margin-top: 2px; }
.w-card h4 .w-hint { display: inline; margin-left: 6px; }
.w-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.w-label { font-size: 13px; color: var(--text); }
.w-row input, .w-add input, .w-tag input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 9px; font-size: 13px; width: 84px; text-align: right;
}
.w-row input:focus, .w-add input:focus, .w-tag input:focus { outline: none; border-color: var(--accent); }
.w-sum { margin-top: 10px; font-size: 12.5px; color: var(--text-dim); }
.w-sum .w-ok { color: var(--positive); }
.w-sum .w-warn { color: #eab308; }
.w-add { display: flex; gap: 8px; margin-bottom: 12px; }
.w-add #w-new-tag { flex: 1; text-align: left; width: auto; }
.w-taglist { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px; max-height: 340px; overflow-y: auto; }
.w-tag { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 8px; }
.w-tag:hover { background: var(--bg-hover); }
.w-tag-name { flex: 1; font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-tag input { width: 64px; }
.w-del { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; padding: 2px 5px; border-radius: 6px; }
.w-del:hover { background: var(--bg-hover); color: var(--negative); }
.w-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* Auto-scan panel */
.sched-status > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.sched-status > div:last-child { border-bottom: 0; }
.sched-status b { font-size: 13px; font-weight: 600; text-align: right; }
.sched-live { color: var(--accent); }
.sched-live::before { content: '● '; }
.sched-err { color: var(--negative); font-size: 11.5px; display: block; }
.sched-history td, .sched-history th { font-size: 12.5px; }

.trend { font-size: 11px; font-weight: 600; }
.trend.up { color: var(--positive); }
.trend.down { color: var(--negative); }
.steam-chk, .steam-num { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13px; }
.steam-num input { width: 78px; }
.steam-table .steam-name { color: var(--text); font-weight: 600; text-decoration: none; }
.steam-table .steam-name:hover { text-decoration: underline; }
.steam-sub { color: var(--text-dim); font-size: 12px; margin-top: 3px; line-height: 1.4; }
.score-pill { display: inline-block; min-width: 30px; text-align: center; padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.score-pill.hot { background: rgba(52, 211, 153, 0.18); color: var(--positive); }
.score-pill.warm { background: rgba(234, 179, 8, 0.16); color: #eab308; }
.score-pill.cold { background: var(--bg-hover); color: var(--text-dim); }
.mob-badge { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; margin-right: 4px; text-decoration: none; }
a.mob-badge:hover { filter: brightness(1.2); }
.mob-badge.ios { background: rgba(10, 132, 255, 0.18); color: #4aa3ff; }
.mob-badge.and { background: rgba(52, 168, 83, 0.18); color: #46c266; }
.tag-ours { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; font-size: 11px; background: var(--bg-hover); color: var(--text-dim); }
.tag-engine { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
/* Newly-added titles (since last visit) */
.tag-new { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.4px; background: var(--positive, #34d399); color: #04170f; vertical-align: middle; }
.steam-table tr.steam-new td { background: rgba(52, 211, 153, 0.08); }
.steam-table tr.steam-new td:first-child { box-shadow: inset 3px 0 0 var(--positive, #34d399); }
/* List bar: new-chip + pager */
.steam-listbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 2px 10px; }
.steam-listbar.bottom { margin: 12px 2px 2px; }
.steam-newchip { border: 1px solid var(--positive, #34d399); background: rgba(52, 211, 153, 0.1); color: var(--text); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 12.5px; }
.steam-newchip.active { background: var(--positive, #34d399); color: #04170f; font-weight: 600; }
.steam-pager { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-dim); }
.steam-pager button { border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.steam-pager button[disabled] { opacity: 0.4; cursor: default; }
.steam-store-link { margin-left: 8px; font-size: 11px; color: var(--text-dim); text-decoration: none; }
.steam-store-link:hover { color: var(--accent); }
.tag-soon { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; background: rgba(234, 179, 8, 0.16); color: #eab308; font-weight: 600; }
/* Rank inside Valve's wishlist-ordered "Popular Upcoming" shelf. */
.tag-rank { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 11px; background: rgba(56, 189, 248, 0.16); color: #38bdf8; font-weight: 600; }
/* Wishlist figure is derived from followers — dimmed so it reads as an estimate. */
.wl-est { color: var(--text-dim); font-size: 11px; white-space: nowrap; }

/* ==================== Mobile (≤720px) ==================== */
@media (max-width: 720px) {
  .page { padding: 12px 12px 48px; }
  .card { padding: 13px; }

  /* Topbar wraps: brand + actions on row 1, nav on its own scrollable row */
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  .topbar .brand { font-size: 15px; }
  .topbar .spacer { display: none; }
  .sync-note { display: none; }
  #sync-btn { margin-left: auto; }        /* push actions to the right of row 1 */
  .user-chip span { display: none; }       /* keep just the avatar */
  .nav { order: 5; flex-basis: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 2px; }
  .nav a { white-space: nowrap; padding: 6px 10px; }

  /* Sub-tabs scroll horizontally instead of overflowing */
  .subtabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; margin-bottom: 12px; }
  .subtab { font-size: 14px; padding: 9px 2px; margin-right: 16px; white-space: nowrap; }

  /* Controls: tighter, tappable */
  .controls { gap: 8px; }
  .seg button { padding: 6px 10px; font-size: 12.5px; }
  .app-chip { font-size: 12px; padding: 4px 10px; }
  .custom-range { flex-wrap: wrap; }
  .date-field { min-width: 120px; }

  /* KPIs: 2-up */
  .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 20px; }

  #chart, #legend { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mini-grid { grid-template-columns: 1fr; }

  /* Mini drill-down tables fit the width instead of scrolling */
  .mini-card table { min-width: 0; width: 100%; font-size: 12.5px; }

  /* Wide data tables → stacked cards: one row = one card, labels shown inline.
     Reads cleanly on a phone instead of overflowing / squeezing columns. */
  .responsive-table { min-width: 0; width: 100%; display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tbody { display: block; }
  .responsive-table tr { display: block; padding: 11px 0; border-bottom: 1px solid var(--border); }
  .responsive-table tbody tr:last-child { border-bottom: 0; }
  .responsive-table td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    padding: 3px 0; text-align: right; border: 0; font-size: 13.5px;
  }
  .responsive-table td::before {
    content: attr(data-label); color: var(--text-dim); font-size: 12px; font-weight: 500;
    text-align: left; white-space: nowrap; flex: none;
  }
  /* First cell is the row's title (game / country / event): full width, no label */
  .responsive-table td:first-child {
    display: block; text-align: left; font-weight: 600; font-size: 14.5px; padding: 0 0 7px;
  }
  .responsive-table td:first-child::before { content: none; }
  .responsive-table td:empty { display: none; }
  .responsive-table .share-bar { margin-top: 7px; }
  /* Long free-text cells stack their value under the label, left-aligned */
  .responsive-table td.desc-cell { display: block; text-align: left; color: var(--text); }
  .responsive-table td.desc-cell:empty { display: none; }
  .responsive-table td.desc-cell::before { display: block; margin-bottom: 2px; }
  .responsive-table td.row-actions { justify-content: flex-end; gap: 8px; padding-top: 8px; }
  .responsive-table td.row-actions::before { content: none; }

  /* LiveOps page form: fields stack full-width */
  .event-form-wide .field { flex: 1 1 100%; }
  .event-form-wide .field select { min-width: 0; width: 100%; }
  .event-form-wide .field-grow { min-width: 0; }

  /* Apps page: listing row reflows to two lines (tag+id, then input+save)
     so the name field and Save button never run off-screen. */
  .listing-row {
    display: grid; align-items: center; gap: 7px 10px;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "tag id id" "input input save";
  }
  .listing-row .platform-tag { grid-area: tag; }
  .listing-row .store-id { grid-area: id; flex: none; word-break: break-all; }
  .listing-row .app-name-input { grid-area: input; min-width: 0; width: 100%; }
  .listing-row .btn { grid-area: save; }
  .game-head { flex-wrap: wrap; }

  /* Login card fits the viewport */
  .login-card { padding: 32px 24px; width: calc(100% - 24px); }
}

/* ---------- Steam title page ---------- */
.st-back { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.st-back a { color: var(--accent); text-decoration: none; font-size: 14px; }
.st-back a:hover { text-decoration: underline; }
.st-h { margin: 26px 0 10px; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.st-muted { color: var(--text-dim); }

.st-head { display: flex; gap: 20px; flex-wrap: wrap; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; }
.st-art { width: 292px; max-width: 100%; border-radius: 8px; align-self: flex-start; }
.st-head-body { flex: 1; min-width: 260px; }
.st-head-body h2 { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-by { margin: 0 0 10px; color: var(--text-dim); font-size: 14px; }
.st-desc { margin: 10px 0; font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.st-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.st-badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); }
.st-badge.hot { border-color: #f59e0b55; color: #f59e0b; }
.st-badge.cool { border-color: #4f8ef755; color: var(--accent); }
.st-badge s { opacity: 0.5; margin-left: 4px; }
.st-links { margin: 10px 0 0; font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.st-links a { color: var(--accent); text-decoration: none; }
.st-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.st-tags span { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--bg-hover); color: var(--text-dim); }

.st-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.st-kpi { position: relative; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px 14px; }
.st-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-dim); }
.st-kpi-value { font-size: 24px; font-weight: 600; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.st-kpi.good .st-kpi-value { color: var(--positive); }
.st-kpi.bad .st-kpi-value { color: var(--negative); }
.st-kpi-sub { font-size: 12px; color: var(--text-dim); line-height: 1.35; min-height: 16px; }
.st-tag { position: absolute; top: 10px; right: 10px; font-size: 9px; letter-spacing: 0.08em;
  padding: 2px 5px; border-radius: 3px; font-weight: 700; }
.st-tag.f { background: #34d39922; color: var(--positive); }
.st-tag.e { background: #f59e0b22; color: #f59e0b; }

.st-cards { display: grid; gap: 12px; }
.st-cards.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.st-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.st-card-head { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-dim);
  font-weight: 600; margin-bottom: 10px; }
.st-note { margin-top: 10px; font-size: 12px; color: var(--text-dim); line-height: 1.45; }

.st-chart { width: 100%; height: auto; display: block; overflow: visible; }
.st-grid { stroke: var(--border); stroke-width: 1; }
.st-axis { fill: var(--text-dim); font-size: 11px; }
.st-hit:hover { fill: var(--text); fill-opacity: 0.05; }
.st-legend { display: flex; gap: 14px; margin-bottom: 8px; font-size: 12px; color: var(--text-dim); }
.st-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

.st-meter { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(36px, 1fr) auto; align-items: center;
  gap: 10px; font-size: 13px; padding: 4px 0; }
.st-meter > span:first-child { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-track { height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.st-track i { display: block; height: 100%; background: var(--accent); }
.st-track i.good { background: var(--positive); }
.st-track i.warn { background: var(--negative); }
.st-track i.cool { background: #a78bfa; }
.st-meter b { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 34px; text-align: right; }
.st-funnel .st-meter > span:first-child { text-transform: capitalize; }

.st-table { width: 100%; font-size: 13px; }
.st-table a { color: var(--accent); text-decoration: none; }
.st-news { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.st-news li { padding: 5px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.st-news li:last-child { border-bottom: 0; }
.st-news a { color: var(--text); text-decoration: none; }
.st-news a:hover { color: var(--accent); }

.st-prov { margin-top: 22px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; font-size: 13px; }
.st-prov summary { cursor: pointer; color: var(--text-dim); font-weight: 600; }
.st-prov h4 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.st-prov ul { margin: 0; padding-left: 18px; line-height: 1.6; color: var(--text-dim); }
.st-prov b { color: var(--text); }
.st-prov code { background: var(--bg-hover); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

@media (max-width: 700px) {
  .st-art { width: 100%; }
  .st-kpis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .st-chart { min-height: 160px; }
}

/* --- Store watch --- */
.sw-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12.5px; cursor: pointer; }
.sw-warn { color: var(--negative); }
.sw-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.sw-add input {
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px;
}
.sw-add #sw-add-input { flex: 1 1 340px; }
.sw-add #sw-add-name { flex: 0 1 220px; }
.sw-add input:focus { outline: none; border-color: var(--accent); }
.sw-tbl td { vertical-align: top; }
.sw-tbl a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.sw-tbl a:hover { color: var(--accent); border-color: var(--accent); }
.sw-sub { color: var(--text-dim); font-size: 11.5px; margin-top: 2px; white-space: nowrap; }
.sw-tag { font-size: 10.5px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; margin-left: 6px; }
.sw-badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.sw-badge.ok { background: rgba(52, 211, 153, 0.16); color: var(--positive); }
.sw-badge.down { background: rgba(248, 113, 113, 0.2); color: var(--negative); }
.sw-badge.err { background: rgba(245, 158, 11, 0.16); color: #f59e0b; }
.sw-badge.unk, .sw-badge.off { background: var(--bg-hover); color: var(--text-dim); font-weight: 600; }
.sw-cc { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; margin-right: 4px; }
.sw-cc.ok { background: rgba(52, 211, 153, 0.14); color: var(--positive); }
.sw-cc.down { background: rgba(248, 113, 113, 0.18); color: var(--negative); }
.sw-cc.err { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.sw-strip { display: inline-flex; gap: 1px; align-items: flex-end; }
.sw-strip i { width: 3px; height: 16px; border-radius: 1px; background: var(--border); }
.sw-strip i.ok { background: var(--positive); opacity: 0.75; }
.sw-strip i.down { background: var(--negative); }
.sw-strip i.err { background: #f59e0b; opacity: 0.8; }
.sw-acts { white-space: nowrap; text-align: right; }
.sw-acts .btn { margin-left: 4px; }
.sw-row-down td { background: rgba(248, 113, 113, 0.06); }
.sw-row-off { opacity: 0.55; }

/* --- Discount alerts (LiveOps) --- */
.da-tbl td { vertical-align: middle; }
.da-row-alert td { background: rgba(248, 113, 113, 0.06); }
.da-note { white-space: normal; max-width: 320px; }

/* ---------- Discounts ---------- */
.dc-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dc-layout { grid-template-columns: 1fr; } }
.dc-hint { font-size: 12.5px; margin: 0; }
.dc-list { display: flex; flex-direction: column; gap: 6px; }
.dc-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.dc-item:hover { background: var(--bg-hover); }
.dc-item.active { border-color: var(--accent); }
.dc-item-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dc-item-sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.dc-badge { font-size: 10.5px; border-radius: 999px; padding: 1px 7px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.dc-badge.draft { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.dc-badge.sent { background: color-mix(in srgb, var(--positive) 18%, transparent); color: var(--positive); }
.dc-badge.base { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #f59e0b; }
.dc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.dc-field { display: flex; flex-direction: column; gap: 4px; }
.dc-field > label { color: var(--text-dim); font-size: 11.5px; font-weight: 600; }
.dc-field input, .dc-field select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; width: 100%; font: inherit;
}
.dc-field input:focus, .dc-field select:focus { outline: none; border-color: var(--accent); }
.dc-field .dc-count { font-size: 11px; color: var(--text-dim); text-align: right; }
.dc-linkbtn { border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 11px; padding: 0 4px; }
.dc-linkbtn:hover { text-decoration: underline; }
.dc-steam-input { flex: 1; min-width: 260px; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; }
.dc-warn { font-size: 12.5px; margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, #f59e0b 45%, transparent); background: color-mix(in srgb, #f59e0b 10%, transparent); color: var(--text); }
.dc-warn.soft { border-color: var(--border); background: transparent; color: var(--text-dim); }
.dc-guide { font-size: 12.5px; color: var(--text-dim); }
.dc-guide summary { cursor: pointer; color: var(--text); font-weight: 600; margin: 6px 0; }
.dc-guide ol { margin: 4px 0 8px; padding-left: 18px; }
.dc-guide li { margin: 3px 0; }
.dc-guide code { font-size: 11.5px; }
.dc-ref { font-size: 10px; color: #f59e0b; font-weight: 700; margin-left: 3px; cursor: help; }
.dc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.dc-actions .spacer { flex: 1; }
.dc-note { color: var(--text-dim); font-size: 12.5px; }
.dc-note.ok { color: var(--positive); }
.dc-note.err { color: var(--negative); }
.dc-import { border: 1px dashed var(--border); border-radius: 10px; padding: 12px; margin-bottom: 14px; background: var(--bg); }
.dc-import textarea {
  width: 100%; min-height: 90px; resize: vertical; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px;
}
.dc-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--text-dim); font-size: 12.5px; }
.dc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dc-table th { position: sticky; top: 0; background: var(--bg-elevated); z-index: 1; }
.dc-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dc-table tbody tr:hover { background: var(--bg-hover); }
.dc-region td { background: var(--bg); font-weight: 700; padding: 8px; }
.dc-region-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dc-region-bar .dc-region-name { margin-right: auto; }
.dc-region-bar input, .dc-region-bar select {
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 4px 7px; font: inherit; font-size: 12.5px; font-weight: 400;
}
.dc-region-bar input { width: 74px; }
.dc-region-bar .dc-region-hint { color: var(--text-dim); font-weight: 400; font-size: 12px; }
.dc-flag { margin-right: 6px; }
.dc-cur { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.dc-sale {
  width: 110px; text-align: right; font-variant-numeric: tabular-nums;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 4px 8px; font: inherit; font-size: 13px;
}
.dc-sale:focus { outline: none; border-color: var(--accent); }
.dc-sale.changed { border-color: var(--accent); }
.dc-sale.bad { border-color: var(--negative); }
.dc-eff { font-variant-numeric: tabular-nums; color: var(--text-dim); }
.dc-eff.off { color: #f59e0b; }
.dc-eff.far { color: var(--negative); }
.dc-ending { display: inline-flex; gap: 3px; }
.dc-ending button {
  border: 1px solid var(--border); background: transparent; color: var(--text-dim); border-radius: 6px;
  padding: 1px 6px; font-size: 11px; cursor: pointer;
}
.dc-ending button:hover { color: var(--text); background: var(--bg-hover); }
.dc-ending button.on { border-color: var(--accent); color: var(--text); }
.dc-locked .dc-sale, .dc-locked .dc-ending button, .dc-locked .dc-region-bar input, .dc-locked .dc-region-bar select { pointer-events: none; opacity: 0.6; }

/* ---------- Users / roles ---------- */
.role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.3px; border: 1px solid var(--border); color: var(--text-dim); background: var(--bg);
}
.role-badge.admin { color: #f59e0b; border-color: rgba(245, 158, 11, 0.5); }
.role-badge.analytics { color: #4aa3ff; border-color: rgba(79, 142, 247, 0.5); }
.role-badge.member { color: #46c266; border-color: rgba(52, 168, 83, 0.5); }
.user-chip .role-badge { margin-left: 2px; }

.user-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.user-add input, .user-add select {
  padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.user-add input { min-width: 260px; }

.users-table .user-cell { display: flex; align-items: center; gap: 10px; }
.users-table .user-cell img, .users-table .avatar-fallback {
  width: 28px; height: 28px; border-radius: 50%; flex: none; background: var(--bg-hover);
}
.users-table .user-cell > span { display: flex; flex-direction: column; min-width: 0; }
.users-table .user-email { font-weight: 600; }
.users-table .user-name { color: var(--text-dim); font-size: 12px; }
.users-table .you { color: var(--text-dim); font-weight: 400; font-size: 11.5px; margin-left: 4px; }
.users-table td.dim { color: var(--text-dim); font-size: 12.5px; }
.users-table tr.me td { background: var(--bg); }
.role-select {
  padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: 13px;
}
.roles-legend { margin-top: 14px; line-height: 1.9; }
@media (max-width: 720px) {
  .user-add input { min-width: 0; flex: 1 1 100%; }
}
