/* RankHub "Briefing" skin (UI redesign 2026-10-18). Loaded after app.css and the app skin by layout.ejs and layout-public.ejs.
   Source: Marcos's Claude Design prototype "RankHub 1c Briefing" on the Modernist system: Archivo only, a near-white page,
   ink text, one red accent, square corners, 2 px dividers, a dark ink rail, a top bar, one full-width red verdict band, and
   an optional Next moves aside. It is a reskin of the shared shell and the shared tokens: no route, query or permission
   changes, and no tool page is rewritten. Every colour literal lives in the :root blocks (test/css.tokens.test.js).
   Structure rules start with `body.app` so they outrank the per-app skins, which scope to [data-app]. */

:root,
:root[data-app] {
  /* Modernist palette mapped onto the existing token names, so every page picks it up. */
  --paper: #f3f2f2;
  --surface: #fbfafa;
  --ink: #201e1d;
  --ink-2: #444141;
  --muted: #605d5d;
  --line: #d7d3d3;
  --line-2: #9b9797;
  --divider: #7d7979;
  --rail: #201e1d;
  --rail-ink: #f3f2f2;
  --rail-muted: #bab6b6;
  --col: #eae9e9;
  --col-ink: #201e1d;
  --col-muted: #605d5d;
  --col-hover: #d7d3d3;
  --col-active: #ffe0d9;
  --link: #ae1800;
  --link-soft: #fff2ef;
  --accent: #ec3013;
  --accent-ink: #f3f2f2;
  --accent-soft: #fff2ef;
  --accent-line: #ffc4b8;
  --accent-600: #dd2b0f;
  --accent-700: #ae1800;
  --accent-100: #fff2ef;
  --action: #ec3013;
  --action-hover: #dd2b0f;
  --on-dark: #f3f2f2;
  --brand-2: #e15b47;
  --hover: #eae9e9;
  --neutral-soft: #eae7e7;
  --th-bg: #eae9e9;
  --th-active: #d7d3d3;
  --row-hover: #f8f4f4;
  --note-bg: #fff2ef;
  --badge-bg: #eae7e7;
  --good: #1f6b3a;
  --warn: #8a4b00;
  --bad: #ae1800;
  --bad-soft: #fff2ef;
  --bad-soft-2: #ffe0d9;
  --bad-line: #ffc4b8;
  --chart-1: #ec3013; --chart-2: #201e1d; --chart-3: #7d7979; --chart-4: #ff9783; --chart-5: #444141; --chart-6: #e15b47;
  --radius: 0px;
  --card-radius: 0px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --topbar-h: 52px;
  --nav-w: 264px;
  --rail-w: 76px;
  --shadow-bar: none;
  --shadow-btn: none;
  --bf-shadow-lg: 0 12px 32px rgba(45, 43, 43, 0.22);
}

body { font-family: var(--font); letter-spacing: 0; }
h1, h2, h3, h4 { font-family: var(--font); font-weight: 800; letter-spacing: -0.015em; }
h4 { font-weight: 600; letter-spacing: 0.08em; }
::selection { background: var(--accent-line); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- square corners everywhere the chrome used pills and soft cards ---------- */
.chip, .pill, .mode-switch, .app-switcher, .app-switcher .app-link, .icon-btn, .m-chip, .m-mode, .m-status-tabs button,
.field-card, .kpi, .panel, .card, .btn, .btn-ghost, .btn-action, input, select, textarea, .seg, .kanban-card,
.kanban-col-head, .topmenu > .menu, .acct-switch > .menu, .palette-box, code, kbd, .count-pill, .flash, .error {
  border-radius: 0;
}

/* ---------- top bar: 52 px, 2 px divider; the brand cell is the top of the rail ---------- */
body.app .topbar { display: flex; align-items: stretch; gap: 14px; height: var(--topbar-h); padding: 0 28px 0 0; background: var(--paper); border-bottom: 2px solid var(--divider); box-shadow: none; }
body.app .topbar > * { align-self: center; }
body.app .brand { align-self: stretch; flex: 0 0 var(--rail-w); justify-content: center; background: var(--rail); margin: 0; }
body.app .brand > span:not(.mark) { display: none; }
.brand .mark { width: 24px; height: 24px; border-radius: 0; background: var(--accent); }
body.app .account { display: contents; }
body.app .account > * { align-self: center; }
body.app .topbar > .topbar-mid { order: 6; }
body.app .app-switcher { order: 1; flex: 1 1 auto; min-width: 0; align-self: stretch; margin: 0; padding: 0; border: 0; display: flex; }
body.app .app-pills { display: flex; align-items: stretch; gap: 16px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
body.app .app-pills::-webkit-scrollbar { display: none; }
body.app .app-switcher .app-link { display: inline-flex; align-items: center; padding: 0; margin-bottom: -2px; border-bottom: 3px solid transparent; background: none; color: var(--ink); font-size: 13px; font-weight: 400; white-space: nowrap; }
body.app .app-switcher .app-link:hover { background: none; text-decoration: none; border-bottom-color: var(--line-2); }
body.app .app-switcher .app-link.active { background: none; color: var(--accent-700); font-weight: 800; border-bottom-color: var(--accent); }
body.app .app-switcher .app-link.locked, body.app .app-switcher .app-link.soon { color: var(--muted); }
body.app .account > .icon-btn[data-palette-open] { order: 2; display: inline-flex; align-items: center; width: 200px; height: 36px; justify-content: flex-start; gap: 8px; padding: 0 10px; border: 1px solid var(--divider); border-radius: 0; color: var(--muted); }
body.app .account > .icon-btn[data-palette-open]:hover { background: var(--hover); }
.bf-search-label { font: 400 13px/1 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.app .account > .mode-switch { order: 3; margin: 0; }
body.app .account > .notif { order: 4; }
body.app .account > .help { order: 5; }
body.app .account > .ws-switch { order: 5; }
body.app .account > .pill { order: 7; }
body.app .account > a[href="/account"] { order: 8; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.app .account > form[action="/logout"] { order: 9; }
body.app .account > .m-acct { order: 10; }
/* The domain / contact search forms are replaced by the command palette (a typed domain opens its report there). Field keeps its job search. */
body.app[data-app="seo"] .topbar > form.search, body.app[data-app="crm"] .topbar > form.search { display: none; }
body.app .topbar-mid .search { max-width: 220px; }
body.app .search input, body.app .search button { height: 34px; border-radius: 0; }
body.app .search input { border-color: var(--divider); background: var(--surface); }
body.app .mode-switch { display: inline-flex; border: 1px solid var(--divider); overflow: hidden; }
body.app .mode-switch button { background: transparent; color: var(--ink); padding: 7px 12px; font-size: 13px; }
body.app .mode-switch button + button { border-left: 1px solid var(--divider); }
body.app .mode-switch button.active { background: var(--accent); color: var(--on-dark); }
body.app .icon-btn { border-radius: 0; color: var(--ink); }
body.app .icon-btn:hover { background: var(--hover); }
.icon-btn .dot { border-radius: 0; background: var(--accent); }
.account .pill { background: var(--accent-100); color: var(--accent-700); }
.account a { color: var(--ink); }
.topmenu > .menu, .acct-switch > .menu { border: 2px solid var(--ink); box-shadow: var(--bf-shadow-lg); }

/* ---------- rail: 76 px dark ink, icon above label, red left border on the active item ---------- */
body.app .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
body.app .shell.has-aside { grid-template-columns: var(--nav-w) minmax(0, 2fr) minmax(280px, 1fr); }
body.app .rail { grid-template-columns: var(--rail-w) 188px; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); }
body.app .iconrail { background: var(--rail); padding: 8px 0 12px; }
body.app .toolkits { gap: 2px; }
body.app .toolkits .tk { width: 100%; margin: 0; padding: 8px 2px; border-radius: 0; border-left: 3px solid transparent; color: var(--rail-ink); font: 500 10.5px/1.15 var(--font); box-shadow: none; }
body.app .toolkits .tk:hover { background: rgba(243, 242, 242, 0.08); }
body.app .toolkits .tk.active { background: rgba(243, 242, 242, 0.14); border-left-color: var(--accent); box-shadow: none; color: var(--rail-ink); }
body.app .toolkits .tk .ico { width: 20px; height: 20px; }
body.app .rail-bottom { border-top: 1px solid rgba(243, 242, 242, 0.16); }
body.app .toolcol { background: var(--col); color: var(--col-ink); border-right: 2px solid var(--divider); padding: 12px 10px 24px; }
body.app .toolcol-title { color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 12px; }
body.app .sections h4 { color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; margin: 14px 0 4px; }
body.app .sections li a { color: var(--ink); font-size: 13px; padding: 5px 8px; border-radius: 0; border-left: 3px solid transparent; }
body.app .sections li a:hover { background: var(--col-hover); color: var(--ink); }
body.app .sections li a.active { background: transparent; color: var(--accent-700); font-weight: 800; border-left-color: var(--accent); }
body.app .acct-switch summary { background: var(--surface); border: 1px solid var(--divider); color: var(--ink); }
body.app .acct-switch summary .ico, body.app .acct-city { color: var(--muted); }
body.app .acct-switch summary .acct-name { color: var(--ink); }
body.app .palette-open { display: none; }
body.app.rail-collapsed .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
body.app.rail-collapsed .shell.has-aside { grid-template-columns: var(--rail-w) minmax(0, 2fr) minmax(280px, 1fr); }
body.app.rail-collapsed .rail { grid-template-columns: var(--rail-w); }

/* ---------- content, verdict band, controls row ---------- */
body.app .content { padding: 24px 24px 60px; }
body.app[data-mode="simple"] .content { padding: 28px 40px 48px; }
body.app .page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin: -24px -24px 24px; padding: 26px 24px 24px; background: var(--accent); color: var(--accent-ink); border: 0; }
body.app[data-mode="simple"] .page-head, body.app[data-mode="simple"] .crm-head { margin: -28px -40px 28px; padding: 36px 40px 34px; }
body.app .crm-head { display: block; min-width: 0; margin: -24px -24px 24px; padding: 26px 24px 16px; background: var(--accent); color: var(--accent-ink); border: 0; }
body.app .page-head > div:first-child, body.app .head-main { min-width: 0; flex: 1 1 420px; }
body.app .page-head h1, body.app .crm-head h1 { margin: 6px 0 10px; font-size: 54px; font-weight: 800; line-height: 1.02; letter-spacing: -0.02em; color: var(--accent-ink); overflow-wrap: anywhere; }
body.app .page-head h1:has(.h1-target) { font-size: 40px; }
body.app .page-head h1 .h1-target { font-weight: 800; color: inherit; }
body.app .page-head .crumbs, body.app .page-head .crumbs a { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-ink); }
body.app .page-head .crumbs a:hover { text-decoration: underline; }
body.app .page-head .sep { margin: 0 6px; opacity: 0.8; }
body.app .page-head .blurb, body.app .page-head > div:first-child > p:not(.crumbs) { max-width: 760px; margin: 0; font-size: 19px; font-weight: 600; line-height: 1.35; color: var(--accent-ink); }
body.app .page-head .chip { background: var(--accent-ink); color: var(--accent-700); vertical-align: middle; font-size: 12px; }
body.app .head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
body.app .page-head .head-links a, body.app .page-head .project-tag { color: var(--accent-ink); }
body.app .page-head .export { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
body.app .page-head .btn-ghost, body.app .page-head .btn, body.app .crm-head .btn-ghost { height: 36px; background: transparent; color: var(--accent-ink); border: 1px solid var(--accent-ink); font-weight: 800; }
body.app .page-head .btn, body.app .crm-head .btn { background: var(--accent-ink); color: var(--accent-700); border-color: var(--accent-ink); height: 36px; }
body.app .chip, body.app .count-pill, body.app .pill { border-radius: 0; }
body.app .page-head .btn-ghost:hover, body.app .crm-head .btn-ghost:hover { background: rgba(243, 242, 242, 0.14); filter: none; }
body.app .page-head .api-call > summary, body.app .page-head summary.btn-ghost { color: var(--accent-ink); border-color: var(--accent-ink); }
body.app .page-head .menu { color: var(--ink); }
body.app .crm-head-row { align-items: flex-end; min-width: 0; max-width: 100%; gap: 8px 24px; }
body.app .crm-tabs { min-width: 0; }
body.app .crm-actions { min-width: 0; }
body.app .crm-tabs a { color: var(--accent-ink); border-bottom: 3px solid transparent; padding: 6px 0 8px; font-size: 14px; }
body.app .crm-tabs a.active { color: var(--accent-ink); font-weight: 800; border-bottom-color: var(--accent-ink); }
body.app .crm-head .project-tag { color: var(--accent-ink); }
body.app .inputs.controls { margin: 0 -24px 24px; padding: 10px 24px; border-bottom: 2px solid var(--divider); gap: 10px; }
body.app[data-mode="simple"] .inputs.controls { margin-left: -40px; margin-right: -40px; padding-left: 40px; padding-right: 40px; }
body.app .inputs.controls label { color: var(--muted); }
body.app .subtabs { border-bottom: 2px solid var(--divider); gap: 22px; }
body.app .subtabs a { color: var(--ink); border-bottom: 3px solid transparent; margin-bottom: -2px; }
body.app .subtabs a.active { color: var(--accent-700); font-weight: 800; border-bottom-color: var(--accent); }
body.app .back-home { color: var(--accent-700); font-weight: 600; }
@media (min-width: 769px) {
  /* Simple mode puts a "Back to home" link above the head; it rides on the band instead of floating over the page color. */
  body.app[data-mode="simple"] .back-home { display: block; margin: -28px -40px 0; padding: 14px 40px 0; background: var(--accent); color: var(--accent-ink); font-size: 13px; }
  body.app[data-mode="simple"] .back-home + .page-head { margin-top: 0; padding-top: 14px; }
}

/* Simple mode keeps its centered column, except where a band heads the page: the band runs the full width (the app.css rule it outranks is higher-specificity, so these three need !important). */
body.app[data-mode="simple"] .content:has(.simple-head, .page-head) { max-width: none !important; margin: 0 !important; padding: 28px 40px 48px !important; }
body.app .simple-head { margin: -28px -40px 28px; padding: 36px 40px 34px; background: var(--accent); color: var(--accent-ink); }
body.app .simple-head h1 { margin: 0 0 10px; font-size: 54px; font-weight: 800; line-height: 1.02; letter-spacing: -0.02em; color: var(--accent-ink); overflow-wrap: anywhere; }
body.app .simple-head .lead { margin: 0; max-width: 760px; font-size: 19px; font-weight: 600; line-height: 1.35; color: var(--accent-ink); }
body.app .simple-head .lead a { color: var(--accent-ink); }
body.app .simple-home > :not(.simple-head) { max-width: 1040px; }

/* ---------- buttons, tags, forms, tables, panels ---------- */
.btn, .btn-action { font-weight: 800; border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: none; background: var(--accent-600); }
.btn-action:hover { background: var(--accent-600); }
.btn-ghost { background: transparent; border: 1px solid var(--divider); color: var(--ink); font-weight: 600; }
.btn-ghost:hover { background: var(--hover); border-color: var(--ink); }
a { text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
input[type=text], input[type=search], input[type=url], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea { background: var(--col); border: 1px solid var(--divider); color: var(--ink); caret-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.chip, .pill, .count-pill { font-family: var(--font); letter-spacing: 0.02em; padding: 3px 10px; }
.chip-accent { background: var(--accent-100); color: var(--accent-700); }
.seg { border: 1px solid var(--divider); }
.seg-opt input:checked + span { background: var(--accent); color: var(--on-dark); }
.panel, .kpi, .card { background: var(--surface); border: 1px solid var(--line); box-shadow: none; }
.panel h2, .panel h3 { font-weight: 800; }
body.app .kpi .label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-weight: 800; }
table.data th { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: transparent; border-bottom: 2px solid var(--divider); }
table.data th[data-dir] { background: var(--col); color: var(--ink); }
table.data td { border-bottom: 1px solid var(--line); }
table.data tbody tr:hover { background: var(--row-hover); }
.flash { background: var(--accent-100); border-color: var(--accent-line); }
code { background: var(--col); }
hr, .hr { border: 0; height: 2px; background: var(--divider); }
body.app .kanban-col-head { border: 1px solid var(--line); border-top: 3px solid var(--ink); }
body.app .kanban-card { border-color: var(--line); }

/* ---------- command palette: red header input, grouped numbered results ---------- */
.palette { background: rgba(45, 43, 43, 0.45); }
.palette-box { width: min(640px, calc(100vw - 32px)); margin-top: 0; background: var(--paper); box-shadow: var(--bf-shadow-lg); overflow: hidden; border: 0; }
.palette-box input { height: 60px; padding: 0 64px 0 18px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 0; font-size: 22px; font-weight: 800; caret-color: var(--accent-ink); }
.palette-box input::placeholder { color: var(--accent-ink); opacity: 0.8; font-weight: 600; }
.palette-box input::-webkit-search-cancel-button { appearance: none; display: none; }
.palette-box input:focus { outline: 0; background: var(--accent); }
.palette-box { position: relative; }
.palette-box::after { content: "Esc"; position: absolute; top: 0; right: 18px; line-height: 60px; font-size: 13px; font-weight: 600; color: var(--accent-ink); pointer-events: none; }
.palette-close { display: none; position: absolute; top: 12px; right: 10px; width: 36px; height: 36px; color: var(--accent-ink); }
.palette-close:hover { background: rgba(243, 242, 242, 0.18); color: var(--accent-ink); }
.palette-list { padding: 0; max-height: 52vh; }
.palette-list li { grid-template-columns: 34px minmax(0, 1fr) auto; align-items: baseline; gap: 0 8px; padding: 10px 18px; border-radius: 0; border-bottom: 1px solid var(--line); }
.palette-list li .n { font-weight: 800; color: var(--accent-700); font-size: 14px; }
.palette-list li .t { font-size: 14px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.palette-list li .s { font-size: 12px; color: var(--muted); text-align: right; }
.palette-list li.group { display: block; padding: 12px 18px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 0; cursor: default; }
.palette-list li.empty { display: block; }
.palette-list li[aria-selected="true"] { background: var(--accent-100); }
.palette-foot { border-top: 2px solid var(--divider); color: var(--muted); }

/* ---------- aside: Next moves + Sources (drawn only when a page passes `aside`) ---------- */
.bf-aside { padding: 24px 24px 28px; border-left: 2px solid var(--divider); display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.bf-aside h6 { margin: 0; font-size: 13px; }
.bf-aside-sub { margin: 2px 0 8px; font-size: 12px; color: var(--muted); }
.bf-moves { list-style: none; margin: 0; padding: 0; }
.bf-moves li { display: grid; grid-template-columns: 34px minmax(0, 1fr); padding: 12px 0; border-top: 1px solid var(--line); }
.bf-move-n { font-size: 22px; font-weight: 800; line-height: 1; color: var(--accent-700); }
.bf-move-t { margin: 0; font-size: 14px; font-weight: 600; }
.bf-move-why { margin: 2px 0 6px; font-size: 12px; color: var(--muted); }
.bf-move-foot { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.bf-move-foot a { color: var(--accent-700); font-weight: 600; }
.tag { display: inline-flex; align-items: center; font-size: 11px; padding: 3px 10px; }
.tag-neutral { background: var(--neutral-soft); color: var(--ink-2); }
.bf-sources { border-top: 2px solid var(--ink); padding-top: 10px; }
.bf-src-list { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); }
.bf-src-list a { color: var(--accent-700); font-weight: 600; }
@media (max-width: 1100px) {
  body.app .shell.has-aside, body.app.rail-collapsed .shell.has-aside { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .bf-aside { grid-column: 2; border-left: 0; border-top: 2px solid var(--divider); }
}

/* ---------- signed-out / public header ---------- */
.pub-top { height: 56px; padding: 0 24px; border-bottom: 2px solid var(--divider); background: var(--paper); }
.pub-top .brand .mark { width: 14px; height: 14px; }
.pub-top .brand { font-size: 18px; font-weight: 800; }
.pub-top nav a:not(.btn) { color: var(--ink); font-weight: 600; }
body.public .pub-top nav a[href="/login"] { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid var(--divider); }
body.public .pub-top nav a.btn { height: 36px; }

/* ---------- tablet: tighten the top bar before it wraps ---------- */
@media (max-width: 1200px) {
  body.app .account > a[href="/account"], body.app .account > .pill { display: none; }
}
@media (max-width: 1000px) {
  body.app .topbar { gap: 10px; padding-right: 16px; }
  body.app .account > .icon-btn[data-palette-open] { width: 36px; padding: 0; justify-content: center; }
  .bf-search-label { display: none; }
  body.app .account > .help { display: none; }
  body.app .page-head h1, body.app .crm-head h1 { font-size: 40px; }
}

/* ---------- tablet (769-900 px): app.css stacks the rail above the content under 900 px; the briefing keeps the vertical rail and tool column ---------- */
@media (min-width: 769px) and (max-width: 900px) {
  body.app .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  body.app.rail-collapsed .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  body.app .rail { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); grid-template-columns: var(--rail-w) 188px; }
  body.app.rail-collapsed .rail { grid-template-columns: var(--rail-w); }
  body.app .iconrail { flex-direction: column; overflow-x: hidden; overflow-y: auto; padding: 8px 0 12px; }
  body.app .toolkits { flex-direction: column; }
  body.app .rail-bottom { border-top: 1px solid rgba(243, 242, 242, 0.16); padding-top: 6px; margin-top: 8px; }
  body.app .toolkits .tk.collapse { display: flex; }
  body.app .toolcol { max-height: none; border-right: 2px solid var(--divider); border-bottom: 0; }
  body.app.rail-collapsed .toolcol { display: none; }
  body.app .content { padding: 24px 24px 60px; }
  body.app .page-head, body.app .crm-head { flex-direction: row; }
  body.app .head-right { align-items: flex-start; }
}

/* ---------- phone (<= 768 px): red band header, light top bar, 5-slot bottom tab bar with a 4 px red top border ---------- */
@media (max-width: 768px) {
  body.app .shell, body.app.rail-collapsed .shell, body.app .shell.has-aside, body.app.rail-collapsed .shell.has-aside { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  body.app .rail, body.app.rail-collapsed .rail { display: none; }
  body.app .page-head { display: none; }
  body.app .account > .mode-switch, body.app .account > .ws-switch, body.app .account > .help, body.app .account > .pill, body.app .account > a[href="/account"], body.app .account > form[action="/logout"] { display: none; }
  .bf-aside { grid-column: 1; }
  body.app .account > .m-acct { display: block; }
  .palette-box::after { content: none; }
  body.app .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 0; height: calc(52px + env(safe-area-inset-top)); }
  body.app .brand { flex: none; align-self: stretch; width: 56px; padding: 0; }
  body.app .account { display: flex; justify-content: flex-end; gap: 0; min-width: 0; }
  body.app .account > .icon-btn[data-palette-open] { order: 0; width: 44px; height: 44px; padding: 0; border: 0; justify-content: center; }
  body.app .account > .icon-btn { width: 44px; height: 44px; }
  body.app .topbar > form.search, body.app .topbar > .topbar-mid { display: none; }
  body.app .app-switcher { order: 0; align-self: center; flex: 0 1 auto; position: relative; }
  body.app .app-pills { display: none; }
  .app-menu-btn { border-radius: 0; border: 1px solid var(--divider); background: transparent; font-weight: 800; }
  .app-menu-list { border-radius: 0; border: 2px solid var(--ink); box-shadow: var(--bf-shadow-lg); }
  .app-menu-item { border-radius: 0; min-height: 52px; font-weight: 700; font-size: 17px; border-bottom: 1px solid var(--line); }
  .app-menu-item.active { background: var(--accent); color: var(--on-dark); }
  .m-avatar > span { border-radius: 0; background: var(--accent); }
  .m-mode { border-radius: 0; border-color: var(--divider); }
  .m-mode button.active { background: var(--accent); }
  body.app .content { padding: 0 16px 32px; }
  body.app[data-mode="simple"] .content { padding: 0 16px 32px; }
  body.app .content > :first-child:not(.m-head) { margin-top: 16px; }
  body.app[data-mode="simple"] .content:has(.simple-head, .page-head) { padding: 0 16px 32px !important; }
  body.app .simple-head { margin: 0 -16px 16px; padding: 20px 16px 16px; }
  body.app .simple-head h1 { font-size: 30px; }
  body.app .simple-head .lead { font-size: 15px; }

  /* band header: kicker, title, one-line summary, project chip + page menu */
  body.app .m-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; margin: 0 -16px 16px; padding: 18px 16px 16px; background: var(--accent); color: var(--accent-ink); }
  .m-kicker { grid-row: 1; grid-column: 1 / -1; margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.app .m-title { grid-row: 2; grid-column: 1 / -1; margin: 0; font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; white-space: normal; overflow: visible; overflow-wrap: anywhere; color: var(--accent-ink); }
  .m-title .chip { background: var(--accent-ink); color: var(--accent-700); font-size: 11px; vertical-align: middle; }
  .m-verdict { grid-row: 3; grid-column: 1 / -1; margin: 4px 0 8px; font-size: 15px; font-weight: 600; line-height: 1.35; }
  .m-verdict:empty, .m-verdict:-moz-only-whitespace { display: none; }
  body.app .m-proj { grid-row: 4; grid-column: 1; justify-self: start; }
  body.app .m-dots { grid-row: 4; grid-column: 2; }
  body.app .m-chip { border: 1px solid var(--accent-ink); border-radius: 0; background: transparent; color: var(--accent-ink); }
  body.app .m-dots .icon-btn { color: var(--accent-ink); border: 1px solid var(--accent-ink); }
  body.app .m-dots .icon-btn:hover { background: rgba(243, 242, 242, 0.18); }
  body.app .m-head .topmenu > .menu { color: var(--ink); }
  body.app .m-head .menu a, body.app .m-head .menu .link { color: var(--ink); }
  body.app .crm-head, body.app[data-mode="simple"] .crm-head { margin: 0 -16px 16px; padding: 18px 16px 12px; }
  body.app .crm-head h1 { font-size: 30px; }
  body.app .inputs.controls, body.app[data-mode="simple"] .inputs.controls { margin: 0 -16px 16px; padding: 10px 16px; }

  /* bottom tab bar: five slots, text only, 4 px red top border on the active tab */
  body.app .m-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--paper); border-top: 2px solid var(--ink); }
  body.app .m-tab { flex-direction: row; align-items: center; justify-content: flex-start; gap: 0; min-height: 52px; padding: 0 10px; border-top: 4px solid transparent; margin-top: -2px; color: var(--ink); font-size: 13px; font-weight: 700; text-align: left; }
  body.app .m-tab .ico { display: none; }
  body.app .m-tab.active { color: var(--accent-700); font-weight: 800; border-top-color: var(--accent); }
  body.app .m-more { display: flex; }
  body.app .m-more[open]::before { background: rgba(45, 43, 43, 0.45); }
  body.app .m-sheet { bottom: calc(52px + env(safe-area-inset-bottom)); border-radius: 0; background: var(--paper); box-shadow: var(--bf-shadow-lg); padding: 0 0 12px; }
  body.app .m-sheet-head { background: var(--accent); color: var(--accent-ink); padding: 8px 8px 8px 16px; }
  body.app .m-sheet-title { font-size: 24px; font-weight: 800; }
  body.app .m-sheet-close { color: var(--accent-ink); }
  body.app .m-group { border-top: 0; padding: 0; }
  body.app .m-group-title { padding: 0 16px; min-height: 44px; color: var(--muted); }
  body.app .m-group ul { display: block; margin: 0; }
  body.app .m-group a { min-height: 56px; padding: 0 16px; border-radius: 0; border-bottom: 1px solid var(--line); font-size: 17px; font-weight: 700; }
  body.app .m-group a.active { background: var(--accent-100); color: var(--accent-700); }
  body.app .m-proj-list { padding: 0 16px; }
  body.app .m-proj-list button { border-radius: 0; border-bottom: 1px solid var(--line); min-height: 52px; }
  body.app .m-proj-list button.active { background: var(--accent-100); }
  body.app .m-fab { bottom: calc(68px + env(safe-area-inset-bottom)); border-radius: 0; background: var(--accent); }
  body.app .m-status-tabs button { border-radius: 0; }
  body.app .m-status-tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
  body.app .kpi { border-radius: 0; }
  body.app .palette-box input { height: 60px; font-size: 20px; }
  body.app .palette-box .palette-close { display: inline-grid; top: calc(12px + env(safe-area-inset-top)); color: var(--accent-ink); }
  body.app .palette-list li { min-height: 52px; }
  .pub-top { padding: 0 16px; }
}
