/* TheAi.Biz — the application shell.
   Built on the same tokens as the homepage. Nothing here redefines a colour, a
   typeface or a spacing step: entering the product should feel like walking
   through the door of the building you saw from the street. */

/* ============================================================
   SHELL
   ============================================================ */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  background: var(--paper-sunk);
}

/* ---------- Sidebar ---------- */

.app-side {
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 18px 14px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.app-side .brand { margin: 4px 8px 18px; font-size: 1.0625rem; }

.org-switch { position: relative; margin-bottom: 18px; }
.org-switch summary {
  list-style: none;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-raised);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.org-switch summary::-webkit-details-marker { display: none; }
.org-switch summary:hover { border-color: var(--line-strong); }
.org-switch .org-initial {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  border-radius: 8px;
  /* --btn-top/--btn-bottom, not --accent-hot: white on the light end of the
     brand gradient is 3.3:1, and this is 13px text, not an icon. */
  background: linear-gradient(145deg, var(--btn-top), var(--btn-bottom));
  color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 0.8125rem;
}
.org-switch .org-name {
  min-width: 0; font-size: var(--step-xs); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.org-switch .org-role { display: block; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-faint); font-weight: 400; letter-spacing: .06em; }
.org-switch .caret { margin-left: auto; flex: none; width: 16px; height: 16px; color: var(--ink-faint); }
.org-switch-static > div {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-raised);
}
.org-menu {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--paper-raised); box-shadow: var(--shadow-pop);
}
.org-menu form { margin: 0; }
.org-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; text-align: left; cursor: pointer;
  font-size: var(--step-xs); color: var(--ink);
}
.org-menu button:hover { background: var(--paper-sunk); }
.org-menu button[aria-current="true"] { font-weight: 600; }
.org-menu .tick { margin-left: auto; width: 14px; height: 14px; color: var(--accent); }

.app-nav { display: grid; gap: 2px; }
.app-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 9px;
  font-size: var(--step-xs); color: var(--ink-soft); text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.app-nav a svg { width: 17px; height: 17px; flex: none; color: var(--ink-faint); }
.app-nav a:hover { background: var(--paper-sunk); color: var(--ink); }
.app-nav a[aria-current="page"] {
  background: var(--paper-sunk); color: var(--ink); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.app-nav a[aria-current="page"] svg { color: var(--accent); }
.app-nav .count {
  margin-left: auto; flex: none; min-width: 20px; padding: 1px 6px;
  border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-mono); font-size: 0.6875rem; text-align: center;
}
.app-nav-group { margin-top: 18px; }
.app-nav-group > .label { display: block; padding: 0 12px 8px; }

.app-side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.app-user {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  text-decoration: none; color: inherit;
}
.app-user:hover { background: var(--paper-sunk); }
.app-user .avatar {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--data-tint); color: var(--data);
  font-size: 0.75rem; font-weight: 600;
}
.app-user .who { min-width: 0; }
.app-user .who b { display: block; font-size: var(--step-micro); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user .who span { display: block; font-size: 0.6875rem; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Main column ---------- */

.app-main { min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
  position: sticky; top: 0; z-index: 30;
  display: none;
  align-items: center; gap: 12px;
  min-height: 60px; padding: 10px clamp(16px, 4vw, 24px);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-topbar .brand { font-size: 1rem; }
.app-topbar .nav-toggle { display: flex; margin-left: auto; }

.app-body {
  flex: 1;
  padding: clamp(20px, 3vw, 36px) clamp(16px, 3.4vw, 40px) clamp(48px, 6vw, 72px);
  max-width: 1180px;
  width: 100%;
}

.page-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: clamp(20px, 2.6vw, 32px);
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.625rem, 3vw, 2.125rem);
  font-weight: 600; letter-spacing: -0.028em; line-height: 1.1;
}
.page-head p { margin-top: 6px; font-size: var(--step-sm); color: var(--ink-soft); max-width: 62ch; }
.page-head-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* mobile sheet reuses the homepage pattern */
.app-sheet {
  position: fixed; inset: 60px 0 0; z-index: 25;
  display: none; flex-direction: column;
  padding: 18px clamp(16px, 4vw, 24px) calc(24px + env(safe-area-inset-bottom));
  background: var(--paper); overflow-y: auto; overscroll-behavior: contain;
}
.app-sheet[data-open="true"] { display: flex; }
.app-sheet .app-nav a { padding: 14px 12px; font-size: 1rem; }

@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app-side { display: none; }
  .app-topbar { display: flex; }
  body[data-nav-open="true"] { overflow: hidden; }
}

/* ============================================================
   SURFACES
   ============================================================ */

.panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 15px clamp(16px, 2vw, 22px);
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.018em; margin: 0; }
.panel-head .panel-actions { margin-left: auto; display: flex; gap: 8px; }
.panel-body { padding: clamp(16px, 2vw, 22px); }
.panel-foot { padding: 14px clamp(16px, 2vw, 22px); border-top: 1px solid var(--line); background: var(--paper-sunk); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.stack { display: grid; gap: clamp(14px, 1.8vw, 20px); }
.stack-sm { display: grid; gap: 10px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 1.8vw, 20px); }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.8vw, 20px); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(14px, 1.8vw, 20px); align-items: start; }
@media (max-width: 900px) { .cols-2, .cols-3, .split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Stat tiles ---------- */

/* Individual cards with a real gap, not a shared grid with drawn separators.
   Any separator scheme has to answer "what happens to the last row when the
   tile count does not fill it", and every answer to that is worse than simply
   not having the problem. */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.stat-tile {
  background: var(--paper-raised); padding: clamp(16px, 2vw, 22px);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.stat-tile .k { font-size: var(--step-micro); color: var(--ink-faint); margin-bottom: 9px; line-height: 1.35; }
.stat-tile .v { font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-tile .d { margin-top: 8px; font-size: 0.75rem; color: var(--ink-faint); }
.stat-tile.accent .v { color: var(--accent); }
.stat-tile.wait .v { color: var(--caution); }
.stat-tile.data .v { color: var(--data); }

/* ---------- Worker cards in-app ---------- */

.worker-tile {
  display: flex; flex-direction: column;
  padding: clamp(18px, 2.2vw, 24px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--paper-raised); box-shadow: var(--shadow-xs);
  text-decoration: none; color: inherit;
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
a.worker-tile:hover { border-color: var(--accent-tint-2); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.worker-tile-top { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 14px; }
.worker-tile .worker-avatar { width: 44px; height: 44px; border-radius: 13px; }
.worker-tile .worker-avatar svg { width: 22px; height: 22px; }
.worker-tile h2 { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 500; letter-spacing: -0.018em; line-height: 1.18; margin-bottom: 3px; }
.worker-tile .role-kind { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); }
.worker-tile .desc { font-size: var(--step-micro); color: var(--ink-soft); line-height: 1.55; flex: 1; }
.worker-tile .worker-now { margin-top: 14px; }
.worker-tile-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }

/* ---------- Status pill ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: var(--radius-pill);
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid transparent; white-space: nowrap;
}
.pill[data-tone="work"] { background: var(--data-tint); color: var(--data); }
.pill[data-tone="wait"] { background: var(--caution-tint); color: var(--caution); }
.pill[data-tone="done"] { background: var(--positive-tint); color: var(--positive); }
.pill[data-tone="error"] { background: #FBE9E6; color: #8C2F1E; }
.pill[data-tone="idle"] { background: var(--paper-sunk); color: var(--ink-faint); border-color: var(--line); }
.pill[data-tone="demo"] { background: var(--accent-tint); color: var(--accent-strong); border-color: var(--accent-tint-2); }

/* ---------- Lists ---------- */

.row-list { display: grid; gap: 8px; }
.row-item {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center; gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--paper-raised);
  text-decoration: none; color: inherit;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
a.row-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-soft); transform: translateX(2px); }
.row-item .row-title { font-size: var(--step-xs); font-weight: 600; display: block; }
.row-item .row-meta { font-size: var(--step-micro); color: var(--ink-soft); display: block; overflow: hidden; text-overflow: ellipsis; }
.row-item .row-right { display: flex; align-items: center; gap: 10px; flex: none; }

@media (max-width: 560px) {
  .row-item { grid-template-columns: 34px minmax(0, 1fr); grid-template-areas: "g t" "g m" "r r"; row-gap: 4px; }
  .row-item > .glyph { grid-area: g; align-self: start; }
  .row-item .row-title { grid-area: t; }
  .row-item .row-meta { grid-area: m; }
  .row-item .row-right { grid-area: r; margin-top: 6px; }
}

/* ---------- Timeline ---------- */

.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 76px 28px minmax(0, 1fr); gap: 12px; padding: 12px 0; position: relative; align-items: start; }
.timeline-item::before { content: ''; position: absolute; left: 89px; top: 34px; bottom: -12px; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-time { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-faint); padding-top: 5px; text-align: right; }
.timeline-dot { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--paper-sunk); border: 1px solid var(--line); position: relative; z-index: 1; }
.timeline-dot svg { width: 14px; height: 14px; color: var(--ink-faint); }
.timeline-dot[data-actor="worker"] { background: var(--accent-tint); border-color: var(--accent-tint-2); }
.timeline-dot[data-actor="worker"] svg { color: var(--accent-strong); }
.timeline-dot[data-actor="user"] { background: var(--data-tint); border-color: color-mix(in srgb, var(--data) 20%, transparent); }
.timeline-dot[data-actor="user"] svg { color: var(--data); }
.timeline-body { padding-top: 3px; }
.timeline-body p { font-size: var(--step-sm); line-height: 1.5; }
.timeline-body .who { font-size: var(--step-micro); color: var(--ink-faint); margin-top: 2px; }

@media (max-width: 560px) {
  .timeline-item { grid-template-columns: 28px minmax(0, 1fr); }
  .timeline-time { grid-column: 2; text-align: left; padding-top: 0; order: 2; }
  .timeline-item::before { left: 13px; }
}

/* ---------- Forms ---------- */

/* A <select> sizes to its widest option, which can be wider than the column it
   sits in — at 320px that pushed the whole page sideways. min-width: 0 on the
   grid child and on the control itself is what actually stops it, since the
   default min-width: auto ignores the 100% width. */
.form-grid { display: grid; gap: 16px; }
.form-grid > *, .field { min-width: 0; }
.input, .textarea, .select { min-width: 0; max-width: 100%; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-grid.two { grid-template-columns: minmax(0, 1fr); } }

.field > label { display: block; margin-bottom: 6px; font-family: var(--font-mono); font-size: var(--step-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.field .help { margin-top: 6px; font-size: var(--step-micro); color: var(--ink-faint); }
.field .error { margin-top: 6px; font-size: var(--step-micro); color: #8C2F1E; }

.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--paper-raised); color: var(--ink);
  font-size: var(--step-sm); font-family: inherit;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: #8C2F1E; }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* ---------- Notices ---------- */

.notice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--paper-sunk);
  font-size: var(--step-sm);
}
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--ink-faint); }
.notice[data-tone="error"] { background: #FBE9E6; border-color: #F0CFC8; color: #6E2417; }
.notice[data-tone="error"] svg { color: #8C2F1E; }
.notice[data-tone="success"] { background: var(--positive-tint); border-color: color-mix(in srgb, var(--positive) 22%, transparent); color: #0E4A33; }
.notice[data-tone="success"] svg { color: var(--positive); }
.notice[data-tone="warn"] { background: var(--caution-tint); border-color: color-mix(in srgb, var(--caution) 24%, transparent); color: #5E3C08; }
.notice[data-tone="warn"] svg { color: var(--caution); }
.notice[data-tone="demo"] { background: var(--accent-tint); border-color: var(--accent-tint-2); color: var(--accent-strong); }
.notice[data-tone="demo"] svg { color: var(--accent); }

/* ---------- Empty states ---------- */

.empty { text-align: center; padding: clamp(32px, 6vw, 60px) 20px; }
.empty .glyph { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: var(--radius-lg); }
.empty .glyph svg { width: 27px; height: 27px; }
.empty h2 { font-family: var(--font-display); font-size: var(--step-h3); font-weight: 500; letter-spacing: -0.018em; margin-bottom: 8px; }
.empty p { font-size: var(--step-sm); color: var(--ink-soft); max-width: 44ch; margin: 0 auto 20px; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--step-micro); }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); background: var(--paper-sunk); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Report reading ---------- */

.report { max-width: 74ch; }
.report h2 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); margin: clamp(26px, 3vw, 36px) 0 12px; }
.report h2:first-child { margin-top: 0; }
.report p { font-size: 1.0625rem; line-height: 1.7; color: var(--ink); margin-bottom: 1em; }
.report .lead { font-size: 1.1875rem; line-height: 1.6; }
.report ol.findings { display: grid; gap: 14px; counter-reset: f; }
.report ol.findings li {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--paper-raised);
}
.report ol.findings h3 { font-size: 1.0625rem; margin-bottom: 5px; }
.report ol.findings p { font-size: var(--step-sm); line-height: 1.6; color: var(--ink-soft); margin: 0; }
.report .action-list { display: grid; gap: 12px; }
.report .action-list li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; }
.report .action-list .n {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600;
}
.report .action-list b { display: block; font-size: var(--step-sm); }
.report .action-list span { display: block; font-size: var(--step-micro); color: var(--ink-soft); margin-top: 2px; }

.provenance {
  margin-top: 28px; padding: 15px 17px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--paper-sunk);
}
.provenance .label { display: block; margin-bottom: 8px; }
.provenance p { font-size: var(--step-micro); color: var(--ink-soft); line-height: 1.6; margin: 0 0 6px; }
.provenance p:last-child { margin-bottom: 0; }

/* ---------- Utility ---------- */

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 28px; }
.hr { height: 1px; background: var(--line); margin: 22px 0; }

/* ============================================================
   WORKER PROFILE
   ============================================================ */

.worker-hero {
  display: flex; align-items: flex-start; gap: clamp(14px, 2vw, 20px);
  padding: clamp(20px, 2.6vw, 28px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: linear-gradient(150deg, var(--accent-tint) 0%, var(--paper-raised) 45%);
  box-shadow: var(--shadow-soft);
  flex-wrap: wrap;
}
.worker-hero .worker-avatar { width: 60px; height: 60px; border-radius: 18px; }
.worker-hero .worker-avatar svg { width: 30px; height: 30px; }
.worker-hero-text { min-width: 0; flex: 1; }
.worker-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.625rem, 3vw, 2.125rem);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1.05;
}
.worker-hero .role-kind { font-family: var(--font-mono); font-size: var(--step-micro); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); margin-top: 4px; }
.worker-mission { margin-top: 10px; font-size: var(--step-sm); color: var(--ink-soft); max-width: 56ch; }
.worker-hero-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 620px) { .worker-hero-side { margin-left: 0; width: 100%; } }

.tabbar {
  display: flex; gap: 2px; margin-top: clamp(18px, 2.4vw, 26px);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar a {
  flex: none; padding: 11px 15px;
  font-size: var(--step-xs); color: var(--ink-soft); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tabbar a:hover { color: var(--ink); }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

/* ---------- Capabilities ---------- */

.policy-key { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.policy-key > div { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-sunk); }
.policy-key dt { font-size: var(--step-micro); font-weight: 600; margin-bottom: 3px; }
.policy-key dd { margin: 0; font-size: 0.75rem; color: var(--ink-soft); line-height: 1.45; }
@media (max-width: 760px) { .policy-key { grid-template-columns: minmax(0, 1fr); } }

.cap-list { display: grid; gap: 8px; }
.cap-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--paper-raised);
}
.cap-row[data-implemented="false"] { background: var(--paper-sunk); }
.cap-text { min-width: 0; flex: 1; }
.cap-text b { display: block; font-size: var(--step-sm); }
.cap-text span { display: block; font-size: var(--step-micro); color: var(--ink-soft); margin-top: 2px; }
/* The generic span rule above would stretch the pill to full width. Higher
   specificity, so a badge stays a badge. */
.cap-text .pill { display: inline-flex; width: auto; margin-top: 7px; }
.cap-control { flex: none; min-width: 200px; }
.cap-control .select { min-height: 42px; }
@media (max-width: 560px) { .cap-control { width: 100%; min-width: 0; } }

/* ---------- Upload ---------- */

.upload {
  display: block; padding: clamp(20px, 3vw, 30px);
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-md);
  background: var(--paper-sunk); text-align: center; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.upload:hover, .upload:focus-within { border-color: var(--accent); background: var(--accent-tint); }
.upload input[type="file"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.upload .glyph { margin: 0 auto 12px; }
.upload b { display: block; font-size: var(--step-sm); margin-bottom: 4px; }
.upload span { display: block; font-size: var(--step-micro); color: var(--ink-soft); }
.upload-label { display: block; margin-top: 12px; font-size: var(--step-micro); color: var(--ink-faint); }
.upload-label[data-tone="ok"] { color: var(--positive); font-weight: 600; }
.upload-label[data-tone="error"] { color: #8C2F1E; font-weight: 600; }

/* ---------- Approval card, matched to the homepage's language ---------- */

.approval-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper-raised); box-shadow: var(--shadow-soft); overflow: hidden; }
.approval-card > header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--paper-edge), var(--paper-sunk));
}
.approval-card > header .label { padding: 0; }
.approval-card .req-body { padding: clamp(16px, 2.2vw, 22px); }
.approval-req { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 16px; }
.approval-req .h4 { margin-bottom: 3px; }
.approval-req p { font-size: var(--step-micro); color: var(--ink-soft); }
.approval-preview {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-sunk); padding: 15px 17px;
  font-size: var(--step-sm); line-height: 1.6;
}
.approval-preview h4 { font-size: var(--step-sm); margin-bottom: 6px; }
.approval-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.approval-actions .btn { flex: 1 1 auto; min-width: 120px; }
@media (max-width: 520px) { .approval-actions .btn { flex: 1 1 100%; } }

/* ---------- Metrics table inside a report ---------- */

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.metric {
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-raised);
}
.metric .k { font-size: 0.75rem; color: var(--ink-faint); margin-bottom: 5px; }
.metric .v { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.024em; font-variant-numeric: tabular-nums; }

.bar-row-app { margin-bottom: 12px; }
.bar-row-app .bh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.bar-row-app .bk { font-size: var(--step-micro); color: var(--ink-soft); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row-app .bv { font-size: var(--step-micro); font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.bar-row-app .track { height: 7px; border-radius: 4px; background: var(--paper-sunk); border: 1px solid var(--line); overflow: hidden; }
.bar-row-app .track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent-deep), var(--accent-hot)); }

/* ---------- File chooser ---------- */

.file-choices { display: grid; gap: 8px; }
.file-choices > * { min-width: 0; }
.file-choice {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-raised); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.file-choice:hover { border-color: var(--line-strong); }
.file-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-choice .fc-box {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--paper);
  display: grid; place-items: center;
}
.file-choice .fc-box svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.file-choice input:checked ~ .fc-box { background: var(--accent); border-color: var(--accent); }
.file-choice input:checked ~ .fc-box svg { opacity: 1; }
.file-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.file-choice input:focus-visible ~ .fc-box { box-shadow: var(--focus-ring); }
.file-choice .fc-text { min-width: 0; }
.file-choice .fc-text b { display: block; font-size: var(--step-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-choice .fc-text span { display: block; font-size: var(--step-micro); color: var(--ink-soft); }

/* ---------- Detail lists ---------- */

.detail-list { display: grid; gap: 0; }
.detail-list > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { font-size: var(--step-micro); color: var(--ink-faint); flex: none; }
.detail-list dd { margin: 0; font-size: var(--step-micro); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.detail-list dd a { color: var(--accent-strong); text-decoration: none; }

.lead-sm { font-size: 1.0625rem; line-height: 1.6; color: var(--ink); }
.v-lg { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.028em; }
.panel-body h3 { font-size: var(--step-h4); font-weight: 600; margin-bottom: 8px; }
.help { font-size: var(--step-micro); color: var(--ink-faint); line-height: 1.5; }

/* ---------- Filters ---------- */

.filters {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px; align-items: end;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--paper-raised);
}
.filters .field { margin: 0; }
.filters-actions { padding-bottom: 1px; }
@media (max-width: 760px) { .filters { grid-template-columns: minmax(0, 1fr); } }

.inline-form { display: flex; gap: 8px; align-items: center; }
.select-sm { min-height: 38px; padding: 7px 32px 7px 12px; font-size: var(--step-micro); background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; }

/* ---------- Day chart ---------- */

.day-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.day-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; min-width: 0; }
.day-bar { width: 100%; max-width: 40px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, var(--accent-hot), var(--accent)); min-height: 4px; }
.day-label { font-family: var(--font-mono); font-size: 0.625rem; color: var(--ink-faint); white-space: nowrap; }

/* ---------- Platform admin ---------- */

.pa-shell { min-height: 100vh; min-height: 100dvh; background: var(--paper-sunk); }
.pa-top {
  display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(18px, 4vw, 36px);
  background: var(--ink); color: #F3F1EE;
  position: sticky; top: 0; z-index: 20;
}
.pa-top .brand { color: #F3F1EE; }
.pa-top .brand .tld { color: var(--accent-hot); }
.pa-top nav { display: flex; gap: 4px; margin-left: 18px; flex-wrap: wrap; }
.pa-top nav a { padding: 7px 12px; border-radius: 8px; font-size: var(--step-xs); color: #B9B5AE; text-decoration: none; }
.pa-top nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.pa-top nav a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.pa-top .right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: var(--step-micro); color: #B9B5AE; min-width: 0; }
.pa-top .right span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The console bar is brand + nav + identity. On a phone that is more than one
   line of content, so it becomes one, rather than pushing the page sideways. */
@media (max-width: 700px) {
  .pa-top { flex-wrap: wrap; gap: 10px; }
  .pa-top nav { margin-left: 0; order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .pa-top nav::-webkit-scrollbar { display: none; }
  .pa-top nav a { flex: none; }
  .pa-top .right { margin-left: auto; }
}
.pa-body { padding: clamp(20px, 3vw, 34px) clamp(18px, 4vw, 36px) 64px; max-width: 1280px; margin-inline: auto; }
