/* Task Manager – Dillon Yarn Corporation. Brand palette from logo.jpg:
   deep maroon -> crimson gradient wordmark. Primary = burgundy, alarm = bright crimson. */
:root {
  --bg: #FAF7F5;
  --surface: #FFFFFF;
  --ink: #2B2224;
  --muted: #8A797C;
  --line: #EDE4E2;
  --indigo: #9E3F45;        /* primary: soft garnet (from the logo, warmed up) */
  --indigo-dark: #7F3136;   /* primary hover */
  --indigo-soft: #F8ECEC;
  --madder: #C6473E;        /* alarm: warm crimson, reserved for urgent/overdue */
  --madder-soft: #FBEDEB;
  --ochre: #BC8526;
  --ochre-soft: #F9F1E1;
  --green: #35836B;
  --green-soft: #E9F5F0;
  --slate: #8A94A4;
  --steel: #64748B;         /* neutral priority accent (red is reserved for urgent) */
  --chip: #EFE8E6;          /* neutral chip/track background */
  --chip-ink: #6B5E60;
  --kcol: #F1EAE8;          /* kanban column background */
  --hover: #FBF6F5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(60, 36, 38, .05), 0 4px 18px rgba(60, 36, 38, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --brandfont: Georgia, "Times New Roman", serif;
}
/* dark theme (UPDATE 12, feature dark_mode; applied via <html data-theme="dark">) */
:root[data-theme="dark"] {
  --bg: #251E1F;
  --surface: #2F2728;
  --ink: #F0E7E6;
  --muted: #B5A5A7;
  --line: #453A3B;
  --indigo-soft: #46282B;
  --madder-soft: #4A2A27;
  --ochre-soft: #423621;
  --green-soft: #24382F;
  --chip: #3B3132;
  --chip-ink: #C9BBBC;
  --kcol: #2A2223;
  --hover: #372E2F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 4px 18px rgba(0, 0, 0, .2);
}
:root[data-theme="dark"] a { color: #E09EA4; }
:root[data-theme="dark"] .badge.in_progress, :root[data-theme="dark"] .badge.active { color: #EBA9AE; }
:root[data-theme="dark"] .badge.done { color: #93D9B9; }
:root[data-theme="dark"] .badge.on_hold { color: #E7C27C; }
:root[data-theme="dark"] .badge.deadline.over { color: #F2A79E; }
:root[data-theme="dark"] .kpi.warn .n { color: #F2A79E; }
:root[data-theme="dark"] .kpi.mid .n { color: #E7C27C; }
:root[data-theme="dark"] .kpi.ok .n { color: #93D9B9; }
:root[data-theme="dark"] .kcol-head.in_progress { color: #EBA9AE; }
:root[data-theme="dark"] .kcol-head.done { color: #93D9B9; }
:root[data-theme="dark"] .login-error { color: #F2A79E; }
:root[data-theme="dark"] .subchip.blocked { color: #E7C27C; }
:root[data-theme="dark"] .wip-warn { color: #E7C27C; }
:root[data-theme="dark"] .mention-pop .mi.on, :root[data-theme="dark"] .mention-pop .mi:hover { color: #EBA9AE; }
:root[data-theme="dark"] .bulk-bar { color: #EBA9AE; border-color: #5A3A3E; }
:root[data-theme="dark"] .qa-card { border-color: #5A3A3E; }
:root[data-theme="dark"] .toast { background: #F0E7E6; color: #251E1F; }
:root[data-theme="dark"] .toast.err { background: #C6473E; color: #fff; }
:root[data-theme="dark"] .login-wrap {
  background:
    radial-gradient(1200px 500px at 85% -10%, #38282A 0%, transparent 60%),
    radial-gradient(900px 420px at -10% 110%, #2E2527 0%, transparent 55%),
    var(--bg);
}
:root[data-theme="dark"] .seg button.active { background: #4A3C3D; color: var(--ink); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--indigo); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 85% -10%, #F6E6E5 0%, transparent 60%),
    radial-gradient(900px 420px at -10% 110%, #F3EAE7 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 36px 32px 32px;
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; text-align: center; }
.login-brand img { width: 230px; max-width: 100%; height: auto; }
.login-brand h1 { font-size: 17px; font-weight: 500; margin: 0; color: var(--muted); font-family: var(--brandfont); font-style: italic; letter-spacing: .02em; }
.login-error {
  background: var(--madder-soft);
  color: var(--madder);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #4A2226 0%, #5D2A2F 100%);
  color: #EBD8D9;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; flex-direction: column; gap: 7px; padding: 8px 10px 20px; color: #fff; }
.brand img { width: 158px; height: auto; opacity: .95; }
.brand .sub { display: block; font-size: 11.5px; color: #D6B2B5; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 11px;
  background: none; border: 0; border-radius: 8px;
  padding: 10px 12px; cursor: pointer;
  color: #EBD8D9; font-size: 14.5px; text-align: left; width: 100%;
}
.nav button:hover { background: rgba(255,255,255,.08); }
.nav button.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.nav svg { flex: 0 0 auto; }
.sidebar .spacer { flex: 1; }
.userbox { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.14); font-size: 13px; }
.userbox .name { color: #fff; font-weight: 600; }
.userbox .role { color: #D6B2B5; font-size: 12px; }

.main { padding: 26px 30px 90px; max-width: 1180px; width: 100%; margin: 0 auto; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px;
}
.btn:hover { border-color: #D9C6C5; }
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--indigo-dark); }
.btn.danger { color: var(--madder); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; background: var(--surface); font-size: 14.5px;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .btn:focus-visible, .nav button:focus-visible {
  outline: 2px solid var(--indigo); outline-offset: 1px;
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--surface); font-size: 13.5px; color: var(--ink); }

/* ---------- cards & lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-head { padding: 14px 18px 0; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.card .card-body { padding: 14px 18px 16px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpis > .kpi { min-width: 0; }
.kpis.exec { grid-template-columns: 1fr 1fr 2fr; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .n { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.warn .n { color: var(--madder); }
.kpi.mid .n { color: var(--ochre); }
.kpi.ok .n { color: var(--green); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-grid .wide { grid-column: 1 / -1; }
.dash-grid > * { min-width: 0; }

.tlist { list-style: none; margin: 0; padding: 0; }
.tlist li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tlist li:last-child { border-bottom: 0; }
.tlist .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlist .dim { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); font-size: 13.5px; padding: 14px 0; }

/* thread dot = priority (signature motif: a wound thread) */
.thread { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; position: relative; }
.thread::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.75); }
.thread.urgent { background: var(--madder); }
.thread.high { background: var(--ochre); }
.thread.normal { background: var(--steel); }
.thread.low { background: #9AA3B0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.todo { background: var(--chip); color: var(--chip-ink); }
.badge.in_progress { background: var(--indigo-soft); color: var(--indigo); }
.badge.done { background: var(--green-soft); color: var(--green); }
.badge.active { background: var(--indigo-soft); color: var(--indigo); }
.badge.on_hold { background: var(--ochre-soft); color: var(--ochre); }
.badge.archived { background: var(--chip); color: var(--chip-ink); }
.badge.deadline { background: var(--chip); color: var(--chip-ink); font-weight: 500; }
.badge.deadline.over { background: var(--madder-soft); color: var(--madder); font-weight: 600; }
.badge.role { background: var(--chip); color: var(--chip-ink); text-transform: capitalize; }

/* task rows */
.task-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow);
}
.task-row:hover { border-color: #D3BCBB; }
.task-row .title { font-weight: 600; }
.task-row .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.task-row .grow { flex: 1; min-width: 0; }
.task-row.done-task .title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.task-row select.status-quick { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 13px; background: var(--surface); }

/* projects */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.proj-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); cursor: pointer; }
.proj-card:hover { border-color: #D3BCBB; }
.proj-card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.proj-card .desc { color: var(--muted); font-size: 13.5px; margin: 6px 0 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.progress { height: 6px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--indigo); border-radius: 4px; }
.proj-card .pmeta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* charts */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap svg { max-width: 100%; height: auto; }
.legend { font-size: 13.5px; display: flex; flex-direction: column; gap: 7px; }
.legend .li { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }
.bars .bar-row { display: grid; grid-template-columns: 90px 1fr 34px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13.5px; }
.bars .bar-row.clickable { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px 7px; }
.bars .bar-row.clickable:hover { background: var(--indigo-soft); }
.bars .bar-row.clickable:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; }
.bars .track { height: 10px; background: var(--chip); border-radius: 5px; overflow: hidden; }
.bars .fill { height: 100%; border-radius: 5px; }

/* team table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .inactive td { opacity: .45; }

/* modal */
#modal-root:empty { display: none; }
.modal-back {
  position: fixed; inset: 0; background: rgba(24, 32, 48, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px 16px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: 0 12px 48px rgba(20,28,44,.28);
  width: 100%; max-width: 540px; padding: 24px 26px;
  animation: pop .18s ease-out;
}
.modal.wide { max-width: 640px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 18px; font-size: 18px; font-weight: 650; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal .foot .left { margin-right: auto; }
.notes { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.notes h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.note { background: var(--bg); border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; font-size: 13.5px; }
.note .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.note-add { display: flex; gap: 8px; margin-top: 10px; }
.note-add input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; }
.pw-reveal { background: var(--indigo-soft); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin-top: 12px; }
.pw-reveal code { font-size: 15px; font-weight: 700; }

/* toast */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; border-radius: 9px; padding: 10px 18px; font-size: 14px; box-shadow: var(--shadow); animation: pop .18s ease-out; }
.toast.err { background: var(--madder); }

/* segmented view toggle */
.seg { display: inline-flex; background: var(--chip); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 6px 14px; font-size: 13.5px; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(30,40,54,.12); }
.seg button:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; }

/* Kanban board (UPDATE 1) – columns always side by side; narrow screens scroll horizontally */
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 6px; }
.kanban .kcol { flex: 1 0 240px; min-width: 240px; }
.kcol { background: var(--kcol); border-radius: 12px; padding: 10px; min-height: 180px; transition: box-shadow .12s, background .12s; }
.kcol.drop-hint { background: var(--indigo-soft); box-shadow: inset 0 0 0 2px var(--indigo); }
.kcol-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 4px 6px 10px; }
.kcol-head.in_progress { color: var(--indigo); }
.kcol-head.done { color: var(--green); }
.kcount { background: var(--surface); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.kcol-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--indigo);
  border-radius: 9px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow);
}
.kcard:hover { border-color: #D3BCBB; border-left-color: inherit; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .35; }
.kproj { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.ktitle { font-weight: 600; font-size: 14px; line-height: 1.35; }
.kmeta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.kwho { font-size: 12.5px; color: var(--muted); }
.kempty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }
.khint { color: var(--muted); font-size: 12.5px; margin-top: 12px; text-align: center; }
.kanban ~ .khint { display: block; }

select.status-quick, input.status-quick {
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px;
  font-size: 13px; background: var(--surface); color: var(--ink);
}

/* tasks table view */
.tasks-table .trow { cursor: pointer; }
.tasks-table .trow:hover td { background: var(--hover); }
.tasks-table .done-task .ttitle b { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }

/* project color swatches */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 26px; height: 26px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.swatch input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }
.swatch input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: 1px; }

/* notifications bell (UPDATE 3) */
.bell { position: relative; background: none; border: 0; cursor: pointer; color: inherit; padding: 6px; border-radius: 8px; display: inline-flex; }
.sidebar .bell { color: #EBD8D9; }
.sidebar .bell:hover, .mobile-top .bell:hover { background: rgba(255,255,255,.12); }
.bell-badge {
  position: absolute; top: 0; right: 0;
  background: var(--madder); color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 700; padding: 1px 5px; line-height: 1.3;
}
.notif-list li.notif-unread .grow { font-weight: 650; }

/* subtasks & attachments (UPDATE 3) */
.subrow { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; }
.subrow label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; min-width: 0; }
.subrow label span { overflow: hidden; text-overflow: ellipsis; }
.sub-done { text-decoration: line-through; color: var(--muted); }
.sub-del { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; border-radius: 6px; padding: 0 6px; }
.sub-del:hover { color: var(--madder); background: var(--madder-soft); }
.subchip { font-size: 11.5px; background: var(--chip); color: var(--chip-ink); border-radius: 999px; padding: 1px 8px; font-weight: 600; white-space: nowrap; }
.subchip.all { background: var(--green-soft); color: var(--green); }

/* @mention autocomplete (UPDATE 5) */
.mention-pop {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  min-width: 220px; max-width: 90%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(43, 23, 25, .18); z-index: 60; overflow: hidden;
}
.mention-pop .mi { padding: 8px 14px; cursor: pointer; font-size: 14px; }
.mention-pop .mi.on, .mention-pop .mi:hover { background: var(--indigo-soft); color: var(--indigo); }

/* bulk actions bar (UPDATE 6) */
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--indigo-soft); border: 1px solid #ECD6D6; border-radius: 10px;
  padding: 8px 14px; margin-bottom: 10px; font-size: 13.5px; color: var(--indigo);
}
.bulk-bar select { border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; background: var(--surface); font-size: 13px; color: var(--ink); }

/* UPDATE 7: dependencies, WIP, AI summary */
.subchip.blocked { background: var(--ochre-soft); color: var(--ochre); }
.wip-warn { color: var(--ochre); font-weight: 650; font-size: 11px; margin-left: 8px; cursor: help; }
.ai-text { white-space: pre-wrap; font-size: 14px; line-height: 1.55; margin-bottom: 12px; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }

/* quick add (UPDATE 11) */
.quick-add { display: flex; gap: 8px; margin-bottom: 12px; }
.quick-add input {
  flex: 1; min-width: 0; border: 1.5px solid var(--indigo); border-radius: 10px; padding: 10px 14px;
  font-size: 14.5px; background: var(--surface); box-shadow: var(--shadow);
}
.quick-add input::placeholder { color: #B49B9D; }
#qa-mic.qa-rec { background: var(--madder); color: #fff; border-color: var(--madder); animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.qa-card {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--indigo-soft); border: 1px solid #ECD6D6; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 12px;
}
.qa-card #qa-title { flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font-size: 14px; }
.qa-card .status-quick { max-width: 160px; }

/* meeting tasks (UPDATE 9) */
.meet-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.meet-row:last-child { border-bottom: 0; }
.meet-check { padding-top: 7px; }
.meet-row .status-quick { max-width: 150px; }
@media (max-width: 600px) { .meet-row { flex-wrap: wrap; } }

/* floating AI button (UPDATE 10) */
.ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 45;
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #9E3F45 0%, #7F3136 100%); color: #F7ECEB;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(74, 34, 38, .35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.ai-fab:hover { transform: scale(1.07); box-shadow: 0 8px 26px rgba(74, 34, 38, .45); }
.ai-fab:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
@media (max-width: 860px) { .ai-fab { right: 16px; bottom: 84px; width: 52px; height: 52px; } }
@media (prefers-reduced-motion: reduce) { .ai-fab { transition: none; } }

/* AI chat (UPDATE 8) */
.chat-log { max-height: 46vh; overflow-y: auto; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-q {
  align-self: flex-end; background: var(--indigo); color: #fff;
  border-radius: 12px 12px 3px 12px; padding: 8px 13px; max-width: 85%; font-size: 14px;
}
.chat-a {
  align-self: flex-start; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px 12px 12px 3px; padding: 8px 13px; max-width: 92%;
  font-size: 14px; white-space: pre-wrap;
}
.chat-a.dim { color: var(--muted); font-style: italic; }

/* calendar view (UPDATE 15) */
.cal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dows { margin-bottom: 4px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cal-dows div { padding: 0 4px; }
.cal-cell { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; min-height: 86px; padding: 5px 6px; overflow: hidden; }
.cal-empty { background: transparent; border-color: transparent; }
.cal-today { outline: 2px solid var(--indigo); outline-offset: -1px; }
.cal-num { font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 3px; }
.cal-today .cal-num { color: var(--indigo); }
.cal-chip {
  color: #fff; font-size: 10.5px; border-radius: 5px; padding: 2px 6px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.cal-chip.cal-done { opacity: .45; text-decoration: line-through; }
.cal-more { font-size: 10.5px; color: var(--muted); }
@media (max-width: 700px) { .cal-cell { min-height: 62px; } .cal-chip { font-size: 9.5px; padding: 1px 4px; } }

/* help (UPDATE 14; redesigned UPDATE 16) */
.help-hero {
  background: linear-gradient(120deg, var(--indigo-soft), var(--surface));
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 20px; font-size: 14px; max-width: 760px;
}
.help-list { max-width: 760px; }
.help-group {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .09em;
  margin: 22px 2px 8px;
}
.help-acc {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; box-shadow: var(--shadow); overflow: hidden;
}
.help-acc summary {
  padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: 14.5px;
  list-style: none; display: flex; align-items: center; user-select: none;
}
.help-acc summary::-webkit-details-marker { display: none; }
.help-acc summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.help-acc[open] summary::after { transform: rotate(180deg); }
.help-acc summary:hover { background: var(--hover); }
.help-acc .hb { padding: 2px 18px 14px; }
.help-steps { margin: 0; padding-left: 4px; font-size: 13.5px; list-style: none; counter-reset: hstep; }
.help-steps li { margin-bottom: 8px; counter-increment: hstep; display: flex; gap: 10px; }
.help-steps li::before {
  content: counter(hstep);
  flex: 0 0 20px; height: 20px; border-radius: 50%;
  background: var(--indigo-soft); color: var(--indigo);
  font-size: 11px; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center; margin-top: 1px;
}

/* activity */
.activity { font-size: 13.5px; }
.activity li { padding: 7px 0; }
.activity .ts { color: var(--muted); font-size: 12px; }

/* ---------- responsive ---------- */
.mobile-top { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-top {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 40;
    background: var(--indigo-dark); color: #fff; padding: 12px 16px;
  }
  .mobile-top b { font-size: 16px; }
  .mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    display: flex; background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(30,40,54,.07);
  }
  .mobile-nav button {
    flex: 1; background: none; border: 0; padding: 9px 4px 10px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 11px; color: var(--muted);
  }
  .mobile-nav button.active { color: var(--indigo); font-weight: 600; }
  .main { padding: 18px 14px 84px; overflow-x: clip; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpis.exec { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .kanban { scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .kanban .kcol { flex: 0 0 80vw; max-width: 330px; scroll-snap-align: start; }
  #toast-root { bottom: 78px; left: 14px; right: 14px; transform: none; }
  .mobile-nav { overflow-x: auto; }
  .mobile-nav button { font-size: 10px; min-width: 52px; }
  .modal .row2 { grid-template-columns: 1fr; }
  .task-row { flex-wrap: wrap; }
  .page-head h2 { font-size: 19px; }
  .page-head .actions { width: 100%; }
  .filters select { flex: 1 1 45%; min-width: 0; max-width: 100%; }
  .seg { max-width: 100%; overflow-x: auto; }
  .seg button { padding: 6px 10px; white-space: nowrap; }
  .modal { padding: 20px 16px; }
  .modal-back { padding: 3vh 10px 12px; }
  .bars .bar-row { grid-template-columns: 74px 1fr 30px; }
  .qa-card .status-quick, .meet-row .status-quick { max-width: 100%; }
  .cal-head { flex-wrap: wrap; gap: 8px; }
  .bulk-bar select { max-width: 45vw; }
  .card .card-head { overflow-wrap: anywhere; }
  .chat-q, .chat-a { overflow-wrap: anywhere; }
  .tlist .grow { white-space: normal; }
  .table th, .table td { padding: 8px 7px; font-size: 13px; }
  .help-acc summary { padding: 11px 13px; }
  .help-acc .hb { padding: 2px 14px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
