/* Fuzta Fi Advertiser — desktop layout (amber accent). */
:root {
  --pine: #0c2b24;
  --pine-2: #14392f;
  --sand: #f1e9da;
  --cream: #eae1cf;
  --mint: #4ade9c;
  --amber: #f5a623;
  --coral: #f26b4e;
  --ink: #0c2b24;
  --muted: #6b7a70;
  --muted-2: #8fa89a;
  --line: #e0d5c0;
  --line-2: #e8dfcc;
  --sidebar-w: 224px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
}

h1, h2, .display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────────────────────────────── */
#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--pine) 0%, var(--pine-2) 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(241, 233, 218, 0.12);
  border-radius: 20px;
  padding: 28px 24px;
  color: var(--sand);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.login-card .brand {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 6px;
}

.login-card h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 10px;
  color: var(--sand);
}

.login-card .lede {
  opacity: 0.8;
  margin: 0 0 22px;
  font-size: 15px;
}

.login-card label {
  display: block;
  font-size: 13px;
  opacity: 0.75;
  margin: 0 0 6px;
}

.login-card input {
  width: 100%;
  padding: 14px;
  font-size: 17px;
  border-radius: 12px;
  border: 1px solid rgba(241, 233, 218, 0.2);
  background: rgba(241, 233, 218, 0.06);
  color: var(--sand);
  margin-bottom: 16px;
  font-family: inherit;
}

.login-card input:focus {
  outline: 2px solid var(--amber);
  border-color: transparent;
}

.login-card input.otp {
  letter-spacing: 0.4em;
  text-align: center;
  font-size: 22px;
}

.login-card button {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: var(--amber);
  color: var(--pine);
  cursor: pointer;
  font-family: inherit;
}

.login-card button:disabled { opacity: 0.5; cursor: default; }

.login-card button.ghost {
  background: transparent;
  color: var(--sand);
  border: 1px solid rgba(241, 233, 218, 0.2);
  margin-top: 10px;
}

.login-card .hint {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 14px;
}

.msg { min-height: 20px; font-size: 13px; margin: 4px 0 12px; }
.msg.error { color: var(--coral); }
.msg.ok { color: var(--mint); }
.panel .msg.error { color: var(--coral); }

/* ── App shell ─────────────────────────────────────────────────────────── */
#screen-app {
  display: flex;
  min-height: 100vh;
  min-width: 1100px;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--pine);
  color: var(--sand);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  box-sizing: border-box;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
}

.sidebar-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--pine-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand .name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-brand .sub {
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav button {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #c9d6cd;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.nav button:hover { background: var(--pine-2); }

.nav button.active {
  background: var(--pine-2);
  color: var(--amber);
  font-weight: 600;
}

.sidebar-foot {
  margin-top: auto;
  background: var(--pine-2);
  border-radius: 12px;
  padding: 12px;
}

.sidebar-foot .k {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.sidebar-foot .v {
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 3px;
}

.sidebar-foot .m {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 2px;
}

.sidebar-foot .logout {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(241, 233, 218, 0.15);
  background: transparent;
  color: var(--sand);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.main {
  flex: 1;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
  overflow-x: auto;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-head h1 {
  font-size: 24px;
  margin: 0;
}

.page-head .sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page { display: none; flex-direction: column; gap: 18px; }
.page.active { display: flex; }

/* KPI */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.kpi-row.six { grid-template-columns: repeat(6, 1fr); }
.kpi-row.four { grid-template-columns: repeat(4, 1fr); }

.kpi {
  background: var(--sand);
  border-radius: 16px;
  padding: 18px;
}

.kpi.compact { padding: 14px 16px; }
.kpi.compact .value { font-size: 22px; }

.kpi.dark {
  background: var(--pine);
  color: var(--sand);
}

.kpi .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.kpi.dark .label { color: var(--muted-2); }

.kpi .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
}

.kpi.dark .value { color: var(--amber); }

.kpi .meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.kpi.dark .meta { color: var(--muted-2); }

/* Panels */
.panel {
  background: var(--sand);
  border-radius: 16px;
  padding: 20px 22px;
}

.panel.inset {
  background: var(--sand);
  margin-bottom: 14px;
}

.panel.dark {
  background: var(--pine);
  color: var(--sand);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.panel-sub {
  font-size: 12px;
  color: var(--muted);
}

/* Charts */
.legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.swatch.pine { background: var(--pine-2); }
.swatch.mint { background: var(--mint); }
.swatch.amber { background: var(--amber); }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 180px;
  margin-top: 18px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow-x: auto;
}

.chart-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 28px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  width: 100%;
  justify-content: center;
}

.chart-bar {
  width: 10px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--pine-2);
}

.chart-bar.amber { background: var(--amber); }
.chart-bar.mint { background: var(--mint); }

.chart-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

/* Segmented control */
.seg {
  display: inline-flex;
  background: var(--sand);
  border: 1px solid #d8cdb8;
  border-radius: 10px;
  overflow: hidden;
}

.seg button {
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
}

.seg button.active {
  background: var(--pine);
  color: var(--sand);
}

.filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.filter-label select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d8cdb8;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--pine);
  color: var(--sand);
}

.btn:disabled { opacity: 0.5; cursor: default; }

.btn.ghost {
  background: var(--sand);
  color: var(--ink);
  border: 1px solid #d8cdb8;
}

.btn.amber { background: var(--amber); color: var(--pine); }
.btn.pine { background: var(--pine); color: var(--sand); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.danger { color: var(--coral); border-color: rgba(242, 107, 78, 0.35); }
.btn.link {
  background: transparent;
  color: var(--muted);
  padding: 0;
  text-decoration: underline;
  font-weight: 500;
  font-size: 12px;
}

/* Tables */
.table-wrap { overflow-x: auto; margin-top: 8px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data.dense { font-size: 12.5px; }

table.data th {
  text-align: left;
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data td {
  padding: 13px 8px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

table.data.dense td { padding: 10px 6px; }

table.data tr:hover td { background: #ece3d0; }

table.data tr.clickable { cursor: pointer; }

table.data .name { font-weight: 600; }
table.data .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
table.data .mono {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 99px;
}

.pill.live {
  color: #1e8a5f;
  background: rgba(30, 138, 95, 0.12);
}

.pill.review {
  color: #c47d0e;
  background: rgba(196, 125, 14, 0.14);
}

.pill.ended,
.pill.paused {
  color: var(--muted);
  background: rgba(107, 122, 112, 0.14);
}

/* Locations */
.loc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.loc-meta {
  width: 200px;
  flex-shrink: 0;
  min-width: 0;
}

.loc-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.loc-track {
  flex: 1;
  height: 22px;
  background: #e0d5c0;
  border-radius: 6px;
  overflow: hidden;
}

.loc-bar {
  height: 100%;
  background: var(--amber);
  border-radius: 6px;
}

.loc-count {
  width: 52px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.loc-live {
  width: 40px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.loc-live.yes { color: #1e8a5f; }
.loc-live.no { color: var(--muted); }

.empty {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 0;
}

.page-error {
  background: rgba(242, 107, 78, 0.12);
  color: var(--coral);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d8cdb8;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.form-actions .msg { margin: 0; flex: 1; text-align: left; }

/* Billing */
.billing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.billing-card {
  background: var(--sand);
  border-radius: 16px;
  padding: 20px 22px;
}

.billing-card.dark {
  background: var(--pine);
  color: var(--sand);
}

.billing-card .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.billing-card.dark .label { color: var(--muted-2); }

.billing-card .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

.billing-card.dark .value { color: var(--amber); }

.billing-card .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.billing-card.dark .meta { color: var(--muted-2); }

.cap-track {
  height: 14px;
  border-radius: 99px;
  background: #e0d5c0;
  overflow: hidden;
  margin-top: 14px;
}

.cap-bar {
  height: 100%;
  background: var(--amber);
  border-radius: 99px;
  min-width: 0;
  transition: width 0.2s ease;
}

.billing-copy {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

/* Drawer (campaign detail) */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 43, 36, 0.45);
}

.drawer-panel {
  position: relative;
  width: min(560px, 100%);
  height: 100%;
  overflow: auto;
  background: var(--cream);
  padding: 22px 24px 32px;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.2);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 22px;
}

.drawer-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.compact-row { margin-bottom: 14px; }

a.ext {
  color: var(--pine);
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}

a.ext.none {
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  pointer-events: none;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
