@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Variable.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Anything scrolled or tabbed into view stays clear of the sticky top bar and the sticky action bars below. */
html { scroll-padding-top: calc(var(--topbar-h) + 56px); scroll-padding-bottom: 104px; }
@media (max-width: 599px) { html { scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 104px); } }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 var(--fs-m)/1.5 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); } h2 { font-size: var(--fs-l); } h3 { font-size: var(--fs-m); }
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 2px; }
img, svg, video { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-s); }
::selection { background: var(--accent-soft); color: var(--text); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-4) 0; }
code, kbd { font-family: var(--mono); font-size: .9em; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--space-3); top: -60px; z-index: 1000; background: var(--accent); color: var(--accent-ink); padding: var(--space-2) var(--space-4); border-radius: var(--radius-m); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: var(--space-3); }

.muted { color: var(--muted); } .text-2 { color: var(--text-2); }
.small { font-size: var(--fs-s); } .xs { font-size: var(--fs-xs); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; min-width: 0; }

/* layout helpers */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-s { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-l { display: flex; flex-direction: column; gap: var(--space-5); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row-nowrap { display: flex; align-items: center; gap: var(--space-3); }
.spacer { flex: 1 1 auto; }
.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(var(--min-col, 240px), 1fr)); }
.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* app shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-4) var(--space-3); background: var(--surface-2); border-right: 1px solid var(--border); overflow-y: auto;
}
.brandmark { white-space: nowrap; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); font-weight: 700; font-size: var(--fs-m); color: var(--text); text-decoration: none; }
.brandmark .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: var(--space-3); min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-m);
  color: var(--text-2); text-decoration: none; font-size: var(--fs-s); font-weight: 500; border: 0; background: none; width: 100%; text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: 600; }
.nav-item[aria-current="page"] .icon { color: var(--accent-text); }
.nav-item .badge { margin-left: auto; }
.nav-label { padding: var(--space-3) var(--space-3) var(--space-1); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sidebar-foot { margin-top: auto; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-5); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .search { flex: 1 1 auto; max-width: 440px; }
.main { padding: var(--space-5); width: 100%; max-width: var(--content-max); margin: 0 auto; flex: 1 1 auto; min-width: 0; }
.main.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head h1 { flex: 1 1 auto; min-width: 0; }
.page-head .sub { color: var(--muted); font-size: var(--fs-s); width: 100%; margin-top: calc(var(--space-2) * -1); }
.section { margin-top: var(--space-6); }
.section-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.section-head h2 { flex: 1 1 auto; font-size: var(--fs-m); }

.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border);
  grid-auto-flow: column; grid-auto-columns: 1fr;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; border: 0; background: none;
  color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none; position: relative;
}
.tab-item[aria-current="page"] { color: var(--accent-text); font-weight: 650; }
.tab-item[aria-current="page"]::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 var(--space-4); }
  .main { padding: var(--space-4); }
}
@media (min-width: 900px) { .topbar .brandmark { display: none; } }
/* Focus mode (the first-run steps): no sidebar, tabs or new-campaign buttons to wander off through. */
.app.focus-mode { grid-template-columns: minmax(0, 1fr); }
.app.focus-mode .sidebar, .app.focus-mode .tabbar, .app.focus-mode .topbar .search, .app.focus-mode .topbar .usage-pill,
.app.focus-mode .topbar .topbar-new, .app.focus-mode .topbar .only-phone { display: none !important; }
.app.focus-mode .topbar .brandmark { display: flex; }
.app.focus-mode .main { padding-bottom: var(--space-6); }
@media (max-width: 599px) {
  .tabbar { display: grid; }
  .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--space-5)); }
  .topbar .hide-phone { display: none !important; }
  h1 { font-size: var(--fs-l); }
  .page-head { margin-bottom: var(--space-4); }
}
@media (min-width: 600px) { .only-phone { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
