/* Portal design system (ADR 0055, layout A · Calm workspace).
   Client colors arrive as --brand-primary / --brand-accent from base.html; everything
   else is neutral so any brand color sits well on it. No platform branding here. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e4e7ec;
  --border-soft: #eef0f3;
  --field-border: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #475467;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --brand-tint: color-mix(in srgb, var(--brand-primary) 8%, #ffffff);
  --brand-tint-strong: color-mix(in srgb, var(--brand-primary) 16%, #ffffff);
  --brand-ink: var(--brand-primary);  /* the brand color used as text, links and outlines */
  --hover: #f9fafb;
  --sunken: #f5f6f8;
  --danger-border: #fecdca;
  --ok-border: #abefc6;
  --warn: #93370d;
  --warn-bg: #fffaeb;
  --warn-border: #fedf89;
  --warn-surface: #fffcf5;
  --shadow-hover: 0 6px 18px rgba(16, 24, 40, .08);
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .13);
  color-scheme: light;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --topbar-h: 64px;
}

/* ------------------------------------------------------------------ Dark mode
   The person's choice (data-theme on <html>) or, for "match device", the device setting.
   Client brand colors stay the client's; as text they're lightened (--brand-ink). */
:root[data-theme="dark"] {
  --bg: #0c111a;
  --surface: #141b26;
  --border: #283244;
  --border-soft: #1e2633;
  --field-border: #3a465a;
  --text: #f2f4f7;
  --text-2: #d0d5dd;
  --muted: #9aa4b5;
  --danger: #f97066;
  --danger-bg: #2b1316;
  --danger-border: #6b2a22;
  --ok: #47cd89;
  --ok-bg: #0e281c;
  --ok-border: #145c39;
  --warn: #fdb022;
  --warn-bg: #2b1f07;
  --warn-border: #6b4a0f;
  --warn-surface: #1b1810;
  --hover: #1a2230;
  --sunken: #0f151f;
  --brand-tint: color-mix(in srgb, var(--brand-primary) 24%, #141b26);
  --brand-tint-strong: color-mix(in srgb, var(--brand-primary) 40%, #141b26);
  --brand-ink: color-mix(in srgb, var(--brand-primary) 38%, #ffffff);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, .45);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
  --bg: #0c111a;
  --surface: #141b26;
  --border: #283244;
  --border-soft: #1e2633;
  --field-border: #3a465a;
  --text: #f2f4f7;
  --text-2: #d0d5dd;
  --muted: #9aa4b5;
  --danger: #f97066;
  --danger-bg: #2b1316;
  --danger-border: #6b2a22;
  --ok: #47cd89;
  --ok-bg: #0e281c;
  --ok-border: #145c39;
  --warn: #fdb022;
  --warn-bg: #2b1f07;
  --warn-border: #6b4a0f;
  --warn-surface: #1b1810;
  --hover: #1a2230;
  --sunken: #0f151f;
  --brand-tint: color-mix(in srgb, var(--brand-primary) 24%, #141b26);
  --brand-tint-strong: color-mix(in srgb, var(--brand-primary) 40%, #141b26);
  --brand-ink: color-mix(in srgb, var(--brand-primary) 38%, #ffffff);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, .45);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
  }
}
/* Logos are made for white: give them a white plate on dark. Reports render as designed. */
:root[data-theme="dark"] .brand-logo { background: #fff; padding: 4px 6px; border-radius: 8px; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .brand-logo { background: #fff; padding: 4px 6px; border-radius: 8px; } }
.report-frame { background: #fff; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
       color: var(--text); background: var(--bg); }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; margin: 0 0 4px; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: .95rem; font-weight: 600; margin: 16px 0 6px; }
p { margin: 0 0 12px; }
a { color: var(--brand-ink); text-underline-offset: 2px; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--brand-accent); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; }
code { font-size: .9em; background: var(--border-soft); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); font-size: .9rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden;
                   clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 10; background: var(--surface);
             padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------------ top bar */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
          min-height: var(--topbar-h); padding: 10px 24px; background: var(--surface);
          border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none;
         font-weight: 600; font-size: 1rem; min-width: 0; }
.brand:hover { color: var(--text); }
.brand-mark { width: 36px; height: 36px; flex: none; border-radius: var(--radius-sm);
              background: var(--brand-primary); color: #fff; display: grid; place-items: center;
              font-weight: 700; font-size: 1.05rem; }
.brand-logo { height: 36px; width: auto; max-width: 160px; object-fit: contain; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-search { flex: 1 1 280px; max-width: 420px; margin: 0 auto; display: flex; }
.topbar-search input { max-width: none; }
.topbar-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar-nav > a { padding: 9px 12px; border-radius: 8px; color: var(--text-2); text-decoration: none;
                  font-size: .93rem; }
.topbar-nav > a:hover { background: var(--border-soft); color: var(--text); }

/* Menus: <details> so they work without JavaScript. */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px;
              background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
              box-shadow: var(--shadow-pop); padding: 6px; }
.menu-panel a, .menu-panel button { display: block; width: 100%; text-align: left; padding: 9px 12px;
              border-radius: 8px; color: var(--text-2); text-decoration: none; background: none;
              border: 0; font: inherit; font-size: .93rem; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--border-soft); color: var(--text); }
.menu-panel form { margin: 0; }
.menu-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px;
             font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.avatar { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--field-border);
          background: var(--surface); display: grid; place-items: center; font-weight: 600;
          font-size: .85rem; color: var(--text-2); text-transform: uppercase; }

/* ------------------------------------------------------------------ page */
main { display: block; }
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 48px; }
.page-narrow { max-width: 880px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
             gap: 12px 16px; margin-bottom: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 28px; }

/* Sidebar layout (home). */
.with-sidebar { display: flex; flex-wrap: wrap; gap: 24px 32px; }
.sidebar { flex: 1 1 200px; max-width: 240px; display: flex; flex-direction: column; gap: 2px; }
.sidebar a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 8px;
             color: var(--text-2); text-decoration: none; font-size: .93rem; }
.sidebar a:hover { background: var(--border-soft); color: var(--text); }
.sidebar a[aria-current] { background: var(--brand-tint); color: var(--brand-ink); font-weight: 600; }
.sidebar .count { color: var(--muted); font-weight: 400; }
.sidebar-label { margin: 16px 12px 6px; font-size: .75rem; font-weight: 600; letter-spacing: .04em;
                 text-transform: uppercase; color: var(--muted); }
.sidebar hr { border: 0; height: 1px; background: var(--border); margin: 14px 12px; }
.with-sidebar > .content { flex: 999 1 560px; min-width: 0; }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); overflow-x: auto; }
.card > :last-child { margin-bottom: 0; }
.card h2:first-child { margin-top: 0; }

/* Report tiles (favorites) and rows (lists). */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
         list-style: none; margin: 0; padding: 0; }
.tile { display: flex; flex-direction: column; height: 100%; background: var(--surface);
        border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
        color: var(--text); text-decoration: none; box-shadow: var(--shadow);
        transition: border-color .15s, box-shadow .15s; }
.tile:hover { color: var(--text); border-color: var(--brand-tint-strong);
              box-shadow: var(--shadow-hover); }
.tile-art { height: 104px; background: var(--brand-tint); display: flex; align-items: flex-end; gap: 8px;
            padding: 16px 20px; }
.tile-art span { width: 18%; border-radius: 4px; background: var(--brand-primary); }
.tile-art span:nth-child(1) { height: 40%; opacity: .35; }
.tile-art span:nth-child(2) { height: 70%; opacity: .55; }
.tile-art span:nth-child(3) { height: 55%; opacity: .45; }
.tile-art span:nth-child(4) { height: 85%; opacity: .7; }
.tile-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile-title { font-weight: 600; }
.tile-meta { font-size: .85rem; color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.rows > li + li { border-top: 1px solid var(--border-soft); }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; color: var(--text);
       text-decoration: none; }
a.row:hover { background: var(--hover); color: var(--text); }
.row-icon { width: 36px; height: 36px; flex: none; border-radius: 9px; background: var(--brand-tint);
            color: var(--brand-ink); display: grid; place-items: center; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-meta { font-size: .85rem; color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
                margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.empty { padding: 32px 22px; text-align: center; color: var(--muted); }

/* Simple bulleted report lists still used on some pages. */
ul.reports { list-style: none; padding: 0; margin: 0; }
ul.reports li { padding: 9px 0; border-top: 1px solid var(--border-soft); }
ul.reports li:first-child { border-top: 0; }

/* ------------------------------------------------------------------ controls */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
                  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
                  border: 1px solid var(--brand-primary); background: var(--brand-primary); color: #fff;
                  font: inherit; font-size: .93rem; font-weight: 600; line-height: 1.2;
                  text-decoration: none; cursor: pointer; white-space: nowrap; }
button:hover, .button:hover { color: #fff; filter: brightness(1.08); }
button.secondary, .button.secondary { background: var(--surface); color: var(--text-2);
                  border-color: var(--field-border); }
button.secondary:hover, .button.secondary:hover { color: var(--text); background: var(--hover); filter: none; }
button.danger, .button.danger { background: var(--surface); color: var(--danger); border-color: var(--danger-border); }
button.danger:hover { background: var(--danger-bg); color: var(--danger); filter: none; }
button.link { background: none; border: 0; min-height: 0; padding: 0; color: var(--brand-ink);
              font-weight: 400; text-decoration: underline; }
button.link:hover { filter: none; color: var(--text); }
button.icon { width: 40px; padding: 0; }
button[aria-pressed="true"].secondary { background: var(--brand-tint); color: var(--brand-ink);
              border-color: var(--brand-tint-strong); }

label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: .9rem; color: var(--text-2); }
input[type=email], input[type=password], input[type=text], input[type=search], input[type=url],
input[type=number], input[type=time], input[type=date], input[type=file], select, textarea {
  width: 100%; max-width: 440px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--field-border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit;
  font-size: .95rem; }
input[type=file] { padding: 7px 10px; }
input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--field-border);
                    border-radius: var(--radius-sm); background: var(--surface); }
textarea { max-width: 640px; min-height: 96px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand-ink);
                                          vertical-align: -3px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 16px 16px;
           margin: 14px 0; }
legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }

/* ------------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: left; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
     color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td form { margin: 0; }

/* ------------------------------------------------------------------ messages and tags */
.error, .notice, .success { border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px;
                            font-size: .93rem; }
.error { color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-border); }
.notice { color: var(--text-2); background: var(--brand-tint); border: 1px solid var(--brand-tint-strong); }
.success { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok-border); }
.tag { display: inline-block; font-size: .75rem; font-weight: 500; padding: 2px 8px; border-radius: 999px;
       background: var(--border-soft); color: var(--muted); vertical-align: 1px; }

/* Tabs (Manage, Help). */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px;
        overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font-size: .93rem; font-weight: 500;
          border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current] { color: var(--brand-ink); border-bottom-color: var(--brand-ink); font-weight: 600; }

/* ------------------------------------------------------------------ report page */
.report-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
              gap: 10px 16px; margin-bottom: 14px; }
.report-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.report-title h1 { font-size: 1.3rem; margin: 0; overflow-wrap: anywhere; }
.back { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-sm);
        border: 1px solid var(--field-border); background: var(--surface); color: var(--text-2); text-decoration: none; }
.back:hover { color: var(--text); background: var(--hover); }
.report-actions { display: flex; align-items: center; gap: 8px; }
.report-actions form { margin: 0; }
.report-frame { height: calc(100vh - var(--topbar-h) - 120px); min-height: 420px; padding: 0; overflow: hidden;
                background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
                box-shadow: var(--shadow); }
.report-frame iframe { border: 0; }
.page-report { padding-top: 18px; padding-bottom: 20px; }

/* ------------------------------------------------------------------ phones (ADR 0048) */
@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  body { font-size: 15px; }
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
  .topbar-search { order: 3; flex: 1 1 100%; max-width: none; margin: 0 0 4px; }
  .topbar-nav > a.optional { display: none; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-logo { height: 30px; }
  .page { padding: 18px 14px 36px; }
  h1 { font-size: 1.3rem; }
  .card { padding: 16px; }
  .card table { min-width: 36rem; }  /* scroll sideways instead of crushing columns */
  td select { min-width: 8rem; }
  input[type=email], input[type=password], input[type=text], input[type=search], input[type=url],
  input[type=number], input[type=file], select, textarea { max-width: 100%; font-size: 16px; }
  .with-sidebar { gap: 16px; }
  .sidebar { flex: 1 1 100%; max-width: none; flex-direction: row; overflow-x: auto; gap: 6px;
             scrollbar-width: none; padding-bottom: 2px; }
  .sidebar a { flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
               padding: 7px 14px; }
  .sidebar .sidebar-label, .sidebar hr, .sidebar .secondary-link { display: none; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .tile-art { height: 72px; }
  .report-frame { height: auto; min-height: 0; aspect-ratio: 16 / 10; }
  /* A report's own phone layout scrolls inside the frame, so the frame fills the screen. */
  .report-frame.phone-layout { aspect-ratio: auto; height: calc(100vh - 140px); height: calc(100dvh - 140px);
                               min-height: 360px; }
  .report-bar .label-wide { display: none; }
  .report-actions > .button, .report-actions > form > button { width: 40px; padding: 0; }
  body.report-page .topbar-search { display: none; }
  .report-actions .menu-panel { left: 0; right: auto; }
}

/* Phone held sideways: the report gets the whole screen (ADR 0048 follow-up). */
@media (orientation: landscape) and (max-height: 520px) {
  body.report-page .topbar { display: none; }
  body.report-page .page-report { padding: 6px 10px 0; max-width: none; }
  body.report-page .report-bar { margin-bottom: 6px; flex-wrap: nowrap; }
  body.report-page .report-title h1 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.report-page .label-wide { display: none; }
  body.report-page .back, body.report-page .report-actions > .button, body.report-page .report-actions > form > button,
  body.report-page .report-actions > details > summary {
    width: 34px; height: 34px; min-height: 34px; padding: 0; }
  body.report-page .report-frame { height: calc(100vh - 52px) !important; aspect-ratio: auto !important;
    border-radius: 8px; }
  body.report-page #rotate-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Help guides. */
pre { background: var(--bg); border: 1px solid var(--border-soft); padding: 12px 14px; border-radius: var(--radius-sm);
      overflow-x: auto; font-size: .88rem; }
.card ol, .card ul:not(.reports):not(.rows):not(.tiles) { padding-left: 1.3em; }
.card li { margin: 4px 0; }

/* Branding preview (Manage → Branding). */
.brand-preview { max-width: 560px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
                 background: var(--bg); }
.brand-preview .topbar { border-bottom: 1px solid var(--border); }

/* ------------------------------------------------------------------ Manage lists (People, Groups) */
.meter-label { margin: 2px 0 6px; font-size: .88rem; }
.meter { width: 180px; height: 6px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand-primary); }
.section-head > div { min-width: 0; }
.card.flush { padding: 0; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 22px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 22px; }
table.list tr.dim td { color: var(--muted); }
.person { display: flex; align-items: center; gap: 12px; line-height: 1.35; }
.person .muted { font-size: .88rem; }
.avatar.small { width: 32px; height: 32px; font-size: .75rem; flex: none; }
form.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
form.inline select { width: auto; min-width: 150px; min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
td.row-actions { text-align: right; white-space: nowrap; }
td.row-actions form + form { margin-left: 6px; }
button.small, .button.small { min-height: 32px; padding: 4px 12px; font-size: .85rem; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.off { background: var(--border-soft); color: var(--muted); }
.role-help { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 14px 0 16px;
             font-size: .88rem; color: var(--muted); }
.role-help dt { font-weight: 600; color: var(--text-2); }
.role-help dd { margin: 0; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 14px 0; }

/* A button that opens a panel (no JavaScript: <details>). */
.popover { position: relative; }
.popover > summary { list-style: none; }
.popover > summary::-webkit-details-marker { display: none; }
.popover-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(380px, calc(100vw - 32px));
                 box-shadow: var(--shadow-pop); }
.popover-panel input, .popover-panel select { width: 100%; }

/* A collapsed card (rare or risky actions). */
details.disclosure > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline;
                               gap: 4px 12px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary h2 { margin: 0; }
details.disclosure > summary::after { content: "Show"; margin-left: auto; color: var(--brand-ink); font-size: .9rem; }
details.disclosure[open] > summary::after { content: "Hide"; }
details.disclosure[open] > summary { margin-bottom: 12px; }

@media (max-width: 760px) {
  .section-head { flex-wrap: wrap; }
  .popover-panel { position: fixed; left: 16px; right: 16px; top: 80px; width: auto; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
  table.list tr:last-child { border-bottom: 0; }
  table.list td, .card.flush table td:first-child, .card.flush table td:last-child { padding: 4px 0; border: 0; }
  table.list td[data-label="Role"], table.list td[data-label="Status"] { display: inline-block; width: auto; margin-right: 10px; }
  td.row-actions { text-align: left; padding-top: 8px !important; }
}

/* ------------------------------------------------------------------ Manage → Folders and reports */
.card.folder { padding: 16px 20px; overflow: visible; }
.card.folder.unfiled { border-color: var(--warn-border); background: var(--warn-surface); }
.folder-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.folder-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.folder-title h3 { margin: 0; font-size: 1rem; }
.folder-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
               background: var(--brand-tint); color: var(--brand-ink); }
.unfiled .folder-icon { background: var(--warn-bg); color: var(--warn); }
.folder-note { margin: 10px 0 0; font-size: .9rem; }
.rows.report-rows { margin: 12px 0 0; border: 0; border-top: 1px solid var(--border-soft); border-radius: 0;
                   box-shadow: none; background: none; overflow: visible; }
.report-rows .row { padding: 10px 0; }
.report-rows .row-main { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.report-rows .row-title { color: var(--text); text-decoration: none; font-weight: 500; }
.report-rows .row-title:hover { color: var(--brand-ink); text-decoration: underline; }
.icon-only { width: 36px; padding-left: 0; padding-right: 0; font-size: 1.1rem; }
.menu-card { width: 280px; padding: 10px; }
.menu-card hr { border: 0; border-top: 1px solid var(--border-soft); margin: 12px 0; }
.menu-card label { margin-top: 4px; }
.menu-label { font-size: .8rem; color: var(--muted); margin: 4px 8px 6px; }
button.menu-item { display: flex; width: 100%; justify-content: flex-start; background: none; border: 0;
                   color: var(--text-2); font-weight: 500; min-height: 36px; padding: 6px 8px; border-radius: 8px; }
button.menu-item:hover { background: var(--bg); color: var(--text); filter: none; }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; }
.small-print { font-size: .8rem; margin: 6px 0 0; }

@media (max-width: 760px) {
  .report-rows .row { flex-wrap: wrap; }
  .report-rows .row .actions { width: 100%; padding-left: 44px; }
  .menu-card { width: auto; }
}

/* Subfolders sit inside their parent's card. */
.subfolder { margin-top: 14px; padding: 12px 0 0 16px; border-left: 2px solid var(--border); }
.subfolder .folder-title h4 { margin: 0; font-size: .95rem; }
.subfolder .folder-icon { width: 28px; height: 28px; }
.button.secondary.shared { background: var(--brand-tint); border-color: var(--brand-tint-strong); color: var(--brand-ink); }
.access-panel { width: 340px; }
.access-panel h2 { margin-bottom: 2px; }
.grant-list { list-style: none; margin: 12px 0; padding: 0; border-top: 1px solid var(--border-soft); }
.grant-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px;
                 padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: .92rem; }
.access-panel .field-row select { flex: 1; min-width: 0; width: auto; }
.notice.small-print { padding: 8px 10px; margin: 8px 0 0; }
@media (max-width: 760px) { .subfolder { padding-left: 10px; } .access-panel { width: auto; } }

/* Collapsible folders: the access button and menu sit outside <details>, over its summary. */
.collapsible { position: relative; }
.folder-actions { position: absolute; top: 14px; right: 20px; z-index: 2; }
.subfolder > .folder-actions { top: 10px; right: 0; }
details.folder-body > summary { list-style: none; cursor: pointer; padding-right: 240px; min-height: 36px; justify-content: flex-start;
                                display: flex; align-items: center; gap: 8px; }
details.folder-body > summary::-webkit-details-marker { display: none; }
details.folder-body > summary:hover h3, details.folder-body > summary:hover h4 { color: var(--brand-ink); }
.chevron { width: 18px; height: 18px; flex: none; display: inline-grid; place-items: center; color: var(--muted);
           transition: transform .15s ease; }
.chevron::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor;
                   border-bottom: 2px solid currentColor; transform: rotate(-45deg); margin-left: -3px; }
details.folder-body[open] > summary .chevron { transform: rotate(90deg); }
details.folder-body:not([open]) > summary { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .chevron { transition: none; } }
@media (max-width: 760px) {
  details.folder-body > summary { padding-right: 0; padding-bottom: 44px; }
  .folder-actions { top: auto; right: auto; left: 20px; }
  .card.folder > .folder-actions { top: 58px; }
  .subfolder > .folder-actions { top: 50px; left: 36px; }
}
/* An open panel sits above every other folder's buttons. */
.folder-actions:has(details[open]) { z-index: 40; }
/* Contents line up with the folder icon, past the arrow (18px + 8px gap). */
details.folder-body > .report-rows, details.folder-body > .folder-note, details.folder-body > .subfolder { margin-left: 26px; }

/* One options menu per folder and report row. */
.access-hint { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.access-hint.shared { color: var(--brand-ink); font-weight: 500; }
.row-main .access-hint::before, .folder-title .access-hint::before { content: "·"; margin-right: 8px; color: var(--field-border); }
details.folder-body > summary { padding-right: 56px; }
.options-card { width: 340px; padding: 8px; }
.menu-title { font-weight: 600; font-size: .9rem; margin: 6px 8px 8px; overflow-wrap: anywhere; }
details.menu-section { border-top: 1px solid var(--border-soft); }
details.menu-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
                                 padding: 10px 8px; border-radius: 8px; font-weight: 500; color: var(--text-2); }
details.menu-section > summary::-webkit-details-marker { display: none; }
details.menu-section > summary:hover { background: var(--bg); }
details.menu-section > summary::after { content: ""; margin-left: auto; width: 6px; height: 6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
details.menu-section[open] > summary::after { transform: rotate(-135deg); }
.menu-section-body { padding: 0 8px 10px; }
.menu-section-body .grant-list { margin-top: 4px; }
a.menu-link { display: block; padding: 10px 8px; border-top: 1px solid var(--border-soft); color: var(--text-2);
              font-weight: 500; text-decoration: none; border-radius: 8px; }
a.menu-link:hover { background: var(--bg); color: var(--text); }
a.danger-link, .menu-panel a.danger-link { color: var(--danger); }
a.danger-link:hover, .menu-panel a.danger-link:hover { background: var(--danger-bg); color: var(--danger); }
.delete-list { margin: 12px 0 0; padding-left: 20px; }
.delete-list li { margin: 6px 0; }
.delete-list ul { margin: 4px 0 0; padding-left: 18px; }
.delete-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.menu-danger { border-top: 1px solid var(--border-soft); padding-top: 4px; }
.menu-danger .small-print { margin: 0 8px 6px; }
button.menu-item.danger-text { color: var(--danger); }
button.menu-item.danger-text:hover { background: var(--danger-bg); color: var(--danger); }
@media (max-width: 760px) {
  details.folder-body > summary { padding-right: 52px; padding-bottom: 0; }
  .card.folder > .folder-actions, .subfolder > .folder-actions { top: 14px; left: auto; right: 16px; }
  .subfolder > .folder-actions { top: 10px; right: 0; }
  .report-rows .row { flex-wrap: nowrap; }
  .options-card { width: auto; }
}
.folder-actions[open] { z-index: 40; }

/* Manage → Groups */
.member-rows .row { gap: 12px; }
.member-rows .row-main { gap: 2px 10px; }
.member-rows .access-hint::before { content: none; }
.add-member { margin: 12px 0 0 26px; max-width: 420px; }
.add-member label { margin-top: 0; }
.add-member select { flex: 1; min-width: 0; width: auto; }
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state h3 { margin: 12px 0 6px; font-size: 1.05rem; }
.empty-state p { max-width: 440px; margin: 0 auto; }
.folder-icon.big { width: 48px; height: 48px; border-radius: 12px; }
@media (max-width: 760px) { .add-member { margin-left: 0; } }
/* Jumping to a folder, group or menu leaves room for the sticky header. */
details[id], section[id] { scroll-margin-top: calc(var(--topbar-h) + 24px); }
details.folder-body > summary { flex-wrap: nowrap; }
details.folder-body > summary .folder-title { flex: 1; min-width: 0; }

/* ------------------------------------------------------------------ Manage → Branding */
.branding-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 20px; align-items: start; }
.branding-preview { position: sticky; top: calc(var(--topbar-h) + 16px); }
.logo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.logo-box { width: 160px; height: 72px; display: grid; place-items: center; border: 1px dashed var(--field-border);
            border-radius: var(--radius-sm); background: #fff; padding: 10px; }
.logo-box img { max-width: 100%; max-height: 48px; }
.logo-box .brand-mark { width: 40px; height: 40px; font-size: 1.1rem; }
.logo-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.logo-upload input[type=file] { max-width: 240px; }
.color-field { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.color-field input[type=color] { width: 48px; height: 40px; padding: 3px; }
.color-field input[type=text] { width: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.contrast { font-size: .85rem; }
.contrast.ok { color: var(--ok); }
.contrast.bad { color: var(--danger); font-weight: 600; }
.color-field + .small-print { margin-top: 6px; }

/* The preview is a miniature built from shapes, colored by --pv-primary and --pv-accent. */
.pv { --pv-tint: color-mix(in srgb, var(--pv-primary) 9%, #fff); font-size: 12px; }
.pv-label { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
            margin: 14px 0 6px; }
.pv-label:first-child { margin-top: 0; }
.pv-portal, .pv-signin { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg); }
.pv-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--border); }
.pv-mark { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; color: #fff;
           font-weight: 700; background: var(--pv-primary); flex: none; }
.pv-mark.big { width: 32px; height: 32px; border-radius: 8px; font-size: 15px; }
.pv-logo { max-height: 22px; max-width: 90px; }
.pv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.pv-search { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; color: var(--muted); min-width: 0;
             white-space: nowrap; overflow: hidden; }
.pv-avatar { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); display: inline-grid;
             place-items: center; font-size: 9px; font-weight: 600; flex: none; }
.pv-body { display: flex; gap: 10px; padding: 10px; }
.pv-side { display: flex; flex-direction: column; gap: 2px; width: 74px; flex: none; }
.pv-side span { padding: 4px 6px; border-radius: 6px; color: var(--text-2); }
.pv-side .pv-on { background: var(--pv-tint); color: var(--pv-primary); font-weight: 600; }
.pv-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.pv-h { font-weight: 700; font-size: 14px; }
.pv-tile { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px;
           padding: 6px 8px; font-weight: 600; }
.pv-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.pv-bars i { width: 4px; background: color-mix(in srgb, var(--pv-primary) 55%, #fff); border-radius: 1px; }
.pv-bars i:nth-child(1) { height: 8px; } .pv-bars i:nth-child(2) { height: 14px; } .pv-bars i:nth-child(3) { height: 11px; }
.pv-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pv-button { display: inline-block; background: var(--pv-primary); color: #fff; font-weight: 600; border-radius: 7px;
             padding: 5px 10px; outline: 2px solid var(--pv-accent); outline-offset: 2px; }
.pv-button.wide { display: block; text-align: center; margin-top: 4px; }
.pv-link { color: var(--pv-primary); text-decoration: underline; }
.pv-hint { color: var(--muted); font-size: 11px; }
.pv-signin { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 56px; }
.pv-signin .pv-h { margin-top: 4px; }
.pv-sub { color: var(--muted); }
.pv-field { display: block; width: 100%; height: 22px; border: 1px solid var(--field-border); border-radius: 6px; background: #fff; }
.pv-signin .pv-button { width: 100%; }

@media (max-width: 760px) {
  .branding-layout { grid-template-columns: 1fr; }
  .branding-preview { position: static; }
}

/* ------------------------------------------------------------------ Manage → Usage and Activity */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.toolbar label { margin-top: 0; }
.toolbar input, .toolbar select { min-height: 38px; }
.inline-toolbar { align-items: center; gap: 8px; margin: 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card.stat { margin: 0; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-value small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.stat-value.small { font-size: 1.05rem; overflow-wrap: anywhere; }
.stat .meter { width: 100%; margin-top: 6px; }
.page-allowance .meter { width: 100%; max-width: 360px; margin-bottom: 8px; }
.page-allowance.is-reached .meter span { background: var(--danger); }
.page-allowance .error { margin: 0; }
.day-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; border-bottom: 1px solid var(--border); }
.day-bar { flex: 1; min-width: 2px; background: var(--brand-primary); opacity: .8; border-radius: 3px 3px 0 0; }
.day-bar:hover { opacity: 1; }
.day-axis { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.card-title { padding: 18px 22px 6px; margin: 0; }
th.num, td.num { text-align: right; white-space: nowrap; }
.inline-bar { display: inline-block; width: 80px; height: 6px; background: var(--border-soft); border-radius: 999px;
              margin-right: 10px; vertical-align: middle; overflow: hidden; }
.inline-bar i { display: block; height: 100%; background: var(--brand-primary); border-radius: 999px; }
.inactive { padding: 12px 22px 18px; border-top: 1px solid var(--border-soft); }
.inactive h3 { margin: 0 0 8px; font-size: .9rem; }
.inactive .tag { margin: 0 4px 6px 0; }
.upsell { background: var(--brand-tint); border-color: var(--brand-tint-strong); }

.day-group { margin-bottom: 14px; }
.day-head { margin: 0; padding: 12px 22px; font-size: .85rem; font-weight: 600; color: var(--muted);
            border-bottom: 1px solid var(--border-soft); background: var(--hover); border-radius: var(--radius) var(--radius) 0 0; }
.events { list-style: none; margin: 0; padding: 0; }
.event { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 4px 14px; padding: 12px 22px;
         border-bottom: 1px solid var(--border-soft); align-items: baseline; }
.event:last-child { border-bottom: 0; }
.event p { margin: 0; }
.event-time { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.event-details { color: var(--muted); font-size: .85rem; margin-top: 2px !important; overflow-wrap: anywhere; }
.event-cat { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 8px 0 24px; }

@media (max-width: 760px) {
  .section-head .inline-toolbar { width: 100%; }
  .event { grid-template-columns: 64px minmax(0, 1fr); padding: 12px 16px; }
  .event-cat { grid-column: 2; }
  .day-head, .card-title { padding-left: 16px; }
  .usage-table td[data-label]::before { content: attr(data-label); font-size: .75rem; color: var(--muted);
                                        display: block; text-align: left; }
  .usage-table td.num { text-align: left; }
  .inline-bar { display: none; }
}
.inline-toolbar select { width: auto; }

/* ------------------------------------------------------------------ Report settings (data, roles) */
.report-bar.subhead { margin-bottom: 8px; }
.subhead .report-title { align-items: center; }
.subhead h1 { font-size: 1.4rem; margin: 0; }
.eyebrow { margin: 0; font-size: .82rem; color: var(--muted); font-weight: 500; }
.callout { background: var(--brand-tint); border-color: var(--brand-tint-strong); }
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }
.step h2 { display: flex; align-items: center; gap: 10px; }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
          background: var(--brand-tint); color: var(--brand-ink); font-size: .85rem; font-weight: 700; }
.sources { list-style: none; margin: 8px 0 0; padding: 0; }
.source { padding: 14px 0; border-top: 1px solid var(--border-soft); }
.source-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.source-name { overflow-wrap: anywhere; }
.source .small-print { margin: 6px 0 0; }
details.set-signin { margin-top: 10px; max-width: 440px; }
details.set-signin > summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; font-size: .92rem; }
details.set-signin[open] > summary { margin-bottom: 4px; }
fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-legend { font-weight: 600; font-size: .9rem; color: var(--text-2); margin: 14px 0 6px; padding: 0; }
.narrow-form { max-width: 440px; }
.step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 0;
              border-top: 1px solid var(--border-soft); font-size: .92rem; }
.history .error { flex-basis: 100%; margin: 4px 0 0; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
        background: var(--border-soft); color: var(--muted); white-space: nowrap; }
.pill.succeeded { background: var(--ok-bg); color: var(--ok); }
.pill.failed { background: var(--danger-bg); color: var(--danger); }
.pill.queued, .pill.running { background: var(--warn-bg); color: var(--warn); }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { margin: 0; font-weight: 500; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-block; min-width: 52px; text-align: center; padding: 7px 10px; border-radius: 999px;
             border: 1px solid var(--field-border); background: var(--surface); cursor: pointer; font-size: .88rem; }
.chip input:checked + span { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--brand-accent); outline-offset: 2px; }
.role-card h2 { display: flex; align-items: center; gap: 10px; }
.role-tag { font-size: .85rem; padding: 4px 10px; background: var(--brand-tint); color: var(--brand-ink); }
.narrow-card { max-width: 560px; } .narrow-card .field-row select { flex: 1; min-width: 0; width: auto; }
/* Assign a role: fields share the card's width. */
.assign-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px 16px; align-items: start; }
.assign-form label { margin-top: 0; }
.assign-form select, .assign-form input[type=text] { width: 100%; }
.assign-form .new-role { margin-top: 10px; }
.assign-submit { padding-top: 26px; }
@media (max-width: 760px) {
  .assign-form { grid-template-columns: 1fr; }
  .assign-submit { padding-top: 0; }
}
.hour-chips .chip span { min-width: 64px; }
button:disabled, button:disabled:hover { opacity: .45; cursor: not-allowed; filter: none; }

/* ------------------------------------------------------------------ Subscriptions */
.sub-rows .row { gap: 14px; }
.sub-next { text-align: right; font-size: .9rem; white-space: nowrap; }
.form-page { max-width: 640px; }
.form-page select, .form-page input[type=text] { width: 100%; }
.time-input { width: 160px; }
.sub-summary { margin: -4px 0 16px; }
.subhead .report-actions { align-items: center; }
.eyebrow a { color: inherit; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 16px; align-items: start; }
.detail-side .card input[type=text] { width: 100%; }
.grant-list li.dim { color: var(--muted); }
.add-row { margin-top: 4px; max-width: 480px; }
.add-row .field-row select { flex: 1; min-width: 0; width: auto; }
details.add-email { margin-top: 14px; max-width: 480px; }
details.add-email > summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; font-size: .92rem; }
details.add-email input[type=email], details.add-email input[type=text] { width: 100%; }
.leave { margin-top: 14px; }
details.deliveries { flex-basis: 100%; }
details.deliveries > summary { cursor: pointer; font-size: .85rem; }
details.deliveries ul { margin: 6px 0 0; padding-left: 1.2em; font-size: .88rem; color: var(--muted); }
@media (max-width: 860px) { .detail-layout { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  /* Subpage headers keep real buttons (the report page shrinks its own to icons). */
  .subhead .report-actions > form > button,
  .subhead .report-actions > .button { width: auto; padding: 6px 14px; min-height: 36px; white-space: nowrap; }
  .subhead { flex-wrap: wrap; }
}

/* ------------------------------------------------------------------ Upload */
.upload-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 16px; align-items: start; }
.upload-layout input[type=text] { width: 100%; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
            margin: 16px 0 0; padding: 36px 20px; text-align: center; cursor: pointer; font-weight: 400;
            border: 2px dashed var(--field-border); border-radius: var(--radius); background: var(--hover); }
.dropzone { transition: border-color 150ms ease, background-color 150ms ease; }
.dropzone.over { border-color: var(--brand-ink); background: var(--brand-tint); }
@media (hover: hover) and (pointer: fine) {
  .dropzone:hover { border-color: var(--brand-ink); background: var(--brand-tint); }
}
.dropzone.chosen { border-style: solid; border-color: var(--ok); background: var(--ok-bg); }
.dropzone.bad { border-style: solid; border-color: var(--danger); background: var(--danger-bg); }
.dropzone-icon { color: var(--brand-ink); }
.dropzone-title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.dropzone-title u { color: var(--brand-ink); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:has(input:focus-visible) { outline: 3px solid var(--brand-accent); outline-offset: 2px; }
.upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.next-steps { margin: 0; padding-left: 1.2em; }
.next-steps li { margin-bottom: 10px; font-size: .92rem; }
.next-steps .muted { display: block; font-size: .85rem; }
@media (max-width: 760px) { .upload-layout { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ Help */
.help-search { margin: 4px 0 20px; max-width: 560px; }
.help-search input { width: 100%; padding: 11px 14px; font-size: 1rem; }
.help-section { margin-bottom: 28px; }
.help-section h2 { margin: 0; font-size: 1.05rem; }
.help-section > .muted { margin: 2px 0 12px; }
.guide-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px;
              grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.guide-grid li { display: flex; }
.guide-card { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 16px 18px;
              background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
              color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.guide-card:hover { border-color: var(--brand-ink); box-shadow: var(--shadow-hover); color: var(--text); }
.guide-card strong { color: var(--brand-ink); }
.help-contact h2 { margin-top: 0; font-size: 1rem; }
.contact-list { list-style: none; margin: 8px 0 0; padding: 0; }
.contact-list li { padding: 3px 0; overflow-wrap: anywhere; }
.help-contact .contact-list + .muted { margin-top: 12px; }
.eyebrow a { color: inherit; }
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 16px; align-items: start; }
.guide-side { display: flex; flex-direction: column; gap: 16px; }
.guide-side .card { margin: 0; }
.guide-side h2 { margin: 0 0 8px; font-size: 1rem; }
.guide { max-width: 760px; line-height: 1.6; }
.guide-lede { font-size: 1.05rem; color: var(--text-2); margin-top: 0; padding-bottom: 14px;
              border-bottom: 1px solid var(--border-soft); }
.guide h2 { font-size: 1.05rem; margin: 26px 0 8px; }
.guide li { margin-bottom: 6px; }
.guide pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: .88rem; line-height: 1.5;
             background: var(--sunken); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.code-wrap { position: relative; margin: 10px 0 14px; }
.code-wrap .copy { position: absolute; top: 8px; right: 8px; padding: 3px 10px; min-height: 0; font-size: .8rem; }
.related-guides { list-style: none; margin: 0; padding: 0; }
.related-guides li { padding: 8px 0; border-top: 1px solid var(--border-soft); }
.related-guides li:first-child { border-top: 0; padding-top: 0; }
.related-guides .muted { display: block; font-size: .85rem; }
@media (max-width: 860px) { .guide-layout { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ Sign-in pages */
.auth-page main.page { padding: 0; max-width: none; }
.auth-split { display: grid; grid-template-columns: minmax(280px, 5fr) 7fr; min-height: 100vh; }
.auth-brand { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
              padding: 48px; color: #fff; background: var(--brand-primary); }
.auth-brand::before, .auth-brand::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none;
              background: rgba(255, 255, 255, .07); }
.auth-brand::before { width: 520px; height: 520px; right: -220px; bottom: -200px; }
.auth-brand::after { width: 280px; height: 280px; left: -120px; top: -100px; }
.auth-brand-inner { position: relative; max-width: 340px; }
.auth-logo { display: inline-grid; place-items: center; min-width: 64px; height: 64px; padding: 10px 14px;
             background: #fff; border-radius: 16px; box-shadow: 0 6px 24px rgba(0, 0, 0, .15); }
.auth-logo img { display: block; max-height: 44px; max-width: 200px; }
.auth-letter { width: 64px; padding: 0; font-size: 1.6rem; font-weight: 700; color: var(--brand-ink); }
.auth-brand-name { margin: 22px 0 6px; font-size: 1.6rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.auth-tagline { margin: 0; opacity: .85; font-size: 1.02rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 1.6rem; margin: 0 0 6px; }
.auth-sub { margin: 0 0 22px; }
.auth-card input:not([type=checkbox]) { max-width: none; width: 100%; }
.auth-card form > button[type=submit], .auth-card .narrow-form > button[type=submit] { width: 100%; margin-top: 18px; min-height: 44px; }
.auth-card .error, .auth-card .notice, .auth-card .success { margin-bottom: 18px; }
.auth-foot { margin: 22px 0 0; text-align: center; font-size: .9rem; color: var(--muted); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.label-row a { font-size: .85rem; }
.password-field { position: relative; }
.password-field input { padding-right: 64px; }
.reveal { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); min-height: 0; padding: 4px 10px;
          font-size: .82rem; background: transparent; color: var(--brand-ink); border: 0; box-shadow: none; }
.reveal:hover { background: var(--brand-tint); }
.caps-hint { margin: 6px 0 0; font-size: .82rem; color: var(--warn); }
.code-input { font-size: 1.4rem !important; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
details.auth-more { margin-top: 18px; font-size: .9rem; }
details.auth-more > summary { cursor: pointer; color: var(--brand-ink); font-weight: 500; }
details.auth-more p { margin: 8px 0 0; }
.auth-done { text-align: center; }
.auth-done-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
                  background: var(--brand-tint); color: var(--brand-ink); margin-bottom: 8px; }
.auth-done-icon svg { width: 24px; height: 24px; }
.auth-done-icon.ok { background: var(--ok-bg); color: var(--ok); }
.password-checks { list-style: none; margin: 14px 0 0; padding: 0; font-size: .85rem; color: var(--muted); }
.password-checks li { position: relative; padding-left: 22px; margin: 4px 0; }
.password-checks li::before { content: ""; position: absolute; left: 3px; top: 5px; width: 10px; height: 10px;
                              border-radius: 50%; border: 1.5px solid var(--field-border); }
.password-checks li.met { color: var(--ok); }
.password-checks li.met::before { content: "✓"; border: 0; top: -1px; left: 2px; width: auto; height: auto; font-weight: 700; }
.mfa-setup { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; margin: 8px 0 20px; }
.mfa-steps { list-style: none; margin: 0; padding: 0; }
.mfa-steps li { display: flex; gap: 12px; margin-bottom: 16px; }
.mfa-steps li > div { display: flex; flex-direction: column; gap: 2px; }
.mfa-steps .muted { font-size: .87rem; }
.qr-box { text-align: center; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.qr-box img { display: block; margin: 0 auto; }
.qr-box .small-print { margin: 8px 0 0; max-width: 200px; font-size: .78rem; overflow-wrap: anywhere; }
.link-button { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand-ink); font-size: inherit;
               text-decoration: underline; box-shadow: none; }
.recovery-codes { list-style: none; margin: 14px 0; padding: 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px;
                  background: var(--sunken); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.recovery-codes code { background: none; padding: 0; font-size: 1rem; letter-spacing: .04em; }
.saved-check { margin-top: 18px; }
.saved-check .check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.account-card { max-width: 680px; }
.account-card .auth-done { text-align: left; }
.account-card .auth-done h2 { margin-top: 4px; }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 18px 16px; justify-content: flex-start; }
  .auth-brand::before, .auth-brand::after { display: none; }
  .auth-brand-inner { display: flex; align-items: center; gap: 12px; max-width: none; }
  .auth-logo { min-width: 40px; height: 40px; padding: 6px 8px; border-radius: 10px; box-shadow: none; }
  .auth-logo img { max-height: 28px; max-width: 140px; }
  .auth-letter { width: 40px; font-size: 1.1rem; }
  .auth-brand-name { margin: 0; font-size: 1.1rem; }
  .auth-tagline { display: none; }
  .auth-main { align-items: flex-start; padding: 28px 16px 40px; }
  .mfa-setup { grid-template-columns: 1fr; }
  .qr-box { justify-self: center; }
}
.password-checks li.muted-check::before { border-style: dashed; }
details.email-extras { margin-top: 14px; }
details.email-extras > summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; font-size: .92rem; }
details.email-extras[open] > summary { margin-bottom: 4px; }

/* ------------------------------------------------------------------ Motion and press feedback */
/* Small and fast: this is a work tool people use every day. Only transform and opacity move. */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); }
button, .button { -webkit-tap-highlight-color: transparent;
                  transition: transform 160ms var(--ease-out), background-color 150ms ease,
                              filter 150ms ease, color 150ms ease; }
button:not(:disabled):not(.link):not(.link-button):not(.menu-item):not(.reveal):active,
.button:active { transform: scale(0.97); }
.menu[open] > .menu-panel, .popover[open] > .popover-panel {
  transform-origin: top right; animation: panel-in 140ms var(--ease-out); }
@keyframes panel-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
@keyframes panel-fade { from { opacity: 0; } }
@media (hover: none) {
  .tile:hover, .guide-card:hover { border-color: var(--border); box-shadow: var(--shadow); }
}
@media (prefers-reduced-motion: reduce) {
  .menu[open] > .menu-panel, .popover[open] > .popover-panel { animation: panel-fade 120ms ease; }
  button:active, .button:active { transform: none; }
}

/* Today's pages: small state changes that should read as one thing changing. */
.guide-card { transition: border-color 150ms ease, box-shadow 150ms ease, transform 160ms var(--ease-out); }
.guide-card:active { transform: scale(0.99); }
.password-checks li { transition: color 150ms ease; }
.auth-done-icon { animation: icon-in 300ms var(--ease-out) both; }
@keyframes icon-in { from { opacity: 0; transform: scale(0.9); } }
.char-count { margin: 4px 0 0; font-size: .8rem; color: var(--muted); text-align: right; max-width: 640px; }
.char-count.at-limit { color: var(--danger); }
@media (prefers-reduced-motion: reduce) {
  .auth-done-icon { animation: panel-fade 200ms ease both; }
  .guide-card:active { transform: none; }
}

/* ------------------------------------------------------------------ People (ADR 0062) */
.seat-line { margin: 2px 0 6px; font-size: .88rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.chip { position: relative; }
.chip span { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
.role-choices { display: grid; gap: 8px; margin: 4px 0 10px; }
.role-choice { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; font-weight: 400;
               border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
               transition: border-color 150ms ease, background-color 150ms ease; }
.role-choice input { margin-top: 3px; flex: none; }
.role-choice > span { display: flex; flex-direction: column; gap: 1px; }
.role-choice .muted { font-size: .84rem; }
.role-choice:has(input:checked) { border-color: var(--brand-ink); background: var(--brand-tint); }
.role-choice:has(input:focus-visible) { outline: 3px solid var(--brand-accent); outline-offset: 2px; }
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name-row input { width: 100%; }
details.invite-names { margin: 6px 0 4px; font-size: .92rem; }
details.invite-names > summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; }
.invite-popover .popover-panel { width: min(440px, calc(100vw - 32px)); max-height: min(80vh, 720px); overflow-y: auto; }
.invite-popover textarea { width: 100%; min-height: 76px; }
.invite-popover form > button[type=submit] { width: 100%; margin-top: 8px; }

.segmented { display: inline-flex; gap: 2px; padding: 3px; margin: 4px 0 16px; border-radius: 10px;
             background: var(--border-soft); }
.segmented a { padding: 6px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .9rem;
               font-weight: 500; transition: background-color 150ms ease, color 150ms ease; }
.segmented a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented .count { margin-left: 4px; color: var(--muted); font-weight: 400; }

.people-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.people-filters input[type=search] { flex: 1 1 240px; max-width: 360px; }
.people-filters select { width: auto; flex: 0 0 auto; }
.stale-hint { margin: -4px 0 12px; }

.people-list { list-style: none; margin: 0 0 16px; padding: 0; }
.person-row { position: relative; border-top: 1px solid var(--border-soft); }
.person-row:first-child { border-top: 0; }
.person-row[hidden] { display: none; }
.person-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 120px 16px; align-items: center; gap: 12px;
               padding: 12px 64px 12px 18px; color: var(--text); text-decoration: none;
               transition: background-color 150ms ease; }
.person-link.static { grid-template-columns: auto minmax(0, 1fr) auto; }
.person-row:first-child .person-link { border-radius: var(--radius) var(--radius) 0 0; }
.person-row:last-child .person-link { border-radius: 0 0 var(--radius) var(--radius); }
@media (hover: hover) and (pointer: fine) { a.person-link:hover { background: var(--hover); color: var(--text); } }
.person-main { display: flex; flex-direction: column; min-width: 0; }
.person-name { font-weight: 600; overflow-wrap: anywhere; }
.person-email { font-size: .85rem; overflow-wrap: anywhere; }
.person-meta { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.role-tag { background: var(--brand-tint); color: var(--brand-ink); }
.person-active { font-size: .85rem; text-align: right; }
.person-active.stale { color: var(--warn); }
.chevron-right { width: 8px; height: 8px; border-right: 2px solid var(--field-border); border-top: 2px solid var(--field-border);
                 transform: rotate(45deg); }
.person-row.dim .person-name, .person-row.dim .avatar { opacity: .55; }
.row-options { position: absolute; right: 14px; top: 14px; }
.row-options[open] { z-index: 40; }
.mail-avatar svg { width: 16px; height: 16px; }

.security-card .check { font-weight: 500; }
.security-card .small-print { margin: 4px 0 8px 26px; }

/* One person */
.person-avatar { width: 44px; height: 44px; font-size: .95rem; flex: none; }
.person-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 16px; align-items: start; }
.person-col, .person-side { display: flex; flex-direction: column; gap: 16px; }
.person-col .card, .person-side .card { margin: 0; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0 0 12px; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.access-list { list-style: none; margin: 0 0 10px; padding: 0; }
.access-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.access-list li:first-child { border-top: 0; padding-top: 0; }
.access-report { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.folder-icon.small { width: 26px; height: 26px; border-radius: 7px; }
.folder-icon.small svg { width: 14px; height: 14px; }
.access-why { font-size: .85rem; padding-left: 34px; }
.empty-inline p { margin: 0 0 4px; }
.inline-edit { margin-top: 4px; }
.stack-form { margin-top: 12px; }
.stack-form:first-child, details + .stack-form { margin-top: 12px; }
@media (max-width: 860px) { .person-layout { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .person-link { grid-template-columns: auto minmax(0, 1fr) 16px; padding-right: 56px; row-gap: 4px; }
  .person-meta, .person-active { grid-column: 2; justify-content: flex-start; text-align: left; }
  .chevron-right { grid-column: 3; grid-row: 1; }
  .name-row { grid-template-columns: 1fr; }
  .people-filters select { flex: 1 1 140px; }
}
.role-choice input[type=radio] { width: auto; min-height: 0; margin: 3px 0 0; accent-color: var(--brand-ink); }
.check input[type=checkbox] { accent-color: var(--brand-ink); }
@media (max-width: 760px) {
  .people-filters input[type=search] { flex: 1 1 100%; max-width: none; }
  .people-filters select { flex: 1 1 0; min-width: 0; width: auto; }
  .person-row .chevron-right { display: none; }
  .person-link { grid-template-columns: auto minmax(0, 1fr); }
}
.facts { align-items: center; }
.facts dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 24px; }
.facts dt { line-height: 24px; }
.facts .pill { line-height: 1.2; }
.current-role { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; }
.current-role .muted { font-size: .88rem; }
.reports-disclosure > summary .muted { font-size: .9rem; }

/* ------------------------------------------------------------------ One way to expand things */
/* Cards keep "Show/Hide"; everything inside a card or written as a link uses this chevron. */
details.menu-section > summary::after { transition: transform 200ms var(--ease-out); }
details.set-signin > summary, details.auth-more > summary,
details.email-extras > summary, details.invite-names > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 8px; }
details.set-signin > summary::-webkit-details-marker, details.auth-more > summary::-webkit-details-marker,
details.email-extras > summary::-webkit-details-marker, details.invite-names > summary::-webkit-details-marker { display: none; }
details.set-signin > summary::after, details.auth-more > summary::after,
details.email-extras > summary::after, details.invite-names > summary::after {
  content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform 200ms var(--ease-out); }
details.set-signin[open] > summary::after, details.auth-more[open] > summary::after,
details.email-extras[open] > summary::after, details.invite-names[open] > summary::after {
  transform: translateY(1px) rotate(-135deg); }

/* What a disclosure reveals settles in instead of jumping (enter only; height isn't animated). */
details.disclosure[open] > summary ~ *, details.menu-section[open] > .menu-section-body,
details.set-signin[open] > summary ~ *, details.auth-more[open] > summary ~ *,
details.email-extras[open] > summary ~ *, details.invite-names[open] > summary ~ * {
  animation: reveal 180ms var(--ease-out); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }

.back { transition: background-color 150ms ease, color 150ms ease; }

@media (prefers-reduced-motion: reduce) {
  details.disclosure[open] > summary ~ *, details.menu-section[open] > .menu-section-body,
  details.set-signin[open] > summary ~ *, details.auth-more[open] > summary ~ *,
  details.email-extras[open] > summary ~ *, details.invite-names[open] > summary ~ * {
    animation: panel-fade 150ms ease; }
}

/* ------------------------------------------------------------------ Platform admin (ADR 0063) */
.staff-topbar { gap: 20px; }
.staff-label { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--text); color: var(--surface);
               font-size: .72rem; font-weight: 600; vertical-align: 2px; }
.staff-nav { display: flex; gap: 4px; margin-right: auto; }
.staff-nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500;
               font-size: .93rem; transition: background-color 150ms ease, color 150ms ease; }
.staff-nav a[aria-current] { color: var(--text); background: var(--border-soft); }
@media (hover: hover) and (pointer: fine) { .staff-nav a:hover { color: var(--text); background: var(--border-soft); } }
.staff-h1 { font-size: 1.5rem; margin: 0 0 4px; }
.flag-text { color: var(--danger); }
.flag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.client-link { grid-template-columns: auto minmax(0, 1fr) auto 280px 16px; padding-right: 18px; }
.client-nums { display: flex; gap: 14px; justify-content: flex-end; font-size: .85rem; white-space: nowrap; }
.access-why.nopad { padding-left: 0; }
code.id { font-size: .78rem; overflow-wrap: anywhere; }
.list-h2 { font-size: 1rem; margin: 0 0 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-n { font-size: 1.6rem; font-weight: 700; margin: 2px 0 0; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .staff-nav { order: 3; width: 100%; overflow-x: auto; }
  .client-link { grid-template-columns: auto minmax(0, 1fr); }
  .client-nums { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
}
.custom-tag { background: var(--warn-bg); color: var(--warn); }
.limits-form .limit-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px auto; align-items: center; gap: 4px 10px; margin-bottom: 8px; }
.limits-form .limit-row label { margin: 0; font-weight: 500; font-size: .9rem; }
.limits-form .limit-row label.check { grid-column: 1 / 3; }
.limits-form .limit-row input[type=number] { width: 100%; min-height: 34px; padding: 4px 8px; }
.limits-form .limit-row .muted { font-size: .8rem; white-space: nowrap; }

/* Appearance switch in the account menu */
.appearance-menu { padding: 8px 12px 10px; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); margin: 4px 0; }
.menu-label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.segmented.small { display: flex; margin: 0; padding: 2px; }
.menu-panel .segmented.small button { flex: 1; width: auto; min-height: 30px; padding: 4px 6px; text-align: center; font-size: .8rem;
  border-radius: 7px; color: var(--muted); background: transparent; transition: background-color 150ms ease, color 150ms ease; }
.menu-panel .segmented.small button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Health status (platform admin) */
.health-pill { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .72rem;
               font-weight: 600; vertical-align: 1px; }
.health-pill.ok { background: var(--ok-bg); color: var(--ok); }
.health-pill.bad { background: var(--danger-bg); color: var(--danger); }
.health-banner { display: block; }
.health-banner.ok { border-color: var(--ok-border); background: var(--ok-bg); }
.health-banner.bad { border-color: var(--danger-border); background: var(--danger-bg); }
.health-banner-title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-weight: 600; }
.health-banner.ok .health-banner-title { color: var(--ok); }
.health-banner.bad .health-banner-title { color: var(--danger); }
.health-banner ul { margin: 6px 0 0; padding-left: 1.2em; }
.health-banner li { margin-bottom: 2px; }
.health-banner .muted { margin: 0; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }

/* Partner hub (ADR 0063) */
.hub-row { padding-right: 96px; grid-template-columns: auto minmax(0, 1fr) auto 280px; }
.row-open { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); margin: 0; }
.activity-when { font-size: .82rem; white-space: nowrap; }
.activity-feed .person-link.static { grid-template-columns: auto minmax(0, 1fr) auto; }
@media (max-width: 760px) { .hub-row { grid-template-columns: auto minmax(0, 1fr); padding-right: 84px; } }

/* Partner admin inside a client's portal (ADR 0063): always clear where they are. */
.via-partner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px;
               padding: 7px 16px; font-size: .86rem; background: var(--text); color: var(--surface); }
.via-partner-text { display: inline-flex; align-items: center; gap: 8px; }
.via-dot { width: 8px; height: 8px; border-radius: 50%; background: #fdb022; flex: none; }
.via-partner-back { color: var(--surface); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.via-partner-back:hover { color: var(--surface); opacity: .85; }
/* Staff support session (ADR 0063 §7): same strip, can't be missed, one-click exit. */
.support-banner { position: sticky; top: 0; z-index: 50; }
.support-banner form { margin: 0; }
.support-exit { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; min-height: 0; }
/* Billing (ADR 0065 §6): payment warning, read-only, paused. */
.billing-banner { background: var(--warn-bg); color: var(--text); border-bottom: 1px solid var(--warn-border); }
.billing-banner .via-dot { background: var(--warn); }
.billing-banner .via-partner-back, .billing-banner .via-partner-back:hover { color: var(--text); }
.billing-banner.billing-suspended { background: var(--danger-bg); border-bottom-color: var(--danger-border); }
.billing-banner.billing-suspended .via-dot { background: var(--danger); }
.plan-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.plan-option { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
               padding: 12px 14px; cursor: pointer; background: var(--surface); }
.plan-option:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan-option input[type=radio] { width: auto; margin: 0 0 4px; align-self: flex-start; }
.auth-card.signup-card { max-width: 600px; }
.signup-card fieldset { border: 0; padding: 0; margin: 4px 0 0; min-width: 0; }
.signup-card legend { font-weight: 600; font-size: .9rem; padding: 0; }
.signup-card .plan-options { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.plan-price { font-size: 1.15rem; font-weight: 600; }
.billing-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.billing-actions form { margin: 0; }
.billing-table th, .billing-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.billing-table th { font-size: .8rem; font-weight: 600; color: var(--muted); }
.billing-table td + td, .billing-table th + th { text-align: right; font-variant-numeric: tabular-nums; }
.billing-table tr:last-child td { border-bottom: 0; }
.support-blocked { max-width: 640px; margin: 24px auto; }

/* Partner hub: New Client (ADR 0063 §4) */
.new-client { max-width: 560px; margin-top: 16px; }
.new-client form { display: grid; gap: 6px; }
.new-client label { margin-top: 10px; }
.new-client label:first-of-type { margin-top: 0; }
.new-client button[type=submit] { justify-self: start; margin-top: 16px; }
.input-suffix { display: flex; align-items: center; gap: 6px; }
.input-suffix input { flex: 1; min-width: 0; }
.input-suffix .muted { white-space: nowrap; }
@media (max-width: 520px) {
  .input-suffix { flex-wrap: wrap; }
}

/* Admin: Support Access card (ADR 0063 §7) */
.support-form { display: grid; gap: 6px; margin-top: 8px; }
.support-form label { margin-top: 6px; }
.support-access h3 { margin-top: 16px; font-size: .95rem; }
.managed-support { max-width: 720px; }
.managed-support h3 { font-size: 1rem; margin: 16px 0 6px; }
.managed-support ul { margin: 0 0 12px; padding-left: 1.2em; }
