/* =========================================================================
   Marvin — "Blueprint / Architect's Desk" design system
   Bespoke, hand-authored (no utility-framework build step).
   Signature: drafting sheets framed by dimension lines + registration ticks,
   over a faint blueprint grid. Structure (mono indices) encodes real sequence.
   ========================================================================= */

:root {
  /* Palette — light "paper" */
  --paper:        #F4F2EC;
  --paper-2:      #FBFAF6;
  --sheet:        #FFFFFF;
  --ink:          #14203A;
  --ink-2:        #29344F;
  --graphite:     #5B6472;
  --line:         #DAD8CE;
  --line-2:       #E7E5DC;
  --blueprint:    #2B5CE6;
  --blueprint-d:  #1B3FA0;
  --blueprint-wash:rgba(43, 92, 230, 0.09);
  --grid:         rgba(20, 32, 58, 0.055);
  --grid-strong:  rgba(20, 32, 58, 0.10);
  --redline:      #E8552D;
  --redline-wash: rgba(232, 85, 45, 0.10);
  --green:        #2F7D5B;
  --green-wash:   rgba(47, 125, 91, 0.12);
  --amber:        #C9871B;

  /* Type */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body:    "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "Cascadia Code", monospace;

  /* Geometry */
  --r-sm: 4px;
  --r:    8px;
  --r-lg: 14px;
  --rail-w: 260px;
  --gap: 20px;

  --shadow-sheet: 0 1px 0 rgba(20,32,58,.03), 0 18px 40px -26px rgba(20,32,58,.35);
  --shadow-pop:   0 12px 34px -10px rgba(20,32,58,.30);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
  --paper:        #0E1526;
  --paper-2:      #121B30;
  --sheet:        #16203A;
  --ink:          #EAF0FB;
  --ink-2:        #C6D2EA;
  --graphite:     #93A0BC;
  --line:         #26314F;
  --line-2:       #202A45;
  --blueprint:    #6D93FF;
  --blueprint-d:  #A9C1FF;
  --blueprint-wash:rgba(109, 147, 255, 0.14);
  --grid:         rgba(150, 175, 230, 0.07);
  --grid-strong:  rgba(150, 175, 230, 0.12);
  --redline:      #FF8863;
  --redline-wash: rgba(255, 136, 99, 0.14);
  --green:        #57C89A;
  --shadow-sheet: 0 1px 0 rgba(0,0,0,.2), 0 22px 44px -26px rgba(0,0,0,.7);
  --shadow-pop:   0 16px 40px -12px rgba(0,0,0,.65);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; color: var(--ink); margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
a { color: var(--blueprint-d); text-decoration: none; }
a:hover { text-decoration: underline; }
.brand:hover { text-decoration: none; }

/* ── Reusable atoms ─────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--graphite);
}
.mono { font-family: var(--font-mono); }
.muted { color: var(--graphite); }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* Dimension-line motif — a measured span with end ticks. */
.dimension { position: relative; height: 1px; background: var(--line); margin: 6px 0; }
.dimension::before, .dimension::after {
  content: ""; position: absolute; top: -3px; width: 1px; height: 7px; background: var(--graphite);
}
.dimension::before { left: 0; } .dimension::after { right: 0; }

/* ── App shell ──────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

.rail {
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.rail-head { padding: 20px 20px 14px; border-bottom: 1px solid var(--line-2); }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 auto;
  border: 1.5px solid var(--blueprint); border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--blueprint-d);
  position: relative; background: var(--blueprint-wash);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.brand-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--graphite); }

.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-group { margin-bottom: 18px; }
.nav-group > .eyebrow { padding: 0 10px 8px; display: block; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--r); color: var(--ink-2);
  position: relative; transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: var(--blueprint-wash); text-decoration: none; }
.nav-item .idx { font-family: var(--font-mono); font-size: 11px; color: var(--graphite); width: 20px; }
.nav-item .label { font-weight: 500; font-size: 14px; position: relative; }
.nav-item.active { background: var(--blueprint-wash); color: var(--blueprint-d); }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--blueprint); border-radius: 0 3px 3px 0;
}
.nav-item .label::after { /* dimension underline on hover without layout shift */
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1px; background: currentColor;
  width: 0; opacity: .5; transition: width .2s var(--ease);
}
.nav-item:hover .label::after { width: 100%; }

.rail-foot { border-top: 1px solid var(--line-2); padding: 12px; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  background: var(--ink); color: var(--paper-2);
}
.userchip .who { min-width: 0; }
.userchip .who b { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userchip .who span { font-size: 11px; color: var(--graphite); }

/* ── Main column ────────────────────────────────────────────────────────── */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.titleblock { display: flex; flex-direction: column; }
.titleblock .eyebrow { display: block; }
.titleblock h1 { font-size: 20px; }
.icon-btn {
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--sheet); color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
  transition: border-color .15s var(--ease), transform .15s var(--ease);
  flex: 0 0 auto;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions:empty { display: none; }
.icon-btn:hover { border-color: var(--blueprint); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0) scale(0.95); }
.icon-btn svg { width: 18px; height: 18px; }
.rail-toggle { display: none; }
@media (max-width: 900px) { .rail-toggle { display: grid; } }
.nav-bell { position: relative; }
.bell-badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--redline); color: #fff; border-radius: 999px; font-family: var(--font-mono);
  font-size: 10px; line-height: 17px; text-align: center; font-weight: 600;
}

.content {
  padding: 28px; flex: 1; position: relative;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
.content::after { /* stronger major gridlines */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px);
  background-size: 140px 140px; opacity: .7; mask-image: linear-gradient(#000, #000);
}
.container { max-width: 1180px; margin: 0 auto; position: relative; z-index: 1; }

/* ── Sheet / card — the signature surface ───────────────────────────────── */
.sheet, .card {
  background: var(--sheet); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sheet); position: relative;
}
.card { padding: 22px; }
.sheet { padding: 26px; }
/* corner registration ticks */
.sheet::before, .sheet::after {
  content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none;
  border: 1.5px solid var(--blueprint); opacity: .55;
}
.sheet::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.sheet::after  { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; }

/* ── Stat tiles ─────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--gap); }
.stat {
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat .label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--graphite); }
.stat .value { font-family: var(--font-display); font-size: 34px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }
.stat .foot { font-size: 12px; color: var(--graphite); margin-top: 2px; }
.stat::after { content: ""; position: absolute; right: -14px; bottom: -14px; width: 60px; height: 60px; border: 1px solid var(--line-2); border-radius: 50%; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  padding: 10px 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--sheet); color: var(--ink); transition: all .15s var(--ease);
  text-decoration: none; white-space: nowrap; flex: 0 0 auto;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-pop); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--blueprint); border-color: var(--blueprint); color: #fff; }
.btn-primary:hover { background: var(--blueprint-d); }
.btn-redline { background: var(--redline); border-color: var(--redline); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ── Badges / chips / avatars ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; line-height: 1;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3.5px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--graphite);
  white-space: nowrap; flex: 0 0 auto;
}
.badge svg {
  width: 12px; height: 12px; flex: 0 0 auto;
}
.badge.blue { color: var(--blueprint-d); border-color: color-mix(in srgb, var(--blueprint) 40%, var(--line)); background: var(--blueprint-wash); }
.badge.green { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--line)); background: var(--green-wash); }
.badge.red { color: var(--redline); border-color: color-mix(in srgb, var(--redline) 40%, var(--line)); background: var(--redline-wash); }
.badge.amber { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); background: rgba(201, 135, 27, 0.12); }

/* Task priority chips (urgent/high/low; medium renders no chip) */
.badge.prio-urgent { color: #fff; border-color: var(--redline); background: var(--redline); }
.badge.prio-high { color: var(--redline); border-color: color-mix(in srgb, var(--redline) 40%, var(--line)); background: var(--redline-wash); }
.badge.prio-low { color: var(--graphite); border-style: dashed; }

/* Percent-complete ring on the project health sheet */
.progress-ring {
  --pct: 0;
  width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; color: var(--blueprint-d);
  background:
    radial-gradient(closest-side, var(--sheet) 74%, transparent 75% 100%),
    conic-gradient(var(--blueprint) calc(var(--pct) * 1%), var(--blueprint-wash) 0);
  border: 1px solid var(--line);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--graphite); }
input, textarea, select {
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 13px; width: 100%; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:hover, textarea:hover, select:hover {
  border-color: var(--graphite);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--blueprint);
  box-shadow: 0 0 0 3px var(--blueprint-wash);
}
input:focus:hover, textarea:focus:hover, select:focus:hover {
  border-color: var(--blueprint);
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 54px 20px; color: var(--graphite); }
.empty .mark { width: 54px; height: 54px; margin: 0 auto 14px; border: 1.5px dashed var(--line); border-radius: var(--r); display: grid; place-items: center; color: var(--blueprint); }
.empty .mark svg { width: 24px; height: 24px; flex: 0 0 auto; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 440px; margin: 0 auto 16px; font-size: 14px; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: var(--sheet); border: 1px solid var(--line); border-left: 3px solid var(--blueprint); border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow-pop); min-width: 240px; animation: fadeUp .3s var(--ease); }
.toast.error { border-left-color: var(--redline); }
.toast.success { border-left-color: var(--green); }

/* ── Auth screen ────────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px; }
.auth-card { width: 100%; max-width: 400px; }

/* ── Motion ─────────────────────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes stampIn { 0% { opacity: 0; transform: scale(.96) translateY(6px); } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes gridReveal { from { opacity: 0; } to { opacity: 1; } }
.anim-up { animation: fadeUp .45s var(--ease) both; }
.anim-stamp { animation: stampIn .5s var(--ease) both; }
.content { animation: gridReveal .6s var(--ease) both; }
.stagger > * { animation: fadeUp .5s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .18s; }
.stagger > *:nth-child(5) { animation-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 50; width: var(--rail-w); transform: translateX(-100%); transition: transform .25s var(--ease); }
  .rail.open { transform: none; }
  .content { padding: 20px 16px; }

  /* Topbar: wrap onto two rows instead of squeezing title + actions into one,
     which used to force titles into tall multi-line stacks and push icon
     buttons off-screen. Row 1 = menu / title / bell / theme; row 2 = actions. */
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .rail-toggle { order: 1; }
  .titleblock { order: 2; min-width: 0; flex: 1 1 0%; }
  .titleblock .eyebrow, .titleblock h1 {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%;
  }
  .titleblock h1 { font-size: 18px; }
  .topbar .spacer { display: none; }
  .topbar .nav-bell { order: 4; }
  .topbar .theme-toggle { order: 5; }
  .topbar-actions {
    order: 6; flex: 1 1 100%; flex-wrap: wrap; row-gap: 8px;
  }

  /* Button/content rows: let them wrap onto multiple lines instead of
     forcing nowrap buttons past the edge of their card. */
  .row { flex-wrap: wrap; }
}

/* ── Studio editor + document sheet ─────────────────────────────────────── */
[x-cloak] { display: none !important; }

.editor-grid { display: grid; grid-template-columns: 350px 1fr; gap: 22px; align-items: start; }
.editor-grid.editor-grid--wide { grid-template-columns: 1fr 340px; }
.composer { position: sticky; top: 92px; }
.composer textarea { resize: vertical; }
@media (max-width: 980px) { .editor-grid, .editor-grid.editor-grid--wide { grid-template-columns: minmax(0, 1fr); } .composer { position: static; } }

.doc-sheet { max-width: 820px; margin: 0 auto; padding: 44px 50px; min-height: 460px; }
.doc-sheet.is-empty { display: grid; place-items: center; }
.doc-sheet h1 { font-size: 30px; margin: 0 0 6px; }
.doc-sheet h2 { font-size: 20px; color: var(--blueprint-d); margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line-2); }
.doc-sheet h3 { font-size: 16px; margin: 18px 0 6px; }
.doc-sheet p { margin: 0 0 12px; color: var(--ink-2); }
.doc-sheet ul, .doc-sheet ol { margin: 0 0 14px 22px; }
.doc-sheet li { margin-bottom: 6px; color: var(--ink-2); }
.doc-sheet table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; font-size: 14px; }
.doc-sheet th { background: var(--blueprint); color: #fff; text-align: left; padding: 8px 11px; font-weight: 600; }
.doc-sheet td { border: 1px solid var(--line); padding: 7px 11px; }
.doc-sheet tr:nth-child(even) td { background: var(--paper); }
.doc-sheet.drafting::after { content: "▍"; color: var(--blueprint); animation: blink 1s steps(1) infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }

/* ── Kanban ─────────────────────────────────────────────────────────────── */
.board { display: flex; gap: 16px; overflow-x: auto; padding: 4px 2px 10px; }
.kcol {
  flex: 0 0 300px; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: 72vh;
}
.kcol-head { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-2); }
.kdot { width: 9px; height: 9px; border-radius: 3px; background: var(--graphite); display: inline-block; }
.k-backlog { background: #9aa2b1; } .k-todo { background: var(--blueprint); }
.k-in_progress { background: var(--amber); } .k-review { background: var(--redline); }
.k-done { background: var(--green); }
.kcol-body { padding: 10px; overflow-y: auto; flex: 1; min-height: 48px; }
.kcard {
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 13px; margin-bottom: 10px; cursor: grab; box-shadow: 0 1px 0 rgba(20,32,58,.04);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.kcard:hover { border-color: var(--blueprint); box-shadow: var(--shadow-pop); }
.kcard .t { font-weight: 600; font-size: 14px; color: var(--ink); display: block; }
.kcard .t:hover { text-decoration: none; color: var(--blueprint-d); }
.kcard .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; min-height: 24px; }
.kcol-add { padding: 8px 10px 12px; border-top: 1px solid var(--line-2); }
.kcol-add input { background: transparent; border: 1px dashed var(--line); font-size: 13px; }
.kcol-add input:focus { border-style: solid; background: var(--sheet); }
.sortable-ghost { opacity: .35; }

/* Utility grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
@media (max-width: 780px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Bespoke Icon Sizing & Micro-interactions ───────────────────────────── */
.icon-svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  vertical-align: middle;
  transition: transform .2s var(--ease), color .2s var(--ease);
}

/* Specific alignments for unconstrained SVGs inside structural containers */
.row svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* Specific constrained containers */
.nav-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* Elegant Hover Micro-interactions */
/* 1. Compass Needle Spin */
a:hover .icon-compass,
.nav-item:hover .icon-compass,
.brand:hover .icon-compass {
  transform: rotate(30deg);
}

/* 2. Direct Action Slide */
a:hover .icon-arrow-right,
button:hover .icon-arrow-right,
.nav-item:hover .icon-arrow-right,
.card:hover .icon-arrow-right {
  transform: translateX(4px);
}

/* 3. Radiant Sparkle */
a:hover .icon-sparkles,
button:hover .icon-sparkles {
  transform: scale(1.15) rotate(15deg);
  color: var(--amber);
}

/* 4. Logout Slide Push */
button:hover .icon-log-out {
  transform: translateX(-2px);
}

/* ── Mobile Sidebar Overlay ─────────────────────────────────────────────── */
.rail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 32, 58, 0.15);
  backdrop-filter: blur(2px);
  z-index: 45;
  animation: gridReveal .2s var(--ease) both;
}

/* ── Toolbox ────────────────────────────────────────────────────────────── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px; }
.tool-card {
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.tool-card:hover { border-color: var(--blueprint); box-shadow: var(--shadow-pop); transform: translateY(-2px); text-decoration: none; }
.tool-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tool-card-head h3 { font-size: 14.5px; }
.tool-card-head .icon-arrow-right { color: var(--graphite); }
.tool-card:hover .tool-card-head h3 { color: var(--blueprint-d); }
.tool-card:hover .tool-card-head .icon-arrow-right { color: var(--blueprint-d); }
.tool-card p { font-size: 12.5px; margin: 0; line-height: 1.5; }

.tool-sheet { max-width: 600px; }
.hint { font-size: 11.5px; color: var(--graphite); margin: 5px 0 0; }

/* Checkbox field — a real choice row, not a mono field label */
.check-field { margin-bottom: 14px; }
.check-field label {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  text-transform: none; letter-spacing: 0; color: var(--ink);
}
.check-field input[type="checkbox"] {
  width: 18px; height: 18px; flex: 0 0 auto; padding: 0; accent-color: var(--blueprint);
}

/* File inputs — style the native selector button to match the blueprint kit */
input[type="file"] { padding: 8px 10px; cursor: pointer; color: var(--graphite); font-size: 13px; }
input[type="file"]::file-selector-button {
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  margin-right: 12px; padding: 7px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--sheet); color: var(--ink); cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
input[type="file"]::file-selector-button:hover { border-color: var(--blueprint); color: var(--blueprint-d); }

/* ── Custom Styled Scrollbars ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--paper-2);
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--r-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--graphite);
}

/* Inline-edit popover — a <details> whose form floats below its summary.
   Reused for sprint edit (project page) and document rename (editor). */
.inline-edit { position: relative; display: inline-block; }
.inline-edit > summary { list-style: none; cursor: pointer; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit > form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--sheet); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; box-shadow: var(--shadow-pop);
  min-width: 250px; text-align: left;
}
.inline-edit > form input,
.inline-edit > form textarea,
.inline-edit > form select { width: 100%; }
/* Row action buttons sit quietly until you hover the row. */
.trash-row:last-child { border-bottom: none !important; }
