/* AXIS web. Orion signal blue (RAL 5015) on frame-white, same tokens as docs/brief.html.
   Archivo for headings, Source Sans 3 for text, JetBrains Mono for labels and ids. */
:root {
  --bg: #f6f8fa; --surface: #ffffff; --surface-2: #eef2f6; --fg: #14202b; --muted: #566573; --line: #d6dee6;
  --accent: #0f6fae; --accent-fg: #ffffff; --accent-soft: #e3f0f9;
  --warn: #a15c00; --warn-soft: #fdf1e0; --ok: #1d7a4c; --ok-soft: #e3f4ea; --bad: #b42318; --bad-soft: #fde8e6;
  --shadow: 0 1px 2px rgba(20, 32, 43, .06), 0 4px 14px rgba(20, 32, 43, .06);
  --shadow-lift: 0 10px 30px rgba(20, 32, 43, .22);
  --display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 6px; --gutter: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e161d; --surface: #15212b; --surface-2: #1b2a36; --fg: #e4ebf1; --muted: #9aabb9; --line: #2a3a47;
    --accent: #5fb0e8; --accent-fg: #0e161d; --accent-soft: #132c3e;
    --warn: #f0b062; --warn-soft: #33240f; --ok: #6fd19c; --ok-soft: #12301f; --bad: #ff8a80; --bad-soft: #3a1714;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e161d; --surface: #15212b; --surface-2: #1b2a36; --fg: #e4ebf1; --muted: #9aabb9; --line: #2a3a47;
  --accent: #5fb0e8; --accent-fg: #0e161d; --accent-soft: #132c3e;
  --warn: #f0b062; --warn-soft: #33240f; --ok: #6fd19c; --ok-soft: #12301f; --bad: #ff8a80; --bad-soft: #3a1714;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--body); min-height: 100dvh; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
h1 { font-size: clamp(26px, 5vw, 34px); font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
h2 { font-size: 19px; font-weight: 700; line-height: 1.25; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: .88em; }
.boot { padding: 40px var(--gutter); color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { font: 600 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Controls ── */
button, .btn {
  font: 600 15px/1 var(--body); border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  border-radius: var(--r); padding: 9px 14px; min-height: 38px; cursor: pointer; display: inline-flex; align-items: center;
  gap: 6px; text-decoration: none; white-space: nowrap; touch-action: manipulation;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--fg); border-color: var(--line); }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
button.sm { min-height: 30px; padding: 5px 10px; font-size: 13.5px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  font: 16px/1.4 var(--body); color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 10px; min-height: 38px; width: 100%; min-width: 0;
}
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); margin: 0; flex: none; }
input[type="color"] { padding: 2px; width: 44px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); font-weight: 600; min-width: 0; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ── Shell ── */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 8px var(--gutter); padding-top: max(8px, env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font: 800 17px/1 var(--display); color: var(--fg); text-decoration: none; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; }
.nav { display: flex; gap: 2px; }
.nav a { padding: 8px 12px; border-radius: var(--r); color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: var(--fg); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.topbar .spacer { flex: 1; }
.orgpick { max-width: 200px; min-height: 34px; padding: 5px 8px; font-weight: 600; font-size: 14px; }
.who { font-size: 14px; color: var(--muted); white-space: nowrap; }
.iconbtn { min-width: 38px; justify-content: center; padding: 6px; }
main { padding: 20px var(--gutter) 96px; max-width: 1180px; margin: 0 auto; }
main.wide { max-width: none; }
.pagehead { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pagehead .grow { display: flex; flex-direction: column; gap: 6px; }

/* Bottom tab bar on phones. */
.tabbar { display: none; }
@media (max-width: 760px) {
  .nav, .who { display: none; }
  .orgpick { max-width: 150px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; color: var(--muted); text-decoration: none; font: 600 12px/1 var(--body); }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
}

/* ── Panels and lists ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel > header { display: flex; align-items: center; gap: 8px; }
.panel > header h2 { flex: 1; }
.panel > header .count { font: 600 12px/1 var(--mono); color: var(--muted); }
.today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.today-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 860px) { .today-grid { grid-template-columns: 1fr; } }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list > li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); min-width: 0; }
.list > li:first-child { border-top: 0; }
.list .title { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.list .title:hover { color: var(--accent); }
.list li.done .title { color: var(--muted); text-decoration: line-through; }
.empty { color: var(--muted); font-size: 15px; padding: 6px 0; }
.tick {
  width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
  flex: none; justify-content: center; color: transparent; font-size: 14px;
}
.tick:hover { border-color: var(--ok); color: var(--ok); }
.tick.on { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.quickadd { display: flex; gap: 8px; }
.quickadd input { flex: 1; }

/* Capture box */
.capture { display: flex; flex-direction: column; gap: 10px; background: var(--accent-soft); border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.capture form { display: flex; gap: 8px; }
.capture input[name="title"] { font-size: 17px; min-height: 44px; }
.capture button.primary { min-height: 44px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: 600 13px/1 var(--body); padding: 7px 11px; min-height: 0; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font: 600 11px/1 var(--mono); padding: 4px 6px; border-radius: 3px; white-space: nowrap; letter-spacing: .02em; }
.vis-private { background: var(--surface-2); color: var(--muted); }
.vis-team { background: var(--warn-soft); color: var(--warn); }
.vis-org { background: var(--ok-soft); color: var(--ok); }
.badge.kind { background: var(--accent-soft); color: var(--accent); }
.badge.overdue { background: var(--bad-soft); color: var(--bad); }
.badge.due { background: var(--warn-soft); color: var(--warn); }
.badge.plain { background: var(--surface-2); color: var(--muted); }
.tag { font: 600 11.5px/1 var(--body); padding: 3px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font: 700 10.5px/24px var(--mono); text-align: center; flex: none; border: 1px solid var(--surface);
}
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -6px; }

/* Feed */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.feed li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.feed .when { font: 12px/1.6 var(--mono); color: var(--muted); white-space: nowrap; margin-left: auto; padding-left: 8px; }
.feed b { font-weight: 600; }

/* Banner (first visit) */
.banner { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.banner .grow { display: flex; flex-direction: column; gap: 4px; min-width: 220px; }

/* ── Boards list ── */
.boardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.boardcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: var(--fg); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.boardcard:hover { border-color: var(--accent); }
.boardcard h3 { overflow-wrap: anywhere; }
.section-title { font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }

/* ── Kanban ── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type="search"] { width: auto; flex: 0 1 220px; min-width: 140px; }
@media (max-width: 760px) { .filters input[type="search"] { flex: 1 1 140px; } }
.filters select { width: auto; }
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto;
  padding-bottom: 12px; scroll-snap-type: x proximity; align-items: start; overscroll-behavior-x: contain;
}
@media (max-width: 760px) { .kanban { grid-auto-columns: 84vw; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 12px; scroll-padding: 0 var(--gutter); } }
.col { background: var(--surface-2); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; scroll-snap-align: start; border-top: 3px solid var(--col, var(--line)); }
.col > header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.col > header h2 { font-size: 15px; flex: 1; }
.col .wip { font: 600 12px/1 var(--mono); color: var(--muted); }
.col.over .wip { color: var(--bad); }
.col.over { box-shadow: inset 0 0 0 2px var(--bad-soft); }
.cards { list-style: none; margin: 0; padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 8px; min-height: 48px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 10px 10px 12px; box-shadow: var(--shadow);
  display: flex; gap: 6px; cursor: pointer; user-select: none; -webkit-user-select: none; position: relative; min-width: 0;
}
.card:hover { border-color: var(--accent); }
.card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card .t { font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.card .meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.card .meta .avatars { margin-left: auto; }
.card.done .t { color: var(--muted); text-decoration: line-through; }
.grip {
  flex: none; width: 26px; margin: -6px -4px -6px -6px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: grab; touch-action: none; border-radius: 4px; opacity: .55;
}
.grip:hover { opacity: 1; background: var(--surface-2); }
.grip svg { width: 14px; height: 20px; }
.card.dragging { opacity: .35; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; box-shadow: var(--shadow-lift); transform: rotate(2deg); opacity: .95; }
.drop-mark { height: 4px; border-radius: 2px; background: var(--accent); margin: -2px 0; }
.col.drop-target { background: var(--accent-soft); }
.coladd { padding: 0 8px 10px; }
.coladd button { width: 100%; justify-content: flex-start; color: var(--muted); background: transparent; border-style: dashed; }
.coladd form { display: flex; flex-direction: column; gap: 6px; }

/* ── Drawer and modal ── */
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 20, .45); z-index: 50; display: flex; justify-content: flex-end; }
.drawer {
  width: min(520px, 100%); height: 100%; background: var(--surface); box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column; animation: slidein .16s ease-out;
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.drawer > header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line); }
.drawer > header .grow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.drawer .content { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.drawer > footer { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.drawer .titlefield { font: 700 20px/1.3 var(--display); }
.scrim.center { justify-content: center; align-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-lift); width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.modal > header { padding: 16px 18px 0; }
.modal .content { padding: 14px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal > footer { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.peoplepick { display: flex; flex-wrap: wrap; gap: 6px; }
.peoplepick label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: 14px; cursor: pointer; }
.peoplepick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.secret { font: 14px/1.4 var(--mono); background: var(--surface-2); border: 1px dashed var(--accent); padding: 12px; border-radius: var(--r); overflow-wrap: anywhere; user-select: all; }
.note { font-size: 14px; color: var(--muted); }
.warnnote { font-size: 14px; color: var(--warn); background: var(--warn-soft); padding: 8px 10px; border-radius: var(--r); }

/* ── Tables (setup, projects) ── */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font: 600 11.5px/1.2 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--bg); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.c, th.c { text-align: center; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--surface-2); }
@media (max-width: 640px) {
  table.cards-sm thead { display: none; }
  table.cards-sm tr { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.cards-sm td { border: 0; padding: 0; }
  table.cards-sm td.first { flex-basis: 100%; font-weight: 600; }
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }

/* Board builder */
.colrows { display: flex; flex-direction: column; gap: 8px; }
.colrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; gap: 8px; align-items: center; background: var(--surface-2); padding: 8px; border-radius: var(--r); }
.colrow .wipin { width: 70px; }
.colrow .ord { display: flex; flex-direction: column; gap: 2px; }
.colrow .ord button { min-height: 0; padding: 1px 6px; font-size: 11px; }
@media (max-width: 640px) {
  .colrow { grid-template-columns: auto minmax(0, 1fr) auto; }
  .colrow .rest { grid-column: 2 / -1; grid-row: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .colrow .rm { grid-column: 3; grid-row: 1; }
  .colrow .ord { grid-row: 1 / span 2; }
}
@media (min-width: 641px) { .colrow .rest { display: contents; } }
.fieldrow { display: grid; grid-template-columns: auto minmax(0, 1fr) 140px minmax(0, 1fr) auto; gap: 8px; align-items: center; background: var(--surface-2); padding: 8px; border-radius: var(--r); }
@media (max-width: 640px) {
  .fieldrow { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; }
  .fieldrow > input:nth-of-type(2) { grid-column: 2 / -1; }
}

/* Sign-in */
.signin { max-width: 440px; margin: 9vh auto 0; padding: 0 var(--gutter); display: flex; flex-direction: column; gap: 18px; }
.signin .panel { padding: 22px; gap: 14px; }
.signin .err { color: var(--bad); font-size: 14px; }

/* Toasts */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: var(--r); box-shadow: var(--shadow-lift); font-size: 15px; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--bad); color: #fff; }
.toast button { min-height: 0; padding: 4px 8px; font-size: 13px; background: transparent; color: inherit; border-color: currentColor; }
@media (min-width: 761px) { #toasts { bottom: 24px; } }

.loading { color: var(--muted); padding: 20px 0; }
.err-box { background: var(--bad-soft); color: var(--bad); padding: 12px 14px; border-radius: var(--r); }

/* ── Drag and drop (DR-012) ── */
/* Grip buttons: drag with a pointer, or focus and use the arrow keys. */
.handle {
  flex: none; width: 24px; min-height: 28px; padding: 0; justify-content: center; border: 0; background: transparent;
  color: var(--muted); cursor: grab; touch-action: none; opacity: .6; border-radius: 4px;
}
.handle:hover, .handle:focus-visible { opacity: 1; background: var(--surface-2); }
.handle svg { width: 12px; height: 18px; }
.list > li > .handle { margin-left: -6px; }
.sorting { position: relative; z-index: 5; box-shadow: var(--shadow-lift); outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r); background: var(--surface); }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

/* Today panels: the grip sits on the top edge of each panel. */
.widget { position: relative; min-width: 0; }
.widget > .panel { height: 100%; }
.widget > .whandle {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%) rotate(90deg); z-index: 2;
  width: 20px; min-height: 32px; opacity: .4;
}
.widget:hover > .whandle, .widget > .whandle:focus-visible { opacity: .9; }
.colrow .ord .handle { min-height: 34px; }

/* Board page: sidebar of drop targets next to the columns. */
.boardwrap { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 14px; align-items: start; }
.rail {
  position: sticky; top: 70px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100dvh - 90px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px;
}
.rail h3 { font: 600 11.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.raillist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.railitem {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--r); color: var(--fg); text-decoration: none;
  border: 1px dashed transparent; font-size: 14px; min-width: 0;
}
.railitem .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.railitem:hover { background: var(--surface-2); }
.railchips { display: flex; flex-wrap: wrap; gap: 6px; }
.railchip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 3px; border: 1px dashed var(--line); border-radius: 99px; font-size: 13.5px; }
.railhint { font-size: 13px; }
body.card-dragging .railitem, body.card-dragging .railchip { border-color: var(--line); }
.rail .drop-target, .rail .filedrop-over { background: var(--accent-soft); border-color: var(--accent) !important; border-style: solid; color: var(--accent); }
@media (max-width: 1100px) {
  .boardwrap { display: block; }
  /* On smaller screens the sidebar appears as a tray along the bottom while a card is dragged. */
  .rail { display: none; }
  body.card-dragging .rail {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: start; gap: 6px 12px;
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 90; max-height: 40dvh; overflow: auto; border-radius: var(--r) var(--r) 0 0;
    box-shadow: var(--shadow-lift); padding: 10px var(--gutter) max(10px, env(safe-area-inset-bottom, 0px));
  }
  body.card-dragging .rail > h3 { grid-row: 1; }
  body.card-dragging .rail > :not(h3) { grid-row: 2; }
  body.card-dragging .rail .railhint { display: none; }
  body.card-dragging .rail .railitem .badge { display: none; }
  body.card-dragging .rail .railitem { padding: 7px 6px; }
}

/* Card menu: always there on touch screens; on hover or focus with a mouse. */
.card .cardmenu { flex: none; align-self: flex-start; min-height: 26px; width: 28px; padding: 0; justify-content: center; margin: -4px -4px 0 0; }
@media (hover: hover) {
  .card .cardmenu { opacity: 0; }
  .card:hover .cardmenu, .card:focus-within .cardmenu, .card:focus .cardmenu { opacity: 1; }
}

/* Files dragged in from the computer. */
.filedrop-over { outline: 2px dashed var(--accent) !important; outline-offset: 2px; background-color: var(--accent-soft) !important; }
.card.filedrop-over { border-color: var(--accent); }
.files { display: flex; flex-direction: column; gap: 8px; border-radius: var(--r); }
.filelist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.filelist > li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); min-width: 0; }
.filelist > li:first-child { border-top: 0; }
.filelist .grow { display: flex; flex-direction: column; gap: 2px; }
.filelist .small { overflow-wrap: anywhere; }
.ficon { flex: none; width: 32px; height: 32px; border-radius: var(--r); background: var(--surface-2); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.ficon.mail { background: var(--accent-soft); color: var(--accent); }
.linklike { border: 0; background: none; padding: 0; min-height: 0; color: var(--fg); font: 600 15px/1.3 var(--body); text-align: left; white-space: normal; overflow-wrap: anywhere; }
.linklike:hover { color: var(--accent); text-decoration: underline; }
.dropzone { display: flex; align-items: center; gap: 10px; border: 1.5px dashed var(--line); border-radius: var(--r); padding: 10px 12px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.files.filedrop-over .dropzone { border-color: var(--accent); color: var(--accent); }

/* Upload tray with progress. */
#uploads { position: fixed; right: 16px; bottom: 84px; z-index: 210; display: flex; flex-direction: column; gap: 6px; width: min(340px, calc(100% - 32px)); }
@media (min-width: 761px) { #uploads { bottom: 24px; } }
.upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lift); padding: 8px 10px; font-size: 14px; }
.upload .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.upload .status { font: 12px/1.5 var(--mono); color: var(--muted); }
.upload .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.upload .fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.upload.ok .fill { background: var(--ok); width: 100%; }
.upload.ok .status { color: var(--ok); }
.upload.err { border-color: var(--bad); }
.upload.err .bar { display: none; }
.upload.err .status { grid-column: 1 / -1; color: var(--bad); font-family: var(--body); font-size: 13.5px; }

details.archived { margin-top: 26px; }
details.archived summary { cursor: pointer; font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 0; }
details.archived .list { margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 12px; }
/* ── My AI and connections (DR-014) ── */
a.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); text-decoration: none; }
a.btn.ghost:hover { color: var(--fg); border-color: var(--line); }
a.iconbtn[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.panel details { border-top: 1px solid var(--line); padding-top: 10px; }
.panel details summary { cursor: pointer; padding: 4px 0; }
.panel details ol { margin: 8px 0 4px; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.panel .secret.grow { min-width: 0; }
