/* =====================================================================
   Chopart Design Pipeline — dark UI
   One stylesheet, no build step. Colours are CSS variables at the top.
   ===================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --bg: #0E0E10;
  --surface: #17171A;
  --surface-2: #1E1E22;
  --surface-3: #26262C;
  --surface-hover: #222227;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #EDEDEF;           /* 16:1 on --bg */
  --text-2: #A1A1AA;         /* 7.6:1 on --bg */
  --text-3: #8B8B95;         /* 5.4:1 on --surface (AA) */
  /* Brand: black and white, red used sparingly (logo mark, active nav, focus, selected underline, small highlights). */
  --brand: #E0262F;          /* Chopart red: tune here */
  --brand-text: #FF6B72;     /* red for text on dark: 6.1:1 on --bg */
  --brand-soft: rgba(224, 38, 47, 0.14);
  /* Primary action = white button with black text. */
  --accent: #FFFFFF;
  --accent-hover: #E6E6EA;
  --accent-ink: #0E0E10;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-text: var(--brand-text);
  /* Semantic colours. Red is ONLY for Overdue and the brand; other warnings are amber/orange. */
  --green: #4ADE80;
  --amber: #FBBF24;
  --orange: #FB923C;
  --warn: var(--orange);     /* errors, over capacity, destructive buttons */
  --red: var(--brand);       /* overdue only */
  --red-text: var(--brand-text);
  --blue: #60A5FA;
  /* Status colours (defaults; config.php can override per status, the UI reads --c from there). */
  --status-todo: #8A8A94;
  --status-in_progress: #3B82F6;
  --status-review: #EAB308;
  --status-with_client: #A855F7;
  --status-revisions: #F97316;
  --status-on_hold: #748AA6;
  --status-complete: #22C55E;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --fast: 160ms;
  --sidebar: 232px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01", "ss03";
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--brand-text); text-decoration: underline; text-underline-offset: 2px; }
a.btn:hover, a.nav-item:hover, a.att-main:hover { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(224, 38, 47, 0.35); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.quiet { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #33333a transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c2c33; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Boot ---------- */
.boot { height: 100vh; height: 100dvh; display: grid; place-items: center; }
.boot-logo, .logo-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: 0 6px 24px -6px rgba(224, 38, 47, .6);
}
.boot-logo { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100vh; height: 100dvh; min-height: 0; }
.sidebar {
  background: #121215; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .logo-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }
.brand-name { font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.brand-sub { font-size: 11px; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: var(--text-2); font-weight: 500; border: 0; background: none; text-align: left; width: 100%;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-item { position: relative; }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--brand); }
.nav-item.active .icon { color: var(--brand-text); }
.nav-item .count { margin-left: auto; font-size: 11px; color: var(--text-3); background: var(--surface-2); padding: 1px 7px; border-radius: 20px; }
.nav-item .count.alert { color: var(--red-text); background: var(--brand-soft); }
.nav-section { margin-top: 14px; padding: 6px 10px; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.sidebar-actions { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px 6px 0; border-top: 1px solid var(--border); }
.me-btn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; border: 0; background: none; padding: 6px; border-radius: 9px; text-align: left; }
.me-btn:hover { background: var(--surface); }
.me-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

.main { overflow: auto; min-width: 0; min-height: 0; position: relative; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.page { padding: 26px 32px 48px; max-width: 1680px; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Icons ---------- */
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 13px; height: 13px; }
.icon.lg { width: 20px; height: 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-weight: 550; font-size: 13px; white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease), opacity var(--fast);
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 18px -10px rgba(255, 255, 255, .5); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--warn); }
.btn.danger:hover { background: rgba(251, 146, 60, .12); border-color: rgba(251, 146, 60, .3); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.sm.icon-only { width: 28px; }
.btn.side-quest { background: rgba(45, 212, 191, .1); border-color: rgba(45, 212, 191, .25); color: #5EEAD4; }
.btn.side-quest:hover { background: rgba(45, 212, 191, .18); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); transition: border-color var(--fast), box-shadow var(--fast);
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.sm, .select.sm { height: 30px; font-size: 13px; padding: 0 9px; border-radius: 8px; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A1A1AA' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 15px; }
.select option { background: var(--surface-2); }
input[type="date"], input[type="month"] { color-scheme: dark; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--warn); font-size: 13px; min-height: 18px; }
.hint { font-size: 12px; color: var(--text-3); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); font-size: 13px; user-select: none; }
.checkbox input { accent-color: var(--brand); width: 15px; height: 15px; }

.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 500; transition: background var(--fast), color var(--fast); }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface-3); color: var(--text); }

/* ---------- Pills & tags ---------- */
.pill {
  --c: #A1A1AA;
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px 0 9px; border-radius: 9px;
  color: var(--c); background: color-mix(in srgb, var(--c) 15%, #101013);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  font-size: 13px; font-weight: 650; letter-spacing: -.005em; white-space: nowrap; line-height: 1;
}
.pill .icon { width: 14px; height: 14px; stroke-width: 2.3; color: var(--c); }
button.pill { cursor: pointer; transition: background var(--fast), border-color var(--fast), transform var(--fast); }
button.pill:hover { background: color-mix(in srgb, var(--c) 24%, #101013); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
button.pill:active { transform: scale(.97); }
button.pill .chev { opacity: .6; margin-left: -1px; width: 12px; height: 12px; }
.pill.overdue { --c: var(--red-text); }
.tag {
  --c: #A1A1AA;
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 7px;
  font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-2); white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
}
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.tag.side { color: #5EEAD4; background: rgba(45, 212, 191, .12); }
.tag.refresh { color: #93C5FD; background: rgba(96, 165, 250, .12); }
.tag.prio-high { color: var(--amber); background: rgba(251, 191, 36, .12); }
.tag.prio-urgent { color: var(--orange); background: rgba(251, 146, 60, .14); }
.due { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.due.soon { color: var(--amber); }
.due.late { color: var(--red-text); font-weight: 600; }

/* ---------- Avatars & load ---------- */
.avatar {
  --c: #8A8A94;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.avatar.none { background: var(--surface-3); color: var(--text-2); }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar.img { background: var(--surface-3); }
.photo-row { display: flex; gap: 14px; align-items: flex-start; }
.photo-big { flex: none; }
.brand-logo { height: 22px; width: auto; display: block; }
.brand { flex-direction: column; align-items: flex-start; gap: 6px; }
.auth-brand { align-items: center; }
.auth-brand .brand-logo { height: 30px; }
.load { display: flex; align-items: center; gap: 8px; }
.load-bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 50px; }
.load-fill { height: 100%; border-radius: 99px; width: 0; transition: width 300ms var(--ease), background var(--fast); }
.load-fill.green { background: var(--green); }
.load-fill.amber { background: var(--amber); }
.load-fill.red { background: var(--orange); }
.load-num { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.load-num b { color: var(--text); font-weight: 600; }
.load-num.red b { color: var(--orange); }

/* ---------- Dashboard tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 14px;
  text-align: left; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
  transition: transform var(--fast) var(--ease), border-color var(--fast), background var(--fast);
}
.tile:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.tile.on { border-color: var(--border-strong); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); box-shadow: inset 0 3px 0 var(--brand); }
.tile-num { font-size: 32px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.tile-bar { height: 3px; background: var(--surface-3); border-radius: 9px; margin-top: 8px; overflow: hidden; }
.tile-bar > div { height: 100%; border-radius: 9px; }
.tile.red .tile-num { color: var(--red-text); }

.team-load {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px;
}
.team-load .who { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; margin-bottom: 5px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .select.sm { width: auto; min-width: 140px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 11px; border-radius: 99px;
  background: var(--accent-soft); color: var(--text); font-size: 12px; font-weight: 600; border: 0;
}
.chip button { border: 0; background: none; color: inherit; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; padding: 0; }
.chip button:hover { background: rgba(255, 255, 255, .08); }

/* ---------- My tasks: status board + layout switch ---------- */
.layout-switch button { display: inline-flex; align-items: center; gap: 6px; }
.status-col { width: 260px; }
.status-col .col-head { padding: 12px 12px 10px; }
.status-col .col-title { gap: 8px; }
.status-col .col-count { margin-left: auto; }
.board.by-status .col-body { min-height: 120px; }

/* ---------- Links & files ---------- */
.count-pill { font-size: 11px; color: var(--text-3); background: var(--surface-2); padding: 0 7px; border-radius: 99px; line-height: 18px; text-transform: none; letter-spacing: 0; }
.att-box .box-title { flex-wrap: wrap; row-gap: 8px; }
.att-box .box-title > .row { flex-wrap: wrap; }
.att-box.drop { border-color: var(--text); background: var(--surface-2); }
.att-list { display: flex; flex-direction: column; gap: 6px; }
.att-item { display: flex; align-items: center; gap: 6px; }
.att-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); text-decoration: none; transition: border-color var(--fast), background var(--fast); }
.att-main:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.att-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.att-ic.link { background: var(--accent-soft); color: var(--text); }
.att-ic.file { background: rgba(34, 211, 238, .12); color: #67E8F9; }
.att-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.att-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-form { display: flex; flex-direction: column; gap: 8px; }
.att-pasted { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.att-progress { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--brand); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Board ---------- */
.board { display: flex; gap: 18px; align-items: flex-start; overflow-x: auto; padding-bottom: 18px; min-height: 360px; overscroll-behavior-x: contain; }
.col {
  width: 312px; flex: none; background: #131316; border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; min-height: 0;
  transition: border-color var(--fast), background var(--fast);
}
.col.drop { border-color: var(--text); background: var(--surface-2); }
.col.unassigned { background: #16130f; border-color: rgba(251, 191, 36, .16); }
.col-head { padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 9px; border-bottom: 1px solid var(--border); }
.col-title { display: flex; align-items: center; gap: 9px; }
.col-name { font-weight: 650; font-size: 14px; }
.col-role { font-size: 11px; color: var(--text-3); }
.col-count { margin-left: auto; font-size: 12px; color: var(--text-3); }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 80px; }
.col-empty { color: var(--text-3); font-size: 12px; text-align: center; padding: 18px 8px; border: 1px dashed var(--border-strong); border-radius: 12px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 13px 13px 11px;
  display: flex; flex-direction: column; gap: 9px; cursor: pointer; position: relative; text-align: left; width: 100%;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), border-color var(--fast), opacity var(--fast);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card { box-shadow: inset 3px 0 0 var(--sc, transparent); }
.card.overdue { border-color: rgba(224, 38, 47, .4); box-shadow: inset 3px 0 0 var(--red); }
.card.done { opacity: .62; }
.card.dragging { opacity: .35; transform: scale(.98); }
.card.ghost-in { animation: cardIn 220ms var(--ease); }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.card-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.35; color: var(--text); word-break: break-word; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-foot { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.card-foot .grow { min-width: 0; }
.card .reassign {
  position: absolute; top: 9px; right: 9px; opacity: 0; transition: opacity var(--fast);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); border-radius: 8px; height: 26px; padding: 0 7px;
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px;
}
.card:hover .reassign, .card .reassign:focus-visible { opacity: 1; }
.card .reassign:hover { color: var(--text); background: var(--surface-3); }

/* ---------- Lists (My tasks, Pipeline) ---------- */
.group { margin-bottom: 26px; }
.group-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.group-title { font-size: 13px; font-weight: 650; letter-spacing: .01em; }
.group-count { font-size: 12px; color: var(--text-3); background: var(--surface-2); padding: 1px 8px; border-radius: 99px; }
.group-title.red { color: var(--red-text); }
.list { display: flex; flex-direction: column; gap: 6px; }
.list-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast) var(--ease);
}
.list-row:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.list-row { box-shadow: inset 3px 0 0 var(--sc, transparent); }
.list-row.overdue { box-shadow: inset 3px 0 0 var(--red); }
.list-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.list-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.list-row.detailed { align-items: start; padding: 13px 14px; }
.list-row.detailed > .pill, .list-row.detailed > .due, .list-row.detailed > div:last-child { margin-top: 2px; }
.list-brief { font-size: 13px; line-height: 1.45; color: var(--text-2, #b7b7bf); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; margin-top: 2px; }
.list-brief.quiet { font-style: italic; }
.list-details { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 4px; }
.detail { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 7px; background: color-mix(in srgb, var(--text) 5%, transparent); border: 1px solid var(--border); font-size: 12px; color: var(--text); white-space: nowrap; }
.detail .k { color: var(--muted); }
.detail .v { font-weight: 500; }
.detail.quiet { color: var(--muted); }
.detail.quiet .v { font-weight: 400; }
.detail > svg { color: var(--muted); flex: none; }
.detail.person { padding-left: 3px; }
.detail.person .avatar.sm { width: 18px; height: 18px; font-size: 9px; }
.card-brief { font-size: 12.5px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.card-count { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; }

.ptable { width: 100%; border-collapse: separate; border-spacing: 0 5px; }
.ptable th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 12px; white-space: nowrap; user-select: none;
}
.ptable th.sortable { cursor: pointer; }
.ptable th.sortable:hover { color: var(--text); }
.ptable th .icon { vertical-align: -2px; margin-left: 3px; }
.ptable td { background: var(--surface); padding: 10px 12px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); vertical-align: middle; }
.ptable td:first-child { border-left: 1px solid var(--border); border-radius: 11px 0 0 11px; }
.ptable td:last-child { border-right: 1px solid var(--border); border-radius: 0 11px 11px 0; }
.ptable tbody tr { cursor: pointer; }
.ptable tbody tr:hover td { background: var(--surface-hover); }
.ptable tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.ptable .id { color: var(--text-3); font-variant-numeric: tabular-nums; width: 60px; }
.ptable .ttl { font-weight: 600; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptable.plain tbody tr { cursor: default; }
.ptable tr.subtotal td { background: var(--surface-2); font-weight: 650; }
.ptable tr.total td { background: var(--surface-3); font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-dow { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 0 6px; }
.cal-day { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; min-height: 118px; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.cal-day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.cal-day.past { opacity: .55; }
.cal-day.weekend { background: #141417; }
.cal-date { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; justify-content: space-between; }
.cal-day.today .cal-date { color: var(--brand-text); }
.cal-item {
  --c: #A1A1AA;
  font-size: 11.5px; padding: 4px 7px; border-radius: 7px; background: color-mix(in srgb, var(--c) 13%, transparent);
  color: var(--text); border: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
  box-shadow: inset 2px 0 0 var(--c);
}
.cal-item:hover { background: color-mix(in srgb, var(--c) 22%, transparent); }
.cal-more { font-size: 11px; color: var(--text-3); padding-left: 4px; }

/* ---------- Panels, modals, menus ---------- */
.overlay { position: fixed; inset: 0; background: rgba(5, 5, 7, .55); backdrop-filter: blur(2px); z-index: 40; opacity: 0; transition: opacity 180ms var(--ease); }
.overlay.show { opacity: 1; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: #141417; border-left: 1px solid var(--border-strong);
  z-index: 41; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 200ms var(--ease); box-shadow: var(--shadow-lg);
}
.panel.show { transform: none; }
.panel-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.panel-body { overflow-y: auto; padding: 18px 22px 30px; display: flex; flex-direction: column; gap: 20px; }
.panel-title { font-size: 19px; font-weight: 700; letter-spacing: -.015em; line-height: 1.3; margin: 0; word-break: break-word; }
.panel-title-input { font-size: 18px; font-weight: 700; height: 42px; }
.panel-id { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.props { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; align-items: center; }
.props .k { color: var(--text-3); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.props .v { min-width: 0; font-size: 13.5px; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.box-title { font-size: 12px; font-weight: 650; color: var(--text-2); margin-bottom: 10px; display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: .05em; }
.dl-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dl-stats .n { font-size: 18px; font-weight: 700; }
.dl-stats .l { font-size: 11.5px; color: var(--text-3); }
.links a { display: flex; align-items: center; gap: 6px; padding: 3px 0; word-break: break-all; }
.brief { white-space: pre-wrap; word-break: break-word; color: var(--text); font-size: 13.5px; line-height: 1.6; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 9px 12px; color: var(--text-2); font-weight: 550; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--brand); }
.comment { display: flex; gap: 10px; padding: 8px 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.comment-meta b { color: var(--text); font-weight: 600; }
.comment-text { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.composer { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.composer .textarea { min-height: 64px; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 10px; padding: 7px 0; font-size: 13px; position: relative; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); margin-top: 6px; flex: none; box-shadow: 0 0 0 3px #141417; }
.tl-dot.status { background: var(--blue); }
.tl-dot.deadline { background: var(--amber); }
.tl-dot.assignee { background: #C084FC; }
.tl-dot.approved { background: var(--green); }
.tl-text { flex: 1; color: var(--text-2); }
.tl-text b { color: var(--text); font-weight: 600; }
.tl-time { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.panel-foot { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal {
  position: relative; z-index: 61; width: min(620px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow: auto; overscroll-behavior: contain;
  background: #16161A; border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.98); opacity: 0; transition: transform 190ms var(--ease), opacity 190ms var(--ease);
}
.modal.show { transform: none; opacity: 1; }
.modal.small { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 6px; }
.modal-title { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.modal-body { padding: 14px 22px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; }

.menu {
  position: fixed; z-index: 80; min-width: 200px; max-width: 320px; max-height: min(360px, calc(100dvh - 24px)); overflow-y: auto; overscroll-behavior: contain;
  background: #1C1C21; border: 1px solid var(--border-strong); border-radius: 12px; padding: 5px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-4px); transition: opacity 140ms var(--ease), transform 140ms var(--ease);
}
.menu.show { opacity: 1; transform: none; }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; border: 0; background: none; border-radius: 8px;
  text-align: left; color: var(--text); font-size: 13px;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item.current { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--brand); }
.menu-item .load { width: 90px; margin-left: auto; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.menu-label { font-size: 11px; color: var(--text-3); padding: 6px 9px 4px; text-transform: uppercase; letter-spacing: .05em; }

/* Person picker (new task form) */
.picker { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg); max-height: 220px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.picker .menu-item.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--brand); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px; background: #222228; border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 10px 14px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 420px;
  animation: toastIn 200ms var(--ease);
}
.toast.err { border-color: rgba(251, 146, 60, .45); }
.toast.err .icon { color: var(--warn); }
.toast.ok .icon { color: var(--green); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all 180ms var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Skeletons & empty states ---------- */
.skel { background: linear-gradient(90deg, #18181c 0%, #222227 50%, #18181c 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel.card-s { height: 96px; }
.skel.line { height: 14px; border-radius: 6px; }
.skel.tile-s { height: 92px; border-radius: var(--radius); }
.skel.row-s { height: 52px; }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 46px 20px;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 16px; color: var(--text-2);
}
.empty .art { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--text); }
.empty .art .icon { width: 22px; height: 22px; }
.empty-title { font-weight: 650; color: var(--text); font-size: 15px; }

/* ---------- Auth screens ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 70% -10%, rgba(224, 38, 47, .10), transparent 60%), radial-gradient(700px 400px at 0% 110%, rgba(255, 255, 255, .04), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); background: rgba(23, 23, 26, .9); border: 1px solid var(--border-strong); border-radius: 20px; padding: 30px 28px; box-shadow: var(--shadow-lg); }
.auth-card .brand { padding: 0 0 22px; }
.auth-title { font-size: 21px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.02em; }
.auth-sub { color: var(--text-2); margin: 0 0 22px; font-size: 13.5px; }

/* ---------- Admin ---------- */
.admin-row {
  display: grid; grid-template-columns: minmax(180px, 1.4fr) 110px 120px 110px minmax(110px, 1fr) 330px; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
}
.admin-row.inactive { opacity: .6; }
.admin-head { display: grid; grid-template-columns: minmax(180px, 1.4fr) 110px 120px 110px minmax(110px, 1fr) 330px; gap: 14px; padding: 0 14px 6px; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.badge.ok { background: rgba(74, 222, 128, .12); color: var(--green); }
.badge.warn { background: rgba(251, 191, 36, .12); color: var(--amber); }
.badge.bad { background: rgba(251, 146, 60, .12); color: var(--orange); }
.client-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.client-row.sub { margin-left: 34px; background: #151518; }
.client-row.inactive { opacity: .55; }
.swatch { width: 14px; height: 14px; border-radius: 5px; flex: none; }
.colour-input { width: 44px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); }
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.health-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.health-card .big { font-size: 18px; font-weight: 700; }
.errors { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.errors .e { padding: 8px 10px; border-bottom: 1px solid var(--border); word-break: break-word; }
.errors .e .t { color: var(--text-3); margin-right: 8px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; font-size: 13px; }
.kv .k { color: var(--text-3); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--bg); border: 1px solid var(--border); padding: 2px 6px; border-radius: 6px; }
.temp-pw { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .04em; padding: 12px 14px; background: var(--bg); border: 1px dashed var(--brand); border-radius: 10px; text-align: center; user-select: all; }

/* ---------- Reports ---------- */
.report-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.report-tiles .tile { cursor: default; }
.report-tiles .tile:hover { transform: none; }
.report-section { margin-bottom: 26px; }
.report-section h2 { font-size: 15px; font-weight: 650; margin: 0 0 10px; }
.bar-list { display: flex; flex-direction: column; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 40px; gap: 12px; align-items: center; font-size: 13px; }
.bar-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-track > div { height: 100%; background: var(--text); border-radius: 99px; }
.print-only { display: none; }

/* ---------- Help ---------- */
.help { max-width: 760px; }
.help h2 { font-size: 15px; margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
.help ol, .help ul { padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 7px; color: var(--text-2); }
.help b { color: var(--text); }
.help .kbd { font-family: ui-monospace, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; color: var(--text); }

/* ---------- Tour ---------- */
.tour-ring { position: fixed; z-index: 90; border-radius: 12px; box-shadow: 0 0 0 4px var(--brand), 0 0 0 9999px rgba(5, 5, 7, .6); pointer-events: none; transition: all 220ms var(--ease); }
.tour-tip { position: fixed; z-index: 91; width: min(300px, calc(100vw - 24px)); background: #1E1E24; border: 1px solid var(--border-strong); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-lg); transition: top 220ms var(--ease), left 220ms var(--ease); }
.tour-tip h3 { margin: 0 0 6px; font-size: 15px; }
.tour-tip p { margin: 0 0 14px; color: var(--text-2); font-size: 13px; }
.tour-steps { font-size: 11px; color: var(--text-3); }

/* ---------- Tablets ---------- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-row, .admin-head { grid-template-columns: 1fr 1fr; }
  .admin-head { display: none; }
  .report-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Phones: bottom tab bar, one-column pages, swipeable board ---------- */
@media (max-width: 820px) {
  :root { --sidebar: 0px; }
  html, body { height: 100%; }
  .shell { display: flex; flex-direction: column; height: 100dvh; }
  .main { flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
  .sidebar {
    order: 2; flex: none; flex-direction: row; align-items: stretch; justify-content: space-between; gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border);
    background: rgba(18, 18, 21, .96); backdrop-filter: blur(10px); overflow: visible;
  }
  .brand, .nav-section, .sidebar-actions { display: none; }
  .nav-item { flex: 1 1 0; width: auto; min-width: 0; flex-direction: column; justify-content: center; gap: 4px; padding: 7px 2px 5px; border-radius: 10px; font-size: 10.5px; font-weight: 500; position: relative; }
  .nav-item .icon { width: 21px; height: 21px; }
  .nav-item span.label { display: block; font-size: 0; white-space: nowrap; }
  .nav-item span.label::after { content: attr(data-short); font-size: 10.5px; }
  .nav-item .count { position: absolute; top: 3px; left: 50%; margin: 0 0 0 6px; font-size: 10px; padding: 0 5px; line-height: 16px; }
  .nav-item.active::before { left: 18px; right: 18px; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .sidebar-foot { margin: 0; border: 0; padding: 0 2px; flex: none; gap: 2px; }
  .me-btn { padding: 6px; flex: none; }
  .me-btn .me-text { display: none; }
  #help-btn { display: none; }

  .page { padding: 16px 14px 28px; }
  .page-title { font-size: 20px; }
  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; justify-content: center; }

  /* Dashboard tiles become one swipeable row. */
  .tiles { display: flex; overflow-x: auto; gap: 8px; margin: 0 -14px 12px; padding: 2px 14px 6px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .tiles::-webkit-scrollbar { display: none; }
  .tile { flex: 0 0 132px; padding: 12px 13px 10px; scroll-snap-align: start; }
  .tile-num { font-size: 24px; }
  .tile-label { font-size: 11.5px; }
  .report-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 14px; padding: 0; overflow: visible; }
  .report-tiles .tile { flex: none; }

  .team-load { display: flex; overflow-x: auto; gap: 0 14px; padding: 10px 12px; margin: 0 -14px 14px; border-radius: 0; border-left: 0; border-right: 0; scrollbar-width: none; }
  .team-load::-webkit-scrollbar { display: none; }
  .team-load > * { flex: 0 0 128px; }
  .toolbar .select.sm { flex: 1 1 140px; min-width: 0; }
  .toolbar .hint { width: 100%; }

  /* Board: one person per screen, swipe sideways, page scrolls vertically. */
  .board { gap: 10px; margin: 0 -14px; padding: 0 14px 12px; scroll-snap-type: x mandatory; min-height: 0; scrollbar-width: none; }
  .board::-webkit-scrollbar { display: none; }
  .col { width: min(86vw, 340px); max-height: none; scroll-snap-align: center; }
  .status-col { width: min(80vw, 300px); }
  .att-box .box-title > .grow { display: none; }
  .att-box .box-title > .row { width: 100%; }
  .page-head .actions .segmented { flex: none; }
  .page-head .actions .segmented button { flex: none; }
  .col-body { overflow: visible; }
  .card .reassign { opacity: 1; }

  /* Lists and tables */
  .list-row { grid-template-columns: 1fr; gap: 8px; }
  .list-row.detailed { grid-template-columns: 1fr auto; }
  .list-row.detailed .list-main { grid-column: 1 / -1; }
  .list-row.detailed > .pill.overdue { grid-column: 1; justify-self: start; }
  .list-row.detailed > span:empty { display: none; }
  .list-row.detailed > .due { grid-column: 1; justify-self: start; }
  .list-row.detailed > div:last-child { grid-column: 2; grid-row: 2 / span 2; align-self: start; }
  .list-details { gap: 5px 6px; }
  .detail { height: 22px; font-size: 11.5px; padding: 0 7px; }
  .tscroll { margin: 0 -14px; padding: 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ptable { min-width: 560px; }
  .ptable.pipe th:nth-child(1), .ptable.pipe td:nth-child(1), .ptable.pipe th:nth-child(6), .ptable.pipe td:nth-child(6) { display: none; }
  .ptable.pipe { min-width: 620px; }
  .cal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-dow { display: none; }

  /* Task panel fills the screen; forms stack. */
  .panel { width: 100vw; border-left: 0; }
  .panel-head { padding: 14px 16px 12px; }
  .panel-body { padding: 14px 16px 24px; gap: 16px; }
  .panel-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .props { grid-template-columns: 96px minmax(0, 1fr); gap: 8px 10px; }
  .props .v .select, .props .v .input { width: 100%; max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-wrap { padding: 10px; align-items: end; }
  .modal { max-height: calc(100dvh - 20px); border-radius: 16px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .input, .select, textarea.input { font-size: 16px; }   /* stops iOS zooming into fields */

  /* Admin */
  .admin-row, .admin-head { grid-template-columns: 1fr; gap: 10px; }
  .admin-row .row { flex-wrap: wrap; }
  .admin-row .row[style*="flex-end"] { justify-content: flex-start !important; }
  .health-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; scrollbar-width: none; }

  #toasts { left: 12px; right: 12px; bottom: calc(74px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .menu { max-width: calc(100vw - 16px); }
}

/* Touch devices: controls that only appeared on hover are always visible. */
@media (hover: none) {
  .card .reassign { opacity: 1; }
  .tile:hover, .card:hover { transform: none; }
}


/* ---------- Status-coloured columns (v1.2 change request 1.2) ----------
   One colour per status across the whole column: solid top bar, tinted head and body,
   3 px left edge on every card (--sc), and the pill. */
.status-col { --c: #8A8A94; border-top: 4px solid var(--c); background: color-mix(in srgb, var(--c) 7%, #131316); border-color: color-mix(in srgb, var(--c) 22%, var(--border)); }
.status-col .col-head { background: color-mix(in srgb, var(--c) 16%, #131316); border-bottom-color: color-mix(in srgb, var(--c) 25%, transparent); }
.status-col .col-count { color: var(--text); background: color-mix(in srgb, var(--c) 24%, #131316); padding: 0 8px; border-radius: 99px; line-height: 20px; font-weight: 600; }
.status-col .col-empty { border-color: color-mix(in srgb, var(--c) 30%, transparent); }
.board.by-status { gap: 18px; }

/* Card cover (first image attachment) */
.card-cover { margin: -13px -13px 0; height: 120px; border-radius: 12px 12px 0 0; overflow: hidden; background: var(--surface-2); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 300ms var(--ease); }
.card:hover .card-cover img { transform: scale(1.04); }
.card-count { display: inline-flex; align-items: center; gap: 3px; }

/* Density toggle: compact hides the brief and detail chips, tightens spacing. */
.density-compact .card { gap: 6px; padding: 10px 11px 9px; }
.density-compact .card-brief, .density-compact .list-brief, .density-compact .list-details, .density-compact .card-cover { display: none; }
.density-compact .list-row.detailed { padding: 9px 12px; }
.density-compact .col-body { gap: 7px; }
.density-compact .card-title { font-size: 13.5px; }

/* ---------- Micro-animations (1.2.0) ----------
   Small, quick and consistent: buttons press, cards and rows rise in, bars fill,
   counts pop, menus and modals scale in. All of it is switched off under
   prefers-reduced-motion (see the end of this file). */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes fillIn { from { width: 0; } }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes glow { 50% { filter: brightness(1.25); } }
@keyframes iconSpin { to { transform: rotate(360deg); } }

/* Buttons: lift on hover, press on click, primary glows. */
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px -8px rgba(0, 0, 0, .8); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: none; }
.btn.primary:hover { filter: none; box-shadow: 0 8px 22px -10px rgba(255, 255, 255, .6); }
.btn .icon { transition: transform var(--fast) var(--ease); }
.btn:hover .icon { transform: translateY(-1px) scale(1.08); }
.btn.busy .icon, .btn[aria-busy="true"] .icon { animation: iconSpin .9s linear infinite; }
.btn:disabled { transform: none; box-shadow: none; }
.btn:focus-visible, .pill:focus-visible, .nav-item:focus-visible, .card:focus-visible, .list-row:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Sidebar / tab bar */
.nav-item { transition: background var(--fast), color var(--fast), transform var(--fast) var(--ease); }
.nav-item:hover { transform: translateX(2px); }
.nav-item .icon { transition: transform 220ms var(--ease); }
.nav-item:hover .icon { transform: scale(1.1); }
.nav-item.active .icon { animation: pop 320ms var(--ease); }
.nav-item .count { transition: background var(--fast), color var(--fast); }
.nav-item .count.bump { animation: pop 360ms var(--ease); }
.me-btn { transition: background var(--fast); }
.me-btn .avatar { transition: transform 200ms var(--ease); }
.me-btn:hover .avatar { transform: scale(1.08); }

/* Status / priority pills and chips */
.pill { transition: background var(--fast), border-color var(--fast), transform var(--fast) var(--ease), box-shadow var(--fast); }
.pill .icon { transition: transform 200ms var(--ease); }
button.pill:hover { transform: translateY(-1px); box-shadow: 0 4px 12px -8px var(--c); }
button.pill:hover .icon { transform: scale(1.15) rotate(-8deg); }
button.pill:hover .chev { transform: translateY(1px); opacity: 1; }
.tag, .detail, .badge, .due, .card-count { transition: background var(--fast), border-color var(--fast), color var(--fast); }
.detail:hover { border-color: var(--border-strong); background: color-mix(in srgb, var(--text) 9%, transparent); }

/* Bars: fill from zero when drawn; over capacity glows. */
.load-fill { animation: fillIn 640ms var(--ease) both; }
.load-fill.red { animation: fillIn 640ms var(--ease) both, glow 1.8s ease-in-out 700ms infinite; }
.load-bar { transition: background var(--fast); }

/* Cards, rows, tiles and columns rise in, one after another. */
.card, .list-row, .tile, .ptable tbody tr, .admin-row, .att-row, .comment { animation: rise 260ms var(--ease) both; }
.card:nth-child(2), .list-row:nth-child(2), .tile:nth-child(2), .ptable tbody tr:nth-child(2), .admin-row:nth-child(2), .att-row:nth-child(2), .comment:nth-child(2) { animation-delay: 35ms; }
.card:nth-child(3), .list-row:nth-child(3), .tile:nth-child(3), .ptable tbody tr:nth-child(3), .admin-row:nth-child(3), .att-row:nth-child(3), .comment:nth-child(3) { animation-delay: 70ms; }
.card:nth-child(4), .list-row:nth-child(4), .tile:nth-child(4), .ptable tbody tr:nth-child(4), .admin-row:nth-child(4), .att-row:nth-child(4), .comment:nth-child(4) { animation-delay: 105ms; }
.card:nth-child(5), .list-row:nth-child(5), .tile:nth-child(5), .ptable tbody tr:nth-child(5), .admin-row:nth-child(5), .att-row:nth-child(5), .comment:nth-child(5) { animation-delay: 140ms; }
.card:nth-child(6), .list-row:nth-child(6), .tile:nth-child(6), .ptable tbody tr:nth-child(6), .admin-row:nth-child(6), .att-row:nth-child(6), .comment:nth-child(6) { animation-delay: 175ms; }
.card:nth-child(n+7), .list-row:nth-child(n+7), .tile:nth-child(n+7), .ptable tbody tr:nth-child(n+7), .admin-row:nth-child(n+7), .att-row:nth-child(n+7), .comment:nth-child(n+7) { animation-delay: 210ms; }
.col { animation: rise 300ms var(--ease) both; }
.col:nth-child(2) { animation-delay: 40ms; } .col:nth-child(3) { animation-delay: 80ms; } .col:nth-child(4) { animation-delay: 120ms; } .col:nth-child(n+5) { animation-delay: 160ms; }
.list-row:hover { transform: translateY(-1px); }
.tile-bar > div { animation: fillIn 700ms var(--ease) both; }
.list-row:active, .card:active { transform: scale(.995); }
.tile:active { transform: translateY(0) scale(.98); }
.tile-num, .col-count, .group-count, .count-pill { animation: pop 420ms var(--ease) both; }
.card:hover .card-title { color: #fff; transition: color var(--fast); }
.ptable tbody tr { transition: transform var(--fast) var(--ease); }
.ptable tbody tr:hover { transform: translateX(2px); }
.admin-row, .att-row { transition: background var(--fast), transform var(--fast) var(--ease); }
.admin-row:hover, .att-row:hover { transform: translateX(2px); }

/* Switches, tabs and inputs */
.segmented button { transition: background var(--fast), color var(--fast), transform var(--fast) var(--ease); }
.segmented button:active { transform: scale(.94); }
.segmented button .icon { transition: transform 200ms var(--ease); }
.segmented button.on .icon { animation: pop 300ms var(--ease); }
.tabs button { position: relative; border-bottom-color: transparent !important; transition: color var(--fast); }
.tabs button::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); transform: scaleX(0); transition: transform 220ms var(--ease); }
.tabs button.on::after { transform: scaleX(1); }
.input, .select, .textarea { transition: border-color var(--fast), box-shadow var(--fast), background var(--fast); }

/* Menus, modals, panel */
.menu { animation: menuIn 160ms var(--ease); transform-origin: top; }
.menu-item { transition: background var(--fast), transform var(--fast) var(--ease); }
.menu-item:hover { transform: translateX(2px); }
.modal { animation: modalIn 200ms var(--ease); }
.avatar img { transition: opacity 200ms; }

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

/* Health cards are narrow: tighter key/value columns, long values wrap. */
.health-card .kv { grid-template-columns: 105px minmax(0, 1fr); }
.health-card .kv > span { min-width: 0; overflow-wrap: anywhere; }
