/* Dreambound CRM stylesheet. Hand-written: tokens, base, shell, components, screens, client pages. */

/* ---- Fonts (self-hosted) --------------------------------------------- */
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/vendor/fonts/inter-tight-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/assets/vendor/fonts/figtree-variable.woff2") format("woff2");
}

/* ---- Tokens ----------------------------------------------------------- */
:root {
  --navy: #081122;
  --navy-2: #1B2540;
  --yellow: #F5FE90;
  --yellow-ink: #081122;
  --sky: #B0E0FF;
  --mint: #BCFFB0;
  --lilac: #DAD6FF;

  --ink: #0F1626;
  --ink-2: #5B6472;
  --ink-3: #9AA2AF;
  --surface: #FFFFFF;
  --surface-2: #F3F4F7;
  --surface-3: #E9EBF0;
  --canvas: #F5F6F9;
  --line: rgba(15, 22, 38, .07);
  --line-strong: rgba(15, 22, 38, .14);

  --accent: #081122;
  --accent-ink: #FFFFFF;
  --accent-soft: #EEF0F5;
  --link: #0F1626;
  --focus: #4A6CF7;

  --positive: #17814A;
  --positive-soft: #E4F6EA;
  --negative: #C8382D;
  --negative-soft: #FBEBE9;
  --warning: #B0620B;
  --warning-soft: #FFF3DF;
  --info-soft: #E6F3FF;

  --chart-1: #081122;
  --chart-2: #DAD6FF;
  --chart-3: #17814A;

  --side-bg: #FFFFFF;
  --side-ink: #5B6472;
  --side-ink-strong: #0F1626;
  --side-hover: #F3F4F7;
  --side-active: #EEF0F5;

  --font: "Inter Tight", "Figtree", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(15, 22, 38, .03), 0 12px 32px -20px rgba(15, 22, 38, .10);
  --shadow-lg: 0 6px 16px -8px rgba(15, 22, 38, .12), 0 28px 56px -28px rgba(15, 22, 38, .22);
  --sidebar-w: 240px;
  --topbar-h: 76px;
  --touch: 44px;
  --ease: 160ms cubic-bezier(.2, .7, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E9ECF2;
    --ink-2: #AEB6C3;
    --ink-3: #78818F;
    --surface: #171C25;
    --surface-2: #1F252F;
    --surface-3: #2A313D;
    --canvas: #0E1218;
    --line: rgba(255, 255, 255, .07);
    --line-strong: rgba(255, 255, 255, .16);
    --accent: #F5FE90;
    --accent-ink: #081122;
    --accent-soft: #252B3A;
    --link: #E9ECF2;
    --focus: #8FA8FF;
    --positive: #5CCB88;
    --positive-soft: #163224;
    --negative: #F28B81;
    --negative-soft: #3B1F1C;
    --warning: #E6AC52;
    --warning-soft: #3B2D13;
    --info-soft: #1B2A3A;
    --chart-1: #F5FE90;
    --chart-2: #6B63C9;
    --chart-3: #5CCB88;
    --side-bg: #12161E;
    --side-ink: #AEB6C3;
    --side-ink-strong: #FFFFFF;
    --side-hover: #1F252F;
    --side-active: #252B3A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -20px rgba(0, 0, 0, .6);
    --shadow-lg: 0 6px 16px -8px rgba(0, 0, 0, .6), 0 28px 56px -28px rgba(0, 0, 0, .8);
  }
}

/* ---- Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; }
p { margin: 0 0 1em; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
code { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }
.num, td.money, th.money, .money { font-variant-numeric: tabular-nums; }
.money { text-align: right; }
.help { color: var(--ink-3); font-size: 13px; }
.help a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.help-inline { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.text-negative { color: var(--negative); }
.text-positive { color: var(--positive); }
.text-warning { color: var(--warning); }
.inline { display: inline; }
.prewrap { white-space: pre-wrap; }
.centre { text-align: center; margin-top: 12px; }
p a, .dl a, td a:not(.row-title):not(.btn), .record-meta a, .cold-list a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
p a:hover, .dl a:hover, td a:hover, .record-meta a:hover, .cold-list a:hover { text-decoration-color: currentColor; }

/* ---- Shell: light sidebar, soft canvas --------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 auto;
  background: var(--side-bg);
  color: var(--side-ink);
  padding: 24px 16px 18px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 12px; color: var(--side-ink-strong); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 118px; height: auto; }
@media (prefers-color-scheme: dark) { .sidebar .brand-logo { filter: invert(1); } }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--yellow); }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 9px 14px;
  color: var(--side-ink); border-radius: 12px; font-weight: 500; font-size: 14px;
  transition: background var(--ease), color var(--ease);
}
.nav a:hover { background: var(--side-hover); color: var(--side-ink-strong); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--side-active); color: var(--side-ink-strong); font-weight: 600; }
.nav a[aria-current="page"]::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 2px var(--navy); }
@media (prefers-color-scheme: dark) { .nav a[aria-current="page"]::after { box-shadow: none; } }
.nav-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-user { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); font-size: 13px; display: grid; grid-template-columns: 36px 1fr; gap: 1px 10px; align-items: center; }
.sidebar-avatar { grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--yellow), var(--sky)); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.sidebar-user-name { font-weight: 600; color: var(--side-ink-strong); line-height: 1.2; }
.sidebar-user-role { color: var(--ink-3); font-size: 12px; }
.sidebar-user form { grid-column: 1 / 3; margin-top: 12px; }
.sidebar-user .btn { width: 100%; }

.page { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 36px;
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.page-title { font-size: 24px; margin: 0; font-weight: 600; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search { position: relative; }
.search input {
  width: 320px; max-width: 46vw;
  height: 42px; padding: 0 16px 0 40px;
  border: 1px solid transparent; border-radius: var(--pill);
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA2AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") 14px 50% / 16px 16px no-repeat;
  color: var(--ink); font: inherit; font-size: 14px;
  box-shadow: var(--shadow);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.search input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 12%, transparent); outline: none; }
.content { padding: 6px 36px 48px; flex: 1 1 auto; max-width: 1480px; width: 100%; }
.ws-switch { display: inline-flex; gap: 2px; background: var(--surface); border-radius: var(--pill); padding: 4px; box-shadow: var(--shadow); }
.ws-switch a { padding: 7px 14px; border-radius: var(--pill); font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.2; }
.ws-switch a:hover { text-decoration: none; color: var(--ink); }
.ws-switch a[aria-current="page"] { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .ws-switch a[aria-current="page"] { background: var(--yellow); color: var(--navy); } }
/* ---- Work: projects, board, list, drawer ----------------------------------------- */
.project-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: var(--lilac); flex: 0 0 auto; vertical-align: middle; }
.project-swatch.mini { width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
.project-swatch.large { width: 40px; height: 40px; border-radius: 12px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 20px; }
.project-card.is-archived { opacity: .6; }
.project-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.project-card-head h2 { margin: 0; }
.project-card-title { flex: 1 1 auto; min-width: 0; }
.project-card-title .row-title { font-size: 16px; }
.project-card-stats { display: flex; gap: 6px; align-items: center; }
.subproject-list { list-style: none; margin: 0; padding: 0; }
.subproject-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.subproject-list a { font-weight: 500; display: inline-flex; align-items: center; }
.subproject-meta { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; }
.subproject-add { display: inline-block; margin-top: 10px; font-size: 13px; }
.kicker-line { color: var(--ink-2); font-size: 13px; margin-bottom: 14px; }
.swatch-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch-option span { display: block; width: 30px; height: 30px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(15, 22, 38, .08); }
.swatch-option input:checked + span { border-color: var(--navy); box-shadow: 0 0 0 2px #fff inset; }
.project-hello-main { display: flex; gap: 14px; align-items: center; }
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpi-strip .kpi { padding: 16px 18px; }
.kpi-strip .kpi-value { font-size: 26px; }
.subproject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.subproject-card { padding: 18px; box-shadow: none; border-color: var(--line); background: var(--surface-2); }
.subproject-card h2 { font-size: 15px; }
.subproject-card:hover { background: var(--surface); }
.subproject-card-stats { display: flex; gap: 14px; font-size: 13px; color: var(--ink-3); }
.subproject-card-stats strong { color: var(--ink); font-weight: 600; margin-right: 2px; }
.subproject-card.is-archived { opacity: .6; }

.project-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.crumbs a { color: var(--ink-2); }
.sibling-menu { position: relative; }
.sibling-menu summary { list-style: none; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.sibling-menu summary::-webkit-details-marker { display: none; }
.sibling-menu .menu { position: absolute; left: 0; top: calc(100% + 6px); min-width: 220px; list-style: none; margin: 0; padding: 8px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 30; }
.sibling-menu .menu a { display: flex; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 500; }
.sibling-menu .menu a:hover, .sibling-menu .menu a[aria-current="page"] { background: var(--surface-2); text-decoration: none; }
.project-title { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.project-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.view-switch { margin: 0; }
.show-done { font-size: 13px; color: var(--ink-2); min-height: 0; }
.show-done input { width: 16px; height: 16px; }

.work-board { padding-bottom: 20px; }
.work-col { flex: 0 0 300px; width: 300px; max-height: calc(100vh - 200px); }
.work-col.is-done-col .board-col-head { color: var(--positive); }
.work-col .board-col-head { gap: 6px; padding: 10px 10px 6px 12px; cursor: grab; }
.col-rename { flex: 1 1 auto; min-width: 0; margin: 0; }
.col-name { width: 100%; min-height: 32px; padding: 4px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; font: inherit; font-weight: 600; font-size: 13.5px; color: inherit; }
.col-name:hover { border-color: var(--line-strong); }
.col-name:focus-visible { background: var(--surface); border-color: var(--focus); box-shadow: none; }
.col-menu { position: relative; }
.col-menu summary { list-style: none; }
.col-menu summary::-webkit-details-marker { display: none; }
.col-menu .menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 220px; list-style: none; margin: 0; padding: 6px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 30; }
.menu-btn { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; font: inherit; font-size: 13.5px; color: var(--ink); border-radius: var(--radius-sm); cursor: pointer; }
.menu-btn:hover { background: var(--surface-2); }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 16px; cursor: pointer; line-height: 1; }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.work-list { min-height: 40px; padding: 4px 8px 4px; }
.task-card { background: var(--surface); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(15, 22, 38, .05); transition: box-shadow var(--ease), transform var(--ease); list-style: none; }
.task-card:hover { box-shadow: var(--shadow-lg); }
.task-card.is-ghost { opacity: .4; }
.task-card.is-chosen { box-shadow: var(--shadow-lg); transform: rotate(-.5deg); }
.task-card.is-done { opacity: .55; }
.task-card.is-done .task-card-title { text-decoration: line-through; color: var(--ink-3); }
.task-card-top { display: flex; gap: 6px; align-items: flex-start; }
.task-card .task-check { width: 24px; height: 24px; margin: -2px 0 0 -4px; }
.task-card .task-check input, .task-line .task-check input, .subtask .task-check input { width: 18px; height: 18px; border-radius: 50%; }
.task-card-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; line-height: 1.35; flex: 1 1 auto; }
.task-card-title:hover { text-decoration: none; color: var(--link); }
.task-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; padding-left: 20px; }
.task-card-meta .avatar { margin-left: auto; }
.due-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--pill); font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.due-pill.is-today { background: var(--warning-soft); color: var(--warning); }
.due-pill.is-overdue { background: var(--negative-soft); color: var(--negative); }
.badge.prio-low { background: var(--surface-2); color: var(--ink-2); }
.badge.prio-medium { background: var(--info-soft); color: #1F4E7A; }
.badge.prio-high { background: var(--warning-soft); color: var(--warning); }
.badge.prio-urgent { background: var(--negative-soft); color: var(--negative); }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: linear-gradient(135deg, var(--yellow), var(--sky)); color: var(--navy); font-weight: 700; flex: 0 0 auto; }
.avatar.mini { width: 24px; height: 24px; font-size: 11px; }
.avatar.is-empty { background: transparent; border: 1px dashed var(--line-strong); }
.quick-add { margin: 0; padding: 4px 8px 10px; }
.quick-add input[name="title"] { width: 100%; min-height: 36px; border: 1px dashed transparent; border-radius: var(--radius-sm); background: transparent; padding: 6px 10px; font: inherit; font-size: 13.5px; color: var(--ink); }
.quick-add input[name="title"]:hover { border-color: var(--line-strong); }
.quick-add input[name="title"]:focus-visible { background: var(--surface); border-style: solid; border-color: var(--focus); box-shadow: none; }
.add-col { background: transparent; border: 1px dashed var(--line-strong); min-height: 60px; max-height: none; justify-content: center; }
.add-col-form { margin: 0; padding: 8px; }
.add-col-form input { border: 0; background: transparent; min-height: 36px; font-weight: 600; text-align: center; }
.add-col-form input:focus-visible { background: var(--surface); box-shadow: none; border: 0; }

.list-card { padding: 8px 0; }
.list-group { border-bottom: 1px solid var(--line); }
.list-group:last-of-type { border-bottom: 0; }
.list-group > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 24px; cursor: pointer; font-weight: 600; font-size: 14px; }
.list-group > summary::-webkit-details-marker { display: none; }
.list-group > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.8px solid var(--ink-3); border-bottom: 1.8px solid var(--ink-3); transform: rotate(45deg); margin-right: 4px; transition: transform var(--ease); }
.list-group:not([open]) > summary::before { transform: rotate(-45deg); }
.task-rows { list-style: none; margin: 0; padding: 0; }
.task-line { display: flex; align-items: center; gap: 10px; padding: 9px 24px 9px 20px; border-top: 1px solid var(--line); transition: background var(--ease); }
.task-line:hover { background: var(--surface-2); }
.task-line.is-done .task-line-title { text-decoration: line-through; color: var(--ink-3); }
.task-line-title { flex: 1 1 auto; min-width: 0; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.task-line-title:hover { text-decoration: none; color: var(--link); }
.task-line-project { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; display: inline-flex; align-items: center; }
.task-line-meta { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.quick-add-row { padding: 4px 16px 10px; }
.list-add-group { padding: 8px 16px 4px; }
.list-add-group input { text-align: left; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); transform: translateX(100%); transition: transform 220ms cubic-bezier(.2, .7, .3, 1); z-index: 40; pointer-events: none; }
.drawer.is-open { transform: none; pointer-events: auto; }
.drawer-panel { height: 100%; overflow-y: auto; background: var(--surface); box-shadow: -20px 0 60px -30px rgba(15, 22, 38, .35); padding: 20px 26px 32px; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 17, 34, .25); opacity: 0; pointer-events: none; transition: opacity 220ms; z-index: 39; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.drawer-crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); min-width: 0; }
.drawer-crumbs a { color: var(--ink-2); display: inline-flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.drawer-tools { display: flex; gap: 4px; align-items: center; }
.btn-complete { border-color: var(--positive); color: var(--positive); }
.btn-complete:hover { background: var(--positive-soft); }
.drawer-title { width: 100%; font: inherit; font-size: 22px; font-weight: 600; letter-spacing: -.02em; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 6px 8px; margin: 0 -8px 12px; background: transparent; color: var(--ink); min-height: 0; }
.drawer-title:hover { border-color: var(--line-strong); }
.drawer-title:focus-visible { background: var(--surface-2); border-color: var(--focus); box-shadow: none; }
.drawer-title.is-done { text-decoration: line-through; color: var(--ink-3); }
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 14px; }
.drawer-field { display: block; margin: 0; }
.drawer-field > span { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; font-weight: 500; }
.drawer-field input, .drawer-field select, .drawer-field textarea { min-height: 38px; font-size: 14px; }
.drawer-field-wide { margin-bottom: 14px; }
.drawer-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.drawer-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.drawer-section h3 { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.subtask-list { list-style: none; margin: 0; padding: 0; }
.subtask { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.subtask a { flex: 1 1 auto; color: var(--ink); font-weight: 500; }
.subtask.is-done a { text-decoration: line-through; color: var(--ink-3); }
.event-list { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; color: var(--ink-2); }
.event-list li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.event-list li:last-child { border-bottom: 0; }
.event-who { font-weight: 600; color: var(--ink); }
.label-pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--pill); font-size: 11.5px; font-weight: 600; color: var(--navy); background: var(--lilac); line-height: 16px; white-space: nowrap; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.label-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.label-option { margin: 0; cursor: pointer; }
.label-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.label-option .label-pill { opacity: .45; border: 1px solid transparent; transition: opacity var(--ease); }
.label-option input:checked + .label-pill { opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--navy); }
.label-option input:focus-visible + .label-pill { outline: 2px solid var(--focus); }
.label-new input { min-height: 26px; padding: 2px 10px; border-radius: var(--pill); font-size: 12px; width: 120px; border-style: dashed; }
.label-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.label-form input[name="name"] { flex: 1 1 180px; }
.compact-swatches .swatch-option span { width: 24px; height: 24px; border-radius: 8px; }
.label-row-form .label-pill { flex: 0 0 auto; }
.label-row-form input[type="text"] { flex: 1 1 140px; min-height: 34px; }
.task-filters { display: flex; gap: 6px; }
.task-filters select { width: auto; min-height: 36px; border-radius: var(--pill); font-size: 13px; padding: 4px 32px 4px 14px; border-color: transparent; box-shadow: var(--shadow); }
.task-card.is-blocked, .task-line.is-blocked .task-line-title { opacity: .85; }
.drawer-blocked { margin-bottom: 12px; }
.dependency-list { list-style: none; margin: 0 0 8px; padding: 0; }
.dependency-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.dependency-list li a { flex: 1 1 auto; font-weight: 500; }
.dependency-list li.is-done a { color: var(--ink-3); text-decoration: line-through; }
.dependency-add { display: flex; gap: 8px; align-items: center; }
.dependency-add select { flex: 1 1 auto; min-height: 36px; font-size: 13.5px; }
.comment-list { list-style: none; margin: 0 0 12px; padding: 0; }
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment-body { flex: 1 1 auto; min-width: 0; }
.comment-head { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 2px; }
.comment-tools { margin-left: auto; display: flex; gap: 8px; opacity: 0; transition: opacity var(--ease); font-size: 12.5px; }
.comment:hover .comment-tools, .comment:focus-within .comment-tools { opacity: 1; }
.comment-text { font-size: 14px; }
.comment-edit textarea, .comment-form textarea { min-height: 60px; }
.comment-edit .actions, .comment-form .actions { margin-top: 6px; }
.history > summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.history > summary::-webkit-details-marker { display: none; }
.feed li { padding: 8px 0; }
.more-menu summary.btn { padding: 0 12px; letter-spacing: .1em; }
.more-menu .menu { min-width: 240px; }
.more-menu .menu form { margin: 0; }
.menu-title { padding: 8px 10px 2px; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.template-banner { margin-bottom: 16px; }
.template-card { background: var(--surface-2); box-shadow: none; }
.task-page { max-width: 760px; }
.task-page .drawer-tools [data-drawer-close] { display: none; }

.work-intro { padding: 28px 30px; }
.work-intro-title { font-size: 24px; font-weight: 500; letter-spacing: -.025em; margin: 6px 0 10px; max-width: 640px; }
.work-intro p { margin: 0; max-width: 640px; color: rgba(8, 17, 34, .72); }
.work-roadmap li { margin-bottom: 10px; color: var(--ink-2); }
.work-roadmap strong { color: var(--ink); }
.work-shared { margin: 0 0 12px; padding-left: 18px; }
.work-shared li { margin-bottom: 4px; }

/* ---- Minimal layout (login, errors, maintenance) --------------------- */
body.minimal { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: var(--canvas) radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--lilac) 45%, transparent), transparent 70%) no-repeat; }
.minimal-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border-radius: 24px;
  box-shadow: var(--shadow-lg); padding: 36px 32px;
}
.minimal-card h1 { font-size: 22px; margin-bottom: 18px; }
.brand-centre { justify-content: center; margin-bottom: 18px; padding: 0; }
.brand-centre .brand-logo { width: 150px; }
@media (prefers-color-scheme: dark) { .brand-centre .brand-logo { filter: invert(1); } }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: var(--pill);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
@media (prefers-color-scheme: dark) { .btn-primary:hover { background: #EEF98A; border-color: #EEF98A; } }
.btn-danger { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 35%, transparent); background: var(--surface); }
.btn-danger:hover { background: var(--negative-soft); border-color: var(--negative); }
.btn-block { width: 100%; }
.btn-small { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-big { min-height: 54px; font-size: 17px; padding: 0 28px; }
.btn-link { border: 0; background: none; color: var(--ink-2); padding: 0; min-height: 0; font-weight: 500; box-shadow: none; border-radius: 4px; }
.btn-link:hover { background: none; color: var(--ink); text-decoration: underline; border: 0; }

/* ---- Badges, counts, status ----------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--pill);
  font-size: 12px; font-weight: 500; line-height: 16px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid transparent;
}
.badge-client::before, .badge-lead::before, .badge-contact::before, .badge-past_client::before, .badge-warning::before, .badge-negative::before,
.badge[class*="status-"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge-client, .badge.status-approved { background: var(--positive-soft); color: var(--positive); }
.badge-lead, .badge.status-sent { background: var(--info-soft); color: #1F4E7A; }
.badge-contact { background: var(--surface-2); color: var(--ink-2); }
.badge-past_client, .badge-warning, .badge.status-viewed { background: var(--warning-soft); color: var(--warning); }
.badge-negative, .badge.status-changes_requested { background: var(--negative-soft); color: var(--negative); }
.badge-tag { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); }
.badge.status-cancelled { background: var(--surface-2); color: var(--ink-3); }
@media (prefers-color-scheme: dark) { .badge-lead, .badge.status-sent { color: #9CC6F5; } }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--pill); background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 600; line-height: 1; vertical-align: middle; }
.stage-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); margin-right: 6px; vertical-align: middle; }

/* ---- Cards ---------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h2 { font-size: 15px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 18px; }
.card-grid > .card { min-width: 0; overflow-wrap: anywhere; }
.card-wide { grid-column: 1 / -1; }
.card-narrow { max-width: 600px; margin-bottom: 18px; }
.card-link { color: inherit; display: block; transition: transform var(--ease), box-shadow var(--ease); }
.card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-link h2 { color: var(--ink); }
.card-link p { color: var(--ink-2); margin: 0; }
.card-muted { color: var(--ink-3); background: var(--surface-2); box-shadow: none; border-color: transparent; }
.card-muted h2 { color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.stack-top { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 10px 20px; margin: 0 0 12px; }
.dl dt { color: var(--ink-3); font-size: 13px; }
.dl dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 18px; }
.details { margin-top: 12px; }
.details summary { cursor: pointer; color: var(--ink-2); font-weight: 500; min-height: 32px; display: flex; align-items: center; }
.inline-form { padding: 12px 0 0; max-width: 380px; }
.steps { padding-left: 20px; margin: 0 0 16px; }
.steps li { margin-bottom: 4px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 16px; }
.section-head h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }

.empty-state { max-width: 560px; margin: 24px auto; padding: 44px 28px; text-align: center; color: var(--ink-2); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state h2 { color: var(--ink); font-size: 17px; }
.empty-state .btn { margin-top: 6px; }

/* ---- Dashboard ---------------------------------------------------------------- */
.dashboard { display: flex; flex-direction: column; gap: 20px; }
.dash-hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 10px 4px 2px; }
.dash-hello h2 { font-size: 30px; font-weight: 500; letter-spacing: -.03em; margin: 0 0 2px; }
.dash-hello .help { margin: 0; font-size: 14px; }
.dash-hello-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-hello-actions .count { background: var(--yellow); color: var(--yellow-ink); margin-left: 2px; }
.dash-row { display: grid; gap: 20px; }
.dash-row-finance { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.dash-row-lists { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.dash-row-bottom { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.dash-row > .card, .dash-kpis > .card { min-width: 0; overflow-wrap: anywhere; }
.dash-chart .card-head { margin-bottom: 10px; align-items: flex-start; }
.dash-chart .card-head h2 .help { font-weight: 400; display: block; margin-top: 2px; }
.chart-wrap { position: relative; height: 240px; }
.dash-kpis { display: grid; grid-template-rows: auto 1fr 1fr; gap: 20px; }
.kpi { padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.kpi-label { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.kpi-label::first-letter { text-transform: uppercase; }
.kpi-value { font-size: 32px; font-weight: 500; letter-spacing: -.035em; line-height: 1.1; }
.kpi-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 13px; }
.kpi-hero { position: relative; overflow: hidden; border-color: transparent; color: var(--navy); background: #fff; }
.kpi-hero::before { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(135deg, var(--yellow) 0%, color-mix(in srgb, var(--sky) 75%, #fff) 50%, var(--lilac) 100%); opacity: .9; }
.kpi-hero > * { position: relative; z-index: 1; }
.kpi-hero .kpi-label { color: rgba(8, 17, 34, .62); }
.kpi-hero .kpi-value { font-size: 38px; }
.kpi-hero .kpi-value.text-negative { color: var(--negative); }
.kpi-hero .badge { background: rgba(255, 255, 255, .6); color: var(--navy); }
.kpi-hero .badge-warning { background: rgba(255, 255, 255, .7); color: var(--warning); }
.kpi-hero .delta { background: var(--navy); color: #fff; }
.kpi-hero .delta-bad { background: var(--negative); color: #fff; }
.delta { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--pill); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta-good { background: var(--positive-soft); color: var(--positive); }
.delta-bad { background: var(--negative-soft); color: var(--negative); }

.dash-pipeline .card-head { flex-wrap: wrap; }
.dash-pipeline-stats { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.dash-pipeline-stats strong { color: var(--ink); font-weight: 600; font-size: 15px; margin-right: 3px; }
.stage-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.stage-lane { background: var(--surface-2); border-radius: var(--radius-md); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 124px; }
.stage-lane-head { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; padding: 2px 4px 4px; }
.stage-lane-head .stage-dot { margin: 0; }
.stage-lane-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-lane-head .count { background: var(--surface); }
.stage-lane-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 24px 0; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.mini-lead { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 22, 38, .04); transition: box-shadow var(--ease), transform var(--ease); }
.mini-lead:hover { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.mini-lead.is-cold { box-shadow: inset 3px 0 0 var(--warning), 0 1px 2px rgba(15, 22, 38, .04); }
.mini-lead-name { font-weight: 600; font-size: 14px; }
.mini-lead-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.stage-lane-more { font-size: 13px; font-weight: 500; text-align: center; padding: 4px; color: var(--ink-2); }

.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dash-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-list .thumb-mini { flex: 0 0 auto; }
.thumb-blank { background: var(--surface-2); }
.dash-list-main { min-width: 0; flex: 1 1 auto; }
.dash-list-title { font-weight: 600; color: var(--ink); display: block; overflow-wrap: anywhere; }
.dash-list-meta { font-size: 13px; color: var(--ink-3); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.dash-empty { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 14px; padding: 6px 0; }
.dash-empty-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--positive-soft); color: var(--positive); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.dash-recent .timeline .tl-item { padding: 12px 0; }
.dash-system .dl { margin: 0; }
.status-ok { color: var(--positive); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---- Stats ------------------------------------------------------------------ */
.stat-row { display: flex; gap: 10px 32px; flex-wrap: wrap; margin-bottom: 12px; }
.stat-value { font-size: 28px; font-weight: 500; letter-spacing: -.03em; line-height: 1.15; }
.stat-label { font-size: 13px; color: var(--ink-3); font-weight: 500; margin-top: 2px; }
.stat-label::first-letter { text-transform: uppercase; }
.stat-row-finance { gap: 10px 36px; margin-bottom: 18px; }
.stat-row-finance .stat-value { font-size: 24px; }
.dashboard h3 { margin-top: 10px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.cold-list { list-style: none; margin: 0 0 8px; padding: 0; }
.cold-list li { padding: 8px 0; display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.cold-list li:last-child { border-bottom: 0; }
.cold-list a { font-weight: 500; }

/* ---- Tables ------------------------------------------------------------------- */
table.data { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data th, table.data td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 12.5px; color: var(--ink-3); font-weight: 500; background: transparent; }
table.data thead th:first-child { padding-left: 22px; }
table.data td:first-child { padding-left: 22px; }
table.data th:last-child, table.data td:last-child { padding-right: 22px; }
table.data tbody tr { transition: background var(--ease); }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tbody tr:hover td:first-child { border-top-left-radius: 0; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
table.data tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius); }
table.data tfoot th { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-size: 13px; }
table.data tfoot tr:last-child th:first-child { border-bottom-left-radius: var(--radius); }
table.data tfoot tr:last-child th:last-child { border-bottom-right-radius: var(--radius); }
table.data tfoot + tbody tr:last-child td, table.data tbody:has(+ tfoot) tr:last-child td { border-radius: 0; }
.row-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.tl-subject, .lead-name { overflow-wrap: anywhere; }
.sort-link { color: inherit; }
.sort-link.is-active { color: var(--ink); font-weight: 600; }
.tags-cell { color: var(--ink-3); font-size: 13px; }
tr.is-muted td { color: var(--ink-3); }
.table-actions { text-align: right; white-space: nowrap; }
.table-actions a, .table-actions .btn-link { padding: 6px 6px; display: inline-block; font-weight: 500; color: var(--ink-2); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; color: var(--ink-3); font-size: 13px; }
.pagination-links { display: flex; gap: 12px; align-items: center; }

/* ---- Forms ----------------------------------------------------------------- */
label { display: block; font-weight: 500; font-size: 13.5px; margin-bottom: 6px; color: var(--ink-2); }
input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="month"], input[type="datetime-local"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 14px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 12%, transparent); }
::placeholder { color: var(--ink-3); }
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA2AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-position: calc(100% - 12px) 50%; background-size: 16px 16px; background-repeat: no-repeat; padding-right: 36px; }
input[type="date"], input[type="month"], input[type="datetime-local"] { color-scheme: light; }
input[type="file"] { width: 100%; padding: 8px 0; font: inherit; }
.field { margin-bottom: 18px; }
.field-error { color: var(--negative); font-size: 13px; margin-top: 5px; }
.field .help { margin-top: 6px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1 1 0; min-width: 0; }
.field-row .field-narrow { flex: 0 0 120px; }
.form-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; max-width: 1040px; }
.form-columns .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.form-actions .spacer { flex: 1 1 auto; }
.lead-fields { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; min-height: 38px; cursor: pointer; color: var(--ink); }
.check input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--accent); }
.input-narrow { width: 110px !important; }
.code-block { display: inline-block; font-family: var(--mono); font-size: 15px; padding: 6px 12px; background: var(--surface-2); border-radius: var(--radius-sm); letter-spacing: .04em; user-select: all; }

/* ---- Alerts and toasts ---------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-md); background: var(--surface-2); margin-bottom: 16px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; margin-top: 7px; opacity: .8; }
.alert-error, .alert-negative { background: var(--negative-soft); color: var(--negative); }
.alert-success { background: var(--positive-soft); color: var(--positive); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: #1F4E7A; }
@media (prefers-color-scheme: dark) { .alert-info { color: #9CC6F5; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: var(--pill); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; max-width: 380px; animation: toast-in 180ms cubic-bezier(.2, .7, .3, 1); }
.toast.error { background: var(--negative); }
.toast.success { background: var(--positive); }
.toast.warning { background: var(--warning); }
.toast.is-leaving { opacity: 0; transition: opacity 300ms; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Filters, tabs, search dropdown, quick add ----------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 auto; }
.filters-row select, .filters-row input[type="search"], .filters-row input[type="date"], .filters-row input[type="number"], .filters-row input[type="month"] { width: auto; min-width: 140px; min-height: 40px; border-radius: var(--pill); padding-left: 16px; border-color: transparent; box-shadow: var(--shadow); }
.filters-row select { padding-right: 36px; }
.filters-search { flex: 1 1 260px; min-width: 200px; }
.filters-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.tabs { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: var(--pill); padding: 4px; margin-bottom: 22px; overflow-x: auto; max-width: 100%; }
.tabs a { padding: 8px 16px; color: var(--ink-2); font-weight: 500; font-size: 13.5px; border-radius: var(--pill); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background var(--ease), color var(--ease); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgba(15, 22, 38, .10); font-weight: 600; }
.tabs .count { background: var(--surface-3); }
.tabs a[aria-current="page"] .count { background: var(--surface-2); }

.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 340px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 30; max-height: 70vh; overflow-y: auto; padding: 8px; }
.search-group-title { padding: 8px 12px 4px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.search-item { display: block; padding: 9px 12px; color: var(--ink); border-radius: var(--radius-sm); }
.search-item:hover, .search-item:focus { background: var(--surface-2); text-decoration: none; outline: none; }
.search-item-name { font-weight: 600; }
.search-item-detail { display: block; font-size: 13px; color: var(--ink-3); }
.search-empty { padding: 12px; color: var(--ink-3); font-size: 14px; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.result-list li:last-child { border-bottom: 0; }
.result-list a { font-weight: 600; }

.quick-add { position: relative; }
.quick-add summary { list-style: none; cursor: pointer; }
.quick-add summary::-webkit-details-marker { display: none; }
.quick-add .menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; list-style: none; margin: 0; padding: 8px; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 30; }
.quick-add .menu a { display: block; padding: 9px 12px; color: var(--ink); border-radius: var(--radius-sm); min-height: 36px; font-weight: 500; }
.quick-add .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---- Record pages (company) ----------------------------------------------- */
.record-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; padding: 4px 2px 0; }
.record-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.record-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 14px; color: var(--ink-2); }
.meta-link { color: var(--ink-2); font-weight: 500; }
.status-form { display: inline-flex; gap: 6px; align-items: center; }
.status-select { width: auto; min-height: 32px; padding: 2px 32px 2px 14px; border-radius: var(--pill); font-weight: 600; font-size: 13px; border-color: transparent; }
.status-select.status-client { background-color: var(--positive-soft); color: var(--positive); }
.status-select.status-lead { background-color: var(--info-soft); color: #1F4E7A; }
.status-select.status-contact { background-color: var(--surface-2); color: var(--ink-2); }
.status-select.status-past_client { background-color: var(--warning-soft); color: var(--warning); }
.stage-select { min-width: 170px; }

/* ---- Activity timeline and tasks ------------------------------------------- */
.composer-card { margin-bottom: 20px; }
.composer-card .card-head { margin-bottom: 16px; }
.timeline-card { padding: 6px 24px; }
.type-toggle { display: inline-flex; gap: 2px; background: var(--surface-2); border: 0; border-radius: var(--pill); padding: 4px; margin: 0 0 18px; max-width: 100%; }
.type-option { flex: 1 1 0; margin: 0; }
.type-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.type-option span { display: flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 16px; font-weight: 500; font-size: 13.5px; color: var(--ink-2); cursor: pointer; border-radius: var(--pill); transition: background var(--ease), color var(--ease); }
.type-option input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.type-option input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.composer textarea { min-height: 80px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-item.is-pinned { background: var(--warning-soft); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--radius-md); border-bottom: 0; }
.tl-icon { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--ink-2); margin-top: 1px; }
.tl-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tl-call .tl-icon { background: var(--info-soft); color: #1F4E7A; }
.tl-meeting .tl-icon { background: var(--positive-soft); color: var(--positive); }
.tl-email .tl-icon { background: var(--warning-soft); color: var(--warning); }
.tl-note .tl-icon { background: color-mix(in srgb, var(--lilac) 55%, #fff); color: #4C47A8; }
.tl-task .tl-icon { background: transparent; }
@media (prefers-color-scheme: dark) { .tl-call .tl-icon { color: #9CC6F5; } .tl-note .tl-icon { background: #2A2A4A; color: #B9B4FF; } }
.tl-body { flex: 1 1 auto; min-width: 0; }
.tl-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--ink-3); margin-bottom: 2px; }
.tl-type { font-weight: 600; color: var(--ink-2); font-size: 12px; }
.tl-subject { font-weight: 600; }
.tl-text { margin-top: 2px; color: var(--ink); }
.tl-foot { margin-top: 6px; font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tl-company { font-weight: 600; color: var(--ink-2); }
.tl-actions { margin-left: auto; display: flex; gap: 10px; opacity: 0; transition: opacity var(--ease); }
.tl-item:hover .tl-actions, .tl-item:focus-within .tl-actions { opacity: 1; }
.tl-actions .btn-link { font-size: 13px; }
.tl-edit { margin-top: 8px; }
.tl-edit .field { margin-bottom: 8px; }
.is-done .tl-subject, .is-done .task-title { text-decoration: line-through; color: var(--ink-3); }

.task-check { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; cursor: pointer; }
.task-check input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--positive); cursor: pointer; border-radius: 50%; }
.task-group { margin-bottom: 24px; }
.task-group h2 { font-size: 14px; }
.task-group-overdue h2 { color: var(--negative); }
.task-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.task-list.compact { background: transparent; box-shadow: none; }
.task-row { display: flex; gap: 10px; align-items: flex-start; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-list.compact .task-row { padding: 8px 0; }
.task-main { flex: 1 1 auto; min-width: 0; }
.task-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.task-meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* ---- Pipeline board ----------------------------------------------------------- */
.pipeline-summary { color: var(--ink-2); font-size: 14px; padding-left: 6px; }
.board { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 12px; align-items: flex-start; scroll-snap-type: x proximity; }
.board-col { flex: 0 0 280px; width: 280px; background: var(--surface-2); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 230px); scroll-snap-align: start; }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 2px; }
.board-col-head h2 { font-size: 13.5px; margin: 0; flex: 1 1 auto; }
.board-col-head .count { background: var(--surface); }
.board-col-totals { padding: 0 16px 10px; font-size: 12.5px; color: var(--ink-3); }
.board-list { list-style: none; margin: 0; padding: 4px 8px 8px; overflow-y: auto; min-height: 60px; flex: 1 1 auto; }
.lead-card { background: var(--surface); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(15, 22, 38, .05); transition: box-shadow var(--ease), transform var(--ease); }
.lead-card:hover { box-shadow: var(--shadow-lg); }
.lead-card:active { cursor: grabbing; }
.lead-card.is-ghost { opacity: .4; }
.lead-card.is-chosen { box-shadow: var(--shadow-lg); transform: rotate(-.5deg); }
.lead-card.is-cold { box-shadow: inset 3px 0 0 var(--warning), 0 1px 2px rgba(15, 22, 38, .05); }
.lead-name { font-weight: 600; color: var(--ink); display: block; }
.lead-value { display: block; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.lead-contact { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.lead-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.lead-owner { margin-left: auto; }
.lead-task { font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.board-drop { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.drop-zone { flex: 0 0 220px; min-height: 54px; border: 2px dashed var(--line-strong); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--ink-3); transition: background var(--ease); }
.drop-zone .lead-card { display: none; }
.drop-won { border-color: var(--positive); color: var(--positive); }
.drop-won:hover { background: var(--positive-soft); }
.drop-lost { border-color: var(--negative); color: var(--negative); }
.drop-lost:hover { background: var(--negative-soft); }
.dialog { border: 0; border-radius: var(--radius); padding: 28px; max-width: 440px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(8, 17, 34, .45); backdrop-filter: blur(4px); }

.stage-list { list-style: none; margin: 0 0 20px; padding: 0; max-width: 800px; }
.stage-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-radius: var(--radius-md); margin-bottom: 8px; box-shadow: var(--shadow); }
.stage-row.is-fixed { background: var(--surface-2); box-shadow: none; }
.drag-handle { cursor: grab; color: var(--ink-3); width: 18px; text-align: center; user-select: none; }
.drag-handle-off { cursor: default; }
.stage-form { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; flex-wrap: wrap; }
.stage-form input[type="text"] { flex: 1 1 160px; min-height: 36px; }
.colour-input { width: 36px; height: 36px; min-height: 0; padding: 3px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); cursor: pointer; }
.stage-prob { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--ink-2); }
.stage-prob input { width: 64px; min-height: 36px; }

/* ---- Retainers, finances ---------------------------------------------------- */
.deliverables { list-style: none; margin: 0 0 12px; padding: 0; }
.deliverable-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.deliverable-row:last-child { border-bottom: 0; }
.deliverable-form { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; flex-wrap: wrap; }
.deliverable-form input[type="text"] { min-height: 36px; }
.deliverable-form input.qty { flex: 0 0 64px; width: 64px; text-align: center; }
.deliverable-form input:not(.qty) { flex: 1 1 160px; }
.deliverable-form select { width: auto; min-height: 36px; }
.add-form { padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.month-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.month-form input[type="month"] { width: auto; min-height: 36px; }
.month-title { margin: 0 0 0 8px; font-size: 18px; font-weight: 500; }
.chart-card { margin-bottom: 18px; }
.chart-card canvas { max-height: 280px; }
.copy-details { position: relative; }
.copy-details summary { list-style: none; }
.copy-details summary::-webkit-details-marker { display: none; }
.copy-form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 340px; max-width: 90vw; background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 16px; }
.copy-form .check { display: flex; min-height: 32px; font-weight: 400; }
.copy-form .check .help { margin-left: auto; }
.clients-table .is-low-margin td { background: var(--warning-soft); }

/* ---- Import, audit, settings ------------------------------------------------- */
.map-table select { min-width: 200px; }
.preview-table tr.is-error td { background: var(--negative-soft); }
.audit-table td { font-size: 13px; }
.audit-table code { font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
.diff { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; }
.diff dt { color: var(--ink-3); }
.diff dd { margin: 0; word-break: break-word; }
.diff-old { color: var(--negative); text-decoration: line-through; }
.diff-new { color: var(--positive); }
.qr-wrap { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.qr { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: var(--radius-md); flex: 0 0 auto; box-shadow: var(--shadow); }
.qr svg { width: 100%; height: 100%; }
.recovery-codes { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.recovery-codes code { display: block; font-family: var(--mono); font-size: 16px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); text-align: center; user-select: all; }
.skip-form { margin-top: 16px; text-align: center; }

/* ---- Approvals inside the CRM ------------------------------------------------ */
.thumb-cell { width: 56px; padding-right: 0 !important; }
.thumb-mini { width: 44px; height: 55px; object-fit: cover; border-radius: 10px; display: block; background: var(--surface-2); }
.approvals-table tr.is-pending .row-title { color: var(--ink); }
.note-preview { max-width: 240px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 10px; }
.gallery .tile { position: relative; display: block; aspect-ratio: 4 / 5; background: #0b1220; border-radius: 12px; overflow: hidden; }
.gallery .tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .tile-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; opacity: .8; padding: 8px; text-align: center; }
.gallery .tile-num { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--pill); background: rgba(8, 17, 34, .78); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.gallery .tile:hover img { opacity: .92; }
.gallery-single { grid-template-columns: 1fr; }
.gallery-single .tile { aspect-ratio: auto; background: transparent; }
.gallery-single .tile img { height: auto; object-fit: contain; border-radius: 12px; }
.gallery-single .tile-num { display: none; }
.gallery.mini { grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.gallery.mini .tile { background: var(--surface-2); border-radius: 10px; }
.gallery.mini.gallery-single { grid-template-columns: minmax(0, 320px); }
.gallery.mini .tile-num { left: 6px; bottom: 6px; padding: 1px 6px; font-size: 10px; }
.gallery.mini .tile-empty { color: var(--ink-3); font-size: 11px; }
.caption-block { margin: 12px 0; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius-md); }
.caption-label { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-bottom: 2px; }
.caption-text { white-space: pre-wrap; }

/* ---- Client-facing pages (approval): Dreambound brand ------------------------ */
body.public {
  --db-navy: #081122; --db-yellow: #f5fe90; --db-bg: #fbfaf9; --db-grey: #6b7280; --db-line: #e5e5e5;
  display: block; padding: 20px 10px 32px; background: var(--db-bg); color: var(--db-navy);
}
.public-wrap { max-width: 540px; margin: 0 auto; }
.public-head { display: flex; justify-content: space-between; align-items: center; background: var(--db-navy); border-radius: 16px 16px 0 0; padding: 22px 24px; }
.public-logo img { display: block; width: 132px; height: auto; }
.public-kicker { color: var(--db-yellow); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.public-card { background: #fff; border: 1px solid var(--db-line); border-top: 0; border-radius: 0 0 16px 16px; padding: 28px 24px 26px; box-shadow: none; }
.public-card h1 { font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-size: 27px; line-height: 1.2; margin: 0 0 14px; color: var(--db-navy); letter-spacing: 0; }
.public-card p, .public-card .help { color: var(--db-navy); }
.public-card .help { color: var(--db-grey); font-size: 14px; }
.public-card a { color: var(--db-navy); text-decoration: underline; }
.public-card .btn { border-radius: 999px; font-weight: 700; border: 2px solid var(--db-navy); background: #fff; color: var(--db-navy); box-shadow: none; }
.public-card .btn-primary { background: var(--db-yellow); border-color: var(--db-yellow); color: var(--db-navy); }
.public-card .btn-primary:hover { background: #eef98a; border-color: #eef98a; filter: none; }
.public-card .btn-big { min-height: 54px; font-size: 17px; }
.public-card textarea { border-color: var(--db-line); border-radius: 12px; background: var(--db-bg); color: var(--db-navy); }
.public-card textarea:focus-visible { outline-color: var(--db-navy); border-color: var(--db-navy); box-shadow: none; }
.public-card .quote { margin: 0 0 16px; padding: 10px 14px; background: var(--db-bg); border-left: 4px solid var(--db-yellow); border-radius: 10px; white-space: pre-wrap; color: var(--db-navy); }
.public-card .alert-error { background: #ffdede; color: #8a1c1c; }
.public-card .alert::before { display: none; }
.public-card .kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--db-grey); margin-bottom: 6px; }
.public-card .meta { color: var(--db-grey); font-size: 14px; margin: -6px 0 16px; }
.public-card .gallery .tile { border: 1px solid var(--db-line); }
.public-card .gallery-single .tile img { border: 1px solid var(--db-line); }
.public-card .caption-block { margin: 18px 0 6px; padding: 12px 14px; background: var(--db-bg); border-radius: 10px; }
.public-card .caption-label { color: var(--db-grey); letter-spacing: .12em; margin-bottom: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.public-card .caption-text { font-size: 15px; line-height: 1.55; color: var(--db-navy); }
.approve-form { margin-top: 16px; }
.public-foot { text-align: center; font-size: 12px; color: var(--db-grey); margin-top: 18px; }
.public-foot a { color: var(--db-grey); }
@media (prefers-color-scheme: dark) { body.public { background: var(--db-bg); color: var(--db-navy); } .public-card { background: #fff; } }

/* ---- Responsive ------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .content, .topbar { padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: auto; height: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    flex-direction: row; gap: 0; z-index: 20; border-right: 0; border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -16px rgba(15, 22, 38, .18);
  }
  .brand, .sidebar-user { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 3px; min-height: var(--touch); padding: 6px 2px; font-size: 10.5px; flex: 1 1 0; border-radius: var(--radius-sm); }
  .nav a[aria-current="page"]::after { display: none; }
  .nav-icon { width: 22px; height: 22px; }
  .topbar { padding: 0 16px; gap: 8px; height: 64px; }
  .page-title { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
  .topbar-actions { flex: 1 1 auto; justify-content: flex-end; }
  .search { flex: 1 1 auto; }
  .search input { width: 100%; max-width: none; }
  .search-results { position: fixed; left: 8px; right: 8px; top: 68px; min-width: 0; }
  .quick-add summary { padding: 0 14px; min-height: 38px; }
  .quick-add .menu { position: fixed; left: 8px; right: 8px; top: 68px; }
  .content { padding: 4px 16px calc(92px + env(safe-area-inset-bottom)); }
  .btn { min-height: var(--touch); }
  .btn-small { min-height: 36px; }
  .card { padding: 18px; border-radius: 18px; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; }
  table.data tr { padding: 12px 18px; border-bottom: 1px solid var(--line); }
  table.data tbody tr:hover td { background: transparent; }
  table.data td, table.data td:first-child, table.data td:last-child { padding: 4px 0; border: 0; display: flex; gap: 8px; border-radius: 0; }
  table.data td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-size: 12px; min-width: 96px; flex: 0 0 auto; }
  table.data td.table-actions { justify-content: flex-start; }
  table.data tfoot { display: block; padding: 8px 18px; }
  table.data tfoot tr, table.data tfoot th { display: inline-block; border: 0; padding: 2px 8px 2px 0; }
  .thumb-cell { display: none !important; }
  .recovery-codes { grid-template-columns: 1fr; }
  .filters-row select, .filters-row input[type="search"] { width: 100%; }
  .filters-actions { width: 100%; }
  .filters-actions .btn { flex: 1 1 0; }
  .field-row { flex-direction: column; gap: 0; }
  .field-row .field-narrow { flex: 1 1 auto; }
  .record-header { flex-direction: column; }
  .dl { grid-template-columns: 1fr; gap: 0; }
  .dl dt { margin-top: 6px; }
  .stat-row { gap: 12px 18px; }
  .stat-value { font-size: 22px; }
  .stat-row-finance { gap: 14px 20px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 45%; }
  .tabs { display: flex; }
  .tabs a { padding: 8px 12px; }
  .type-toggle { display: flex; }
  .type-option span { font-size: 13px; padding: 0 4px; }
  .tl-actions { opacity: 1; margin-left: 0; width: 100%; }
  .board-col { flex: 0 0 85vw; width: 85vw; max-height: none; }
  .drop-zone { flex: 1 1 0; }
  .lead-card { cursor: default; }
  .deliverable-form input.qty { flex: 0 0 56px; width: 56px; }
  .copy-form { position: static; width: auto; margin-top: 8px; }
  .diff { grid-template-columns: 1fr; }
  .audit-table td[data-label]::before { min-width: 70px; }
  .gallery.mini { grid-template-columns: repeat(3, 1fr); }
  .dash-row-finance, .dash-row-bottom { grid-template-columns: 1fr; }
  .dash-kpis { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .dash-kpis .kpi-hero { grid-column: 1 / -1; }
  .chart-wrap { height: 200px; }
  .stage-strip { grid-auto-columns: 78vw; }
  .dash-hello h2 { font-size: 24px; }
  .work-col { flex: 0 0 85vw; width: 85vw; max-height: none; }
  .task-card { cursor: default; }
  .drawer-grid { grid-template-columns: 1fr; }
  .drawer-panel { padding: 16px 16px 90px; }
  .project-head { align-items: flex-start; }
  .task-line { padding-left: 14px; padding-right: 14px; flex-wrap: wrap; }
  .task-line-meta { width: 100%; padding-left: 28px; }
  .list-group > summary { padding: 12px 16px; }
  .minimal-card { padding: 26px 20px; }
  .empty-state { padding: 28px 18px; }
}
@media (max-width: 480px) {
  body.public { padding: 10px 8px 24px; }
  .public-head { padding: 18px; }
  .public-card { padding: 22px 18px; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 6px; }
}
@media (prefers-color-scheme: dark) {
  input[type="date"], input[type="month"], input[type="datetime-local"] { color-scheme: dark; }
  .qr { background: #fff; }
  .lead-card, .mini-lead { box-shadow: none; }
  .kpi-hero { color: var(--navy); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .toasts, .filters, .tl-actions, .table-actions { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card, table.data { box-shadow: none; }
}
