/* TASKS — team workspace. Dark rail + light workspace. */
:root {
  --rail: #142240; --rail-ink: #E9EDF5; --rail-muted: #93A0BE; --rail-hover: rgba(255,255,255,0.07); --rail-active: rgba(255,255,255,0.12);
  --ground: #F4F5F9; --surface: #FFFFFF; --surface-2: #EEF0F6; --surface-3: #E4E7EF;
  --ink: #0F1B33; --ink-2: #3A4460; --muted: #6B748A; --line: #DCE0E9; --line-strong: #B9C0D0;
  --accent: #D9691F; --accent-ink: #fff; --accent-soft: #FBEADF; --accent-hover: #C55D18;
  --ok: #1F8F63; --ok-soft: #DDF3E9; --warn: #B7860F; --warn-soft: #FAF0CF; --bad: #BE4038; --bad-soft: #F8E0DE; --info: #3B6CE0; --info-soft: #E3EAFB;
  --shadow: 0 1px 2px rgba(15,27,51,.06), 0 8px 24px -12px rgba(15,27,51,.25);
  --shadow-lg: 0 20px 60px -20px rgba(15,27,51,.45);
  --r: 8px; --r-lg: 12px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: 0.95rem; font-weight: 700; }
p { margin: 0; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.tnum { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

/* ---- layout */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.rail .logo { padding: 20px 20px 14px; font-weight: 800; letter-spacing: .16em; font-size: 0.95rem; display: flex; align-items: center; justify-content: space-between; }
.rail .logo span { color: var(--accent); }
.rail .ws { padding: 0 20px 14px; color: var(--rail-muted); font-size: 0.78rem; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.rail nav { display: grid; gap: 2px; padding: 6px 10px; }
.rail nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--rail-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.rail nav a:hover { background: var(--rail-hover); color: var(--rail-ink); }
.rail nav a.active { background: var(--rail-active); color: var(--rail-ink); }
.rail nav a .ic { width: 18px; height: 18px; flex: none; opacity: .9; }
.rail nav a .badge { margin-left: auto; }
.rail .spacer { flex: 1; }
.rail .me { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.rail .me .who { min-width: 0; flex: 1; }
.rail .me .who b { display: block; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .me .who span { color: var(--rail-muted); font-size: 0.74rem; }
.rail .me button { background: none; border: 0; color: var(--rail-muted); padding: 6px; border-radius: 6px; }
.rail .me button:hover { background: var(--rail-hover); color: var(--rail-ink); }
.rail .hamb { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; min-height: 58px; }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.topbar .crumbs a { text-decoration: none; color: var(--muted); font-weight: 600; }
.topbar .crumbs .sep { color: var(--line-strong); }
.topbar .grow { flex: 1; }
.search { position: relative; }
.search input[type=search] { width: 260px; max-width: 40vw; padding: 7px 10px 7px 32px; border: 1px solid var(--line); border-radius: 7px; background: var(--ground); }
.search .ic { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--muted); }
.search .results { position: absolute; top: 40px; right: 0; width: 420px; max-width: 80vw; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; max-height: 70vh; overflow: auto; }
.search .results .grp { font-size: 0.7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.search .results a { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 6px; text-decoration: none; }
.search .results a:hover, .search .results a.sel { background: var(--surface-2); }
.content { padding: 24px 28px 60px; flex: 1; min-width: 0; }
.content.wide { padding-left: 20px; padding-right: 20px; }

/* ---- controls */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 0.86rem; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: var(--surface); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 9px; font-size: 0.8rem; }
.btn.xs { padding: 2px 7px; font-size: 0.75rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ic { width: 15px; height: 15px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn .ic { width: 17px; height: 17px; }
.ic { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); font-size: 0.9rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--info); outline-offset: -1px; border-color: var(--info); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
label.field { display: grid; gap: 5px; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
label.field > span.hint { font-weight: 500; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.86rem; cursor: pointer; }
.check input { width: auto; }
.form-error { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 0.83rem; }
.switch i { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on i { background: var(--ok); }
.switch.on i::after { left: 16px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.5; }
.pill.soft { background: var(--surface-2); color: var(--ink-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 800; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 0; white-space: nowrap; cursor: pointer; }
.status-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.status-chip:hover { filter: brightness(.96); }
.tag { display: inline-flex; padding: 1px 7px; border-radius: 5px; font-size: 0.72rem; font-weight: 700; color: #fff; white-space: nowrap; }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.prio.urgent { color: var(--bad); background: var(--bad-soft); }
.prio.high { color: var(--accent); background: var(--accent-soft); }
.prio.normal { color: var(--muted); background: var(--surface-2); }
.prio.low { color: var(--muted); background: transparent; border: 1px dashed var(--line-strong); }
.vis { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; border: 0; cursor: pointer; }
.vis.shared { color: var(--ok); background: var(--ok-soft); }
.vis.internal { color: var(--muted); background: var(--surface-2); }
.vis .ic { width: 13px; height: 13px; }

.av { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 0.68rem; font-weight: 800; letter-spacing: .02em; flex: none; box-shadow: 0 0 0 2px var(--surface); }
.av.lg { width: 34px; height: 34px; font-size: 0.8rem; }
.av.sm { width: 22px; height: 22px; font-size: 0.6rem; }
.avs { display: inline-flex; }
.avs .av { margin-left: -6px; }
.avs .av:first-child { margin-left: 0; }
.avs .more { background: var(--surface-3); color: var(--ink-2); }
.av.none { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); box-shadow: none; }

.bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .3s; }
.bar.thin { height: 5px; }
.bar.accent > i { background: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card .card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card .card-h h3 { flex: 1; }
.card .card-b { padding: 16px 18px; }
.card .card-b.flush { padding: 0; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 0.9rem; }
.empty b { color: var(--ink-2); display: block; margin-bottom: 4px; }

/* ---- page header */
.page-h { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h .titles { min-width: 0; flex: 1; }
.page-h .titles .sub { color: var(--muted); margin-top: 3px; }
.page-h .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 0.88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a:hover { color: var(--ink); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; padding: 6px 9px; font-size: 0.84rem; }
.toolbar .grow { flex: 1; }

/* ---- grids */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: grid; gap: 2px; }
.stat .k { font-size: 0.72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .v.bad { color: var(--bad); }
.stat .v.warn { color: var(--warn); }
.stat .v.accent { color: var(--accent); }
.stat .s { font-size: 0.8rem; color: var(--muted); }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.stack { display: grid; gap: 14px; }

/* project cards */
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: grid; gap: 10px; text-decoration: none; color: inherit; border-left: 4px solid var(--pc, var(--info)); transition: box-shadow .15s; }
.pcard:hover { box-shadow: var(--shadow); }
.pcard .t { display: flex; align-items: flex-start; gap: 10px; }
.pcard .t h3 { flex: 1; font-size: 1rem; }
.pcard .client { color: var(--muted); font-size: 0.82rem; }
.pcard .meta { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 0.8rem; flex-wrap: wrap; }
.pcard .pr { display: flex; align-items: center; gap: 10px; }
.pcard .pr .bar { flex: 1; }
.pcard .pr b { font-variant-numeric: tabular-nums; font-size: 0.85rem; min-width: 36px; text-align: right; }
.health { font-size: 0.72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.health.on_track { background: var(--ok-soft); color: var(--ok); }
.health.at_risk { background: var(--warn-soft); color: var(--warn); }
.health.overdue { background: var(--bad-soft); color: var(--bad); }
.health.done { background: var(--info-soft); color: var(--info); }
.health.on_hold { background: var(--surface-2); color: var(--muted); }

/* ---- task list */
.tlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.tgroup { border-top: 1px solid var(--line); }
.tgroup:first-child { border-top: 0; }
.tgroup-h { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--surface-2); font-weight: 800; font-size: 0.82rem; }
.tgroup-h .n { color: var(--muted); font-weight: 600; }
.tgroup-h .bar { width: 90px; }
.tgroup-h .pct { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; width: 36px; text-align: right; }
.tgroup-h .grow { flex: 1; }
.tgroup-h .caret { transition: transform .15s; width: 14px; height: 14px; color: var(--muted); }
.tgroup.collapsed .caret { transform: rotate(-90deg); }
.tgroup.collapsed .trows { display: none; }
.trow { display: grid; grid-template-columns: 22px 108px 1fr 84px 62px 74px 50px 30px; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-top: 1px solid var(--line); min-height: 40px; cursor: pointer; }
.trow:hover { background: #F9FAFC; }
.trow.sub { padding-left: 42px; background: #FBFBFD; }
.trow.sub .trow-title { font-size: 0.86rem; }
.trow.done .trow-title { color: var(--muted); text-decoration: line-through; }
.trow .handle { color: var(--line-strong); cursor: grab; display: flex; align-items: center; justify-content: center; }
.trow .handle .ic { width: 14px; height: 14px; }
.trow .trow-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.trow .trow-title .id { color: var(--muted); font-family: var(--mono); font-size: 0.72rem; flex: none; }
.trow .trow-title .tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; flex: 0 1 auto; min-width: 40px; }
.trow .trow-title .proj { color: var(--muted); font-size: 0.78rem; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .trow-title .cnt { color: var(--muted); font-size: 0.74rem; display: inline-flex; gap: 6px; align-items: center; flex: none; }
.trow .trow-title .cnt .ic { width: 13px; height: 13px; }
.trow .trow-title .tags { display: inline-flex; gap: 4px; flex: none; }
.trow .due { font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; cursor: pointer; }
.trow .due.over { color: var(--bad); font-weight: 700; }
.trow .due.today { color: var(--accent); font-weight: 700; }
.trow .due.nodate { color: var(--line-strong); }
.trow .est { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.trow.dragging { opacity: .4; }
.trow.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.trow.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.tgroup.drop-target .tgroup-h { background: var(--accent-soft); }
.addrow { display: flex; align-items: center; gap: 8px; padding: 6px 14px 8px 40px; border-top: 1px solid var(--line); }
.addrow input { border: 0; background: transparent; padding: 4px 6px; }
.addrow input:focus { outline: none; background: var(--surface-2); border-radius: 5px; }
.addrow .hint { color: var(--muted); font-size: 0.78rem; }

/* ---- board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: 60vh; }
.col { width: 272px; flex: none; background: var(--surface-2); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 800; font-size: 0.82rem; }
.col-h i { width: 9px; height: 9px; border-radius: 50%; }
.col-h .n { color: var(--muted); font-weight: 600; }
.col-h .grow { flex: 1; }
.col-b { padding: 0 8px 8px; overflow-y: auto; display: grid; gap: 8px; align-content: start; min-height: 40px; flex: 1; }
.col.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 7px; cursor: pointer; box-shadow: 0 1px 1px rgba(15,27,51,.04); }
.tcard:hover { border-color: var(--line-strong); }
.tcard.dragging { opacity: .4; }
.tcard.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.tcard .tt { font-weight: 600; font-size: 0.88rem; line-height: 1.35; }
.tcard .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tcard .row .grow { flex: 1; }
.tcard .id { color: var(--muted); font-family: var(--mono); font-size: 0.7rem; }
.tcard .due { font-size: 0.76rem; color: var(--ink-2); }
.tcard .due.over { color: var(--bad); font-weight: 700; }
.tcard .due.today { color: var(--accent); font-weight: 700; }
.col .addcard { margin: 0 8px 8px; }

/* ---- calendar */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cal-h h3 { flex: 1; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); font-size: 0.72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cal-dow div { padding: 6px 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day { min-height: 108px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px; display: grid; gap: 3px; align-content: start; }
.cal-day:nth-child(7n+1) { border-left: 0; }
.cal-day.other { background: #FAFBFD; color: var(--muted); }
.cal-day.today .d { background: var(--accent); color: #fff; }
.cal-day.drop-target { background: var(--accent-soft); }
.cal-day .d { font-size: 0.76rem; font-weight: 800; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-ev { font-size: 0.74rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); border-left: 3px solid var(--pc, var(--info)); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.done { opacity: .55; text-decoration: line-through; }
.cal-ev:hover { background: var(--surface-3); }

/* ---- tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl thead th { border-top: 0; background: var(--surface-2); font-size: 0.7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tbl tr.row-link { cursor: pointer; }
.tbl tr.row-link:hover td { background: #F9FAFC; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.actions { text-align: right; white-space: nowrap; }

/* ---- drawer (task) */
.drawer-bg { position: fixed; inset: 0; background: rgba(15,27,51,.35); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 640px; max-width: 100vw; background: var(--surface); z-index: 51; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer-h { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.drawer-h .id { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.drawer-h .grow { flex: 1; }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.drawer .title { font-size: 1.2rem; font-weight: 800; border: 0; padding: 4px 6px; margin: 0 -6px 10px; width: calc(100% + 12px); background: transparent; border-radius: 6px; line-height: 1.3; }
.drawer .title:hover { background: var(--surface-2); }
.drawer .title:focus { background: var(--surface-2); outline: none; }
.meta { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; align-items: center; margin-bottom: 18px; }
.meta .k { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.meta .v { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 28px; }
.meta .v select, .meta .v input { width: auto; padding: 4px 8px; font-size: 0.84rem; }
.meta .v input[type=date] { width: 150px; }
.meta .v input[type=number] { width: 80px; }
.sec { margin-top: 20px; }
.sec-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sec-h h3 { flex: 1; }
.desc { border: 1px solid transparent; border-radius: 7px; padding: 8px 10px; margin: 0 -10px; min-height: 40px; }
.desc:hover { border-color: var(--line); }
.desc.editing { border-color: var(--info); }
.desc .md { font-size: 0.9rem; color: var(--ink-2); }
.desc .placeholder { color: var(--muted); font-style: italic; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin: 0; }
.md ul { margin: 0 0 8px; padding-left: 20px; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 0.82em; }
.md a { color: var(--info); }
.mention { background: var(--info-soft); color: var(--info); font-weight: 700; padding: 0 4px; border-radius: 4px; }
.subtasks { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.subtask { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-top: 1px solid var(--line); cursor: pointer; }
.subtask:first-child { border-top: 0; }
.subtask:hover { background: #F9FAFC; }
.subtask input[type=checkbox] { width: 16px; height: 16px; margin: 0; }
.subtask .tt { flex: 1; font-size: 0.88rem; font-weight: 600; }
.subtask.done .tt { color: var(--muted); text-decoration: line-through; }
.subtask .due { font-size: 0.76rem; color: var(--muted); }
.subtasks .addrow { padding-left: 10px; }

.approval-box { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; }
.approval-box .t { font-weight: 800; font-size: 0.78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.approval-box.approved { border-color: var(--ok); background: var(--ok-soft); }
.approval-box.approved .t { color: var(--ok); }
.approval-box.changes { border-color: var(--warn); background: var(--warn-soft); }
.approval-box.changes .t { color: var(--warn); }

.files { display: grid; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 0.85rem; }
.file .ic { width: 16px; height: 16px; color: var(--muted); flex: none; }
.file a { text-decoration: none; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .sz { color: var(--muted); font-size: 0.76rem; white-space: nowrap; }

.comments { display: grid; gap: 12px; }
.comment { display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
.comment .body { background: var(--surface-2); border-radius: 0 10px 10px 10px; padding: 8px 12px; }
.comment.shared .body { background: var(--ok-soft); }
.comment.client .body { background: var(--info-soft); }
.comment .who { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; margin-bottom: 3px; flex-wrap: wrap; }
.comment .who b { font-size: 0.82rem; }
.comment .who time { color: var(--muted); }
.comment .who .grow { flex: 1; }
.comment .who .iconbtn { width: 22px; height: 22px; }
.comment .who .iconbtn .ic { width: 13px; height: 13px; }
.comment .md { font-size: 0.88rem; }
.composer { border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); position: relative; }
.composer textarea { border: 0; background: transparent; min-height: 64px; padding: 10px 12px; }
.composer textarea:focus { outline: none; }
.composer .foot { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.composer .foot .grow { flex: 1; }
.composer .files-pending { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 10px 6px; }
.composer .files-pending span { font-size: 0.76rem; background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
.mention-pop { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); min-width: 220px; padding: 4px; }
.mention-pop div { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 0.86rem; font-weight: 600; }
.mention-pop div.sel, .mention-pop div:hover { background: var(--surface-2); }

.timeline { display: grid; gap: 10px; }
.tl { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 0.86rem; }
.tl .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tl .dot .ic { width: 13px; height: 13px; }
.tl .dot.shared { background: var(--ok-soft); color: var(--ok); }
.tl .dot.client { background: var(--info-soft); color: var(--info); }
.tl .txt { padding-top: 3px; }
.tl .txt time { color: var(--muted); font-size: 0.76rem; margin-left: 6px; }
.tl .txt .ex { color: var(--muted); display: block; font-size: 0.8rem; }

/* ---- popovers, menus, modals, toasts */
.pop { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; max-height: 60vh; overflow: auto; }
.pop .item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 0.86rem; font-weight: 600; }
.pop .item:hover, .pop .item.sel { background: var(--surface-2); }
.pop .item.danger { color: var(--bad); }
.pop .item .tick { margin-left: auto; color: var(--ok); width: 14px; height: 14px; }
.pop .sep { height: 1px; background: var(--line); margin: 4px 0; }
.pop input.filter { margin: 2px 2px 6px; width: calc(100% - 4px); padding: 6px 8px; font-size: 0.84rem; }
.modal-bg { position: fixed; inset: 0; background: rgba(15,27,51,.45); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: 560px; max-width: 100%; box-shadow: var(--shadow-lg); }
.modal.wide { width: 720px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.modal-h h2 { flex: 1; }
.modal-b { padding: 16px 20px; display: grid; gap: 14px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; flex-wrap: wrap; }
.modal-f .left { margin-right: auto; }
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; font-weight: 600; font-size: 0.86rem; box-shadow: var(--shadow-lg); max-width: 380px; }
.toast.err { background: var(--bad); }
.toast.ok { background: var(--ok); }
.linkbox { display: flex; gap: 8px; align-items: center; }
.linkbox input { font-family: var(--mono); font-size: 0.78rem; }
.notice { padding: 10px 14px; border-radius: var(--r); background: var(--info-soft); color: var(--info); font-size: 0.86rem; font-weight: 600; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.kbd { font-family: var(--mono); font-size: 0.72rem; background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

/* ---- notifications */
.notif { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: start; padding: 10px 14px; border-top: 1px solid var(--line); text-decoration: none; }
.notif:first-child { border-top: 0; }
.notif:hover { background: #F9FAFC; }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 7px; }
.notif.unread .dot { background: var(--accent); }
.notif .t { font-weight: 700; font-size: 0.88rem; }
.notif .b { color: var(--muted); font-size: 0.8rem; }
.notif time { color: var(--muted); font-size: 0.74rem; white-space: nowrap; }
.bell { position: relative; }
.bell .badge { position: absolute; top: -4px; right: -4px; }
.bell-pop { width: 380px; padding: 0; }
.bell-pop .h { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 800; }
.bell-pop .h .grow { flex: 1; }
.bell-pop .list { max-height: 60vh; overflow: auto; }

/* ---- auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--rail); padding: 20px; }
.auth .box { background: var(--surface); border-radius: 14px; padding: 30px 32px; width: 400px; max-width: 100%; display: grid; gap: 14px; box-shadow: var(--shadow-lg); }
.auth .logo { font-weight: 800; letter-spacing: .16em; font-size: 0.9rem; color: var(--ink); }
.auth .logo span { color: var(--accent); }
.auth h1 { font-size: 1.3rem; }
.auth .foot { text-align: center; font-size: 0.82rem; color: var(--muted); }
.auth .foot a { color: var(--ink); }

/* ---- settings */
.settings-grid { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: 80px; }
.settings-nav a { padding: 8px 12px; border-radius: 7px; text-decoration: none; font-weight: 700; color: var(--muted); }
.settings-nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.status-row { display: grid; grid-template-columns: 22px 28px 1fr 130px 90px 70px; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.status-row:first-child { border-top: 0; }
.status-row input[type=color] { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.status-row .handle { color: var(--line-strong); cursor: grab; }
.form { display: grid; gap: 14px; max-width: 560px; }

/* ---- responsive */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: 240px; transform: translateX(-100%); transition: transform .2s; z-index: 90; }
  .rail.open { transform: none; }
  .rail-bg { position: fixed; inset: 0; background: rgba(15,27,51,.4); z-index: 89; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar .hamb { display: inline-flex; flex: none; }
  .topbar .crumbs { flex: 1; min-width: 0; }
  .topbar .crumbs a, .topbar .crumbs span:not(.sep) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .crumbs a { display: none; }
  .topbar .crumbs .sep { display: none; }
  .topbar .grow { display: none; }
  .topbar .btn.primary .lbl { display: none; }
  .topbar .btn.primary { padding: 7px 9px; }
  .search input[type=search] { width: 40px; padding-left: 30px; }
  .search input[type=search]:focus { width: 200px; }
  .addrow .hint { display: none; }
  .tgroup-h .bar { width: 60px; }
  .content { padding: 16px 14px 60px; }
  .two { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .trow { grid-template-columns: 22px 1fr 70px 30px; }
  .trow .due, .trow .est, .trow .prio-cell, .trow .st-cell { display: none; }
  .drawer { width: 100vw; }
  .field-row { grid-template-columns: 1fr; }
  .meta { grid-template-columns: 100px 1fr; }
}
@media (min-width: 961px) { .topbar .hamb { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
