/* Altvina Review - the warm-paper design system, ported from the walk-v1
   review tool. Tokens and component CSS carried over verbatim wherever the
   new shell renders the same surface. Fonts: no external hosts are allowed,
   so the stacks lean on locally installed faces with Georgia / system
   fallbacks that keep the look. */

:root {
  /* canvas + surface */
  --bg: #F7F6F2;             /* warm paper canvas, not cool corporate gray */
  --bg-card: #FFFFFF;
  --bg-soft: #F2F0EA;        /* recessed inset for sibling/child */
  --bg-tint: #FAF8F2;
  --rule: #E4E1D9;           /* hairline 1px */
  --rule-strong: #CFCBC0;
  --border: #E4E1D9;
  --border-strong: #CFCBC0;
  /* ink */
  --text: #111111;           /* near-black, not slate */
  --text-1: #2A2620;
  --text-2: #3F3D38;
  --text-3: #7A766D;
  --text-4: #A8A39A;
  /* brand-locked primary (use sparingly) */
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: #DBEAFE;
  /* per-campaign accent (teal-structural) */
  --accent-week: #00838C;
  --accent-week-tint: #E6F1F1;
  /* state */
  --green: #2A8C4A;
  --green-soft: #DCEEDF;
  --amber: #B47A1A;
  --amber-soft: #F6EDD8;
  --red: #B43A3A;
  --red-soft: #F5E1E1;
  --navy: #0F172A;
  /* SURFACE COLORS: one per kind of post, and one definition for all of them.
     They were hardcoded in the calendar's own rules, so the filter chips built
     beside it invented a different palette. Jay, 2026-08-14: "filtering is not
     cosmetically acceptable and does not use the same consistent color codes as
     we do in our calendar view. Whenever possible we are trying to keep a
     cohesive user experience." Anything that names a blog, a founder or the
     company page reads from here now. */
  --sp-blog: #2b5f8c;
  --sp-jay: #2f6f55;
  --sp-katie: #8a4a78;
  --sp-page: #96660a;
  /* depth */
  --shadow-sm: 0 1px 0 rgba(17,17,17,0.04);
  --shadow-md: 0 1px 0 rgba(17,17,17,0.06), 0 8px 24px -12px rgba(17,17,17,0.08);
  --radius: 10px;
  /* Default rail width; scales up on larger viewports via media queries. */
  --rail-w: 224px;
  /* type */
  --serif: 'Newsreader', 'Charter', Georgia, ui-serif, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--text-2);
  background: var(--bg);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
button { font-family: inherit; }
.hide { display: none !important; }
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.boot { padding: 60px 20px; text-align: center; color: var(--text-3); }
.loading { padding: 60px 20px; text-align: center; color: var(--text-3); }

/* ---------- LOGIN ---------- */
.login-shell {
  min-height: calc(100vh - 44px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px 14px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 48px 40px 36px;
  box-shadow: var(--shadow-md);
  width: 380px;
  text-align: center;
}
.login-card .eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 18px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}
.login-card p { color: var(--text-3); margin: 0 0 18px; font-size: 14px; }
.login-card p.or { margin: 14px 0 10px; font-size: 12.5px; }
.login-card input[type=email] {
  width: 100%;
  font-size: 15px;
  text-align: center;
  padding: 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  font-family: var(--sans);
  background: var(--bg-tint);
  color: var(--text);
}
.login-card input[type=email]:focus { outline: none; border-color: var(--accent-week); background: #fff; }
.login-card .login-btn {
  margin-top: 12px;
  width: 100%;
  padding: 12px;
  background: var(--text);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background 180ms ease-out;
}
.login-card .login-btn:hover { background: #000; }
.login-card .login-btn.is-quiet {
  background: var(--bg-card);
  color: var(--text-2);
  border: 1px solid var(--rule-strong);
}
.login-card .login-btn.is-quiet:hover { background: var(--bg-soft); }
.login-status { color: var(--text-3); font-size: 12.5px; margin-top: 14px; min-height: 16px; font-family: var(--mono); }

/* ---------- APP SHELL ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  background: rgba(247,246,242,0.92);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}
.app-bar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.app-bar-left { display: flex; align-items: center; gap: 22px; }
.app-brand { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.app-logo {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1;
}
.app-brand .app-tool-name { padding-left: 12px; border-left: 1px solid var(--rule); }
.app-tool-name {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent-week);
  font-weight: 500;
}

/* Week switcher dropdown */
.app-week-label {
  font-family: var(--mono);
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}
.app-week-switcher { position: relative; }
.app-week-button {
  background: none;
  border: none;
  padding: 6px 10px 6px 22px;
  margin-left: 0;
  border-left: 1px solid var(--rule);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 120ms ease-out;
}
.app-week-button:hover { background: var(--bg-tint); }
.app-week-button[aria-expanded="true"] { background: var(--bg-tint); }
.app-week-caret {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  line-height: 1;
}
.app-week-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 22px;
  z-index: 50;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  min-width: 320px;
  max-width: 440px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
}
.app-week-menu[hidden] { display: none; }
.app-week-menu-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  background: none;
  border: none;
  width: 100%;
  font-family: var(--sans);
  transition: background 120ms ease-out;
}
.app-week-menu-row:hover { background: var(--bg-tint); }
.app-week-menu-row.is-current { background: rgba(0, 131, 140, 0.08); }
.app-week-menu-row.is-current:hover { background: rgba(0, 131, 140, 0.12); }
.app-week-menu-row .wk {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 500;
}
.app-week-menu-row.is-current .wk { color: var(--accent-week); font-weight: 600; }
.app-week-menu-row .theme {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.005em;
}
.app-week-menu-row .theme small { display: block; margin-top: 2px; font-family: var(--sans); font-size: 11px; font-weight: 400; color: var(--text-3); }
.app-week-menu-row .status {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--bg-tint);
  color: var(--text-3);
}
.app-week-menu-row .status.is-ratified { background: rgba(15, 118, 110, 0.10); color: var(--green); }
.app-week-menu-row .status.is-active { background: rgba(0, 131, 140, 0.12); color: var(--accent-week); font-weight: 600; }
.app-week-menu-row .status.is-preparing { background: rgba(197, 138, 26, 0.10); color: #8a5e10; font-weight: 500; }

/* View switcher (console views), segmented control */
.app-view-switch { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 8px; padding: 2px; }
.app-view-tab { font: inherit; font-size: 13px; font-weight: 600; color: var(--text-3); background: none; border: none; border-radius: 6px; padding: 5px 14px; cursor: pointer; }
.app-view-tab.is-active { background: #fff; color: var(--accent-week); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.app-view-tab:hover:not(.is-active) { color: var(--text-1, #2A2620); }

.app-viewer { color: var(--text-3); font-size: 13px; font-family: var(--mono); letter-spacing: 0.2px; }
.app-viewer strong { color: var(--text); font-weight: 500; }
.app-gear { font: inherit; font-size: 15px; background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.app-gear:hover { background: var(--bg-soft); }
.app-logout {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  margin-left: 14px;
  text-decoration: none;
  transition: color 120ms ease-out;
}
.app-logout:hover { color: var(--text); }

/* Passkey banner keeps the old announce look */
.banner {
  display: flex; align-items: flex-start; gap: 10px; border-radius: 14px;
  padding: 12px 16px; margin: 14px auto; max-width: 960px;
  font-size: 13.5px; line-height: 1.5;
  background: var(--accent-week-tint);
  border: 0.5px solid rgba(0,131,140,0.2);
  color: var(--text-1, #1d1d1f);
}
.banner p { margin: 0; flex: 1; }

/* Layout: the rail is fixed to the viewport's left edge; main content sits
   to its right with its own max-width so reading width stays comfortable. */
.app-body {
  display: block;
  flex: 1 0 auto;
  margin: 0;
  max-width: none;
  padding: 32px 32px 96px calc(var(--rail-w) + 40px);
}
.app-body.is-rail-collapsed {
  padding-left: 32px;
  max-width: 1080px;
  margin: 0 auto;
}
.app-body.is-rail-collapsed .rail { display: none; }
.main { min-width: 0; max-width: 960px; margin: 0 auto; }
@media (max-width: 900px) {
  .app-body { padding-left: 24px; padding-right: 24px; }
  .rail { display: none; }
  .rail-expander { display: none !important; }
}
@media (min-width: 1280px) { :root { --rail-w: 244px; } }
@media (min-width: 1600px) { :root { --rail-w: 264px; } }

.rail-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background 120ms ease-out, color 120ms ease-out;
  font-family: var(--mono);
}
.rail-toggle:hover { background: var(--bg-soft); color: var(--text); }
.rail-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }

/* Floating expander when the rail is hidden */
.rail-expander {
  display: none;
  position: fixed;
  top: 90px;
  left: 20px;
  z-index: 40;
  padding: 7px 12px 7px 10px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: color 120ms ease-out, border-color 120ms ease-out;
}
.rail-expander .arrow { margin-right: 6px; }
.rail-expander:hover { color: var(--text); border-color: var(--text-3); }
body.has-rail-collapsed .rail-expander { display: inline-flex; }

/* ---------- RAIL ---------- */
.rail {
  position: fixed;
  left: 0;
  top: 88px;
  width: var(--rail-w);
  height: calc(100vh - 88px - 44px);
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--rule);
  padding: 16px 14px 24px;
  z-index: 40;
}
.rail-header { padding: 2px 4px 14px; border-bottom: 1px solid var(--rule); margin-bottom: 8px; position: relative; }
.rail-title {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-4);
  font-weight: 500;
}
.rail-progress {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--text);
  margin-top: 6px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.rail-section { padding: 12px 4px 14px; border-bottom: 1px solid var(--rule); }
.rail-section + .rail-section { padding-top: 14px; }
.rail-section:last-of-type { border-bottom: none; }
.rail-section-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; gap: 8px; }
.rail-section-label {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-4); font-weight: 500;
}

/* Week list */
.rail-weeks { display: flex; flex-direction: column; gap: 1px; }
.rail-week-row {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: start;
  gap: 7px;
  width: 100%;
  padding: 7px 6px;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-2);
  text-align: left;
  font-family: inherit;
  transition: background 120ms ease-out, color 120ms ease-out, border-color 180ms ease-out;
}
.rail-week-row:hover { background: var(--bg-soft); color: var(--text); }
.rail-week-row.is-current { background: var(--bg-soft); color: var(--text); border-left-color: var(--accent-week); }
.rail-week-sym {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-4);
  text-align: center;
  width: 14px;
  padding-top: 1px;
  align-self: start;
}
.rail-week-row.is-ratified .rail-week-sym { color: var(--green); }
.rail-week-row.is-active .rail-week-sym { color: var(--accent-week); }
.rail-week-text {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
          line-clamp: 3;
  overflow: hidden;
}
.rail-week-num {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1px;
  color: var(--text-3);
  text-transform: uppercase;
  font-weight: 500;
  margin-right: 4px;
}
.rail-week-row.is-current .rail-week-num { color: var(--accent-week); }
/* A FILTER THAT WOULD EMPTY THE PAGE SAYS SO AND CANNOT BE TAPPED (Jay,
   2026-08-23: "one item shows as done but no item exists once filtered to
   that pane"). The count is honest now, so a zero is real and the row must
   look unavailable rather than broken. */
.rail-week-row.is-empty { opacity: 0.45; cursor: not-allowed; }
.rail-week-row.is-empty:hover { background: transparent; color: var(--text-2); }
.rail-week-row.is-clear { color: var(--text); }
.rail-week-row.is-clear .rail-week-num { color: var(--accent-week); }

/* Day list */
.rail-days { display: flex; flex-direction: column; gap: 2px; }
.rail-day { border-radius: 4px; }
.rail-day-row {
  display: grid;
  grid-template-columns: 8px 1fr;
  align-items: start;
  gap: 8px;
  width: 100%;
  padding: 7px 6px;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-2);
  text-align: left;
  font-family: inherit;
  transition: background 120ms ease-out, color 120ms ease-out;
}
.rail-day-row:hover { background: var(--bg-soft); color: var(--text); }
.rail-day.is-expanded > .rail-day-row { background: var(--bg-soft); color: var(--text); }
.rail-day-pip {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rule-strong);
  transition: background 180ms ease-out;
  margin-top: 6px;
  align-self: start;
}
.rail-day-pip.is-pending { background: var(--rule-strong); }
.rail-day-pip.is-approved-1 { background: var(--accent-week); }
.rail-day-pip.is-ratified { background: var(--green); }
.rail-day-pip.is-blocked { background: var(--red); }
.rail-day-pip.is-revision-ready,
.rail-day-pip.is-rework-in-flight { background: var(--amber); }
.rail-day-text {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
          line-clamp: 3;
  overflow: hidden;
}
.rail-day-name {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
  margin-right: 4px;
}
.rail-day.is-expanded > .rail-day-row .rail-day-name { color: var(--accent-week); }
.rail-day-count {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.6px;
  color: var(--text-3);
  font-weight: 500;
  margin-left: 4px;
  white-space: nowrap;
}

/* Item rows */
.rail-day-items {
  padding: 2px 0 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-left: 1px solid var(--rule);
  margin-left: 9px;
}
.rail-item-row {
  display: grid;
  grid-template-columns: 8px 1fr;
  align-items: start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-2);
  border-left: 2px solid transparent;
  margin-left: -2px;
  background: transparent;
  border-top: none; border-right: none; border-bottom: none;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: background 120ms ease-out, color 120ms ease-out, border-color 180ms ease-out;
}
.rail-item-row:hover { background: var(--bg-soft); color: var(--text); }
.rail-item-row.is-active { background: var(--bg-soft); color: var(--text); border-left-color: var(--accent-week); }
.rail-item-pip { width: 6px; height: 6px; border-radius: 50%; background: var(--rule-strong); }
.rail-item-pip.is-pending { background: var(--rule-strong); }
.rail-item-pip.is-approved-1 { background: var(--accent-week); }
.rail-item-pip.is-ratified { background: var(--green); }
.rail-item-pip.is-blocked { background: var(--red); }
.rail-item-pip.is-revision-ready,
.rail-item-pip.is-rework-in-flight { background: var(--amber); }
.rail-item-pip.is-revision-info { background: var(--text-3); }
.rail-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rail-item-type {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  /* Wrap at word boundaries, never truncate and never split words
     (2026-08-28, twice: first "words are getting truncated", then the wrap
     "its messy looking"). Label and state stack as two calm lines. */
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.3;
}
.rail-item-state {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
}
.rail-item-row.is-ratified .rail-item-state { color: var(--green); }
.rail-item-row.is-blocked .rail-item-state { color: var(--red); }
.rail-item-row.is-revision-ready .rail-item-state { color: var(--amber); font-weight: 600; }
.rail-item-row.is-rework-in-flight .rail-item-state { color: var(--amber); }

/* ---------- Type tags (channel/format identifiers) ---------- */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.tag-blog    { background: var(--accent-week-tint); color: var(--accent-week); }
.tag-jay     { background: #E1E8F0; color: #3D5878; }
.tag-katie   { background: #F0E0E5; color: #7A4A55; }
.tag-altvina { background: #F0E6D9; color: #8B6B43; }
.tag.is-carousel { box-shadow: inset 0 0 0 1px currentColor; padding: 2px 7px; opacity: 0.95; }
.rail-tag { font-size: 9.5px; padding: 2px 6px; letter-spacing: 1px; flex-shrink: 0; }
.tag-group { display: inline-flex; align-items: center; gap: 5px; }

/* Channel glyph chips: platform brand colors so the channel reads at a glance */
.ch-icon-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 3px;
  vertical-align: middle;
  flex-shrink: 0;
}
.ch-icon-tag svg { width: 14px; height: 14px; display: block; }
.ch-icon-tag.rail-tag { width: 22px; height: 18px; }
.ch-icon-tag.rail-tag svg { width: 12px; height: 12px; }
.ch-icon-li   { background: #0A66C2; color: #FFFFFF; }  /* LinkedIn brand blue */
.ch-icon-blog { background: var(--accent-week); color: #FFFFFF; }
.ch-mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }
.ch-mark svg { display: block; }
.ch-mark-li { background: #0A66C2; color: #fff; }
.ch-mark-altvina { background: var(--navy, #002642); color: #F7F6F2; }

/* Surface pills (desk + calendar voice palette) */
.surface-pill { font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--text-2, #4a4540); }
.surface-pill.sp-blog { background: #eaf1f7; color: #2b5f8c; }
.surface-pill.sp-jay { background: #e9f2ee; color: #2f6f55; }
.surface-pill.sp-katie { background: #f6edf3; color: #8a4a78; }
.surface-pill.sp-page { background: #fdf0dc; color: #96660a; }

/* ---------- Rollup / status chips (shared tone palette) ---------- */
.chip {
  display: inline-block; border-radius: 999px; padding: 3px 10px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--bg-soft); color: var(--text-2);
}
.chip.tone-attention { background: #FFF4E0; color: #8a6d00; }
.chip.tone-ok { background: var(--accent-week-tint); color: var(--accent-week); }
.chip.tone-block { background: var(--red-soft); color: var(--red); }
.chip.tone-hold { background: var(--amber-soft); color: var(--amber); }
.chip.tone-work { background: var(--amber-soft); color: #7A5A00; }
.chip.tone-done { background: var(--green-soft); color: var(--green); }
.chip.tone-info { background: var(--bg-soft); color: var(--text-3); }
.chip.saving { opacity: 0.65; }
.rollup { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 6px; }
.rollup .chip b { font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  padding: 9px 18px;
  border-radius: 6px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-card);
  color: var(--text-2);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background 180ms ease-out, border-color 180ms ease-out, color 180ms ease-out;
}
.btn:hover { border-color: var(--text-3); color: var(--text); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-approve { background: var(--bg-card); color: var(--text-2); border-color: var(--rule-strong); }
.btn-approve:hover:not(:disabled) { background: var(--green); color: white; border-color: var(--green); }
/* A FINISHED approval still reads green: that is the "you approved this"
   state and it is correct. */
.btn-approve:disabled { background: var(--green-soft); color: var(--green); border-color: var(--green-soft); cursor: default; opacity: 1; }
/* A BLOCKED approval must not (2026-09-08). The rule above painted every
   disabled approve button full-strength green, so a cut that could not yet
   be approved wore the most confident color on the page and swallowed the
   press. Jay, on W37 Wednesday: "Preview shows a green approval button but
   its not clickable." A button he cannot use now looks like one. */
.btn-approve[data-blocked="true"]:disabled {
  background: var(--bg-card);
  color: var(--text-3);
  border-color: var(--rule-strong);
  border-style: dashed;
  opacity: 0.75;
  cursor: not-allowed;
}
.btn-needs-work { background: var(--bg-card); color: var(--text-2); border-color: var(--rule-strong); }
.btn-needs-work:hover { background: var(--bg-tint); border-color: var(--text-3); color: var(--text); }
.btn-comment { background: var(--bg-card); color: var(--text-2); border-color: var(--rule-strong); }
.btn-comment:hover { background: var(--accent-week-tint); border-color: var(--accent-week); color: var(--accent-week); }
.btn-block-quiet { background: transparent; color: var(--red); border-color: var(--red-soft); font-weight: 500; }
.btn-block-quiet:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-more {
  background: none;
  border: none;
  color: var(--text-3);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: color 120ms ease-out;
}
.btn-more:hover { color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-primary { background: var(--accent-week); color: white; border-color: var(--accent-week); }
.btn-primary:hover { background: #006d75; border-color: #006d75; color: #fff; }
.btn-ghost { background: none; color: var(--text-3); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-danger-fill { background: var(--red); color: white; border-color: var(--red); }
.btn-danger-fill:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }

/* Overflow menu */
.post-menu-wrap { position: relative; }
.post-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: 4px;
  z-index: 10;
}
.post-menu[hidden] { display: none; }
.post-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-2);
}
.post-menu button:hover { background: var(--bg-soft); color: var(--text); }
.post-menu button.danger { color: var(--red); }
.post-menu button.danger:hover { background: var(--red-soft); }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}
.toast {
  padding: 10px 14px;
  background: var(--text);
  color: white;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease-out;
}
.toast.is-warn { background: var(--amber); }
.toast.is-err { background: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- Sticky agency footer (navy, always pinned) ---------- */
.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 8px calc(32px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(32px + env(safe-area-inset-left, 0px));
  display: flex;
  justify-content: flex-end;
  align-items: center;
  background: #0F172A;
  border-top: 1px solid #1E293B;
  margin: 0;
  min-height: 32px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.agency-mark {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.92);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.agency-mark .by { color: rgba(255,255,255,0.82); }
.agency-mark .name {
  color: #FFFFFF;
  font-family: var(--serif);
  text-transform: none;
  font-size: 13px;
  letter-spacing: -0.005em;
  font-weight: 500;
}
@media (max-width: 640px), (max-height: 500px) and (pointer: coarse) {
  .app-footer { justify-content: center; padding-left: 16px; padding-right: 16px; }
  .agency-mark { white-space: nowrap; }
}

/* ---------- Mobile bottom navigation ---------- */
.mobile-nav { display: none; }
/* WHY THE TABLET IS IN HERE (Jay, 2026-08-22, on his iPad mid-review: "The
   main menu bar at top is not responding"). The bar was built for a mouse:
   its tabs are 28px tall, which is under Apple's 44px minimum, so on a touch
   screen a tap that looks aimed lands on nothing and the bar reads as dead.
   A tablet now gets the same bottom navigation the phone has, so getting
   around never depends on hitting a small target, AND the bar's own controls
   are made touch-sized below. Both, because either alone leaves him tapping
   something that ignores him. */
@media (max-width: 640px), (max-height: 500px) and (pointer: coarse), (pointer: coarse) and (max-width: 1400px) {
  :root {
    --mobile-nav-height: clamp(58px, 12vh, 64px);
    --mobile-nav-height: clamp(58px, 12dvh, 64px);
    --mobile-footer-height: max(16px, env(safe-area-inset-bottom, 0px));
    --mobile-chrome-height: calc(var(--mobile-nav-height) + var(--mobile-footer-height));
  }
  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: var(--mobile-footer-height);
    z-index: 60;
    height: var(--mobile-nav-height);
    background: #0F172A;
    border-top: 1px solid #1E293B;
    padding: 6px 8px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.14);
  }
  .mnav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font: inherit;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 4px 2px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
    min-height: 44px;
  }
  .mnav-btn.is-active { color: #fff; }
  .mnav-btn svg { display: block; }
  /* Brand footer owns the true bottom edge, beneath the navigation. */
  .app-footer {
    height: var(--mobile-footer-height);
    min-height: 0;
    padding: 1px 8px;
    margin: 0;
    justify-content: center;
  }
  .agency-mark { gap: 3px; font-size: 7px; letter-spacing: 0.5px; white-space: nowrap; line-height: 1; }
  .agency-mark .name { font-size: 9px; line-height: 1; }
  .app-body { padding-bottom: calc(var(--mobile-chrome-height) + 24px); }
  .toast-stack { left: 12px; right: 12px; bottom: calc(var(--mobile-chrome-height) + 12px); }
  .toast { width: 100%; }
}

/* Phone only: the top switch and the gear give way to the bottom bar. A
   tablet keeps both (it has the room, and the top bar is where he looks). */
@media (max-width: 640px), (max-height: 500px) and (pointer: coarse) {
  .app-view-switch { display: none; }
  .app-gear { display: none; }
}

/* Touch-sized controls wherever the pointer is a finger. 44px is Apple's own
   minimum and the bar was at 28px. `touch-action: manipulation` also drops
   Safari's double-tap-to-zoom delay, which reads as a dropped tap. */
@media (pointer: coarse) {
  /* The blurred translucent bar is a desk flourish and a liability on a
     tablet: Safari composites it on every scroll frame and hit-testing over
     a backdrop filter has a history of going astray. Opaque on touch. */
  .app-bar { background: #F7F6F2; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .app-bar button, .app-bar a { touch-action: manipulation; -webkit-tap-highlight-color: rgba(0,0,0,0.06); }
  .app-view-tab { min-height: 44px; padding: 10px 16px; }
  .app-week-button { min-height: 44px; }
  .app-gear { min-height: 44px; min-width: 44px; font-size: 18px; }
  .app-logout { min-height: 44px; padding: 10px 10px; }
  .app-week-menu-row { min-height: 44px; }
  .rail-expander { min-height: 44px; }
}

/* ---------- Responsive app bar ---------- */
@media (max-width: 1024px) {
  .app-bar { padding: 12px 22px; }
  .app-body { padding-top: 24px; }
}
@media (max-width: 900px) {
  .app-bar { flex-wrap: wrap; }
  .app-bar-left { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; gap: 10px 16px; }
  .app-bar-right { width: 100%; justify-content: flex-end; padding-top: 2px; }
  .app-view-switch { flex-wrap: wrap; }
}
@media (max-width: 640px), (max-height: 500px) and (pointer: coarse) {
  .app-bar { padding: calc(7px + env(safe-area-inset-top, 0px)) 12px 7px; gap: 8px; flex-wrap: nowrap; }
  .app-bar-left { gap: 8px; min-width: 0; flex: 1 1 auto; flex-wrap: nowrap; }
  .app-bar-right { width: auto; flex: 0 0 auto; justify-content: flex-end; gap: 4px; padding-top: 0; }
  .app-logo { font-size: 21px; }
  .app-tool-name { display: none; }
  .app-week-button { padding: 6px 8px 6px 14px; }
  .app-week-menu { left: 0; right: 0; min-width: 0; max-width: none; width: calc(100vw - 28px); }
  .app-viewer { display: none; }
  .app-logout { margin-left: 0; padding: 8px 5px; }
  .app-body { padding-left: 14px; padding-right: 14px; }
  html, body { overflow-x: hidden; max-width: 100vw; }
  img, svg, video { max-width: 100%; height: auto; }
  .login-card { width: calc(100vw - 28px); max-width: 380px; padding: 36px 24px 28px; }
}
@media (max-width: 380px) {
  .app-bar { padding-left: 9px; padding-right: 9px; }
  .app-body { padding-left: 10px; padding-right: 10px; }
}

/* Calendar entries lead with the topic; type reads from glyph + color. */
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-title { font-weight: 600; font-size: 13px; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-publine { font-size: 13px; color: var(--text-3); margin-bottom: 12px; }

/* Calendar date picker: only dates inside an available week are pickable. */
.cal-pick { position: relative; display: inline-block; }
.cal-pick-btn { font-family: var(--mono); font-size: 11.5px; letter-spacing: .4px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border: 1px solid var(--rule-strong); border-radius: 999px;
  background: var(--bg-card); color: var(--text-2); cursor: pointer; }
.cal-pick-btn:hover { border-color: var(--accent-week); color: var(--accent-week); }
.cal-pick-glyph { display: inline-flex; align-items: center; }
.cal-pick-caret { font-size: 9px; color: var(--text-3); }
.cal-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 12px; min-width: 252px; }
.cal-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-pop-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.cal-pop-nav { border: 1px solid var(--rule-strong); background: var(--bg-card);
  border-radius: 6px; padding: 2px 9px; cursor: pointer; color: var(--text-2); }
.cal-pop-nav:disabled { opacity: .35; cursor: default; }
.cal-pop-grid { display: grid; grid-template-columns: repeat(7, 32px); gap: 2px; }
.cpd-dow { font-family: var(--mono); font-size: 10px; color: var(--text-4); text-align: center; padding: 2px 0; }
.cpd { height: 30px; border: none; background: none; border-radius: 6px; font-size: 12.5px;
  color: var(--text-4); cursor: default; }
.cpd.is-avail { color: var(--text); background: var(--accent-week-tint); cursor: pointer; }
.cpd.is-avail:hover { background: var(--accent-week); color: #fff; }
.cpd.is-current { box-shadow: inset 0 0 0 1.5px var(--accent-week); }
.cpd.is-today { font-weight: 700; text-decoration: underline; }
.cal-day.is-picked { outline: 2px solid var(--accent-week); outline-offset: -2px; border-radius: 8px; }

/* Home Screen install coach (phone browser only, dismissible). */
.portal-install { background: #fff; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05); padding: 14px 16px; margin-bottom: 12px; }
.pi-title { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.pi-body { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 10px; }
.pi-dismiss { font-size: 12.5px; font-weight: 600; border: 1px solid var(--rule-strong);
  border-radius: 999px; padding: 6px 14px; background: #fff; color: var(--text-2); cursor: pointer; }

/* The stale-build banner (2026-08-27): fixed above everything, one action. */
.update-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #002642;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  max-width: calc(100vw - 24px);
}
