:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1efea;
  --line: #e4e1da;
  --line-strong: #cfcbc2;
  --ink: #1e1f24;
  --ink-2: #4b4d55;
  --muted: #80828b;
  --accent: #5b4fe0;
  --accent-ink: #ffffff;
  --accent-soft: #ecebfc;
  --ok: #1f9d6b;
  --ok-soft: #e1f4ec;
  --warn: #c7811a;
  --danger: #d9434f;
  --danger-soft: #fbe7e9;
  --side: #1d1e26;
  --side-ink: #d9dae3;
  --side-muted: #8c8ea0;
  --side-hover: #2a2b36;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 4px 16px rgba(20, 20, 30, .06);
  --shadow-lg: 0 10px 40px rgba(20, 20, 30, .18);
  --radius: 10px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161b; --surface: #1c1d24; --surface-2: #23242c; --line: #2e2f39; --line-strong: #3d3e4a;
    --ink: #ecedf2; --ink-2: #b9bbc6; --muted: #858897; --accent: #8a80ff; --accent-ink: #12121a;
    --accent-soft: #2a2850; --ok: #3cc28c; --ok-soft: #173a2d; --danger: #f06470; --danger-soft: #3d1f24;
    --side: #101116; --side-hover: #1d1e26;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #15161b; --surface: #1c1d24; --surface-2: #23242c; --line: #2e2f39; --line-strong: #3d3e4a;
    --ink: #ecedf2; --ink-2: #b9bbc6; --muted: #858897; --accent: #8a80ff; --accent-ink: #12121a;
    --accent-soft: #2a2850; --ok: #3cc28c; --ok-soft: #173a2d; --danger: #f06470; --danger-soft: #3d1f24;
    --side: #101116; --side-hover: #1d1e26;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 500; 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 { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.icon-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; color: inherit; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.sm { width: 22px; height: 22px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], select, textarea, input:not([type]) {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); outline: none; }
textarea { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-weight: 500; font-size: 13px; color: var(--ink-2); }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 12px; margin: 0; }
.form legend { padding: 0 6px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.alert { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; }

/* ---------- Auth ---------- */
.auth-page { display: grid; place-items: center; padding: 24px 16px; min-height: 100%; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 480px; }
.auth-card h1 { font-size: 22px; margin: 14px 0 6px; }
.auth-card p { margin: 0 0 16px; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(135deg, #f06a6a, #5b4fe0); color: #fff; }
.brand-mark.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: grid; padding: 4px 8px; gap: 1px; }
.side-nav a, .project-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-ink); }
.side-nav a:hover, .project-link:hover { background: var(--side-hover); }
.side-nav a.active, .project-link.active { background: var(--side-hover); color: #fff; font-weight: 600; }
.side-nav .ico { width: 18px; text-align: center; opacity: .8; }
.side-section { padding: 14px 8px; flex: 1; overflow: auto; min-height: 0; }
.side-label { display: flex; justify-content: space-between; align-items: center; padding: 0 10px 6px; font-size: 12px; color: var(--side-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.side-label .icon-btn { color: var(--side-muted); }
.side-label .icon-btn:hover { background: var(--side-hover); color: #fff; }
.project-link .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.project-link .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-link.archived { opacity: .55; }
.side-foot { border-top: 1px solid #2c2d38; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot a { color: var(--side-muted); }
.user-chip { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; color: var(--side-ink); padding: 4px; border-radius: 8px; min-width: 0; }
.user-chip:hover { background: var(--side-hover); }
.user-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.top-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; min-width: 0; flex: 1; }
.top-title .ptitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-title .swatch { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.search-wrap { position: relative; width: 300px; max-width: 40vw; }
.search-wrap input { height: 34px; border-radius: 17px; padding-left: 14px; background: var(--surface-2); border-color: transparent; }
.search-results { position: absolute; top: 40px; right: 0; width: 360px; max-width: 90vw; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 40; max-height: 420px; overflow: auto; padding: 6px; }
.search-results .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 8px 4px; font-weight: 600; }
.search-results a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; color: var(--ink); }
.search-results a:hover { background: var(--surface-2); }
.view { flex: 1; overflow: auto; min-height: 0; }
.only-mobile { display: none; }
.scrim { display: none; }

/* ---------- Project header / tabs ---------- */
.proj-bar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; }
.tab { padding: 6px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; cursor: pointer; border: 0; background: none; }
.tab:hover { background: var(--surface-2); }
.tab.active { background: var(--accent-soft); color: var(--accent); }
.spacer { flex: 1; }
.filter-select { width: auto; height: 30px; font-size: 13px; padding: 0 8px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; width: 120px; }
.progress > i { display: block; height: 100%; background: var(--ok); }

/* ---------- List view ---------- */
.list { padding: 8px 20px 80px; }
.list-head, .row { display: grid; grid-template-columns: minmax(200px, 1fr) 150px 110px 90px; align-items: center; }
.list-head { position: sticky; top: 0; z-index: 2; background: var(--bg); font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 8px 0; }
.list-head > div, .row > div { padding: 0 10px; }
.sec { margin-top: 18px; }
.sec-head { display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.sec-head .caret { width: 22px; height: 22px; border: 0; background: none; cursor: pointer; color: var(--muted); transition: transform .15s; }
.sec.collapsed .caret { transform: rotate(-90deg); }
.sec.collapsed .sec-body { display: none; }
.sec-name { font-weight: 700; font-size: 15px; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; background: transparent; width: auto; height: auto; min-width: 60px; }
.sec-name:hover { border-color: var(--line-strong); }
input.sec-name { border-color: transparent; background: transparent; width: auto; height: 30px; box-shadow: none; }
input.sec-name:hover { border-color: var(--line-strong); }
input.sec-name:focus { border-color: var(--accent); background: var(--surface); }
.col-head input.sec-name { flex: 1; min-width: 0; width: 100%; }
.sec-head .count { color: var(--muted); font-size: 12px; }
.sec-head .icon-btn { opacity: 0; color: var(--muted); }
.sec-head:hover .icon-btn { opacity: 1; }
.row { min-height: 40px; border-bottom: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.row:first-child { border-top: 1px solid var(--line); }
.row:hover { background: var(--surface-2); }
.row.selected { background: var(--accent-soft); }
.row.dragging, .card.dragging { opacity: .4; }
.row .title-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.done .title-text { color: var(--muted); }
.meta-inline { display: inline-flex; gap: 8px; color: var(--muted); font-size: 12px; flex: none; }
.add-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; color: var(--muted); cursor: pointer; border-bottom: 1px solid var(--line); }
.add-row:hover { color: var(--ink); background: var(--surface); }
.add-row input { border: 0; height: 26px; padding: 0; background: transparent; box-shadow: none !important; }
.drop-line { height: 2px; background: var(--accent); margin: -1px 0; position: relative; z-index: 3; }
.add-section { margin-top: 20px; }

/* ---------- Check circle ---------- */
.check { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; color: transparent; font-size: 11px; }
.check:hover { border-color: var(--ok); color: var(--ok); }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.check.lg { width: 22px; height: 22px; font-size: 13px; }

/* ---------- Avatars & badges ---------- */
.avatar { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.avatar.lg { width: 32px; height: 32px; font-size: 12px; }
.avatar.empty { background: transparent; border: 1.5px dashed var(--line-strong); color: var(--muted); }
.who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due { font-size: 13px; color: var(--ink-2); }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.today { color: var(--ok); font-weight: 600; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.pill.high { background: var(--danger-soft); color: var(--danger); }
.pill.medium { background: #fdf0d9; color: #a76a10; }
.pill.low { background: var(--ok-soft); color: var(--ok); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.medium { background: #3a2e17; color: #e8b25a; } }
:root[data-theme="dark"] .pill.medium { background: #3a2e17; color: #e8b25a; }
.ptag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); padding: 1px 8px 1px 6px; border-radius: 10px; background: var(--surface-2); max-width: 160px; }
.ptag i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.ptag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Board ---------- */
.board { display: flex; gap: 14px; padding: 16px 20px 24px; height: 100%; overflow-x: auto; align-items: flex-start; }
.col { flex: 0 0 290px; background: var(--surface-2); border-radius: 12px; display: flex; flex-direction: column; max-height: 100%; }
.col-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px 12px; }
.col-head .sec-name { font-size: 14px; flex: 1; min-width: 0; }
.col-head .count { color: var(--muted); font-size: 12px; }
.col-body { padding: 4px 8px 8px; overflow-y: auto; display: grid; gap: 8px; min-height: 40px; align-content: start; }
.col-body.over { outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.03); display: grid; gap: 8px; }
.card:hover { border-color: var(--line-strong); }
.card .ctitle { display: flex; gap: 8px; align-items: flex-start; }
.card .ctitle span { overflow-wrap: anywhere; }
.card.done .ctitle span { color: var(--muted); }
.card .cmeta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card .cmeta .avatar { margin-left: auto; }
.col-add { margin: 0 8px 10px; justify-content: flex-start; color: var(--muted); }
.new-col { flex: 0 0 240px; }

/* ---------- Task panel ---------- */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100%; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(105%); transition: transform .2s ease; z-index: 30; display: flex; flex-direction: column; }
.panel.open { transform: none; }
.panel-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel-body { flex: 1; overflow: auto; padding: 16px 20px 24px; }
.panel-crumb { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.panel-crumb a { color: var(--muted); }
.panel-crumb a:hover { color: var(--ink); }
.task-title { font-size: 21px; font-weight: 700; width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; margin-left: -7px; resize: none; background: transparent; min-height: 0; line-height: 1.3; overflow: hidden; }
.task-title:hover { border-color: var(--line-strong); }
.fields { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; margin: 14px 0 18px; }
.fields > label { color: var(--muted); font-size: 13px; }
.fields select, .fields input { height: 32px; max-width: 260px; }
.block-title { font-weight: 600; margin: 20px 0 8px; font-size: 14px; }
.desc { min-height: 100px; }
.subtasks { border-top: 1px solid var(--line); }
.subtask { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.subtask:hover { background: var(--surface-2); }
.subtask .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtask.done .t { color: var(--muted); text-decoration: line-through; }
.feed { display: grid; gap: 12px; }
.feed .act { font-size: 12px; color: var(--muted); padding-left: 32px; }
.comment { display: flex; gap: 10px; }
.comment .cbody { flex: 1; min-width: 0; }
.comment .chead { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.comment .chead b { font-weight: 600; }
.comment .ctext { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.comment .del { margin-left: auto; font-size: 12px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.comment-box { border-top: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 10px; align-items: flex-end; background: var(--surface-2); }
.comment-box textarea { min-height: 40px; height: 40px; flex: 1; }

/* ---------- Home / My tasks / Team ---------- */
.page { padding: 24px 20px 60px; max-width: 1100px; margin: 0 auto; }
.greet { font-size: 26px; font-weight: 700; margin: 4px 0 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.bad b { color: var(--danger); }
.grid2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.cardbox { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.cardbox h3 { margin: 0 0 10px; font-size: 15px; }
.proj-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.proj-tile { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.proj-tile:hover { border-color: var(--line-strong); background: var(--surface-2); }
.proj-tile .top { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.proj-tile .top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-tile .progress { width: 100%; }
.feed-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item a { color: var(--ink); font-weight: 600; }
.mine-group h4 { margin: 22px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mine-group h4.bad { color: var(--danger); }
.mine .row { grid-template-columns: minmax(200px, 1fr) 170px 110px; }
.team-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.team-table th, .team-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.team-table th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface-2); }
.team-table tr:last-child td { border-bottom: 0; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.off { background: var(--surface-2); color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- Modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 15, 25, .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); padding: 22px; max-height: 90vh; overflow: auto; }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.colors { display: flex; gap: 6px; flex-wrap: wrap; }
.colors button { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; }
.colors button.on { border-color: var(--ink); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; z-index: 80; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 90vw; }
.menu { position: fixed; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; z-index: 70; min-width: 170px; }
.menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .layout.side-open .sidebar { transform: none; }
  .layout.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .top-title { font-size: 16px; }
  .search-wrap { width: 150px; }
  .proj-bar, .list, .page { padding-left: 12px; padding-right: 12px; }
  .board { padding: 12px; }
  .proj-bar .progress, .proj-bar .pct { display: none; }
  .proj-bar .filter-select { flex: 1; min-width: 0; }
  .proj-bar .spacer { flex-basis: 100%; height: 0; order: 2; }
  .proj-bar .tabs { order: 1; }
  .proj-bar [data-act=add-task-top] { order: 1; margin-left: auto; }
  .proj-bar .filter-select { order: 3; }
  .list-head { display: none; }
  .row, .mine .row { grid-template-columns: 1fr auto; padding: 6px 0; }
  .row > .c-due, .row > .c-prio { display: none; }
  .row > .c-who .who span:last-child { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px; }
  .stat b { font-size: 20px; }
  .panel { width: 100%; }
  .fields { grid-template-columns: 90px 1fr; }
  .team-table .hide-sm { display: none; }
  .col { flex-basis: 82vw; }
}

/* ===================== v2 additions ===================== */
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--ink); margin-bottom: 18px; }
.auth-brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
.auth-card h1 { margin-top: 0; }
.auth-links { text-align: center; font-size: 13px; margin: 16px 0 0 !important; color: var(--muted); }
.auth-legal { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }
.auth-legal a { color: var(--muted); }
.notice { background: var(--accent-soft); color: var(--ink); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; line-height: 1.55; }
.form label.check-label, label.check-label { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.check-label input { width: 16px; height: 16px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.row2.even { grid-template-columns: 1fr 1fr; }

.ws-switch { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--side-ink); cursor: pointer; padding: 4px 6px; margin-left: -6px; border-radius: 8px; min-width: 0; font-weight: 700; font-size: 15px; }
.ws-switch:hover { background: var(--side-hover); }
.caret-sm { font-size: 10px; color: var(--side-muted); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; margin-left: auto; }
.bell { position: relative; font-size: 16px; }
.bell .badge { position: absolute; top: -2px; right: -4px; margin: 0; }
.lock { margin-left: auto; font-size: 11px; opacity: .7; }
.side-empty { color: var(--side-muted); font-size: 12px; padding: 4px 10px; }
.user-chip { text-decoration: none; }

.page.narrow { max-width: 720px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-head > div { flex: 1; }
.callout { display: flex; align-items: center; gap: 16px; background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.callout > div { flex: 1; }
.section-card { margin-bottom: 16px; padding: 18px 20px; }
.section-card h3 { margin: 0 0 12px; }
.meter { margin: 12px 0; }
.mrow { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.progress.wide { width: 100%; height: 8px; }
.label-list { display: grid; gap: 4px; }
.label-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.danger-zone { border-color: var(--danger-soft); }
.dz-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dz-row:last-child { border-bottom: 0; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .6; cursor: default; }
.modal.wide { max-width: 640px; }
.inline-form { display: flex; gap: 8px; grid-template-columns: none; }
.inline-form input { max-width: 320px; }
.table-wrap { overflow-x: auto; }
.stats.five { grid-template-columns: repeat(5, 1fr); }

/* Labels */
.lbl { --c: #4186e0; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lbl { color: color-mix(in srgb, var(--c) 70%, white); background: color-mix(in srgb, var(--c) 24%, transparent); } }
:root[data-theme="dark"] .lbl { color: color-mix(in srgb, var(--c) 70%, white); background: color-mix(in srgb, var(--c) 24%, transparent); }
.title-cell .lbl { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.clabels { display: flex; gap: 4px; flex-wrap: wrap; }
.label-field { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.label-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.lbl-toggle { cursor: pointer; display: inline-flex; }
.lbl-toggle input { display: none; }
.lbl-toggle .lbl { opacity: .45; border: 1.5px solid transparent; }
.lbl-toggle input:checked + .lbl { opacity: 1; border-color: var(--c); }
.menu .tick { display: inline-block; width: 16px; color: var(--accent); font-weight: 700; }
.menu button { display: flex; align-items: center; gap: 6px; }
.menu button.on { font-weight: 600; color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px 4px; }
.menu-foot { display: block; text-align: center; padding: 8px; border-top: 1px solid var(--line); margin-top: 4px; font-size: 13px; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 12px; text-transform: none; letter-spacing: 0; padding: 0; width: auto !important; }

/* Notifications */
.notif-menu { width: 360px; max-width: calc(100vw - 16px); max-height: 70vh; overflow: auto; }
.notif { display: flex; gap: 10px; padding: 10px 12px; color: var(--ink); border-radius: 8px; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--accent-soft); }
.notif .nbody { min-width: 0; font-size: 13px; }
.notif .ntitle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Files */
.files { display: grid; gap: 6px; border: 1.5px dashed transparent; border-radius: 10px; transition: border-color .15s; }
.files.over { border-color: var(--accent); background: var(--accent-soft); }
.file { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.file img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.file-ico { width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface-2); border-radius: 6px; font-size: 20px; flex: none; }
.file-info { flex: 1; min-width: 0; }
.file-name { color: var(--ink); font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-btn { display: flex; align-items: center; gap: 6px; padding: 8px 4px; color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 500; flex-wrap: wrap; }

/* Comments & mentions */
.cwrap { flex: 1; position: relative; }
.cwrap textarea { width: 100%; }
.mention { color: var(--accent); font-weight: 600; background: var(--accent-soft); border-radius: 4px; padding: 0 2px; }
.mention-pop { position: absolute; bottom: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; min-width: 220px; z-index: 5; }
.mention-pop button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.mention-pop button.on, .mention-pop button:hover { background: var(--surface-2); }
.member-list { display: grid; gap: 6px; max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.member-list .check-label { align-items: center; }
.pview-board { height: calc(100% - 55px); }
.sr-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-add { border: 0; border-radius: 8px; }

@media (max-width: 860px) {
  .stats.five { grid-template-columns: repeat(2, 1fr); }
  .callout { flex-direction: column; align-items: flex-start; }
  .title-cell .lbl { display: none; }
  .row > .c-proj { display: none; }
  .mine .row { grid-template-columns: 1fr auto; }
  .inline-form { flex-wrap: wrap; }
  .pview-board { height: calc(100% - 96px); }
}

/* Theme switch */
.theme-seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.theme-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.theme-seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.side-foot .icon-btn { color: var(--side-muted); }
.side-foot .icon-btn:hover { background: var(--side-hover); color: #fff; }
