/* Harbor32 — "Meadow Duo, black text".
   Teal marks navigation and whatever is selected, orange marks actions, and
   body text is near-black for easy reading. Every colour below is a token so
   the dark theme is just a second set of values. */

@font-face {
  font-family: 'Manrope';
  src: url('/fonts/manrope.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-sunken: #f3f5f8;
  --bg-hover: #eef1f5;
  --row-hover: #f7f9fb;
  --sidebar: #ffffff;
  --line: #e4e8ef;
  --line-soft: #eef1f5;
  --line-strong: #d3d9e1;
  --ink: #162136;
  --ink-soft: #5f6b7c;
  --ink-faint: #758094;
  --brand: #00878c;
  --brand-ink: #00696d;
  --brand-dark: #00696d;
  --brand-soft: #ddf1f0;
  --brand-soft-ink: #045d61;
  --brand-softer: #eef8f7;
  --accent: #f15f22;
  --accent-hover: #d9511a;
  --accent-ink: #ffffff;
  --danger: #c8323f;
  --danger-soft: #fdecec;
  --ok: #1b9e6b;
  --ok-soft: #e3f5ec;
  --warn-soft: #fdf3dc;
  --warn-ink: #7a5200;
  --chip-bg: #eef1f5;
  --status-empty: #eef1f5;
  --scrim: rgba(22, 33, 54, .32);
  --shadow-sm: 0 1px 2px rgba(22, 33, 54, .06);
  --shadow-pop: 0 10px 30px rgba(22, 33, 54, .14), 0 1px 3px rgba(22, 33, 54, .08);
  --shadow-panel: -12px 0 40px rgba(22, 33, 54, .16);
  --focus-ring: 0 0 0 3px rgba(0, 135, 140, .2);
  --toast-bg: #162136;
  --toast-ink: #ffffff;
  --logo-light: block;
  --logo-dark: none;

  --radius: 10px;
  --radius-sm: 8px;
  --row-h: 38px;
  --panel-w: 640px;
  --name-col-w: 280px;
  --bubble-col-w: 46px;
  --addcol-w: 44px;
  --font: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1d2128;
    --bg-sunken: #15181d;
    --bg-hover: #262b33;
    --row-hover: #22262e;
    --sidebar: #1a1e24;
    --line: #2c313a;
    --line-soft: #252a32;
    --line-strong: #3a404b;
    --ink: #f4f5f7;
    --ink-soft: #b5bbc5;
    --ink-faint: #8a92a0;
    --brand: #6cc8c1;
    --brand-ink: #8ee3db;
    --brand-dark: #8ee3db;
    --brand-soft: #0f3f3b;
    --brand-soft-ink: #9fe0db;
    --brand-softer: #12302e;
    --accent: #f15f22;
    --accent-hover: #ff7a45;
    --accent-ink: #ffffff;
    --danger: #f07c86;
    --danger-soft: #3a1d22;
    --ok: #4cc38a;
    --ok-soft: #173327;
    --warn-soft: #3a3017;
    --warn-ink: #f2d38a;
    --chip-bg: #2a2f38;
    --status-empty: #2a2f38;
    --scrim: rgba(0, 0, 0, .5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .3);
    --shadow-panel: -12px 0 40px rgba(0, 0, 0, .5);
    --focus-ring: 0 0 0 3px rgba(108, 200, 193, .25);
    --toast-bg: #f4f5f7;
    --toast-ink: #15181d;
    --logo-light: none;
    --logo-dark: block;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d2128;
  --bg-sunken: #15181d;
  --bg-hover: #262b33;
  --row-hover: #22262e;
  --sidebar: #1a1e24;
  --line: #2c313a;
  --line-soft: #252a32;
  --line-strong: #3a404b;
  --ink: #f4f5f7;
  --ink-soft: #b5bbc5;
  --ink-faint: #8a92a0;
  --brand: #6cc8c1;
  --brand-ink: #8ee3db;
  --brand-dark: #8ee3db;
  --brand-soft: #0f3f3b;
  --brand-soft-ink: #9fe0db;
  --brand-softer: #12302e;
  --accent: #f15f22;
  --accent-hover: #ff7a45;
  --accent-ink: #ffffff;
  --danger: #f07c86;
  --danger-soft: #3a1d22;
  --ok: #4cc38a;
  --ok-soft: #173327;
  --warn-soft: #3a3017;
  --warn-ink: #f2d38a;
  --chip-bg: #2a2f38;
  --status-empty: #2a2f38;
  --scrim: rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-panel: -12px 0 40px rgba(0, 0, 0, .5);
  --focus-ring: 0 0 0 3px rgba(108, 200, 193, .25);
  --toast-bg: #f4f5f7;
  --toast-ink: #15181d;
  --logo-light: none;
  --logo-dark: block;
}

* { box-sizing: border-box; }

/* Class rules below set display on elements we also toggle with [hidden];
   without this the attribute loses on specificity and they stay visible. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  font-weight: 500;
}

body { overflow: hidden; }

button, input, select, textarea { font-family: inherit; }

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

svg { flex-shrink: 0; }

/* ----------------------------------------------------------------- logo -- */

.h32-logo-light { display: var(--logo-light); }
.h32-logo-dark { display: var(--logo-dark); }

.h32-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}

.h32-logo img { height: 52px; width: auto; }

/* The canvas brand.js lays over the logo while the waves roll. */
.h32-wave { position: absolute; pointer-events: none; }

/* ------------------------------------------------------------- avatars -- */

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.env-pill {
  font-size: 11px;
  letter-spacing: .04em;
  background: var(--warn-soft);
  color: var(--warn-ink);
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
}

/* ---------------------------------------------------------- board head -- */

.board-head { flex: 0 0 auto; padding: 18px 24px 0; border-bottom: 1px solid var(--line); }

.bh-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.bh-spacer { flex: 1; }

.board-head h1 {
  margin: 0; font-size: 26px; font-weight: 800;
  letter-spacing: -.02em;
  cursor: text; border-radius: 8px; padding: 0 6px; margin-left: -6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}

.board-head h1:hover { background: var(--bg-hover); }

/* Rename the board straight from its header, like monday. */
.title-pencil {
  flex: 0 0 auto;
  border: 0; background: none;
  width: 28px; height: 28px;
  border-radius: 7px;
  padding: 0;
  font: inherit; font-size: 14px;
  color: var(--ink-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity .1s;
}

.board-head:hover .title-pencil, .title-pencil:focus-visible { opacity: 1; }
.title-pencil:hover { background: var(--bg-hover); color: var(--ink); }

.title-input {
  font: inherit; font-size: 26px; font-weight: 800;
  letter-spacing: -.02em;
  padding: 0 6px;
  min-width: 260px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: var(--ink);
  background: var(--bg);
}

.title-input:focus { outline: none; box-shadow: var(--focus-ring); }

/* View tabs on the left, board tools on the right. */
.bh-views {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 4px 6px;
  padding: 14px 0 12px;
}

.view-tabs {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-hover);
}

.view-tab {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
}

.view-tab:hover { color: var(--ink); }
.view-tab.is-active {
  background: var(--bg); color: var(--ink); cursor: default;
  box-shadow: 0 1px 2px rgba(22, 33, 54, .12), 0 0 0 1px var(--line);
}

.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
}

.tool-btn:hover { background: var(--bg-hover); color: var(--ink); }

.tool-check {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 8px;
  color: var(--ink-soft); font-size: 13px; font-weight: 700;
  cursor: pointer;
}

.tool-check input { accent-color: var(--brand); margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0 14px;
  height: 36px;
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: var(--radius-sm); }

.search-wrap {
  position: relative;
  display: inline-flex; align-items: center;
  color: var(--ink-faint);
}

.search-wrap svg { position: absolute; left: 10px; pointer-events: none; }

.search-wrap input {
  width: 210px;
  height: 32px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit; font-size: 13px;
  transition: width .15s, border-color .15s;
}

.search-wrap input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); width: 260px; }

.toolbar-check { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); cursor: pointer; }

.row-count { margin-left: 2px; color: var(--ink-faint); font-size: 13px; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }

/* --------------------------------------------------------------- board -- */

.board-root { flex: 1 1 auto; overflow: auto; padding: 14px 24px 120px; }

/* Rows are windowed (syncRows in app.js), which keeps the scroll position
   steady itself; the browser's own anchoring would correct it twice. */
.board-root { overflow-anchor: none; }

.loading { color: var(--ink-faint); padding: 40px 0; }

.group { margin-bottom: 28px; }

.group-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  position: sticky; left: 0;
  width: max-content;
}

.group-caret {
  border: 0; background: none; cursor: pointer;
  color: inherit; font-size: 12px; padding: 2px 4px;
  transition: transform .12s;
}

.group.is-collapsed .group-caret { transform: rotate(-90deg); }

.group-title { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.group-meta { color: var(--ink-faint); font-size: 12.5px; font-weight: 600; }

.group.is-collapsed .grid { display: none; }

/* The grid is one CSS grid so header and body cells always line up. */
.grid {
  display: grid;
  width: max-content;
  min-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: var(--bg);
}

/* Stand-ins, at their exact height, for the rows scrolled out of view. */
.row-spacer { grid-column: 1 / -1; }

.cell {
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 0 10px;
  height: var(--row-h);
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: var(--bg);
}

body.compact { --row-h: 30px; font-size: 13px; }

.cell-head {
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 1px solid var(--line);
}

/* First column stays put while the rest scrolls sideways. */
.cell-name {
  position: sticky;
  left: 0;
  z-index: 2;
  border-left: 4px solid var(--group-color, var(--brand));
  font-weight: 700;
  cursor: pointer;
  gap: 8px;
}

.cell-head.cell-name { z-index: 4; }

.row:hover .cell { background: var(--row-hover); }

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

.name-text { overflow: hidden; text-overflow: ellipsis; }

/* updates bubble column ------------------------------------------------- */

/* Pinned immediately right of the name column so it stays put on scroll. */
.cell-bubble {
  position: sticky;
  left: var(--name-col-w);
  z-index: 2;
  padding: 0;
  justify-content: center;
}

.cell-head.cell-bubble { z-index: 4; }

.bubble-btn {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  width: 26px; height: 22px;
  display: grid; place-items: center;
  color: var(--ink-faint);
}

.bubble-btn:hover { color: var(--brand-ink); }
.bubble-btn.has-updates { color: var(--ink-soft); }

.bubble-icon { width: 20px; height: 20px; overflow: visible; }

.bubble-shape {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.bubble-plus {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* Count badge tucked into the bubble's lower-right corner. */
.bubble-count {
  position: absolute;
  right: -3px;
  bottom: -1px;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--brand);
  color: var(--bg);
  font-size: 9px;
  font-weight: 800;
  line-height: 13px;
  text-align: center;
  border: 1.5px solid var(--bg);
  box-sizing: content-box;
}

.row:hover .cell-bubble .bubble-count { border-color: var(--row-hover); }

/* status + dropdown chips ---------------------------------------------- */

/* Labels sit as rounded pills inside the cell rather than flooding it. */
.cell-status {
  padding: 0 6px;
  color: #fff;
  justify-content: center;
  font-size: 13px;
}

.status-fill {
  width: 100%; height: calc(100% - 10px);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 8px;
  font-weight: 700;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

.chips { display: flex; gap: 4px; overflow: hidden; }

.chip {
  background: var(--chip-bg);
  color: var(--ink);
  border-radius: 8px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-more { color: var(--ink-faint); font-size: 12px; align-self: center; }

.cell-date { color: var(--ink-soft); font-size: 13px; }
.cell-date.is-overdue { color: var(--danger); font-weight: 700; }

.people { display: flex; gap: -4px; }

.person {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  color: #fff;
  margin-right: -6px;
  border: 2px solid var(--bg);
}

.file-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-soft-ink);
  background: var(--brand-soft);
  border-radius: 8px;
  padding: 1px 8px;
}

.muted { color: var(--ink-faint); }

.cell-add { cursor: text; font-weight: 400; }
.cell-add:hover { color: inherit; }

.add-item-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  background: none;
  font: inherit;
  color: var(--ink);
}

.add-item-input::placeholder { color: var(--ink-faint); }
.add-item-input:hover { border-color: var(--line-strong); }
.add-item-input:hover::placeholder { color: var(--brand-ink); }
.add-item-input:focus {
  outline: none; border-color: var(--brand); background: var(--bg);
}
.add-item-input:focus::placeholder { color: var(--ink-faint); }
.add-item-input:disabled { opacity: .6; }

/* --------------------------------------------------------------- panel -- */

.panel-scrim {
  position: fixed; inset: 0;
  background: var(--scrim);
  z-index: 40;
}

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(var(--panel-w), 94vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-panel);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.panel-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 10px; }

.icon-btn {
  border: 0; background: none; cursor: pointer;
  font-size: 16px; color: var(--ink-soft);
  padding: 4px 8px; border-radius: 8px;
}

.icon-btn:hover { background: var(--bg-hover); color: var(--ink); }

.panel-title {
  flex: 1;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.01em;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 8px;
  font-family: inherit;
  color: inherit;
  background: transparent;
}

.panel-title:hover { border-color: var(--line-strong); }
.panel-title:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }

.panel-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); }

.tab {
  border: 0; background: none; cursor: pointer;
  padding: 10px 12px;
  font: inherit; font-weight: 600; color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 700; }
.tab-count { color: var(--ink-faint); font-size: 12px; }

.tab-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; }

/* updates --------------------------------------------------------------- */

.composer {
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 18px; background: var(--bg);
}

.composer:focus-within { border-color: var(--brand); box-shadow: var(--focus-ring); }

.composer textarea {
  width: 100%; border: 0; resize: vertical;
  font: inherit; color: inherit; padding: 0;
  min-height: 44px; background: transparent;
}

.composer textarea:focus { outline: none; }

.composer-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.update {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.update-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.update-author { font-weight: 700; }
.update-time { color: var(--ink-faint); font-size: 12px; }
.update-body { white-space: pre-wrap; line-height: 1.55; font-weight: 500; }

.update-del {
  margin-left: auto;
  border: 0; background: none; cursor: pointer;
  color: var(--ink-faint); font-size: 14px;
  padding: 2px 6px; border-radius: 6px;
}

.update-del:hover { background: var(--danger-soft); color: var(--danger); }

.empty { color: var(--ink-faint); text-align: center; padding: 30px 0; }

/* files ----------------------------------------------------------------- */

.upload-target {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
  color: var(--ink-soft); font-size: 13px;
}

.upload-target select {
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}

.files-heading {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 6px;
}

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  color: var(--ink-soft);
  transition: border-color .12s, background .12s;
}

.dropzone.is-over { border-color: var(--brand); background: var(--brand-softer); }
.dropzone p { margin: 0 0 4px; }
.dropzone-hint { font-size: 12px; color: var(--ink-faint); }

.link-btn {
  border: 0; background: none; padding: 0;
  color: var(--brand-ink); cursor: pointer;
  font: inherit; font-weight: 700; text-decoration: underline;
}

.upload-status { margin-top: 10px; font-size: 13px; color: var(--ink-soft); }
.upload-status.is-error { color: var(--danger); }

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

.file-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

.file-thumb {
  height: 110px;
  background: var(--bg-sunken);
  display: grid; place-items: center;
  overflow: hidden;
  cursor: pointer;
}

.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-icon { font-size: 30px; color: var(--ink-faint); }

.file-meta { padding: 8px 10px; }
.file-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

.file-del {
  position: absolute; top: 6px; right: 6px;
  border: 0; border-radius: 6px;
  background: var(--bg);
  cursor: pointer; padding: 3px 7px;
  font-size: 12px; color: var(--ink-soft);
  opacity: 0; transition: opacity .12s;
}

.file-card:hover .file-del { opacity: 1; }
.file-del:hover { color: var(--danger); }

/* details --------------------------------------------------------------- */

.details-form { display: flex; flex-direction: column; gap: 2px; }

.field {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 12px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}

.field > label { color: var(--ink-soft); font-size: 13px; font-weight: 600; padding-top: 7px; }

.field input[type="text"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}

.field textarea { resize: vertical; min-height: 62px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--focus-ring);
}

.field .readonly { color: var(--ink-faint); padding-top: 6px; font-size: 13px; }

.multi-select { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 4px; max-height: 150px; overflow-y: auto; }
.multi-option { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.multi-option:hover { background: var(--bg-hover); }
.multi-option input { margin: 0; accent-color: var(--brand); }

.field-section {
  margin-top: 18px;
  padding: 6px 0 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 2px solid var(--line);
}

/* lightbox / toast ------------------------------------------------------ */

.lightbox {
  position: fixed; inset: 0;
  background: rgba(10, 14, 22, .88);
  z-index: 80;
  display: grid; place-items: center;
  padding: 40px;
}

.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); }

.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  border: 0; background: none; color: #fff;
  font-size: 26px; cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-weight: 600;
  padding: 11px 18px;
  border-radius: var(--radius);
  z-index: 90;
  box-shadow: var(--shadow-pop);
}

.toast.is-error { background: var(--danger); color: #fff; }

/* =======================================================================
   Split button, selection bar, column chrome
   ==================================================================== */

.split-btn { display: flex; }
.bh-views .split-btn { margin-right: 6px; }
.split-btn .btn { border-radius: var(--radius) 0 0 var(--radius); }
.split-caret {
  border-radius: 0 var(--radius) var(--radius) 0 !important;
  padding: 0 9px;
  border-left: 1px solid rgba(255, 255, 255, .35);
}

.selection-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
}

.sel-count { font-weight: 800; margin-right: 4px; color: var(--brand-ink); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger); filter: brightness(.92); }

.row-check { margin: 0 2px 0 0; flex: 0 0 auto; cursor: pointer; accent-color: var(--brand); }

.row-kebab, .group-kebab, .colhead-kebab {
  margin-left: auto;
  border: 0; background: none; cursor: pointer;
  color: var(--ink-faint);
  padding: 2px 6px; border-radius: 6px;
  font-size: 15px; line-height: 1;
  opacity: 0; transition: opacity .1s;
  flex: 0 0 auto;
}

.row:hover .row-kebab,
.group-head:hover .group-kebab,
.cell-colhead:hover .colhead-kebab { opacity: 1; }

.row-kebab:hover, .group-kebab:hover, .colhead-kebab:hover {
  background: var(--bg-hover); color: var(--ink);
}

.group-kebab { opacity: 0; margin-left: 4px; }

/* column header ---------------------------------------------------------- */

.cell-colhead { position: relative; gap: 4px; }
.cell-colhead.is-clickable { cursor: pointer; }
.cell-colhead.is-clickable:hover { background: var(--bg-hover); }
.colhead-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Active filter / sort marks, so a narrowed column is obvious at a glance. */
.colhead-marks { display: inline-flex; gap: 3px; flex: 0 0 auto; }
.colhead-mark { color: var(--brand-ink); font-size: 11px; line-height: 1; }
.namehead-title .colhead-mark { margin-left: 4px; }

.namehead-title {
  border: 0; background: none; padding: 0;
  font: inherit; color: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center;
}

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

/* Collapsed column: a sliver you click to bring back. */
.cell-colhead.is-collapsed {
  padding: 0; justify-content: center;
  cursor: pointer;
  background: var(--bg-hover);
}
.cell-colhead.is-collapsed:hover { background: var(--brand-soft); }
.colhead-collapsed-mark {
  color: var(--ink-soft); font-size: 11px; letter-spacing: -1.5px;
}
.cell-collapsed { background: var(--bg-sunken); }

.col-grip {
  position: absolute;
  right: -3px; top: 0; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 5;
}

.col-grip:hover { background: var(--brand); opacity: .4; }

body.is-resizing { cursor: col-resize; user-select: none; }

.cell-addcol { padding: 0; justify-content: center; }

.addcol-btn {
  border: 0; background: none; cursor: pointer;
  color: var(--ink-faint); font-size: 16px;
  width: 100%; height: 100%;
}

.addcol-btn:hover { background: var(--bg-hover); color: var(--brand-ink); }

.cell-status.is-editable { cursor: pointer; }
.status-fill.is-orphan { color: var(--ink-faint); font-style: italic; }

/* =======================================================================
   Subitems
   ==================================================================== */

.sub-caret {
  border: 0; background: none; cursor: pointer;
  color: var(--ink-faint);
  font-size: 16px; line-height: 1;
  padding: 1px 3px;
  border-radius: 4px;
  flex: 0 0 auto;
  transition: transform .12s;
}

.sub-caret:hover { background: var(--bg-hover); color: var(--ink); }
.sub-caret.has-subs { color: var(--ink-soft); font-weight: 700; }
.sub-caret.is-open { transform: rotate(90deg); }

.subitem-tray {
  height: auto;
  padding: 0 0 0 34px;
  background: var(--bg-sunken);
  border-left: 4px solid var(--group-color, var(--brand));
  border-bottom: 1px solid var(--line);
  display: block;
  white-space: normal;
  overflow: visible;
}

.subtable { padding: 10px 12px 12px 0; }

.subgrid {
  display: grid;
  width: max-content;
  min-width: 480px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.subcell {
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 0 8px;
  height: 32px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

.subcell-head {
  background: var(--bg-sunken);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
}

.subcell-name { font-weight: 600; }

.subitem-name, .subitem-input {
  width: 100%;
  border: 1px solid transparent;
  background: none;
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
  color: inherit;
}

.subitem-name:hover, .subitem-input:hover { border-color: var(--line-strong); }
.subitem-name:focus, .subitem-input:focus {
  outline: none; border-color: var(--brand); background: var(--bg);
}

.subcell-status { padding: 0 4px; cursor: pointer; color: #fff; font-size: 12px; }
.subcell-status .status-fill { height: calc(100% - 8px); border-radius: 6px; }
.subcell-actions { justify-content: center; padding: 0; }
.subcell.is-editable { cursor: pointer; }

.sub-empty {
  color: var(--ink-faint);
  font-size: 13px;
  justify-content: center;
  border-right: 0;
}

.sub-add {
  margin-top: 8px;
  border: 0; background: none;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit; font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.sub-add:hover { background: var(--bg-hover); color: var(--brand-ink); }

/* =======================================================================
   Popover menus
   ==================================================================== */

.menu {
  position: fixed;
  z-index: 200;
  min-width: 210px;
  max-width: 320px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 6px;
  max-height: 70vh;
  overflow-y: auto;
}

.menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  border: 0; background: none;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit; font-weight: 600; color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.menu-item:hover:not(:disabled) { background: var(--bg-hover); }
.menu-item:disabled { color: var(--ink-faint); cursor: default; }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover:not(:disabled) { background: var(--danger-soft); }

.menu-icon {
  width: 18px; flex: 0 0 18px;
  text-align: center; font-size: 13px;
}

.menu-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--ink-faint); font-size: 12px; flex: 0 0 auto; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* =======================================================================
   Popovers (column header filter/sort)
   ==================================================================== */

.popover {
  position: fixed;
  z-index: 200;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 10px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.pop-head { display: flex; align-items: center; gap: 7px; padding: 2px 2px 0; }
.pop-icon { color: var(--ink-faint); width: 16px; text-align: center; }
.pop-title {
  font-weight: 800; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

.pop-sort { display: flex; gap: 6px; }

.pop-sort-btn {
  flex: 1;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 6px;
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.pop-sort-btn:hover { background: var(--bg-hover); }
.pop-sort-btn.is-on {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand-soft-ink);
  font-weight: 700;
}

.pop-search {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit; font-size: 12.5px;
  background: var(--bg); color: var(--ink);
}

.pop-search:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }

.pop-list {
  overflow-y: auto;
  max-height: 300px;
  border-top: 1px solid var(--line);
  padding-top: 5px;
}

.pop-option {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 7px;
  border-radius: 7px;
  cursor: pointer;
}

.pop-option:hover { background: var(--bg-hover); }
.pop-option.is-on { background: var(--brand-softer); }
.pop-option input { flex: 0 0 auto; margin: 0; accent-color: var(--brand); }
.pop-option-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pop-count { color: var(--ink-faint); font-size: 11.5px; flex: 0 0 auto; }
.pop-empty { color: var(--ink-faint); margin: 4px 2px; font-size: 12.5px; }

.pop-foot {
  display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.pop-link {
  border: 0; background: none; padding: 0;
  font: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--brand-ink);
  cursor: pointer;
}

.pop-link:hover { text-decoration: underline; }
.pop-foot .btn { margin-left: auto; }

/* =======================================================================
   Modals
   ==================================================================== */

.modal-scrim {
  position: fixed; inset: 0;
  background: var(--scrim);
  z-index: 150;
  display: grid; place-items: center;
  padding: 24px;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  width: min(460px, 100%);
  max-height: 86vh;
  display: flex; flex-direction: column;
}

.modal.is-wide { width: min(680px, 100%); }

.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 10px;
}

.modal-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; flex: 1; }

.modal-body { padding: 4px 20px 8px; overflow-y: auto; }
.modal-text { margin: 0 0 12px; line-height: 1.55; color: var(--ink-soft); }
.modal-note {
  margin: 14px 0 0;
  font-size: 12px; line-height: 1.5;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.modal-alt { margin-top: 14px; }

.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 18px;
}

.field-stack { display: flex; flex-direction: column; gap: 8px; }
.field-stack > label { color: var(--ink-soft); font-size: 13px; font-weight: 600; }

.text-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}

.text-input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }

.radio-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0;
  cursor: pointer;
}

.radio-row input { accent-color: var(--brand); }
.radio-row select { flex: 1; }

/* swatches --------------------------------------------------------------- */

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  padding: 4px 0;
}

.swatch {
  width: 100%; aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.swatch.is-selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg) inset; }

/* drag to reorder --------------------------------------------------------- */

.cell-colhead[draggable="true"] { cursor: grab; }
.cell-colhead.is-dragging { opacity: .4; }

.cell-colhead.drop-before { box-shadow: inset 3px 0 0 var(--brand); }
.cell-colhead.drop-after { box-shadow: inset -3px 0 0 var(--brand); }

/* Groups and items drag by pointer (see app.js), so their grab areas must not
   start a text selection on the way. */
.group-head { cursor: grab; padding: 2px 4px; border-radius: 6px; user-select: none; }
.cell-name[data-item-id] { user-select: none; }

body.is-board-dragging,
body.is-board-dragging * { cursor: grabbing !important; user-select: none; }

/* While a group is carried, every group folds to its header. */
.board-root.is-group-drag .group .grid { display: none; }
.board-root.is-group-drag .group { margin-bottom: 10px; }
.board-root.is-group-drag .group-caret { transform: rotate(-90deg); }

.group.is-drag-source > .group-head,
.cell.is-drag-source { opacity: .35; }

.drag-ghost {
  position: fixed; top: 0; left: 0; z-index: 1000;
  pointer-events: none;
  max-width: 280px;
  padding: 7px 12px;
  border-radius: 8px;
  border-left: 4px solid var(--ghost-color, var(--brand));
  background: var(--bg);
  box-shadow: var(--shadow-pop);
  font-size: 13px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.drop-line {
  position: fixed; top: 0; left: 0; z-index: 999;
  height: 3px;
  border-radius: 2px;
  background: var(--brand);
  pointer-events: none;
}
.drop-line::before {
  content: '';
  position: absolute; left: -4px; top: -3px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--brand);
}

/* convert preview --------------------------------------------------------- */

.convert-samples {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 180px; overflow-y: auto;
  margin-top: 8px;
}

.convert-sample {
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.convert-before, .convert-after {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.convert-before { color: var(--ink-soft); }
.convert-after { font-weight: 700; }

/* =======================================================================
   Forms manager + builder
   ==================================================================== */

.forms-list { display: flex; flex-direction: column; gap: 8px; }

.form-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.form-info { flex: 1; min-width: 0; }
.form-name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.form-meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }
.form-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.chip-off {
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--chip-bg); color: var(--ink-soft);
  border-radius: 999px; padding: 2px 8px;
}

.builder {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 22px;
}

.builder-hint { font-size: 12px; color: var(--ink-faint); margin: 6px 0 10px; }

.q-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }

.q-row {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.q-type { width: 20px; text-align: center; color: var(--ink-faint); font-size: 13px; flex: 0 0 auto; }

.q-title {
  flex: 1; min-width: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 7px;
  font: inherit;
  background: none;
  color: var(--ink);
}

.q-title:hover { border-color: var(--line-strong); }
.q-title:focus { outline: none; border-color: var(--brand); background: var(--bg); }

.q-req {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ink-soft);
  cursor: pointer; flex: 0 0 auto;
}

.q-req input { accent-color: var(--brand); }

/* Show-if rules under a question row. */
.q-rule-btn { font-size: 11px; font-weight: 800; padding: 4px 7px; }
.q-rule-btn.is-on { background: var(--brand-soft); color: var(--brand-soft-ink); }

.q-logic {
  margin: -2px 0 4px 27px;
  padding: 8px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12px; color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 8px;
}

.q-logic-summary {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--brand-ink); text-align: left;
}
.q-logic-summary:hover { text-decoration: underline; }

.q-logic-join { width: auto; align-self: flex-start; }
.q-logic-cond { display: flex; flex-direction: column; gap: 6px; }
.q-logic-line { display: flex; align-items: center; gap: 7px; }
.q-logic-line select { flex: 1; min-width: 0; }
.q-logic-word { flex: 0 0 auto; font-weight: 700; }

.q-logic-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.q-logic-chip {
  display: flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 9px 2px 6px; cursor: pointer; color: var(--ink);
}
.q-logic-chip:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); }
.q-logic-chip input { margin: 0; accent-color: var(--brand); }
.q-logic-chip .dot { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.q-logic-actions { display: flex; gap: 6px; }

.builder-settings .field-stack { margin-bottom: 12px; }

.form-link {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.form-link code {
  flex: 1;
  font-size: 11.5px;
  background: var(--bg-sunken);
  border-radius: 6px;
  padding: 7px 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* =======================================================================
   Import wizard
   ==================================================================== */

.wiz-rail {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0 16px;
  flex-wrap: wrap;
}

.wiz-step {
  display: flex; align-items: center; gap: 7px;
  color: var(--ink-faint);
  font-size: 13px;
  padding-right: 10px;
}

.wiz-step:not(:last-child)::after {
  content: '';
  width: 22px; height: 1px;
  background: var(--line-strong);
  margin-left: 4px;
}

.wiz-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
  flex: 0 0 auto;
}

.wiz-step.is-active { color: var(--ink); font-weight: 700; }
.wiz-step.is-active .wiz-num { background: var(--brand); border-color: var(--brand); color: var(--bg); }
.wiz-step.is-done .wiz-num { background: var(--ok); border-color: var(--ok); color: #fff; }

.wiz-body { display: flex; flex-direction: column; }
.wiz-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; }

.wiz-status { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); min-height: 18px; }
.wiz-status.is-error { color: var(--danger); }

.map-table {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 320px; overflow-y: auto;
  padding-right: 4px;
}

.map-row {
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  align-items: center;
  gap: 8px;
}

.map-source { overflow: hidden; }
.map-header { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-sample {
  font-size: 11px; color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.map-arrow { text-align: center; color: var(--ink-faint); }

.import-summary { display: flex; gap: 10px; margin-bottom: 12px; }

.import-stat {
  flex: 1;
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  font-weight: 700;
}

.import-warnings {
  max-height: 190px; overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.import-warn {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
}

.import-warn:last-child { border-bottom: 0; }

/* =======================================================================
   Label editor
   ==================================================================== */

.label-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }

.label-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
}

.label-row:hover { background: var(--bg-hover); }
.label-row.is-archived { opacity: .55; }

.label-dot {
  width: 22px; height: 22px;
  border: 0; border-radius: 6px;
  cursor: pointer; flex: 0 0 auto;
}

.label-name {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  background: none;
  color: var(--ink);
}

.label-name:hover { border-color: var(--line-strong); background: var(--bg); }
.label-name:focus { outline: none; border-color: var(--brand); background: var(--bg); }

.label-usage {
  font-size: 11px;
  color: var(--ink-faint);
  flex: 0 0 auto;
  min-width: 62px;
  text-align: right;
}

.label-row .icon-btn { font-size: 13px; padding: 3px 6px; }
.label-row .icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }

.label-add { display: flex; gap: 8px; }
.label-add .text-input { flex: 1; }

.empty-inline { color: var(--ink-faint); font-size: 12px; margin: 4px 6px; }
.multi-option.is-archived { opacity: .6; }


/* =======================================================================
   Inline cell editors + new column types
   ==================================================================== */

.cell.is-editable { cursor: pointer; }
.cell.is-editable:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }

.cell-inline {
  width: 100%; height: 80%;
  border: 1px solid var(--brand);
  border-radius: 6px;
  font: inherit;
  padding: 2px 6px;
  background: var(--bg);
  color: inherit;
}

.cell-inline:focus { outline: none; box-shadow: var(--focus-ring); }
.cell-inline.is-number { text-align: right; font-variant-numeric: tabular-nums; }

.cell-number { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.cell-check { justify-content: center; }
.cell-check input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.timeline-pill {
  background: var(--brand);
  color: var(--bg);
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.timeline-pill.is-past { background: var(--ink-faint); }

.timeline-fields { display: flex; align-items: center; gap: 6px; }
.timeline-fields input {
  padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px;
  font: inherit; background: var(--bg); color: var(--ink);
}

.cell-pop {
  position: fixed;
  z-index: 220;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cell-pop-textarea {
  width: 100%; min-height: 110px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit; padding: 8px;
  resize: vertical;
  background: var(--bg); color: var(--ink);
}

.cell-pop-actions { display: flex; justify-content: flex-end; gap: 6px; }

.cell-pop-field {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-soft);
}

.cell-pop-field span { width: 40px; }
.cell-pop-field input {
  flex: 1; padding: 6px 8px;
  border: 1px solid var(--line-strong); border-radius: 6px; font: inherit;
  background: var(--bg); color: var(--ink);
}

.cell-pop-search {
  width: 100%; padding: 7px 9px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit;
  background: var(--bg); color: var(--ink);
}

.cell-pop-search:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }

.people-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.people-chips:empty { display: none; }

.people-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--chip-bg); border-radius: 999px;
  padding: 2px 4px 2px 10px; font-size: 12px; font-weight: 600;
}

.people-chip.is-legacy { background: var(--warn-soft); color: var(--warn-ink); font-style: italic; }

.people-chip-x {
  border: 0; background: none; cursor: pointer;
  font-size: 10px; color: var(--ink-faint);
  padding: 2px 5px; border-radius: 50%;
}

.people-chip-x:hover { color: var(--danger); }

.people-list {
  display: flex; flex-direction: column;
  max-height: 240px; overflow-y: auto;
}

.people-row {
  display: flex; align-items: center; gap: 8px;
  border: 0; background: none; cursor: pointer;
  padding: 6px 8px; border-radius: 7px;
  font: inherit; text-align: left; color: var(--ink);
}

.people-row:hover { background: var(--bg-hover); }
.people-row.is-on { background: var(--brand-soft); color: var(--brand-soft-ink); }
.people-row.is-on .people-name { font-weight: 700; }
.people-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-none { color: var(--ink-faint); font-size: 13px; padding: 8px; text-align: center; }

.people-open {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font: inherit;
  cursor: pointer;
  color: inherit;
}

.people-open:hover { border-color: var(--brand); }

.filecell-list { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto; }
.filecell-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; }
.filecell-row:hover { background: var(--bg-hover); }
.filecell-name {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--brand-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: none;
}
.filecell-name:hover { text-decoration: underline; }


/* =======================================================================
   App shell: sidebar + main column
   ==================================================================== */

.shell { display: flex; height: 100vh; background: var(--bg); --sb-w: 256px; --sb-slide: .28s cubic-bezier(.2, .7, .2, 1); }

/* Collapsing slides the sidebar out to the left at its full width, so its
   contents never reflow mid-slide; the board widens into the space it leaves.
   It stays visible until the slide ends, then drops out of the tab order. */
.sidebar {
  flex: 0 0 var(--sb-w);
  width: var(--sb-w);
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px 12px;
  min-width: 0;
  transition: margin-left var(--sb-slide), visibility 0s;
}

body.sb-hidden .sidebar {
  margin-left: calc(-1 * var(--sb-w));
  visibility: hidden;
  transition: margin-left var(--sb-slide), visibility 0s .28s;
}

.sb-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 8px 4px;
}

/* Collapsed sidebar: a ">>" tab, top left, brings it back. It fades in as the
   sidebar finishes leaving, and out as soon as it starts coming back. */
.sb-expand {
  position: fixed;
  left: 10px; top: 22px;
  z-index: 30;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: var(--sidebar);
  color: var(--ink-soft);
  border-radius: 9px;
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: grid; place-items: center;
  opacity: 0;
  transform: translateX(-6px);
  visibility: hidden;
  transition: opacity .12s, transform .12s, visibility 0s .12s;
}

body.sb-hidden .sb-expand {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition: opacity .18s .2s, transform .18s .2s, visibility 0s;
}

.sb-expand:hover { border-color: var(--brand); color: var(--brand); }

.board-head { transition: padding-left var(--sb-slide); }
body.sb-hidden .board-head { padding-left: 56px; }

.sb-icon {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border: 0; background: none; cursor: pointer;
  color: var(--ink-faint);
  padding: 0; border-radius: 8px;
  font-size: 14px;
}

.sb-icon:hover { background: var(--bg-hover); color: var(--ink); }

.sb-add { color: var(--ink-soft); }
.sb-add:hover { background: var(--brand-soft); color: var(--brand-soft-ink); }

.sb-switcher {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 6px 8px;
  margin-top: 6px;
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
}

.sb-switcher:hover { background: var(--bg-hover); }

.sb-ws-dot {
  width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 7px;
  background: var(--brand); color: var(--bg);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
}

.sb-switcher span:nth-child(2) {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sb-caret { margin-left: auto; color: var(--ink-faint); }

.sb-section-bar {
  display: flex; align-items: center; gap: 2px;
  padding: 10px 2px 4px 10px;
}

.sb-section-title {
  flex: 1;
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sb-search-row { padding: 2px 0 6px; }

.sb-search-row input {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  background: var(--bg-sunken);
  color: var(--ink);
}

.sb-search-row input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); background: var(--bg); }

.sb-tree { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 2px 4px 12px; }

.sb-board {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  border: 0; background: none;
  height: 34px;
  padding: 0 8px 0 10px;
  border-radius: 9px;
  font: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.sb-board:hover { background: var(--bg-hover); }
.sb-board:focus-visible, .sb-folder-head:focus-visible {
  outline: 2px solid var(--brand); outline-offset: -2px;
}
.sb-board.is-current { background: var(--brand-soft); color: var(--brand-soft-ink); font-weight: 700; }
.sb-board-icon { color: var(--ink-faint); display: grid; place-items: center; flex: 0 0 auto; }
.sb-board.is-current .sb-board-icon { color: var(--brand-soft-ink); }
.sb-board-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Row actions: pencil / star / ⋯. Hidden until the row is hovered or focused,
   except a star that is already on — that one always shows. */
.sb-actions {
  display: flex; align-items: center; gap: 1px;
  margin-left: auto; flex: 0 0 auto;
}

/* Per-button, not per-group: a lit star stays visible while its neighbours
   only appear on hover. */
.sb-act { visibility: hidden; }

.sb-board:hover .sb-act,
.sb-folder-head:hover .sb-act,
.sb-board:focus-within .sb-act,
.sb-folder-head:focus-within .sb-act,
.sb-act.is-starred { visibility: visible; }

.sb-act {
  border: 0; background: none;
  width: 22px; height: 22px;
  border-radius: 6px;
  padding: 0;
  font: inherit; font-size: 12px; line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid; place-items: center;
}

.sb-act:hover { background: var(--line); color: var(--ink); }
.sb-act.is-starred { color: var(--accent); opacity: 1; }

/* Inline rename input, sized to sit exactly where the name was. */
.sb-rename {
  flex: 1; min-width: 0;
  padding: 2px 6px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  font: inherit; font-size: 14px; font-weight: 500;
  background: var(--bg);
  color: var(--ink);
}

.sb-rename:focus { outline: none; box-shadow: var(--focus-ring); }

.sb-section { margin-bottom: 6px; }

.sb-section-h {
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 8px 10px 4px;
}

.sb-folder { margin: 2px 0; }

.sb-folder-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  border: 0; background: none;
  height: 34px;
  padding: 0 8px 0 10px;
  border-radius: 9px;
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
}

.sb-folder-head:hover { background: var(--bg-hover); }

.sb-folder-caret {
  font-size: 11px; color: var(--ink-faint);
  transition: transform .12s;
  flex: 0 0 auto;
}

.sb-folder-caret.is-open { transform: rotate(90deg); }

.sb-folder-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.sb-folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-folder-n { color: var(--ink-faint); font-size: 11.5px; font-weight: 600; }

.sb-folder-boards { padding-left: 16px; }

.sb-empty { color: var(--ink-faint); font-size: 12.5px; padding: 8px 10px; }

.sb-drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.sb-drop-after { box-shadow: inset 0 -2px 0 var(--brand); }
.sb-drop-into { background: var(--brand-soft) !important; box-shadow: inset 0 0 0 1.5px var(--brand); }

/* Bottom of the sidebar: notifications, admin, and who is signed in. */
.sb-foot {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  display: flex; flex-direction: column; gap: 2px;
}

.sb-nav {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px;
  border: 0; border-radius: 9px;
  background: none;
  color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}

.sb-nav svg { color: var(--ink-faint); }
.sb-nav:hover { background: var(--bg-hover); }

.sb-me {
  display: flex; align-items: center; gap: 10px;
  margin-top: 4px;
  padding: 6px 8px;
  border: 0; border-radius: 10px;
  background: none;
  color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.sb-me:hover { background: var(--bg-hover); }
.sb-me .avatar { width: 28px; height: 28px; }
.sb-me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* global search (top of the sidebar) */

.global-search { position: relative; }

.gs-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none;
}

.global-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.global-search input::placeholder { color: var(--ink-faint); }
.global-search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); }

/* Wider than the sidebar so item names and their board fit on one line. */
.global-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 440px;
  max-width: calc(100vw - 24px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 6px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 300;
  color: var(--ink);
}

.gs-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  border: 0; background: none;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  text-align: left; color: var(--ink);
}

.gs-row:hover { background: var(--bg-hover); }

.gs-kind {
  flex: 0 0 auto;
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-soft-ink);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 2px 6px;
}

.gs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-sub { margin-left: auto; color: var(--ink-faint); font-size: 12px; flex: 0 0 auto; }
.gs-none { color: var(--ink-faint); text-align: center; padding: 12px; font-size: 13px; }

/* ------------------------------------------------- board permissions -- */

.perm-wrap { display: flex; flex-direction: column; gap: 20px; }
.perm-section { display: flex; flex-direction: column; gap: 7px; }
.perm-h { font-size: 13px; font-weight: 800; color: var(--ink); }
.perm-hint { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }
.perm-select {
  font: inherit; font-size: 13.5px; color: var(--ink); width: 100%;
  padding: 8px 10px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--bg);
}
.perm-select:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--focus-ring);
}
.perm-grid { display: grid; grid-template-columns: 1fr 190px; gap: 8px; }

.perm-members { display: flex; flex-direction: column; gap: 4px; }
.perm-member {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius-sm); background: var(--bg-sunken);
}
.perm-who {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.perm-who .perm-sub { display: block; }
.perm-sub { font-size: 11.5px; font-weight: 500; color: var(--ink-faint); }
.perm-member .perm-select { width: auto; min-width: 150px; padding: 4px 8px; font-size: 13px; }
.perm-x {
  border: 0; background: none; cursor: pointer; color: var(--ink-faint);
  font-size: 14px; padding: 4px 6px; border-radius: 6px; flex-shrink: 0;
}
.perm-x:hover { background: var(--danger-soft); color: var(--danger); }

.perm-add { margin-top: 10px; position: relative; }
.perm-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5;
  margin-top: 4px; background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); overflow: hidden;
}
.perm-result {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 11px; cursor: pointer; color: var(--ink);
}
.perm-result:hover { background: var(--bg-hover); }


/* filter / sort chip bar ------------------------------------------------- */

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 0 0 12px;
}

.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-soft);
  color: var(--brand-soft-ink);
  border-radius: 999px;
  padding: 3px 4px 3px 11px;
  font-size: 12.5px;
  font-weight: 700;
}

.filter-chip-x {
  border: 0; background: none; cursor: pointer;
  color: var(--brand-soft-ink);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 50%;
}

.filter-chip-x:hover { background: rgba(0, 0, 0, .1); }

.filter-clear-all {
  border: 0; background: none; cursor: pointer;
  color: var(--ink-soft); font: inherit; font-size: 12.5px; font-weight: 600;
  text-decoration: underline;
  padding: 3px 6px;
}

.filter-clear-all:hover { color: var(--danger); }

/* ------------------------------------------------------------ activity -- */
/* The audit trail: one feed shared by the item panel's Activity Log tab and
   the board-wide history screen, which adds the item each line refers to. */

.activity-feed { padding: 6px 0 16px; }
.activity-feed.is-board {
  max-height: min(60vh, 560px);
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.activity-day {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg);
  padding: 10px 2px 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
}

.activity-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.activity-row:last-child { border-bottom: 0; }
.activity-row:hover { background: var(--row-hover); }

/* Form submissions have no person behind them; a square avatar says so at a
   glance without needing to read the name. */
.activity-row .person { margin-right: 0; border-width: 0; }
.activity-row .person.is-form { border-radius: 6px; }

.activity-main { min-width: 0; }

.activity-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  font-size: 13px; line-height: 1.5;
}
.activity-who { font-weight: 700; color: var(--ink); }
.activity-verb { color: var(--ink-soft); }
.activity-col { font-weight: 700; color: var(--ink); }

.activity-item {
  border: 0; background: none; padding: 0;
  font: inherit; font-weight: 700;
  color: var(--brand-ink); cursor: pointer;
  max-width: 260px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.activity-item:hover { text-decoration: underline; }

.activity-chip {
  display: inline-block;
  max-width: 260px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-sunken);
  font-size: 12px;
}
/* A status/dropdown chip paints itself in the label's own colour, so the log
   reads the same way the cell did. */
.activity-chip.is-label { color: #fff; border-style: solid; font-weight: 700; }

.activity-sub {
  margin-top: 3px;
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  font-size: 12px; color: var(--ink-faint); line-height: 1.5;
}
.activity-subpair {
  background: var(--bg-sunken);
  border-radius: 6px;
  padding: 1px 6px;
}

.activity-when {
  font-size: 12px; color: var(--ink-faint);
  white-space: nowrap; padding-top: 2px;
}

.activity-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0 10px;
}
.activity-summary { margin-left: auto; font-size: 12px; color: var(--ink-faint); }
.activity-more { display: block; margin: 12px auto 0; }

/* ------------------------------------------------------------- patches -- */
/* The board assistant: a teal button beside the title, and a panel docked on
   the right so the board stays in view while you ask about it. */

.btn-patches {
  background: var(--brand-soft);
  color: var(--brand-soft-ink);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
  margin-left: 4px;
}

.btn-patches:hover, .btn-patches.is-on {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.btn-patches.is-on { box-shadow: var(--focus-ring); }

.patches-panel {
  flex: 0 0 380px;
  width: 380px;
  display: flex; flex-direction: column;
  background: var(--sidebar);
  border-left: 1px solid var(--line);
  min-width: 0;
}

.pt-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px 14px 18px;
  border-bottom: 1px solid var(--line);
}

.pt-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; object-fit: cover; flex: 0 0 auto;
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.pt-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pt-title b { font-size: 16px; font-weight: 800; }

.pt-scope {
  display: inline-flex; align-items: center; gap: 5px;
  align-self: flex-start;
  font-size: 11.5px; font-weight: 700;
  color: var(--brand-soft-ink);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 2px 8px;
}

.pt-body {
  flex: 1; overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex; flex-direction: column; gap: 12px;
}

.pt-hello p { margin: 0 0 8px; line-height: 1.55; }
.pt-hello .pt-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 4px; }

.pt-can {
  list-style: none; margin: 0 0 12px; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: var(--ink-soft);
}

.pt-can b { color: var(--ink); }

.pt-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.pt-chip {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  text-align: left;
}

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

.pt-msg {
  max-width: 92%;
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 14px; line-height: 1.55;
  overflow-wrap: anywhere;
}

.pt-msg.is-you {
  align-self: flex-end;
  background: var(--brand);
  color: var(--bg);
  font-weight: 600;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.pt-msg.is-patches {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.pt-answer p { margin: 0 0 6px; }
.pt-answer p:last-child { margin-bottom: 0; }
.pt-answer ul { margin: 2px 0 6px; padding-left: 18px; }
.pt-answer li { margin: 2px 0; }

.pt-sources {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin-top: 10px; padding-top: 9px;
  border-top: 1px solid var(--line-soft);
}

.pt-sources-h {
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-right: 2px;
}

.pt-source {
  border: 0; border-radius: 7px;
  background: var(--brand-soft); color: var(--brand-soft-ink);
  padding: 3px 8px;
  font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pt-source:hover { text-decoration: underline; }

/* An item on another board carries that board's name. */
.pt-source-board {
  margin-left: 5px; padding-left: 5px;
  border-left: 1px solid currentColor;
  font-weight: 600; opacity: .75;
}

.pt-meta { margin-top: 8px; font-size: 11.5px; color: var(--ink-faint); }

.pt-msg.is-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.pt-msg.is-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint);
  animation: pt-dot 1.1s infinite ease-in-out;
}
.pt-msg.is-typing span:nth-child(2) { animation-delay: .15s; }
.pt-msg.is-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes pt-dot {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.pt-note {
  font-size: 13px; line-height: 1.5;
  border-radius: 10px; padding: 9px 12px;
}

.pt-note.is-error { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.pt-note.is-warn { background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; }

.pt-composer {
  display: flex; align-items: flex-end; gap: 8px;
  margin: 8px 14px 0;
  padding: 8px 8px 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
}

.pt-composer:focus-within { border-color: var(--brand); box-shadow: var(--focus-ring); }

.pt-composer textarea {
  flex: 1; min-width: 0;
  border: 0; resize: none; background: transparent;
  font: inherit; font-size: 14px; color: var(--ink);
  padding: 5px 0; max-height: 140px;
}

.pt-composer textarea:focus { outline: none; }
.pt-send { width: 36px; height: 36px; padding: 0; border-radius: 10px; flex: 0 0 auto; }

.pt-foot {
  margin: 0; padding: 8px 16px 14px;
  font-size: 11.5px; line-height: 1.5; color: var(--ink-faint);
}

.pt-withheld { font-weight: 700; color: var(--ink-soft); }

.colhead-mark.is-lock { font-size: 10px; }

@media (max-width: 1100px) {
  .patches-panel {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 45;
    width: min(380px, 100vw);
    box-shadow: var(--shadow-panel);
  }
}

@media (max-width: 700px) {
  .btn-patches span { display: none; }
}

/* ------------------------------------------------------------ narrow -- */

@media (max-width: 900px) {
  .shell { --sb-w: 224px; }
  .board-head { padding: 14px 16px 0; }
  .board-root { padding: 12px 16px 120px; }
  .search-wrap input, .search-wrap input:focus { width: 160px; }
}

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