/* ============================================================
   Search Feed — operations console
   Shell: dark rail + light data canvas
   Type:  Space Grotesk (display) / Inter (UI) / IBM Plex Mono (all figures)
   ============================================================ */

:root{
  /* rail */
  --rail:#161B22;
  --rail-2:#1D242E;
  --rail-line:#2A323D;
  --rail-text:#AEB8C4;
  --rail-text-hi:#F2F5F8;

  /* canvas */
  --canvas:#F4F6F8;
  --card:#FFFFFF;
  --line:#E2E7ED;
  --line-soft:#EDF1F5;

  /* ink */
  --ink:#151A21;
  --ink-2:#3D4753;
  --muted:#6B7684;

  /* signal */
  --pine:#1F6F5C;
  --pine-hi:#175547;
  --pine-wash:#E7F2EE;
  --pos:#12805C;
  --pos-wash:#E4F4EC;
  --neg:#C33A3A;
  --neg-wash:#FBEAEA;
  --warn:#9A6410;
  --warn-wash:#FBF0DC;

  --r:10px;
  --r-sm:7px;
  --shadow:0 1px 2px rgba(21,26,33,.05), 0 1px 3px rgba(21,26,33,.04);
  --rail-w:236px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--canvas);
  color:var(--ink);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  font-size:14px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  font-feature-settings:'tnum' 1,'cv05' 1;
}
a{color:var(--pine);text-decoration:none}
a:hover{text-decoration:underline}

/* numbers, ids, urls — tabular mono everywhere */
.num,td .num,.value,.code,.mono{
  font-family:'IBM Plex Mono',ui-monospace,Menlo,monospace;
  font-variant-numeric:tabular-nums;
}

:focus-visible{outline:2px solid var(--pine);outline-offset:2px;border-radius:4px}

/* ---------- shell ---------- */
.shell{display:flex;min-height:100vh}

.rail{
  width:var(--rail-w);
  background:var(--rail);
  border-right:1px solid var(--rail-line);
  display:flex;flex-direction:column;
  /* Fixed to the viewport so it never scrolls away with a long page.
     (sticky broke because html/body have overflow-x set.) Only the nav
     list scrolls inside; brand + user footer stay put. */
  position:fixed;left:0;top:0;bottom:0;height:100vh;height:100dvh;
  overflow:hidden;z-index:40;
}
.rail-brand{
  padding:20px 18px 16px;border-bottom:1px solid var(--rail-line);
}
.rail-brand .mark{
  font-family:'Space Grotesk',sans-serif;
  font-size:16px;font-weight:700;letter-spacing:-.2px;color:var(--rail-text-hi);
  display:flex;align-items:center;gap:9px;
}
.rail-brand .dot{
  width:9px;height:9px;border-radius:2px;background:var(--pine);
  box-shadow:0 0 0 3px rgba(31,111,92,.22);
}
.rail-brand .env{
  margin-top:7px;font-size:10.5px;letter-spacing:.9px;text-transform:uppercase;
  color:var(--rail-text);opacity:.75;
  font-family:'IBM Plex Mono',monospace;
}

.rail-nav{padding:12px 10px;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.rail-brand,.rail-foot{flex:0 0 auto}
.rail-group{margin-bottom:16px}
.rail-group-label{
  font-size:10px;letter-spacing:1.1px;text-transform:uppercase;
  color:#7A8494;padding:0 9px 7px;font-weight:600;
}
.rail-link{
  display:flex;align-items:center;gap:10px;
  padding:8px 10px;border-radius:var(--r-sm);
  color:var(--rail-text);font-size:13.5px;font-weight:500;
  margin-bottom:1px;
}
.rail-link:hover{background:var(--rail-2);color:var(--rail-text-hi);text-decoration:none}
.rail-link.is-active{background:var(--rail-2);color:var(--rail-text-hi)}
.rail-link.is-active .glyph{color:var(--pine);}
.rail-link .glyph{
  width:16px;text-align:center;font-size:13px;color:#77828F;flex:0 0 16px;
}
.rail-link .tail{
  margin-left:auto;font-size:10.5px;padding:1px 6px;border-radius:20px;
  background:rgba(255,255,255,.07);color:var(--rail-text);
  font-family:'IBM Plex Mono',monospace;
}

.rail-foot{
  border-top:1px solid var(--rail-line);padding:12px 14px;
  display:flex;align-items:center;gap:10px;
}
.avatar{
  width:30px;height:30px;border-radius:7px;flex:0 0 30px;
  background:var(--pine);color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-size:12px;font-weight:700;font-family:'Space Grotesk',sans-serif;
}
.rail-foot .who{min-width:0;flex:1}
.rail-foot .nm{
  color:var(--rail-text-hi);font-size:12.5px;font-weight:600;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.rail-foot .rl{font-size:10px;letter-spacing:.7px;text-transform:uppercase;color:#7A8494}
.icon-btn{
  background:none;border:1px solid var(--rail-line);color:var(--rail-text);
  border-radius:6px;padding:5px 7px;cursor:pointer;font-size:12px;line-height:1;
}
.icon-btn:hover{background:var(--rail-2);color:var(--rail-text-hi)}

/* ---------- main ---------- */
.main{flex:1;min-width:0;display:flex;flex-direction:column;margin-left:var(--rail-w)}
.topbar{
  display:none;align-items:center;gap:12px;
  background:var(--rail);border-bottom:1px solid var(--rail-line);padding:11px 16px;
}
.topbar .mark{
  font-family:'Space Grotesk',sans-serif;color:var(--rail-text-hi);font-weight:700;font-size:15px;
}
.wrap{padding:26px 28px 56px;max-width:1360px;width:100%}

.page-head{
  display:flex;align-items:flex-start;justify-content:space-between;
  gap:16px;flex-wrap:wrap;margin-bottom:22px;
}
.page-head h1{
  font-family:'Space Grotesk',sans-serif;
  font-size:24px;font-weight:600;letter-spacing:-.4px;margin:0;color:var(--ink);
}
.page-head .sub{color:var(--muted);font-size:13.5px;margin:4px 0 0}
.page-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex;align-items:center;gap:7px;
  background:var(--pine);color:#fff;border:1px solid var(--pine);
  border-radius:var(--r-sm);padding:8px 15px;
  font-size:13.5px;font-weight:600;font-family:inherit;cursor:pointer;
  transition:background .12s ease;
}
.btn:hover{background:var(--pine-hi);border-color:var(--pine-hi);text-decoration:none;color:#fff}
.btn.ghost{background:var(--card);color:var(--ink-2);border-color:var(--line)}
.btn.ghost:hover{background:#F8FAFB;border-color:#CFD7E0;color:var(--ink)}
.btn.danger{background:var(--card);color:var(--neg);border-color:#EBC9C9}
.btn.danger:hover{background:var(--neg-wash)}
.btn.sm{padding:5px 11px;font-size:12.5px}
.btn:disabled{opacity:.45;cursor:not-allowed}

/* ---------- cards ---------- */
.card{
  background:var(--card);border:1px solid var(--line);
  border-radius:var(--r);box-shadow:var(--shadow);
}
.card-pad{padding:18px}
.card-head{
  padding:14px 18px;border-bottom:1px solid var(--line-soft);
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
}
.card-head h2{
  font-family:'Space Grotesk',sans-serif;
  font-size:14.5px;font-weight:600;margin:0;letter-spacing:-.1px;
}
.card-head .hint{color:var(--muted);font-size:12.5px;margin:3px 0 0;font-weight:400}

.grid{display:grid;gap:14px}
.g2{grid-template-columns:repeat(2,1fr)}
.g3{grid-template-columns:repeat(3,1fr)}
.g4{grid-template-columns:repeat(4,1fr)}
.stack{margin-top:16px}

/* ---------- metric ---------- */
.metric{
  background:var(--card);border:1px solid var(--line);border-radius:var(--r);
  padding:15px 16px;box-shadow:var(--shadow);
  display:flex;flex-direction:column;gap:5px;
}
.metric .k{
  font-size:11px;letter-spacing:.8px;text-transform:uppercase;
  color:var(--muted);font-weight:600;
}
.metric .v{
  font-family:'IBM Plex Mono',monospace;font-variant-numeric:tabular-nums;
  font-size:24px;font-weight:600;letter-spacing:-.6px;line-height:1.15;color:var(--ink);
}
.metric .v.pos{color:var(--pos)}
.metric .v.neg{color:var(--neg)}
.metric .v.warn{color:var(--warn)}
.metric .foot{font-size:12px;color:var(--muted)}
.metric.lead{border-left:3px solid var(--pine)}
a.metric:hover{border-color:#CFD7E0;text-decoration:none}

/* ---------- SIGNATURE: the spread bar ----------
   The whole business is a spread: cost in, revenue out, profit is the gap. */
.spread{margin-top:4px}
.spread-track{
  display:flex;height:30px;border-radius:6px;overflow:hidden;
  border:1px solid var(--line);background:var(--line-soft);
}
.spread-cost{
  background:repeating-linear-gradient(135deg,#F1DADA,#F1DADA 5px,#F7E6E6 5px,#F7E6E6 10px);
  border-right:1px solid #E4C4C4;
}
.spread-profit{background:var(--pos-wash)}
.spread-loss{background:var(--neg-wash)}
.spread-legend{
  display:flex;gap:18px;margin-top:9px;flex-wrap:wrap;
  font-size:12px;color:var(--muted);
}
.spread-legend b{
  display:block;color:var(--ink);font-size:14px;font-weight:600;
  font-family:'IBM Plex Mono',monospace;font-variant-numeric:tabular-nums;
}
.spread-legend .sw{
  display:inline-block;width:9px;height:9px;border-radius:2px;margin-right:6px;vertical-align:baseline;
}
.sw-cost{background:#E4C4C4}
.sw-rev{background:var(--pos)}
.sw-pl{background:var(--pine)}

/* mini spread used inside table rows */
.bar{
  height:5px;border-radius:3px;background:var(--line-soft);
  overflow:hidden;min-width:64px;display:flex;
}
.bar i{display:block;height:100%}
.bar .b-rev{background:var(--pos)}
.bar .b-cost{background:#DCA3A3}

/* ---------- tables ---------- */
.table-scroll{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:13px}
thead th{
  text-align:left;padding:9px 14px;
  background:#FAFBFC;border-bottom:1px solid var(--line);
  font-size:10.5px;letter-spacing:.8px;text-transform:uppercase;
  color:var(--muted);font-weight:600;white-space:nowrap;
}
tbody td{padding:11px 14px;border-bottom:1px solid var(--line-soft);vertical-align:middle}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover td{background:#FAFBFC}
td.r,th.r{text-align:right}
td.num{font-family:'IBM Plex Mono',monospace;font-variant-numeric:tabular-nums;white-space:nowrap}
.t-strong{font-weight:600;color:var(--ink)}
.t-dim{color:var(--muted)}
.t-id{
  font-family:'IBM Plex Mono',monospace;font-size:11.5px;color:var(--muted);
}

/* ---------- pills ---------- */
.pill{
  display:inline-flex;align-items:center;gap:5px;
  padding:2px 9px;border-radius:20px;font-size:11.5px;font-weight:600;
  border:1px solid transparent;white-space:nowrap;
}
.pill.ok{background:var(--pos-wash);color:var(--pos);border-color:#C7E6D8}
.pill.bad{background:var(--neg-wash);color:var(--neg);border-color:#F0CFCF}
.pill.warn{background:var(--warn-wash);color:var(--warn);border-color:#EDDCBB}
.pill.mute{background:#F1F4F7;color:var(--muted);border-color:var(--line)}
.pill.brand{background:var(--pine-wash);color:var(--pine);border-color:#CBE3DB}
.pill .dot{width:5px;height:5px;border-radius:50%;background:currentColor}

/* ---------- forms ---------- */
label{display:block;margin:0 0 6px;color:var(--ink-2);font-size:12.5px;font-weight:600}
.field{margin-bottom:15px}
input[type=text],input[type=email],input[type=password],input[type=url],
input[type=number],input[type=date],select,textarea{
  width:100%;padding:9px 11px;
  background:var(--card);border:1px solid var(--line);border-radius:var(--r-sm);
  color:var(--ink);font-size:13.5px;font-family:inherit;
  transition:border-color .12s ease,box-shadow .12s ease;
}
textarea{font-family:'IBM Plex Mono',monospace;font-size:12.5px;line-height:1.6}
input:focus,select:focus,textarea:focus{
  outline:none;border-color:var(--pine);box-shadow:0 0 0 3px rgba(31,111,92,.11);
}
input::placeholder,textarea::placeholder{color:#A6B0BC}
.help{font-size:12px;color:var(--muted);margin-top:5px}
.check{display:flex;align-items:center;gap:9px;font-weight:500;color:var(--ink-2);cursor:pointer;margin:0}
.check input{width:auto;margin:0;accent-color:var(--pine)}
.inline-form{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap}
.inline-form .field{margin-bottom:0}

/* ---------- notices ---------- */
.notice{
  display:flex;gap:10px;align-items:flex-start;
  padding:11px 14px;border-radius:var(--r-sm);font-size:13.5px;margin-bottom:18px;
  border:1px solid;
}
.notice.good{background:var(--pos-wash);border-color:#C7E6D8;color:#0D5C43}
.notice.bad{background:var(--neg-wash);border-color:#F0CFCF;color:#8E2A2A}
.notice.info{background:var(--pine-wash);border-color:#CBE3DB;color:var(--pine-hi)}
.err{color:var(--neg);font-size:12.5px;margin-top:5px}

/* ---------- code ---------- */
.code{
  background:#F7F9FB;border:1px solid var(--line);border-radius:var(--r-sm);
  padding:10px 12px;font-size:12px;color:var(--ink-2);
  word-break:break-all;line-height:1.65;
}
.code.block{white-space:pre-wrap;max-height:340px;overflow:auto}

/* ---------- empty state: an invitation to act ---------- */
.empty{padding:44px 24px;text-align:center}
.empty .glyph{
  font-size:20px;width:44px;height:44px;margin:0 auto 12px;
  border-radius:11px;background:var(--pine-wash);color:var(--pine);
  display:flex;align-items:center;justify-content:center;
}
.empty h3{font-family:'Space Grotesk',sans-serif;font-size:15px;margin:0 0 5px;font-weight:600}
.empty p{color:var(--muted);font-size:13px;margin:0 auto 16px;max-width:400px}

/* ---------- section heading ---------- */
.sec{
  display:flex;align-items:baseline;justify-content:space-between;
  gap:14px;margin:26px 0 12px;flex-wrap:wrap;
}
.sec h2{
  font-family:'Space Grotesk',sans-serif;font-size:16px;font-weight:600;
  margin:0;letter-spacing:-.2px;
}
.sec .sub{color:var(--muted);font-size:13px;margin:3px 0 0}

/* ---------- phase checklist ---------- */
.phase-row{display:flex;align-items:center;gap:12px;padding:10px 16px;border-bottom:1px solid var(--line-soft)}
.phase-row:last-child{border-bottom:0}
.tick{
  width:19px;height:19px;border-radius:5px;flex:0 0 19px;
  display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;
}
.tick.on{background:var(--pos-wash);color:var(--pos);border:1px solid #C7E6D8}
.tick.off{background:#F1F4F7;color:#AAB4C0;border:1px solid var(--line)}
.meter{height:4px;border-radius:3px;background:var(--line-soft);overflow:hidden;width:90px}
.meter i{display:block;height:100%;background:var(--pine)}

/* ---------- responsive ---------- */

/* responsive layer moved to end of file */
@media (prefers-reduced-motion:reduce){
  *{animation:none !important;transition:none !important}
}

/* ============================================================
   PUBLIC LANDING — deliberately NOT the console.
   Reads like a real article page, because that's what visitors see.
   ============================================================ */
.pub{background:#fff;color:#1B1F24}
.pub-wrap{max-width:690px;margin:0 auto;padding:40px 22px 64px}
.pub-wrap h1{
  font-family:'Space Grotesk',sans-serif;
  font-size:clamp(27px,4.4vw,36px);line-height:1.2;letter-spacing:-.7px;
  margin:0 0 12px;font-weight:600;color:#12161B;
}
.pub-lede{font-size:17px;line-height:1.6;color:#4A535E;margin:0 0 26px}
.pub-body{font-size:16.5px;line-height:1.78;color:#23282F}
.pub-body h2{
  font-family:'Space Grotesk',sans-serif;
  font-size:20px;margin:32px 0 10px;font-weight:600;letter-spacing:-.3px;color:#12161B;
}
.pub-body h3{font-size:17px;margin:24px 0 8px;font-weight:600}
.pub-body p{margin:0 0 16px}
.pub-body ul{padding-left:20px;margin:0 0 16px}
.pub-body li{margin-bottom:7px}
.pub-body a{color:#1A5FBF}

.feed{margin-top:36px;border-top:1px solid #E6EAEF;padding-top:16px}
.feed-label{
  font-size:11px;letter-spacing:1px;text-transform:uppercase;
  color:#77818D;font-weight:600;margin-bottom:6px;
}
.ad{padding:15px 0;border-bottom:1px solid #F0F2F5}
.ad:last-child{border-bottom:0}
.ad .title{color:#1A0DAB;font-size:18px;font-weight:500;line-height:1.35;display:inline-block}
.ad .title:hover{text-decoration:underline}
.ad .url{color:#0B7A2E;font-size:13px;margin:3px 0 2px}
.ad .desc{color:#48515C;font-size:14px;line-height:1.55}
.tag-ad{
  font-size:10.5px;color:#0B7A2E;font-weight:700;border:1px solid #0B7A2E;
  border-radius:3px;padding:0 4px;margin-right:7px;vertical-align:2px;
}

/* preview chrome */
.preview-bar{
  background:var(--rail);color:#F2F5F8;padding:9px 16px;font-size:12.5px;
  display:flex;align-items:center;gap:10px;justify-content:center;flex-wrap:wrap;
}
.preview-bar .pill{background:rgba(255,255,255,.1);color:#F2F5F8;border-color:transparent}
.serp{
  border:1px solid var(--line);border-radius:var(--r);padding:14px 16px;
  background:#FBFCFD;margin-bottom:26px;
}
.serp .cap{
  font-size:10.5px;letter-spacing:.9px;text-transform:uppercase;
  color:var(--muted);font-weight:600;margin-bottom:8px;
}
.serp .s-title{color:#1A0DAB;font-size:19px;line-height:1.3}
.serp .s-url{color:#0B7A2E;font-size:13px}
.serp .s-desc{color:#48515C;font-size:13.5px;line-height:1.5}

/* ---------- reporting window ---------- */
.rangebar{
  display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;
  background:var(--card);border:1px solid var(--line);border-radius:var(--r);
  padding:10px 12px;margin-bottom:18px;box-shadow:var(--shadow);
}
.range-presets{display:flex;gap:5px;flex-wrap:wrap}
.range-chip{
  padding:5px 11px;border-radius:20px;font-size:12.5px;font-weight:600;
  color:var(--ink-2);border:1px solid transparent;
}
.range-chip:hover{background:#F1F4F7;text-decoration:none}
.range-chip.is-on{background:var(--pine-wash);color:var(--pine);border-color:#CBE3DB}
.range-custom{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.range-custom input[type=date]{width:auto;padding:6px 9px;font-size:12.5px}

/* ---------- pagination ---------- */
.pager{
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  padding:12px 16px;border-top:1px solid var(--line-soft);font-size:12.5px;
}
.pager-links{display:flex;align-items:center;gap:10px}


.pub-hero{
  width:100%;height:auto;border-radius:10px;margin:0 0 24px;display:block;
  background:#F0F2F5;
}

/* ---------- live/mock mode banner ---------- */
.mode-banner{
  display:flex;align-items:center;gap:10px;
  padding:10px 15px;border-radius:var(--r);margin-bottom:18px;
  font-size:13.5px;border:1px solid;
}
.mode-banner .mode-dot{width:8px;height:8px;border-radius:50%;flex:0 0 8px}
.mode-banner.is-live{background:var(--pos-wash);border-color:#C7E6D8;color:#0D5C43}
.mode-banner.is-live .mode-dot{background:var(--pos);box-shadow:0 0 0 3px rgba(18,128,92,.18)}
.mode-banner.is-mock{background:var(--warn-wash);border-color:#EDDCBB;color:var(--warn)}
.mode-banner.is-mock .mode-dot{background:var(--warn);box-shadow:0 0 0 3px rgba(154,100,16,.16)}
.mode-banner a{margin-left:auto;font-weight:600;white-space:nowrap}

/* ============================================================
   RESPONSIVE LAYER — desktop / laptop / tablet / mobile
   Breakpoints:
     > 1080px  full desktop
     1080px    laptop (4-col grids -> 2-col)
     900px     tablet (sidebar -> drawer, grids -> 1-col)
     640px     mobile (tables -> stacked cards, tighter spacing)
     380px     small phones
   ============================================================ */

/* ---- prevent any horizontal overflow globally ---- */
html, body { max-width: 100%; overflow-x: hidden; }
@supports (overflow: clip){ html, body { overflow-x: clip; } }
img, svg, video, canvas, table { max-width: 100%; }
.code, .code.block { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- LAPTOP ---------- */
@media (max-width: 1080px){
  .g4{ grid-template-columns: repeat(2, 1fr); }
  .wrap{ padding: 24px 22px 52px; }
}

/* ---------- TABLET ---------- */
@media (max-width: 900px){
  .rail{
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  .rail.open{ transform: translateX(0); }

  /* .shell is a row flex container, so without taking .topbar out of
     that row it just squeezes in as a narrow vertical strip next to
     .main. Pin it to the top of the viewport instead, full width,
     above everything except the open drawer + its scrim. */
  .topbar{
    display: flex;
    position: fixed; top: 0; left: 0; right: 0; width: 100%;
    z-index: 56;
  }
  .scrim{ position: fixed; inset: 0; background: rgba(10,14,19,.45); z-index: 55; display: none; }
  .scrim.on{ display: block; }

  /* room for the now-fixed topbar so page content doesn't start underneath it */
  .main{ padding-top: 52px; margin-left: 0; }

  .wrap{ padding: 18px 16px 48px; }
  .g2, .g3, .g4{ grid-template-columns: 1fr; }
  .page-head h1{ font-size: 20px; }

  .rangebar{ flex-direction: column; align-items: stretch; }
  .range-presets{ justify-content: flex-start; }
  .pager{ flex-direction: column; align-items: flex-start; }

  /* forms that were side-by-side stack */
  .inline-form{ flex-direction: column; align-items: stretch; }
  .inline-form .field{ width: 100% !important; min-width: 0 !important; }
  .inline-form .field input,
  .inline-form .field select{ width: 100% !important; }
  /* inputs/selects dropped straight into an .inline-form (no .field wrapper)
     also need to give up any inline pixel width so they fill the stacked row */
  .inline-form > input,
  .inline-form > select,
  .inline-form input[style*="width"],
  .inline-form select[style*="width"]{ width: 100% !important; min-width: 0 !important; }
  .inline-form .btn{ width: 100%; justify-content: center; }
}

/* ---------- MOBILE ---------- */
@media (max-width: 640px){
  .wrap{ padding: 14px 12px 44px; }
  .page-head{ margin-bottom: 16px; }
  .page-head h1{ font-size: 18px; }
  .page-head .sub{ font-size: 12.5px; }
  .page-actions{ width: 100%; }
  .page-actions .btn{ flex: 1; justify-content: center; }

  .card-pad{ padding: 14px; }
  .card-head{ padding: 12px 14px; }
  .metric .v{ font-size: 20px; }

  /* any fixed / min widths from inline styles get neutralised on phones */
  [style*="min-width"]{ min-width: 0 !important; }
  [style*="width:104px"], [style*="width:82px"], [style*="width:78px"],
  [style*="width:118px"], [style*="width:130px"]{ width: 100% !important; }

  .btn{ padding: 9px 13px; }
  .page-actions{ flex-wrap: wrap; }

  /* spread legend stacks so numbers don't collide */
  .spread-legend{ gap: 12px 18px; }

  /* ---- TABLES -> STACKED CARDS ----
     Each row becomes a card; each cell shows its column label.
     Opt-out with class "keep-table" on the <table>. */
  table:not(.keep-table){ border: 0; }
  table:not(.keep-table) thead{
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
  }
  table:not(.keep-table) tbody tr{
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--card);
  }
  table:not(.keep-table) tbody tr:hover td{ background: transparent; }
  table:not(.keep-table) tbody td{
    display: flex; justify-content: space-between; align-items: center;
    gap: 14px; padding: 5px 0; border: 0; text-align: right;
  }
  table:not(.keep-table) tbody td::before{
    content: attr(data-label);
    font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase;
    color: var(--muted); font-weight: 600; text-align: left; flex: 0 0 auto;
  }
  /* cells without a label (e.g. action buttons) span full width */
  table:not(.keep-table) tbody td:not([data-label]){ justify-content: flex-end; }
  table:not(.keep-table) tbody td.num{ white-space: normal; }
  .table-scroll{ overflow: visible; }

  /* two-up metric grids stay two-up on phones for density */
  .grid.g3, .grid.g4{ grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* modals / wide inline blocks */
  .serp{ padding: 12px; }

  /* fraud alert strip on the dashboard: let the message wrap instead of
     forcing the "Review" link off-screen on narrow phones */
  .fraud-alert{ align-items: flex-start !important; }
  .fraud-alert span[style*="margin-left:auto"]{ margin-left: 0 !important; }
}

/* ---------- SMALL PHONES ---------- */
@media (max-width: 380px){
  .grid.g3, .grid.g4{ grid-template-columns: 1fr; }
  .page-head h1{ font-size: 17px; }
  .metric .v{ font-size: 18px; }
  .rail{ width: 86vw; }
}

/* ---------- touch niceties ---------- */
@media (hover: none){
  .btn, .rail-link, .range-chip, a.metric{ -webkit-tap-highlight-color: transparent; }
  .btn, .icon-btn{ min-height: 40px; }   /* comfortable tap target */
  input, select, textarea{ font-size: 16px; } /* stop iOS zoom-on-focus */
}

/* landscape phones: let the drawer scroll */
@media (max-height: 480px){
  .rail{ overflow-y: auto; }
}

/* mobile card view: first cell of each row acts as the card title */
@media (max-width: 640px){
  table:not(.keep-table) tbody td:first-child{
    justify-content: flex-start;
    font-weight: 600;
    font-size: 14px;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line-soft);
  }
  table:not(.keep-table) tbody td:first-child::before{ display: none; }
  /* action button cells: full width, buttons spread */
  table:not(.keep-table) tbody td.r:last-child{
    justify-content: flex-start; flex-wrap: wrap; gap: 6px;
    padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line-soft);
  }
  table:not(.keep-table) tbody td .btn.sm{ flex: 1; justify-content: center; min-width: 72px; }
}

/* editor textareas: shorter on phones so the page isn't endless */
@media (max-width: 640px){
  textarea{ min-height: 180px; }
  #content, textarea[name="content"]{ min-height: 240px; }
  #preview{ min-height: 200px !important; }
  /* article editor preview sits below content on mobile — add breathing room */
  .grid.g2 > .card + .card{ margin-top: 0; }
}

.hidden{display:none !important;}
/* ---------- uploaded brand logo (System settings) ---------- */
.brand-logo{display:block;max-width:100%;width:auto;object-fit:contain;flex:0 1 auto}
.rail-brand .mark{min-width:0}
.rail-brand .mark span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topbar .mark{display:inline-flex;align-items:center;gap:8px}
