/* ==========================================================================
   Product Brain design system
   Based on the AnywhereWorks website (anywhereworks.com): bold display headlines that end in a
   blue dot, slate body text, generous white space, pill-shaped buttons.
   Rules and usage: docs/knowledge/design-system.md. Live reference: /design-system.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */

:root {
  /* Brand */
  --aw-blue: #6699ff;          /* AnywhereWorks blue: the dot, highlights, decorative fills */
  --aw-ink: #181818;           /* AnywhereWorks near-black: footer, brand mark */

  /* Text */
  --ink: #000000;              /* headings */
  --text: #40495b;             /* body text (AW slate) */
  --text-muted: #727c8f;       /* secondary text */

  /* Surfaces */
  --canvas: #f8f8f8;           /* page background behind cards */
  --surface: #ffffff;          /* cards, sidebar, inputs */
  --subtle: #f0f2f5;           /* hover, tags, code */
  --border: #e4e7ec;

  /* Actions. --accent is a darker blue than --aw-blue so text and buttons pass contrast checks */
  --accent: #2f5fd0;
  --accent-hover: #244cad;
  --accent-soft: #eaf0ff;
  --on-accent: #ffffff;        /* text on --accent buttons */
  --focus: #6699ff;

  /* Status */
  --danger: #c4320a;
  --danger-soft: #fef3f2;
  --success: #067647;
  --success-soft: #ecfdf3;
  --scrollbar: rgba(16, 24, 40, 0.22);  /* thin scrollbar thumb (sidebars, chat) */
  --table-head: #2b3240;       /* dark header row of every table (.table th, .prose th) */
  --on-table-head: #ffffff;
  /* Roadmap stages, lightest (Backlog) to strongest (Released): Visual tab */
  --st-backlog: #e4e7ec;
  --st-discovery: #dbe6ff;
  --st-scoping: #bcd0ff;
  --st-design: #93b2ff;
  --st-build: #2f5fd0;
  --st-testing: #1f3f99;
  --st-released: #067647;
  --st-fg-soft: #1f2a44;       /* text on the light stage colours */
  --st-fg-strong: #ffffff;     /* text on Build, Testing, Released */


  /* Type. The AW brand fonts (Paralucent, Simplon BP) are licensed, so free look-alikes load from Google Fonts. */
  --font-display: "Paralucent-AW", "Barlow", "Trebuchet MS", sans-serif;
  --font-body: "Simplon BP", "Inter", "Helvetica Neue", Arial, sans-serif;

  /* Shape and depth */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.18);

  /* Layout */
  --sidebar-w: 256px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ffffff;
    --text: #c9cfdb;
    --text-muted: #8b93a5;
    --canvas: #111318;
    --surface: #181a20;
    --subtle: #22252d;
    --border: #2c3039;
    --accent: #7fa6ff;
    --accent-hover: #a3bfff;
    --accent-soft: #1d2640;
    --on-accent: #0b1020;
    --danger: #ff8a65;
    --danger-soft: #3a1d17;
    --success: #6ee7b7;
    --success-soft: #133024;
    --scrollbar: rgba(255, 255, 255, 0.2);
    --table-head: #0b0d11;
    --on-table-head: #e4e8f0;
    --st-backlog: #2c3039;
    --st-discovery: #1d2640;
    --st-scoping: #26355e;
    --st-design: #34497f;
    --st-build: #5b7fe0;
    --st-testing: #9ab8ff;
    --st-released: #6ee7b7;
    --st-fg-soft: #e4e8f0;
    --st-fg-strong: #0b1020;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ink: #ffffff;
  --text: #c9cfdb;
  --text-muted: #8b93a5;
  --canvas: #111318;
  --surface: #181a20;
  --subtle: #22252d;
  --border: #2c3039;
  --accent: #7fa6ff;
  --accent-hover: #a3bfff;
  --accent-soft: #1d2640;
  --on-accent: #0b1020;
  --danger: #ff8a65;
  --danger-soft: #3a1d17;
  --success: #6ee7b7;
  --success-soft: #133024;
  --scrollbar: rgba(255, 255, 255, 0.2);
  --table-head: #0b0d11;
  --on-table-head: #e4e8f0;
  --st-backlog: #2c3039;
  --st-discovery: #1d2640;
  --st-scoping: #26355e;
  --st-design: #34497f;
  --st-build: #5b7fe0;
  --st-testing: #9ab8ff;
  --st-released: #6ee7b7;
  --st-fg-soft: #e4e8f0;
  --st-fg-strong: #0b1020;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 3. Typography ---------- */

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

/* The AW signature: a blue dot at the end of a headline */
.dot::after {
  content: "";
  display: inline-block;
  width: 0.2em;
  height: 0.2em;
  margin-left: 0.06em;
  border-radius: 50%;
  background: var(--aw-blue);
}

.eyebrow {
  display: block;
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lede {
  margin: 0;
  font-size: 16px;
  color: var(--text-muted);
}

/* ---------- 4. Brand mark ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--aw-ink);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}

:root[data-theme="dark"] .brand-mark {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  }
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

/* Animated mark (login page): each node lights up in AW blue in turn, and the link leading to it pulses */

.brand-mark--live .node {
  transform-box: fill-box;
  transform-origin: center;
  animation: pb-node 3.6s ease-in-out infinite;
}

.brand-mark--live .edge {
  opacity: 0.45;
  animation: pb-edge 3.6s ease-in-out infinite;
}

.brand-mark--live .node-2 { animation-delay: 1.2s; }
.brand-mark--live .node-3 { animation-delay: 2.4s; }
.brand-mark--live .edge-1 { animation-delay: 0.6s; }
.brand-mark--live .edge-2 { animation-delay: 1.8s; }
.brand-mark--live .edge-3 { animation-delay: 3s; }

@keyframes pb-node {
  0%, 40%, 100% { fill: transparent; transform: scale(1); }
  12% { fill: #6699ff; stroke: #6699ff; transform: scale(1.18); }
  24% { fill: #6699ff; stroke: #6699ff; transform: scale(1); }
}

@keyframes pb-edge {
  0%, 40%, 100% { opacity: 0.45; }
  15% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark--live .node,
  .brand-mark--live .edge {
    animation: none;
  }
  .brand-mark--live .edge {
    opacity: 1;
  }
}

/* ---------- 5. Local-site banner ---------- */

.env-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #b42318;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  padding: 10px 16px;
}

/* ---------- 6. Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font: 500 15px/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--subtle);
  color: var(--ink);
}

.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13.5px;
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font: 500 13px/1 var(--font-body);
  cursor: pointer;
}

.btn-quiet:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}

.link-btn:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* "Sign in with Google" follows Google's branding guidelines, not the AW button style */
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 260px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid #dadce0;
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: #1f1f1f;
  font: 500 15px/1 Roboto, Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.google-btn:hover {
  background: #f8fafd;
  color: #1f1f1f;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
}

.google-btn:focus-visible {
  outline: 2px solid #1a73e8;
}

.google-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .google-btn {
    background: #131314;
    border-color: #8e918f;
    color: #e3e3e3;
  }
  :root:not([data-theme="light"]) .google-btn:hover {
    background: #1f1f20;
  }
}

:root[data-theme="dark"] .google-btn {
  background: #131314;
  border-color: #8e918f;
  color: #e3e3e3;
}

/* ---------- 7. Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.input,
.select {
  height: 42px;
}

.textarea {
  min-height: 140px;
  padding: 10px 14px;
  resize: vertical;
  line-height: 1.5;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.form-row .input {
  flex: 1 1 200px;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- 8. Feedback and status ---------- */

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.notice.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice.success {
  background: var(--success-soft);
  color: var(--success);
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--subtle);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.tag.blue { background: var(--accent-soft); color: var(--accent); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.green { background: var(--success-soft); color: var(--success); }

.empty {
  padding: 48px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  color: var(--text-muted);
}

.empty strong {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
}

/* ---------- 9. Cards, panels, lists, tables ---------- */

.panel {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.panel > p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

/* A whole card that links somewhere */
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-link:hover {
  border-color: var(--aw-blue);
  box-shadow: var(--shadow);
  color: inherit;
}

/* Product card: plain white card */
.product-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.product-card h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.product-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.list .name {
  font-weight: 500;
  color: var(--ink);
}

.list .meta {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
}

.list .tag {
  margin-left: 8px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

/* Every table has a dark header row (Amit, 16 Nov 2026). New tables get it by using class="table". */
.table th {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-table-head);
  background: var(--table-head);
}

.table tr:last-child td {
  border-bottom: 0;
}

/* Sticky header row: app.js moves the header cells down as the page scrolls (see "Sticky table headers" there) */
.table thead th {
  position: relative;
  z-index: 2;
}

.table thead.stuck th {
  box-shadow: 0 6px 12px -6px rgba(16, 24, 40, 0.35);
}

.table .wrap {
  white-space: pre-wrap;
  min-width: 260px;
  color: var(--ink);
}

.table .nowrap {
  white-space: nowrap;
}

/* ---------- 10. Login ---------- */

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.login-top {
  display: flex;
  justify-content: center;
  padding: 40px 16px 0;
}

.login-top .brand {
  gap: 14px;
  font-size: 34px;
}

.login-top .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.login-top .brand-mark svg {
  width: 30px;
  height: 30px;
}

.login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.login-box {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-box p {
  margin: 0 0 24px;
  color: var(--text-muted);
}

.login-box .form-row {
  justify-content: center;
}

/* Temporary password sign-in (functions/auth/password.js) */
.login-form {
  text-align: left;
}

.login-form .btn {
  width: 100%;
  justify-content: center;
}

.login-error {
  text-align: left;
}

/* ---------- 11. App shell: sidebar + main ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: var(--banner-h, 0px);
  height: calc(100vh - var(--banner-h, 0px));
  height: calc(100dvh - var(--banner-h, 0px));
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}

/* Quiet scrollbars (Amit, 16 Nov 2026): the sidebars and the chat scroll with a thin bar that only shows
   while you point at them or scroll; nothing changes for keyboard or trackpad scrolling. */
.sidebar,
.chat-side,
.chat-scroll {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.sidebar:hover,
.sidebar:focus-within,
.chat-side:hover,
.chat-scroll:hover {
  scrollbar-color: var(--scrollbar) transparent;
}

.sidebar::-webkit-scrollbar,
.chat-side::-webkit-scrollbar,
.chat-scroll::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
.chat-side::-webkit-scrollbar-thumb,
.chat-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  background-clip: padding-box;
}

.sidebar:hover::-webkit-scrollbar-thumb,
.chat-side:hover::-webkit-scrollbar-thumb,
.chat-scroll:hover::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 20px 14px 12px 20px;
}

/* Pin button, top right of the sidebar */
.pin-btn,
.sidebar-open-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.pin-btn svg,
.sidebar-open-btn svg {
  width: 18px;
  height: 18px;
}

.pin-btn:hover {
  background: var(--subtle);
  color: var(--ink);
}

.pin-btn[aria-pressed="true"] {
  color: var(--accent);
}

.pin-btn[aria-pressed="true"] svg path:first-child {
  fill: currentColor;
}

.sidebar-edge,
.sidebar-open-btn {
  display: none;
}

/* Unpinned (wide screens only): the sidebar collapses and slides in over the page on demand */
@media (min-width: 901px) {
  .sidebar-unpinned .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar-unpinned .sidebar {
    position: fixed;
    top: var(--banner-h, 0px);
    left: 0;
    bottom: 0;
    z-index: 45;
    width: var(--sidebar-w);
    height: auto;
    transform: translateX(-100%);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .sidebar-unpinned .sidebar.peek {
    transform: none;
    box-shadow: var(--shadow-lg);
  }

  .sidebar-unpinned .sidebar-edge {
    display: block;
    position: fixed;
    top: var(--banner-h, 0px);
    left: 0;
    bottom: 0;
    z-index: 44;
    width: 10px;
  }

  .sidebar-unpinned .sidebar-open-btn {
    display: grid;
    position: fixed;
    top: calc(var(--banner-h, 0px) + 16px);
    left: 16px;
    z-index: 43;
    border-color: var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .sidebar-unpinned .sidebar-open-btn:hover {
    color: var(--ink);
  }

  .sidebar-unpinned .page {
    padding-left: 72px;
    padding-right: 72px;
  }
}

/* Phones use the menu button instead, so pinning doesn't apply there */
@media (max-width: 900px) {
  .pin-btn {
    display: none;
  }
}

/* Product dropdown at the top of the sidebar: button + list, each with the brand's icon */
.product-picker {
  position: relative;
  padding: 4px 14px 6px 20px;
}

.product-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 500 15px/1 var(--font-body);
  text-align: left;
  cursor: pointer;
}

.product-button:hover {
  background: var(--subtle);
}

.product-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-chevron {
  width: 7px;
  height: 7px;
  margin: -3px 3px 0 0;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
}

.product-button[aria-expanded="true"] .product-chevron {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.brand-icon {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 5px;
  object-fit: contain;
}

/* Brand icons sit on a white tile so dark marks stay visible in dark mode */
:root[data-theme="dark"] img.brand-icon {
  background: #fff;
  padding: 2px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.brand-icon {
    background: #fff;
    padding: 2px;
  }
}

.brand-letter {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 12px/1 var(--font-body);
}

.product-list {
  position: absolute;
  top: calc(100% - 2px);
  left: 20px;
  right: 14px;
  z-index: 20;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.product-list:focus {
  outline: none;
}

.product-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 14.5px;
  cursor: pointer;
}

.product-option.active {
  background: var(--subtle);
}

.product-option[aria-selected="true"] {
  font-weight: 500;
}

.product-option[aria-selected="true"]::after {
  content: "";
  width: 9px;
  height: 5px;
  margin-left: auto;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg) translateY(-2px);
}

.product-note {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.product-option[aria-selected="true"] .product-note {
  margin-left: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
}

.nav-group {
  margin-top: 6px;
}

/* Accordion heading (Knowledge, Admin): sentence case, with a chevron that turns when open */
.nav-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-section::-webkit-details-marker {
  display: none;
}

.nav-section::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.nav-group[open] > .nav-section::after {
  transform: rotate(45deg);
}

.nav-section:hover {
  background: var(--subtle);
}

.nav-group > .nav-item {
  padding-left: 22px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14.5px;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--subtle);
  color: var(--ink);
}

.nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.sidebar-foot {
  padding: 14px 20px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.sidebar-actions .btn {
  flex: 1;
}

.main {
  min-width: 0;
}

.mobile-bar {
  display: none;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 32px 72px;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  margin: 0 0 8px;
  font-size: 44px;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(16, 24, 40, 0.45);
}

@media (max-width: 900px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    top: 0;
    height: 100dvh;
    z-index: 60; /* above the local-site banner */
    width: min(86vw, var(--sidebar-w));
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: none;
  }

  .mobile-bar {
    position: sticky;
    top: var(--banner-h, 0px);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }

  .menu-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
  }

  .menu-btn svg {
    width: 20px;
    height: 20px;
  }

  .page {
    padding: 28px 16px 56px;
  }

  .page-head h1 {
    font-size: 34px;
  }

  .login-top .brand {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-unpinned .sidebar,
  .nav-section::after {
    transition: none;
  }
}

/* ---------- 12. Modal (feedback form) ---------- */

.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.modal::backdrop {
  background: rgba(16, 24, 40, 0.5);
}

.modal-body {
  padding: 28px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
  font-size: 28px;
}

.modal-head p {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--subtle);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Screenshot upload (feedback form) */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 18px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone strong {
  color: var(--accent);
  font-weight: 500;
}

.dropzone:hover,
.dropzone.over {
  border-color: var(--aw-blue);
  background: var(--accent-soft);
}

.dropzone:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.shots,
.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shots {
  margin-bottom: 4px;
}

.shot {
  position: relative;
  width: 88px;
  height: 66px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--subtle);
}

.shot img,
.thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 24, 40, 0.75);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.thumbs {
  margin-top: 10px;
}

.thumbs a {
  display: block;
  width: 72px;
  height: 54px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--subtle);
}

.thumbs a:hover {
  border-color: var(--aw-blue);
}

/* ---------- 13. Knowledge ---------- */

.kn-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.kn-side {
  position: sticky;
  top: calc(24px + var(--banner-h, 0px));
  max-height: calc(100dvh - 48px - var(--banner-h, 0px));
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.kn-count {
  margin: 8px 2px 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.kn-group {
  margin: 16px 2px 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kn-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.kn-item:hover {
  background: var(--subtle);
  color: var(--ink);
}

.kn-item[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.kn-doc {
  min-height: 400px;
  padding: 32px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.kn-path {
  margin-bottom: 18px;
  font-size: 12.5px;
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .kn-layout {
    grid-template-columns: 1fr;
  }
  .kn-side {
    position: static;
    max-height: 320px;
  }
  .kn-doc {
    padding: 24px 20px;
  }
}

/* Synced Google Doc pages (North star) */

.doc-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px 0 20px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.doc-bar-actions {
  display: flex;
  gap: 8px;
}

.doc-entry {
  scroll-margin-top: calc(24px + var(--banner-h, 0px));
}

.doc-entry + .doc-entry {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.kn-doc.prose img {
  max-width: 100%;
  height: auto;
}

/* Summary panel and time-frame choices (North star → Summarize) */

.summary-panel {
  margin: 0 0 24px;
  padding: 24px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* a soft accent wash fading into the card, instead of a coloured edge (design-system.md) */
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 85%, var(--surface)) 0, var(--surface) 140px);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(16px + var(--banner-h, 0px));
}

.summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.summary-head h2 {
  margin: 0 0 2px;
  font-size: 24px;
}

.summary-head .hint {
  margin: 0;
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-body {
  min-height: 28px;
}

.summary-note {
  margin: 12px 0 0;
}

.type-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--aw-blue);
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .type-caret {
    animation: none;
  }
}

.choice-list {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--aw-blue);
  background: var(--accent-soft);
}

.choice input {
  accent-color: var(--accent);
}

/* Connections page: one table */

.conn-table td {
  font-size: 14px;
}

.conn-name {
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}

.conn-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.conn-status-cell {
  min-width: 140px;
}

.conn-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.conn-status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

.conn-status.ok { background: var(--success-soft); color: var(--success); }
.conn-status.partial { background: var(--subtle); color: var(--text-muted); }
.conn-status.error { background: var(--danger-soft); color: var(--danger); }

.conn-note-text {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Rendered Markdown */
.prose {
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.7;
}

.prose h1 { font-size: 36px; margin: 0 0 16px; }
.prose h2 { font-size: 26px; margin: 36px 0 12px; }
.prose h3 { font-size: 20px; margin: 28px 0 10px; }
.prose p, .prose ul, .prose ol, .prose table, .prose blockquote, .prose pre { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose strong { color: var(--ink); font-weight: 600; }

.prose code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--subtle);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  color: var(--ink);
}

.prose pre {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--subtle);
  overflow-x: auto;
}

.prose pre code {
  padding: 0;
  background: none;
}

.prose blockquote {
  padding: 4px 16px;
  border-left: 3px solid var(--aw-blue);
  color: var(--text-muted);
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
}

.prose th,
.prose td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--table-head);
  color: var(--on-table-head);
  font-weight: 500;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* ---------- 14. Design system reference page ---------- */

.ds-section {
  margin-top: 40px;
}

.ds-section > h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.ds-section > p {
  margin: 0 0 18px;
  color: var(--text-muted);
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.swatch {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  font-size: 13px;
}

.swatch-chip {
  height: 64px;
  border-bottom: 1px solid var(--border);
}

.swatch-info {
  padding: 10px 12px;
}

.swatch-info strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
}

.swatch-info code {
  color: var(--text-muted);
  font-size: 12px;
}

.ds-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.type-sample {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.type-sample code {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .type-sample {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ---------- 15. Roadmap board (site/roadmap.html, docs/knowledge/roadmap.md) ---------- */

.page.page-wide {
  max-width: 1400px;
}

.modal.modal-wide {
  width: min(820px, calc(100vw - 32px));
}

.rm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.rm-toolbar-end {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rm-views {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.rm-view {
  padding: 7px 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font: 500 14px var(--font-body);
  cursor: pointer;
}

.rm-view[aria-selected="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.rm-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.rm-filters .input {
  flex: 1 1 240px;
  width: auto;
}

.rm-filters .select {
  flex: 0 1 auto;
  width: auto;
}

.rm-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}

.rm-drag-hint {
  margin: -6px 0 12px;
}

.rm-row {
  cursor: pointer;
}

.rm-row:hover,
.rm-row:focus-visible {
  background: var(--subtle);
  outline: none;
}

.rm-rank {
  color: var(--text-muted);
}

.rm-handle {
  margin-right: 8px;
  color: var(--text-muted);
  cursor: grab;
  letter-spacing: -2px;
}

.rm-title {
  font-weight: 500;
  color: var(--ink);
}

.rm-title-cell {
  min-width: 260px;
}

.rm-qw {
  margin-left: 8px;
}

.rm-sub {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.rm-muted {
  color: var(--text-muted);
}

.rm-table .rm-num {
  text-align: right;
}

/* Darker header row (asked for by Amit, 16 Nov 2026) */
.rm-table th {
  background: var(--table-head);
  color: var(--on-table-head);
}

.rm-draggable.dragging {
  opacity: 0.4;
}

.rm-row.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
.rm-row.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
.rm-card.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.rm-card.drop-after { box-shadow: 0 3px 0 var(--accent); }

/* Board by stage */
.rm-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.rm-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--subtle);
}

.rm-col-head,
.rm-month-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
  font-size: 16px;
}

.rm-col-count {
  margin-left: auto;
  font: 500 13px var(--font-body);
  color: var(--text-muted);
}

.rm-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 80px;
  padding: 0 10px 10px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.rm-col-body.drop-col {
  background: var(--accent-soft);
}

.rm-col-empty {
  margin: 8px 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.rm-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.rm-card:hover,
.rm-card:focus-visible {
  border-color: var(--aw-blue);
  outline: none;
}

.rm-card.late {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger-soft) 45%, var(--surface));
}

.rm-card-title {
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
}

.rm-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rm-card .rm-sub {
  margin: 0;
}

/* Launch timeline */
.rm-timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rm-month {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.rm-month.current {
  border-color: var(--aw-blue);
}

.rm-month-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}

/* Recent changes */
.rm-log summary {
  cursor: pointer;
  list-style: none;
}

.rm-log summary::-webkit-details-marker {
  display: none;
}

.rm-log summary h2 {
  display: inline;
  margin: 0;
}

.rm-log summary::after {
  content: " ▾";
  color: var(--text-muted);
}

.rm-log[open] summary::after {
  content: " ▴";
}

.rm-log-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.rm-log-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.rm-log-list li:last-child {
  border-bottom: 0;
}

.rm-log-text {
  display: block;
  color: var(--text);
  overflow-wrap: anywhere;
}

.rm-log-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Item dialog */
.rm-d-tags {
  margin-top: 10px;
}

.rm-d-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.rm-d-section {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.rm-d-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.rm-d-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}

.rm-jira {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 14px;
}

.rm-jira li {
  padding: 4px 0;
}

.rm-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.rm-form .rm-wide {
  grid-column: 1 / -1;
}

.rm-form .select,
.rm-form .input {
  width: 100%;
}

.rm-qw-field {
  align-self: end;
  margin-bottom: 18px;
}

.rm-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.rm-sources legend {
  margin-bottom: 6px;
}

@media (max-width: 640px) {
  .rm-form {
    grid-template-columns: 1fr;
  }

  .rm-filters .select {
    flex: 1 1 140px;
  }
}

/* Roadmap → Visual tab */
.rv-panel {
  margin-top: 0;
  margin-bottom: 16px;
}

.rv-bar {
  display: flex;
  height: 34px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.rv-seg {
  display: grid;
  place-items: center;
  min-width: 6px;
  font-size: 13px;
  font-weight: 600;
}

.rv-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text);
}

.rv-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rv-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.st-backlog { background: var(--st-backlog); color: var(--st-fg-soft); }
.st-discovery { background: var(--st-discovery); color: var(--st-fg-soft); }
.st-scoping { background: var(--st-scoping); color: var(--st-fg-soft); }
.st-design { background: var(--st-design); color: var(--st-fg-soft); }
.st-build { background: var(--st-build); color: var(--st-fg-strong); }
.st-testing { background: var(--st-testing); color: var(--st-fg-strong); }
.st-released { background: var(--st-released); color: var(--st-fg-strong); }

.rv-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.rv-grid {
  display: grid;
  width: max-content;
  min-width: 100%;
}

.rv-corner,
.rv-colhead {
  position: sticky;
  top: 0;
  padding: 10px 12px;
  background: var(--table-head);
  color: var(--on-table-head);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rv-corner {
  left: 0;
  z-index: 2;
}

.rv-now {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--aw-blue);
  color: var(--aw-ink);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.rv-lane {
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--ink);
}

.rv-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--canvas);
}

.rv-cell.current {
  background: var(--accent-soft);
}

.rv-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  font: 500 12px/1.3 var(--font-body);
  text-align: left;
  cursor: pointer;
}

.rv-pill:hover,
.rv-pill:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.rv-pill-text {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.rv-pri {
  flex: none;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: var(--surface);
  font-size: 10px;
  font-weight: 700;
}

/* Feature requests page (shares the roadmap's filter and table styles) */
.fr-votes {
  font-weight: 600;
  color: var(--ink);
}

.fr-tags {
  margin-top: 6px;
}

.fr-detail td {
  background: var(--subtle);
}

.fr-open {
  margin-top: 10px;
}

.fr-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

.rv-more {
  align-self: flex-start;
  font-size: 12px;
}

.rv-pill[hidden] {
  display: none;
}

/* Roadmap table: sortable column headers */
.rm-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.rm-sort-btn:hover,
.rm-sort-btn.active {
  color: var(--aw-blue);
}

.rm-sort-arrow {
  font-size: 10px;
  opacity: 0.6;
}

.rm-sort-btn.active .rm-sort-arrow {
  opacity: 1;
}

/* ---------- 16. People (site/admin/people.html, docs/knowledge/people.md) ---------- */

.pp-filters {
  flex: 1 1 520px;
  margin-bottom: 0;
}

.pp-count {
  margin: 0 0 8px;
}

.pp-name {
  display: block;
  font-weight: 500;
  color: var(--ink);
}

.pp-sub {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
}

.pp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pp-work-cell {
  min-width: 240px;
}

.pp-chip {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 6px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink);
}

.pp-chip:not(:has(.tag)) {
  padding-left: 10px;
}

.pp-chip-role {
  color: var(--text-muted);
}

.pp-chip-role::before {
  content: "· ";
}

.pp-actions {
  text-align: right;
}

.pp-actions .btn-quiet {
  margin-left: 6px;
}

.pp-dri-panel {
  margin-top: 28px;
}

.pp-notes {
  min-height: 80px;
}

.pp-remove {
  margin-right: auto;
}

.pp-work {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.pp-work h3 {
  margin: 0 0 8px;
}

.pp-work h4 {
  margin: 20px 0 10px;
  font-size: 15px;
}

.pp-dri {
  margin-bottom: 16px;
}

/* The People panel on an initiative's page (site/initiative.html) */

.pp-team {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.pp-team li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.pp-team li:first-child {
  padding-top: 0;
}

.pp-team .pp-name {
  display: inline;
}

.pp-team .tag {
  margin-left: 8px;
}

.pp-team-manage {
  margin: 12px 0 0;
}

/* ---------- 17. Roadmap Visual 2: Gantt-style launch timeline (site/roadmap.html → Visual 2) ---------- */

.rg {
  display: grid;
  gap: 16px;
}

.rg-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

/* Summary tiles: even border all round (never a coloured edge); the status colour (--tile) is only in the
   icon and the share bar, so the number and label stay in ink */
.rg-tile {
  --tile: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.rg-tile.released { --tile: var(--success); }
.rg-tile.due { --tile: var(--aw-blue); }
.rg-tile.upcoming { --tile: var(--accent); }
.rg-tile.overdue { --tile: var(--danger); }

.rg-tile-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.rg-tile-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tile) 14%, transparent);
  color: var(--tile);
}

.rg-tile-icon svg {
  width: 16px;
  height: 16px;
}

.rg-tile-label {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
}

.rg-tile-num {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.rg-tile-share {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.rg-tile-meter {
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--subtle);
}

.rg-tile-meter > span {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: var(--radius-pill);
  background: var(--tile);
}

.rg-tile-pct {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.rg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rg-group {
  width: auto;
  height: 36px;
  font-size: 14px;
}

.rg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.rg-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rg-key .rg-mark {
  position: static;
  transform: rotate(45deg);
}

.rg-key-bar {
  display: inline-block;
  width: 22px;
  height: 8px;
  margin-right: -4px;
  border-radius: 999px;
}

.rg-key-bar.upcoming { background: var(--st-build); }
.rg-key-bar.overdue { background: repeating-linear-gradient(135deg, var(--danger) 0 4px, var(--danger-soft) 4px 8px); }

.rg-key-today {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: var(--danger);
}

/* The chart: a sticky label column on the left and a month track that scrolls sideways */
.rg-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.rg-chart {
  --rg-label: 320px;
  position: relative;
  min-width: max-content;
}

/* Today line, through every row */
.rg-chart::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--rg-label) + var(--rg-today));
  width: 2px;
  background: var(--danger);
  opacity: 0.7;
  pointer-events: none;
  z-index: 1;
}

.rg-row {
  display: flex;
  min-height: 46px;
  border-bottom: 1px solid var(--border);
}

.rg-row:last-child {
  border-bottom: 0;
}

.rg-label {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: var(--rg-label);
  flex: none;
  padding: 6px 14px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  min-width: 0;
}

.rg-track {
  position: relative;
  flex: none;
  /* month grid lines */
  background-image: repeating-linear-gradient(to right, transparent 0 calc(var(--rg-col) - 1px), var(--border) calc(var(--rg-col) - 1px) var(--rg-col));
}

/* This month's column */
.rg-track::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--rg-current);
  width: var(--rg-col);
  background: var(--accent-soft);
  opacity: 0.6;
}

.rg-axis {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 48px;
  background: var(--surface);
}

.rg-axis-label {
  font-size: 12.5px;
  color: var(--text-muted);
}

.rg-month {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.rg-month.current {
  color: var(--accent);
}

.rg-year {
  font-size: 11px;
  font-weight: 400;
}

.rg-group-row {
  min-height: 40px;
  background: var(--subtle);
}

.rg-group-row .rg-label {
  background: var(--subtle);
}

.rg-group-row strong {
  color: var(--ink);
  font-size: 14px;
}

.rg-title {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 500 14px/1.3 var(--font-body);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rg-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.rg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

/* How far through the stages: one dot per stage, filled up to the current one */
.rg-dots {
  display: inline-flex;
  gap: 2px;
}

.rg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.rg-dot.on {
  background: var(--accent);
}

.rg-item.released .rg-dot.on {
  background: var(--success);
}

/* Bars and milestone marks on the track */
.rg-bar {
  position: absolute;
  top: 50%;
  height: 8px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.rg-bar.upcoming {
  opacity: 0.85;
}

.rg-bar.overdue {
  background: repeating-linear-gradient(135deg, var(--danger) 0 4px, var(--danger-soft) 4px 8px);
}

.rg-mark {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
  z-index: 1;
}

.rg-mark.released { background: var(--success); }
.rg-mark.upcoming { background: var(--accent); }
.rg-mark.due { background: var(--aw-blue); box-shadow: 0 0 0 3px var(--accent-soft); }
.rg-mark.overdue { background: var(--surface); border: 2px solid var(--danger); }

.rg-mark-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}

.rg-mark-label.overdue { color: var(--danger); font-weight: 500; }
.rg-mark-label.released { color: var(--success); }
.rg-mark-label.due { color: var(--accent); font-weight: 500; }

.rg-item.released .rg-title {
  color: var(--text-muted);
}

.rg-undated h2 {
  font-size: 18px;
}

.rg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rg-chips .rv-pill {
  max-width: 320px;
}

.rg-footnote {
  margin: 0;
}

@media (max-width: 640px) {
  .rg-chart {
    --rg-label: 210px;
  }
}

/* ---------- 18. Initiatives (site/initiatives.html, site/initiative.html, docs/knowledge/initiatives.md) ---------- */

.in-name {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.in-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.in-summary {
  display: block;
  max-width: 520px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-muted);
}

.in-back {
  text-decoration: none;
}

.in-back:hover {
  color: var(--accent);
}

.in-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--text);
}

.in-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.in-grid .panel {
  margin-top: 0;
}

.in-panel.wide {
  grid-column: 1 / -1;
}

.in-panel > p:not(.in-empty):not(.in-text) {
  margin-bottom: 12px;
}

.in-text {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink);
}

.in-empty {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

.in-segments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.in-segment {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.in-segment-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.in-segment-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.in-segment-icon svg {
  width: 16px;
  height: 16px;
}

.in-segment strong {
  color: var(--ink);
}

.in-segment p {
  margin: 10px 0 0;
  font-size: 14px;
  white-space: pre-wrap;
}

.in-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.in-list > li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.in-list > li:last-child {
  border-bottom: 0;
}

.in-list > li > a {
  font-weight: 500;
}

.in-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.in-quotes {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--text);
}

.in-links {
  margin: 0;
  padding-left: 18px;
}

.in-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 14px;
}

.in-facts dt {
  color: var(--text-muted);
}

.in-facts dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.in-form .panel {
  margin-top: 0;
}

.in-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.in-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 16px;
  font-size: 14px;
  color: var(--ink);
}

.in-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.in-spacer {
  flex: 1;
}

@media (max-width: 760px) {
  .in-grid,
  .in-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- 19. Roadmap change log (site/roadmap.html → Change log; the guardrail for group ownership) ---------- */

.rm-log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 12px;
}

.rm-log-head h2 {
  margin: 0 0 4px;
}

.rm-log-intro {
  max-width: 620px;
  margin: 0;
}

.rm-log-stats {
  margin: 6px 0 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.rm-log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rm-log-filters .select {
  width: auto;
  height: 36px;
  font-size: 14px;
}

.rm-log-open {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.rm-log-open:hover {
  color: var(--accent);
  text-decoration: underline;
}

.rm-log-meta strong {
  font-weight: 500;
  color: var(--ink);
}

.rm-log-more {
  margin-top: 10px;
  font-size: 14px;
}

/* ---------- 20. Chat (site/home.html, docs/knowledge/chat.md) ---------- */

/* Chart colours for chat answers (site/assets/chat-charts.js): the validated reference categorical order,
   stepped separately for light and dark. Charts use these, never other colours. */
:root {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #6250d6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #9085e9;
  }
}

:root[data-theme="dark"] {
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #9085e9;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Layout: the chat fills the window beside the main sidebar, with saved chats on the right. Only the chat scrolls. */
.page.chat-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  max-width: none;
  height: calc(100vh - var(--banner-h, 0px));
  height: calc(100dvh - var(--banner-h, 0px));
  padding: 0;
}

/* The chat page fits the window exactly, so the page itself never scrolls (the local banner sits above .app) */
.app:has(.chat-page) {
  min-height: 0;
}

.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 28px 32px 12px;
}

.chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  width: 100%;
  max-width: 880px;
  margin: 0 auto 12px;
}

.chat-head h1 {
  margin: 4px 0 0;
  font-size: 36px;
}

.chat-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-current {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.chat-side-open {
  display: none;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -32px;
  padding: 0 32px;
}

.chat-thread {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px 0 16px;
}

.chat-intro {
  padding: 24px 0;
}

.chat-intro .lede {
  margin: 0 0 8px;
}

.chat-note {
  background: var(--subtle);
  color: var(--text);
}

.chat-msg {
  margin: 0 0 20px;
}

.chat-msg.user {
  display: flex;
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 16px;
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  background: var(--accent-soft);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-prose {
  max-width: none;
}

.chat-prose > :last-child {
  margin-bottom: 0;
}

/* Markdown tables in answers use the house table (dark header row) */
.chat-prose .table-wrap {
  margin: 0 0 16px;
}

.chat-prose .table {
  display: table;
  margin: 0;
}

.chat-prose .table th,
.chat-prose .table td {
  border-width: 0 0 1px;
}

.chat-thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
}

.chat-thinking::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: chat-spin 0.8s linear infinite;
}

@keyframes chat-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .chat-thinking::before {
    animation: none;
  }
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

.chat-input {
  min-height: 46px;
  max-height: 200px;
  resize: none;
}

.chat-foot {
  width: 100%;
  max-width: 880px;
  margin: 8px auto 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Saved chats sidebar (right) */
.chat-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 18px;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.chat-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chat-side-head h2 {
  margin: 0;
  font-size: 20px;
}

.chat-side-close {
  color: var(--text-muted);
}

/* Hidden saved chats bar (wide screens): the chat takes the full width; "Saved chats" brings it back */
.page.chat-page.side-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.chat-page.side-hidden .chat-side {
  display: none;
}

.chat-page.side-hidden .chat-side-open {
  display: inline-flex;
}

/* Folders in the saved chats bar */
.chat-side-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 16px 0 6px;
}

.chat-side-group-row .chat-side-group {
  margin: 0;
}

.chat-folder-add {
  padding: 2px 8px;
  font-size: 12.5px;
}

.chat-folder-form {
  margin: 0 0 8px;
}

.chat-folder-form .input,
.chat-folder-input {
  height: 34px;
  font-size: 14px;
}

.chat-side-error {
  margin: 0 0 8px;
  font-size: 13px;
}

.chat-folder {
  margin: 0 0 2px;
  border-radius: var(--radius-sm);
}

.chat-folder.drop,
.chat-loose.drop {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.chat-loose {
  min-height: 12px;
  border-radius: var(--radius-sm);
}

.chat-folder-head {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius-sm);
}

.chat-folder-head:hover {
  background: var(--subtle);
}

.chat-folder-head.editing {
  padding: 2px 0;
}

.chat-folder-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 500 14px var(--font-body);
  text-align: left;
  cursor: pointer;
}

.chat-folder-chevron {
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--text-muted);
  border-bottom: 1.6px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.chat-folder.open .chat-folder-chevron {
  transform: rotate(45deg);
}

.chat-folder-icon {
  position: relative;
  flex: none;
  width: 16px;
  height: 12px;
  border: 1.6px solid var(--text-muted);
  border-radius: 2px 3px 3px 3px;
}

.chat-folder-icon::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -1.6px;
  width: 7px;
  height: 3px;
  border: 1.6px solid var(--text-muted);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}

.chat-folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-folder-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.chat-folder-action {
  flex: none;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: 12px var(--font-body);
  cursor: pointer;
  opacity: 0;
}

.chat-folder-head:hover .chat-folder-action,
.chat-folder-action:focus-visible {
  opacity: 1;
}

.chat-folder-action:hover {
  background: var(--border);
  color: var(--ink);
}

@media (hover: none) {
  .chat-folder-action {
    opacity: 1;
  }
}

.chat-folder > .chat-list {
  padding-left: 14px;
}

.chat-folder-empty {
  padding: 2px 10px 8px 30px;
}

.chat-link[draggable="true"] {
  cursor: grab;
}

.chat-link.dragging {
  opacity: 0.5;
}

.chat-side-search {
  height: 38px;
  margin-bottom: 8px;
  font-size: 14px;
}

.chat-side-group {
  margin: 16px 0 6px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chat-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-list-empty {
  padding: 6px 2px;
  font-size: 13px;
  color: var(--text-muted);
}

.chat-link {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.chat-link:hover {
  background: var(--subtle);
}

.chat-link.active {
  background: var(--accent-soft);
}

.chat-link-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.chat-link-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

.chat-link-meta .tag {
  padding: 0 8px;
  font-size: 11px;
}

/* Save dialog */
.chat-visibility {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.chat-visibility legend {
  margin-bottom: 6px;
}

.chat-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.chat-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chat-choice input {
  margin-top: 4px;
}

.chat-choice strong {
  display: block;
  color: var(--ink);
}

.chat-delete {
  margin-right: auto;
}

/* Charts in answers */
.chart {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.chart-title {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.chart-body.chart-pie {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
}

.chart-pie .chart-plot {
  flex: 0 0 220px;
  max-width: 100%;
}

.chart-plot {
  position: relative;
  width: 100%;
}

.chart-plot svg {
  display: block;
  overflow: visible;
}

.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-base {
  stroke: var(--text-muted);
  stroke-width: 1;
}

.chart-axis {
  font-size: 11.5px;
  fill: var(--text-muted);
}

.chart-label {
  font-size: 12.5px;
  fill: var(--text);
}

.chart-total {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  fill: var(--ink);
}

.chart-dot {
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-slice {
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-cross {
  stroke: var(--text-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.chart-hit {
  fill: transparent;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text);
}

.chart-pie .chart-legend {
  flex-direction: column;
  margin: 0;
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-key {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  color: var(--text);
  pointer-events: none;
}

.chart-tip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.chart-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-tip-row b {
  margin-left: auto;
  padding-left: 12px;
  font-weight: 600;
  color: var(--ink);
}

.chart-table {
  margin-top: 12px;
}

.chart-table .num {
  font-variant-numeric: tabular-nums;
}

.chart-toggle {
  margin-top: 10px;
}

/* Narrower windows: saved chats slide in from the right */
@media (max-width: 1100px) {
  .page.chat-page {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-side-open {
    display: inline-flex;
  }

  .chat-page.side-hidden .chat-side {
    display: flex;
  }

  .chat-side {
    position: fixed;
    top: var(--banner-h, 0px);
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(320px, 88vw);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.2s ease;
  }

  .chat-side.open {
    transform: none;
  }
}

@media (max-width: 900px) {
  .page.chat-page {
    height: calc(100vh - var(--banner-h, 0px) - 56px);
    height: calc(100dvh - var(--banner-h, 0px) - 56px);
  }

  .chat-main {
    padding: 16px 16px 10px;
  }

  .chat-scroll {
    margin: 0 -16px;
    padding: 0 16px;
  }

  .chat-head h1 {
    font-size: 28px;
  }

  .chat-bubble {
    max-width: 90%;
  }
}

/* "Still learning" notice at the top of a chat */
.chat-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 20px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface));
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}

.chat-notice-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.chat-notice-icon svg {
  width: 16px;
  height: 16px;
}

.chat-notice-text {
  flex: 1;
  padding-top: 4px;
}

.chat-notice-text strong {
  color: var(--ink);
}

.chat-notice-close {
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--text-muted);
}

/* end of 20. Chat */

/* ---------- 21. Changelog (site/changelog.html, docs/knowledge/knowledge.md) ---------- */

.cl-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.cl-search {
  flex: 0 1 420px;
}

.cl-day {
  margin-bottom: 28px;
}

.cl-day-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  font-size: 22px;
}

.cl-day-count {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

.cl-day-list {
  display: grid;
  gap: 12px;
}

.cl-change {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cl-change:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow);
}

.cl-change-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.cl-change-head h3 {
  margin: 0;
  font-size: 18px;
}

.cl-meta {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.cl-meta a {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}

.cl-body {
  margin-top: 10px;
  font-size: 14.5px;
}

.cl-body > :last-child {
  margin-bottom: 0;
}

.cl-files {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.cl-files summary {
  cursor: pointer;
}

.cl-files ul {
  margin: 8px 0 0;
  padding-left: 18px;
  columns: 2 280px;
}

.cl-foot {
  margin-top: 8px;
}

/* ---------- 22. Agents (site/agents.html, docs/knowledge/agents.md) ---------- */

.ag-empty {
  padding: 36px 24px !important;
  text-align: center !important;
  color: var(--text-muted);
}

.ag-empty strong {
  color: var(--ink);
}

.ag-name {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
}

.ag-star {
  font-size: 12px;
  color: var(--text-muted);
}

.ag-what {
  min-width: 260px;
}

.ag-what p {
  margin: 0;
  color: var(--ink);
}

.ag-details summary {
  margin-top: 6px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
}

.ag-details ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 13px;
}

.ag-cmd {
  display: block;
  max-width: 220px;
  margin-bottom: 4px;
  font-size: 12.5px;
  white-space: normal;
}

.ag-table td:nth-child(3) {
  min-width: 150px;
}

.ag-table .tag {
  white-space: nowrap;
}

.ag-note {
  max-width: 760px;
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.ag-note p {
  margin: 0;
}
