/* ════════════════════════════════════════════════════════════════
   TEESHOPPEN · MARKETING DASHBOARD — design-system
   Minimal app · Montserrat · sand/cream + pine accent
   ════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  --sand: #e0d7cc;
  --sand-mist: #faf7f1;
  --sand-light: #f4efe7;
  --tan: #b59676;
  --ink: #1c1c1c;
  --ink-soft: #2a2a2a;
  --ink-2: #4a4a4a;
  --ink-muted: #6b6b6b;
  --ink-subtle: #9a9a9a;
  --paper: #fcfcfc;
  --slate: #47677d;
  --slate-tint: #eaf0f4;
  --sage: #6e9986;
  --sage-soft: #dde8e2;
  --pine: #1F3A3D;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --good: #2f7d52;
  --good-soft: #e4f1e9;
  --line: #ececec;
  --line-soft: #f3f3f3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.03);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }
html, body {
  font-family: 'Montserrat', -apple-system, Arial, sans-serif;
  color: var(--ink); font-size: 13.5px; line-height: 1.5;
  background: var(--sand-mist); min-height: 100vh;
}
img, svg, table { max-width: 100%; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
button { font-family: inherit; cursor: pointer; }

/* ── LOGIN ──────────────────────────────────────────────────────── */
#login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 48px 40px; width: 100%; max-width: 400px; text-align: center; }
.login-logo { font-size: 12px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--tan); margin-bottom: 22px; }
.login-title { font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.login-subtitle { font-size: 13.5px; color: var(--ink-muted); margin-bottom: 30px; }
.g_id_signin { display: flex; justify-content: center; }
.login-error { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 12px 16px; font-size: 13px; margin-top: 16px; display: none; }

/* ── APP SHELL ──────────────────────────────────────────────────── */
#app { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 50; background: white;
  border-bottom: 1px solid var(--line); padding: 11px 22px;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar-brand { display: flex; align-items: center; gap: 11px; }
.ts-mark { background: var(--pine); color: white; width: 24px; height: 24px; display: grid; place-items: center; font-weight: 800; font-size: 11px; border-radius: 6px; }
.topbar-wordmark { font-weight: 700; letter-spacing: 0.14em; font-size: 12px; text-transform: uppercase; }
.topbar-wordmark small { display: block; font-size: 9px; color: var(--ink-subtle); letter-spacing: .1em; font-weight: 600; }
.topbar-actions { display: flex; gap: 14px; align-items: center; color: var(--ink-muted); font-size: 12px; }
.topbar-actions .user-email { color: var(--ink-muted); }
.sign-out-btn { background: none; border: 1px solid var(--line); color: var(--ink-muted); font-size: 11.5px; padding: 5px 11px; border-radius: 6px; }
.sign-out-btn:hover { border-color: var(--ink-subtle); color: var(--ink); }

.layout { display: grid; grid-template-columns: 218px 1fr; min-height: calc(100vh - 47px); }
.sidebar { background: white; border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 47px; align-self: start; height: calc(100vh - 47px); overflow-y: auto; }
.nav-group { margin-bottom: 14px; }
.nav-group-title { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-subtle); padding: 0 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 13px; color: var(--ink-2); border-radius: 7px; margin-bottom: 1px; font-weight: 500; transition: background .14s, color .14s; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
.nav-item:hover { background: var(--sand-mist); }
.nav-item.active { background: var(--ink); color: white; font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-badge { margin-left: auto; background: var(--danger); color: white; font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }

.main { padding: 22px 30px 70px; max-width: 1240px; margin: 0 auto; width: 100%; }

/* ── PAGE HEADER + FILTERS ──────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.page-subtitle { font-size: 13px; color: var(--ink-muted); margin-top: 3px; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 16px 0 22px; }
.filter { display: flex; align-items: center; gap: 6px; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); }
.filter label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-subtle); font-weight: 700; }
.filter select { border: none; background: none; font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink); outline: none; cursor: pointer; }
.seg { display: inline-flex; background: var(--sand-light); border-radius: 8px; padding: 3px; }
.seg button { border: none; background: none; padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--ink-muted); border-radius: 6px; }
.seg button.active { background: white; color: var(--ink); box-shadow: var(--shadow); }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); background: white; color: var(--ink-2); transition: .14s; }
.btn:hover { border-color: var(--ink-subtle); }
.btn-primary { background: var(--ink); color: white; border-color: var(--ink); }
.btn-primary:hover { opacity: .88; }
.btn svg { width: 14px; height: 14px; }

/* ── KPI CARDS ──────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 17px; box-shadow: var(--shadow); position: relative; }
.kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-subtle); font-weight: 700; }
.kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 5px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.chg { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.chg.up { color: var(--good); } .chg.down { color: var(--danger); } .chg.flat { color: var(--ink-subtle); }
.chg svg { width: 11px; height: 11px; }
.kpi-sub { color: var(--ink-subtle); }
.kpi-target { margin-top: 10px; }
.kpi-bar { height: 6px; border-radius: 4px; background: var(--sand-light); overflow: hidden; }
.kpi-bar span { display: block; height: 100%; border-radius: 4px; background: var(--sage); }
.kpi-bar span.over { background: var(--good); }
.kpi-bar span.under { background: var(--warn); }
.kpi-target-txt { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-subtle); margin-top: 5px; font-weight: 600; }

/* ── PANELS / CARDS ─────────────────────────────────────────────── */
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-title { font-size: 14px; font-weight: 700; }
.panel-title small { display: block; font-size: 11px; color: var(--ink-subtle); font-weight: 500; margin-top: 2px; }
.panel-body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .layout { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ── TABLES ─────────────────────────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th { text-align: right; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-subtle); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: var(--sand-mist); }
table.data tr.total td { font-weight: 800; border-top: 2px solid var(--line); background: var(--sand-light); }
table.data .ch-name { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.cell-pos { color: var(--good); font-weight: 700; }
.cell-neg { color: var(--danger); font-weight: 700; }

/* ── BARS in cells (revenue share etc.) ─────────────────────────── */
.minibar { display: inline-block; width: 56px; height: 6px; border-radius: 3px; background: var(--sand-light); vertical-align: middle; margin-left: 7px; overflow: hidden; }
.minibar span { display: block; height: 100%; background: var(--slate); }

/* ── PACING GAUGE ───────────────────────────────────────────────── */
.gauge-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.gauge { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.gauge svg { transform: rotate(-90deg); }
.gauge-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge-pct { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.gauge-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-subtle); font-weight: 700; }
.gauge-stats { display: flex; flex-direction: column; gap: 12px; }
.gstat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-subtle); font-weight: 700; }
.gstat-value { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.gstat-value small { font-size: 12px; font-weight: 600; color: var(--ink-muted); }

/* ── TREND CHART (inline SVG) ───────────────────────────────────── */
.chart { width: 100%; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-muted); margin-top: 10px; }
.chart-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ── BADGES / STATUS ────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }
.badge.live { background: var(--good-soft); color: var(--good); }
.badge.manual { background: var(--slate-tint); color: var(--slate); }
.badge.planned { background: var(--sand-light); color: var(--ink-muted); }
.badge .pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── ALERTS ─────────────────────────────────────────────────────── */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 10px; background: white; }
.alert-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.alert.warn .alert-ico { background: var(--warn-soft); color: var(--warn); }
.alert.danger .alert-ico { background: var(--danger-soft); color: var(--danger); }
.alert.good .alert-ico { background: var(--good-soft); color: var(--good); }
.alert-body h4 { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.alert-body p { font-size: 12px; color: var(--ink-muted); }
.alert-time { margin-left: auto; font-size: 10.5px; color: var(--ink-subtle); white-space: nowrap; }

/* ── NOTES ──────────────────────────────────────────────────────── */
.note { padding: 12px 14px; border-left: 3px solid var(--tan); background: var(--sand-mist); border-radius: 0 8px 8px 0; margin-bottom: 10px; }
.note-meta { font-size: 10.5px; color: var(--ink-subtle); font-weight: 600; margin-bottom: 3px; }
.note p { font-size: 12.5px; }
.note-input { display: flex; gap: 8px; margin-top: 8px; }
.note-input input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-family: inherit; font-size: 13px; outline: none; }
.note-input input:focus { border-color: var(--ink); }

/* ── EDITABLE TARGET INPUTS ─────────────────────────────────────── */
td input.target-input { width: 110px; text-align: right; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-family: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; outline: none; }
td input.target-input:focus { border-color: var(--ink); background: var(--sand-mist); }

/* ── SETTINGS / CHANNEL CARDS ───────────────────────────────────── */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.conn { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.conn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.conn-logo { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: white; font-weight: 800; font-size: 13px; }
.conn-name { font-size: 14px; font-weight: 700; }
.conn-group { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-subtle); font-weight: 700; }
.conn-metrics { font-size: 11.5px; color: var(--ink-muted); margin-top: 8px; line-height: 1.6; }

.empty { text-align: center; padding: 40px; color: var(--ink-subtle); font-size: 13px; }
.muted { color: var(--ink-subtle); }
footer.foot { text-align: center; padding: 26px; font-size: 11px; color: var(--ink-subtle); }
