/* =========================================================================
   ADORE — Meta Ads Control Center · Design System
   Dark premium · Spectral (editorial serif) + DM Sans + DM Mono
   Brand: Slate #464854 · Accent Blue #9ECDF3 · warm, family-first, premium
   ========================================================================= */

:root {
  /* surfaces — deep cool-warm slate, not pure black */
  --bg:      #101319;
  --bg-grad: radial-gradient(120% 90% at 50% -10%, #fbf9f5 0%, #f5f2ec 55%, #f1ede4 100%);
  --panel:   #fcfbf8;
  --panel-2: #f4f1ea;
  --card:    #ffffff;
  --inset:   #f1ece3;
  --line:    #eae3d7;
  --line-2:  #e0d8c9;
  --line-3:  #cbc0ad;

  --slate:   #464854;

  /* ink — warm near-black */
  --t1: #1b1713;
  --t2: #5b554b;
  --t3: #8a8478;
  --t4: #aaa496;

  /* accent — godeye forest green */
  --acc:      #318555;
  --acc-deep: #276b45;
  --acc-ink:  #ffffff;
  --acc-soft: color-mix(in srgb, var(--acc) 12%, transparent);
  --acc-line: color-mix(in srgb, var(--acc) 38%, transparent);

  /* status (oklch — tuned for light bg) */
  --ok:    oklch(0.52 0.12 150);   /* green  — active / scale */
  --ok-bg: oklch(0.52 0.12 150 / 0.12);
  --warn:    oklch(0.56 0.11 66);  /* amber  — fatigued / refresh */
  --warn-bg: oklch(0.56 0.11 66 / 0.14);
  --bad:    oklch(0.54 0.17 27);   /* red    — underperformer / pause */
  --bad-bg: oklch(0.54 0.17 27 / 0.12);
  --info:    oklch(0.52 0.11 245); /* blue   — insight / gathering */
  --info-bg: oklch(0.52 0.11 245 / 0.12);
  --neutral: #6b6558;
  --neutral-bg: rgba(27,23,19,0.06);

  --gold: oklch(0.55 0.10 72);     /* google amber accent */

  --r-sm: 8px;
  --r:    13px;
  --r-lg: 20px;
  --shadow: 0 1px 2px rgba(27,23,19,0.03), 0 14px 32px -22px rgba(27,23,19,0.18);
  --serif: "Spectral", Georgia, serif;
  --sans:  "DM Sans", system-ui, sans-serif;
  --mono:  "DM Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--t1);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
::selection { background: var(--acc-soft); }

/* scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #d8cfbf; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c6bba6; background-clip: content-box; }

.serif { font-family: var(--serif); }
.mono  { font-family: var(--mono); }

.shell { max-width: 1480px; margin: 0 auto; padding: 26px 30px 120px; }

/* ---- eyebrow / labels ---- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--t3);
}

/* =================== HEADER =================== */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.brandmark { display: flex; align-items: center; gap: 13px; }
.logo-unit { width: 34px; height: 34px; flex: none; }
.brand-eyebrow { color: var(--acc); letter-spacing: 0.34em; font-size: 11.5px; }
.h-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 40px; line-height: 1.02; letter-spacing: -0.02em;
  margin: 4px 0 7px;
}
.h-sub { color: var(--t3); font-size: 14px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.h-sub .arr { color: var(--t4); }
.h-sub b { color: var(--t2); font-weight: 500; }

.topbar-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 11px; }
.meta-of-meta { font-size: 12.5px; color: var(--t3); line-height: 1.7; }
.meta-of-meta b { color: var(--t2); font-weight: 500; }
.mode-pill {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 100px; border: 1px solid var(--line-2);
  color: var(--t2);
}
.mode-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t4); }
.mode-pill.live { color: var(--ok); border-color: oklch(0.52 0.12 150 / 0.4); }
.mode-pill.live .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }

/* refresh button */
.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--t1);
  padding: 10px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 9px;
  transition: 140ms ease; white-space: nowrap;
}
.btn:hover { border-color: var(--line-3); background: var(--inset); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 15px; height: 15px; display: inline-flex; }
.btn-accent { background: var(--acc); color: var(--acc-ink); border-color: transparent; font-weight: 600; }
.btn-accent:hover { background: var(--acc-deep); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: rgba(27,23,19,0.05); }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =================== PLATFORM CARDS =================== */
.platforms { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; }
.plat {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 24px; box-shadow: var(--shadow);
}
.plat-head { display: flex; align-items: center; gap: 9px; }
.plat-badge { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap; }
.plat.meta .plat-badge { color: var(--acc); }
.plat.google .plat-badge { color: var(--gold); }
.plat-num { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -0.02em; margin: 9px 0 2px; }
.plat-num small { font-family: var(--sans); font-size: 15px; font-weight: 400; color: var(--t2); letter-spacing: 0; }
.plat-sub { color: var(--t3); font-size: 13px; }
.plat .glow { position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; filter: blur(40px); opacity: 0.12; pointer-events: none; }
.plat.meta .glow { background: var(--acc); }
.plat.google .glow { background: var(--gold); }

/* =================== KPI STRIP =================== */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 13px; margin-top: 14px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 17px 16px; position: relative; overflow: hidden;
}
.kpi-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--t3); }
.kpi-val { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; line-height: 1; }
.kpi-val small { font-family: var(--sans); font-size: 14px; font-weight: 400; color: var(--t3); }
.kpi-foot { font-size: 11.5px; color: var(--t3); margin-top: 7px; min-height: 14px; }
.kpi.good .kpi-val { color: var(--ok); }
.kpi.bad .kpi-val { color: var(--bad); }
.kpi.accent { border-color: var(--acc-line); background: linear-gradient(180deg, var(--acc-soft), transparent 70%), var(--panel); }
.kpi.accent .kpi-val { color: var(--acc); }
.kpi .spark { position: absolute; right: 12px; bottom: 12px; opacity: 0.85; }

/* =================== TABS =================== */
.tabs { display: flex; gap: 4px; margin: 30px 0 22px; border-bottom: 1px solid var(--line); }
.tab {
  font-family: var(--sans); font-size: 15px; font-weight: 500; color: var(--t3);
  background: none; border: none; padding: 11px 18px 14px; cursor: pointer;
  position: relative; display: inline-flex; align-items: center; gap: 8px; transition: 120ms;
}
.tab:hover { color: var(--t1); }
.tab.on { color: var(--t1); }
.tab.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--acc); border-radius: 2px; }
.tab .tcount { font-family: var(--mono); font-size: 11px; color: var(--t3); background: var(--neutral-bg); border-radius: 6px; padding: 1px 6px; }
.tab.on .tcount { color: var(--acc); background: var(--acc-soft); }

/* =================== FILTER CHIPS =================== */
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  font-family: var(--sans); font-size: 13px; color: var(--t2);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 100px;
  padding: 6px 13px; cursor: pointer; transition: 120ms; white-space: nowrap;
}
.chip:hover { border-color: var(--line-2); color: var(--t1); }
.chip.on { background: var(--acc); color: var(--acc-ink); border-color: transparent; font-weight: 500; }
.chip-ghost { background: transparent; border-style: dashed; color: var(--t3); }

/* =================== STATUS BADGE =================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 9px 3px 8px; border-radius: 100px; border: 1px solid transparent; white-space: nowrap;
}
.badge .bd { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.badge.neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--line); }
.badge.neutral .bd { background: var(--neutral); }
.badge.good { color: var(--ok); background: var(--ok-bg); }
.badge.good .bd { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.warn .bd { background: var(--warn); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.bad .bd { background: var(--bad); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.info .bd { background: var(--info); }
.badge.gen .bd { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.fmt-badge {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.03em;
  color: var(--t1); background: rgba(252,251,248,0.82); backdrop-filter: blur(6px);
  border: 1px solid var(--line-2); border-radius: 7px; padding: 3px 8px; display: inline-flex; gap: 5px; align-items: center;
}

/* =================== PLACEHOLDER MEDIA =================== */
.media {
  position: relative; overflow: hidden; background: var(--inset);
  border-bottom: 1px solid var(--line);
}
.media .ph {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(27,23,19,0.03) 0 2px, transparent 2px 11px);
}
.media .ph-grad { position: absolute; inset: 0; opacity: 0.85; }
.media .ph-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--t2);
  text-align: center; white-space: nowrap; padding: 6px 11px;
  border: 1px dashed var(--line-3); border-radius: 8px; background: rgba(252,251,248,0.7);
}
.media .play {
  position: absolute; left: 14px; bottom: 14px; width: 34px; height: 34px;
  border-radius: 50%; background: rgba(252,251,248,0.82); backdrop-filter: blur(6px);
  border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--t1);
}

/* =================== EDIT MODAL =================== */
.overlay {
  position: fixed; inset: 0; background: rgba(6,8,12,0.66); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 60; padding: 24px;
  animation: fade 160ms ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: 0 30px 70px -28px rgba(27,23,19,0.32);
  animation: rise 180ms cubic-bezier(.2,.7,.2,1); overflow: hidden;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

/* =================== FORM FIELDS =================== */
.field label, .fl {
  display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--t3); margin-bottom: 7px;
}
.input, .select, .textarea {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--t1);
  background: var(--inset); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 10px 12px; transition: 120ms;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--acc-line); box-shadow: 0 0 0 3px var(--acc-soft); }
.input::placeholder, .textarea::placeholder { color: var(--t4); }
.textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23767c8a' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }

/* utility */
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.muted { color: var(--t3); }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
.card-surface { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
