:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --surface-3: #e8e8e4;
  --sidebar: #1d2321;
  --sidebar-2: #2a312e;
  --sidebar-text: #c9d1cd;
  --sidebar-muted: #8a958f;
  --border: #e3e3df;
  --border-strong: #cfcfca;
  --text: #17191a;
  --text-2: #55585a;
  --muted: #85888a;
  --accent: #0f7b6c;
  --accent-2: #0b6559;
  --accent-soft: #dff1ec;
  --accent-text: #ffffff;
  --danger: #c93b3b;
  --danger-soft: #fbe6e5;
  --warn: #b26b00;
  --warn-soft: #fdf0d9;
  --ok: #1f7a3d;
  --ok-soft: #e1f3e6;
  --info: #2a62b8;
  --info-soft: #e3edfb;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .08);
  --radius: 10px;
  /* chart series (validated reference palette) */
  --series-rev: #2a78d6;
  --series-exp: #eb6834;
  --series-profit: #1baf7a;
  --grid: #ececea;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141716; --surface: #1b1f1e; --surface-2: #232826; --surface-3: #2c3230;
    --sidebar: #101312; --sidebar-2: #1d2321; --sidebar-text: #c9d1cd; --sidebar-muted: #7d8883;
    --border: #2c3230; --border-strong: #3a413e;
    --text: #eceeed; --text-2: #b4bab7; --muted: #848c88;
    --accent: #2fb39d; --accent-2: #46c4af; --accent-soft: #173a34; --accent-text: #08201c;
    --danger: #ef7070; --danger-soft: #3a1d1d; --warn: #e9a640; --warn-soft: #3a2c14;
    --ok: #5cc27e; --ok-soft: #173322; --info: #6fa3f0; --info-soft: #1b2a42;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .4);
    --series-rev: #3987e5; --series-exp: #d95926; --series-profit: #199e70; --grid: #2a2f2d;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141716; --surface: #1b1f1e; --surface-2: #232826; --surface-3: #2c3230;
  --sidebar: #101312; --sidebar-2: #1d2321; --sidebar-text: #c9d1cd; --sidebar-muted: #7d8883;
  --border: #2c3230; --border-strong: #3a413e;
  --text: #eceeed; --text-2: #b4bab7; --muted: #848c88;
  --accent: #2fb39d; --accent-2: #46c4af; --accent-soft: #173a34; --accent-text: #08201c;
  --danger: #ef7070; --danger-soft: #3a1d1d; --warn: #e9a640; --warn-soft: #3a2c14;
  --ok: #5cc27e; --ok-soft: #173322; --info: #6fa3f0; --info-soft: #1b2a42;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .4);
  --series-rev: #3987e5; --series-exp: #d95926; --series-profit: #199e70; --grid: #2a2f2d;
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { font-size: 22px; margin: 16px 0 6px; }
.login-card p { color: var(--text-2); margin: 0 0 24px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-text); display: inline-grid; place-items: center; font-weight: 700; font-size: 18px; }
.alert { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; text-align: left; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; height: 100%; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; min-height: 0; }
.sb-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.sb-head .brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }
.sb-title { font-weight: 600; color: #fff; line-height: 1.2; }
.sb-sub { font-size: 11px; color: var(--sidebar-muted); }
.sb-search { margin: 4px 12px 8px; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--sidebar-2); color: var(--sidebar-muted); border: 0; cursor: pointer; text-align: left; }
.sb-search kbd { margin-left: auto; font-size: 11px; border: 1px solid #3c4542; border-radius: 4px; padding: 0 5px; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.sb-section { margin-top: 14px; }
.sb-label { display: flex; align-items: center; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--sidebar-muted); padding: 4px 8px; }
.sb-label button { background: none; border: 0; color: var(--sidebar-muted); cursor: pointer; padding: 2px; border-radius: 4px; display: grid; }
.sb-label button:hover { color: #fff; background: var(--sidebar-2); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--sidebar-text); cursor: pointer; text-decoration: none !important; font-size: 13.5px; }
.nav-item:hover { background: var(--sidebar-2); }
.nav-item.active { background: var(--sidebar-2); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--accent); color: var(--accent-text); border-radius: 10px; padding: 0 7px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.sb-foot { border-top: 1px solid var(--sidebar-2); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.sb-foot .who { flex: 1; min-width: 0; font-size: 13px; }
.sb-foot .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot button, .sb-foot a { background: none; border: 0; color: var(--sidebar-muted); cursor: pointer; padding: 6px; border-radius: 6px; display: grid; }
.sb-foot button:hover, .sb-foot a:hover { background: var(--sidebar-2); color: #fff; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.topbar h1 { font-size: 15px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .crumb { color: var(--muted); font-weight: 400; }
.topbar .menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 20px; }
.content.flush { padding: 0; }
.page-max { max-width: 1200px; margin: 0 auto; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 13px; white-space: nowrap; line-height: 1.4; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.icon { padding: 6px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 7px 10px; outline: none; min-width: 0; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 72px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }

/* inline-editable text */
.inline { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 2px 6px; margin: -2px -6px; width: calc(100% + 12px); outline: none; }
.inline:hover { border-color: var(--border); }
.inline:focus { border-color: var(--accent); background: var(--surface); }
select.inline { cursor: pointer; appearance: none; width: auto; }
input.inline[type="date"] { width: auto; color: var(--text-2); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; text-transform: uppercase; letter-spacing: .02em; border: 0; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.nodot::before { display: none; }
select.pill { cursor: pointer; padding: 4px 8px; font: inherit; font-size: 11.5px; font-weight: 600; text-transform: uppercase; }
.s-todo, .s-draft, .s-planning { background: var(--surface-3); color: var(--text-2); }
.s-in_progress, .s-pending, .s-active { background: var(--info-soft); color: var(--info); }
.s-review, .s-approved, .s-on_hold { background: var(--warn-soft); color: var(--warn); }
.s-done, .s-completed { background: var(--ok-soft); color: var(--ok); }
.s-paid { background: var(--accent-soft); color: var(--accent); }
.s-rejected, .s-cancelled { background: var(--danger-soft); color: var(--danger); }
.demo-tag { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; line-height: 1.5; }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.prio svg { width: 14px; height: 14px; }
.prio.urgent { color: var(--danger); } .prio.high { color: var(--warn); } .prio.normal { color: var(--info); } .prio.low { color: var(--muted); }
.overdue { color: var(--danger); font-weight: 500; }

.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 600; color: #fff; flex: none; object-fit: cover; }
.avatar.lg { width: 32px; height: 32px; font-size: 13px; }
.avatar.empty { background: none; border: 1.5px dashed var(--border-strong); color: var(--muted); }
.avatars { display: flex; } .avatars .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); } .avatars .avatar:first-child { margin-left: 0; }

/* ---------- cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-h h2, .card-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-b { padding: 12px 16px; }
.card-b.flush { padding: 0; }
.cards { display: grid; gap: 16px; }
.home-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.greet h2 { margin: 0 0 2px; font-size: 22px; }
.greet { margin-bottom: 18px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); cursor: pointer; min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 20px; background: var(--surface); overflow-x: auto; flex: none; }
.tabs a { padding: 10px 12px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .count { font-size: 11px; background: var(--surface-3); border-radius: 8px; padding: 0 6px; color: var(--text-2); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 600; border-bottom: 0; }

/* ---------- progress ---------- */
.bar { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.lg { height: 10px; }
.pct { font-size: 12px; color: var(--text-2); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- task list (grouped) ---------- */
.group { margin-bottom: 18px; }
.group-h { display: flex; align-items: center; gap: 8px; padding: 6px 4px; cursor: pointer; user-select: none; }
.group-h .chev { transition: transform .15s; color: var(--muted); }
.group.collapsed .chev { transform: rotate(-90deg); }
.group.collapsed .group-b { display: none; }
.group-b { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.trow { display: grid; grid-template-columns: minmax(220px, 1fr) 120px 120px 110px 70px; align-items: center; gap: 8px; padding: 0 12px; min-height: 40px; border-bottom: 1px solid var(--border); }
.trow:last-child { border-bottom: 0; }
.trow.head { min-height: 32px; font-size: 11.5px; color: var(--muted); background: var(--surface-2); }
.trow:not(.head):hover { background: var(--surface-2); }
.trow .tname { display: flex; align-items: center; gap: 8px; min-width: 0; }
.trow .tname .title { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .tname .title:hover { color: var(--accent); }
.trow.sub .tname { padding-left: 28px; }
.trow .meta { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); flex: none; }
.trow .meta span { display: inline-flex; align-items: center; gap: 3px; }
.trow .meta svg { width: 12px; height: 12px; }
.status-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; flex: none; cursor: pointer; background: none; padding: 0; display: grid; place-items: center; }
.status-dot.st-todo { color: var(--muted); } .status-dot.st-in_progress { color: var(--info); } .status-dot.st-review { color: var(--warn); }
.status-dot.st-done { color: var(--ok); background: var(--ok); }
.status-dot.st-done::after { content: ""; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.add-row { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 38px; color: var(--muted); }
.add-row input { border: 0; background: none; outline: none; flex: 1; padding: 8px 0; }
.mini-sel { border: 1px solid transparent; background: none; border-radius: 6px; padding: 3px 4px; cursor: pointer; max-width: 100%; font-size: 12.5px; color: var(--text-2); }
.mini-sel:hover { border-color: var(--border); }

/* ---------- board ---------- */
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; min-height: 60vh; }
.col { flex: 0 0 280px; background: var(--surface-2); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; }
.col-b { padding: 0 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.kcard:hover { border-color: var(--border-strong); }
.kcard.dragging { opacity: .5; }
.kcard .kt { font-weight: 500; margin-bottom: 8px; word-break: break-word; }
.kcard .kf { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.col .add-row { padding: 0 4px; }

/* ---------- timeline ---------- */
.gantt { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.gantt-inner { position: relative; min-width: 100%; }
.g-head { display: flex; position: sticky; top: 0; background: var(--surface-2); border-bottom: 1px solid var(--border); height: 32px; z-index: 1; }
.g-label-col { width: 220px; flex: none; border-right: 1px solid var(--border); padding: 0 12px; display: flex; align-items: center; font-size: 12.5px; background: var(--surface); position: sticky; left: 0; z-index: 2; overflow: hidden; }
.g-head .g-label-col { background: var(--surface-2); color: var(--muted); font-size: 11.5px; }
.g-months { position: relative; flex: 1; }
.g-month { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); font-size: 11.5px; color: var(--muted); padding: 7px 6px; white-space: nowrap; }
.g-row { display: flex; height: 36px; border-bottom: 1px solid var(--border); }
.g-row:last-child { border-bottom: 0; }
.g-track { position: relative; flex: 1; }
.g-bar { position: absolute; top: 9px; height: 18px; border-radius: 5px; background: var(--accent); opacity: .9; cursor: pointer; min-width: 6px; }
.g-bar.st-done { background: var(--ok); } .g-bar.st-todo { background: var(--muted); } .g-bar.st-review { background: var(--warn); } .g-bar.st-in_progress { background: var(--info); }
.g-ms { position: absolute; top: 10px; width: 14px; height: 14px; transform: translateX(-7px) rotate(45deg); background: var(--warn); border-radius: 2px; }
.g-ms.done { background: var(--ok); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .7; z-index: 1; pointer-events: none; }
.g-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); pointer-events: none; }

/* ---------- side panel ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 40; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.panel-h { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex: none; }
.panel-b { flex: 1; overflow-y: auto; padding: 16px 20px 32px; }
.panel h2.ptitle { font-size: 20px; margin: 4px 0 14px; }
.panel h2.ptitle .inline { font-size: 20px; font-weight: 600; }
.props { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; align-items: center; margin-bottom: 18px; font-size: 13px; }
.props > .k { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.props > .v { min-width: 0; }
.sec { margin-top: 22px; }
.sec-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.sec-h .muted { font-weight: 400; }
.cl-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.cl-item.done span { text-decoration: line-through; color: var(--muted); }
.cl-item .x { margin-left: auto; opacity: 0; }
.cl-item:hover .x { opacity: 1; }

/* comments + activity */
.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment .bubble { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.comment .bubble.private { background: var(--warn-soft); }
.comment .meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.comment .meta b { color: var(--text); font-weight: 600; }
.comment .text { white-space: pre-wrap; word-break: break-word; }
.composer { border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px; background: var(--surface); }
.composer textarea { border: 0; outline: none; width: 100%; resize: vertical; min-height: 54px; background: none; }
.composer .row { justify-content: flex-end; }
.act { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 4px 0; }
.act time { color: var(--muted); margin-left: auto; white-space: nowrap; font-size: 11.5px; }
.feed-item { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item time { font-size: 11.5px; color: var(--muted); display: block; }

/* VietQR */
.qr-box { display: grid; grid-template-columns: auto 1fr; gap: 16px; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface-2); align-items: start; }
.qr-img { background: #fff; border-radius: 10px; padding: 6px; line-height: 0; }
.qr-img svg { width: 200px; height: 200px; stroke: none; }
.copy-line { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.copy-line:last-child { border-bottom: 0; }
.copy-line .k { font-size: 11.5px; color: var(--muted); width: 92px; flex: none; }
.copy-line .v { flex: 1; min-width: 0; font-weight: 600; word-break: break-all; }
.notice { font-size: 12px; color: var(--text-2); background: var(--info-soft); border-radius: 8px; padding: 8px 10px; margin-top: 10px; }
.notice.warn { background: var(--warn-soft); }
.locked { display: flex; gap: 8px; align-items: center; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; }

/* ---------- finance ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .d { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.kpi .sw { width: 10px; height: 10px; border-radius: 3px; }
.fin-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; stroke: none; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 1px; width: 14px; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; z-index: 5; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; align-items: center; gap: 6px; }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.hbar { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; }
.hbar .track { height: 10px; border-radius: 0 4px 4px 0; background: transparent; position: relative; }
.hbar .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-exp); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .v { color: var(--text); font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); } .neg { color: var(--danger); }

/* ---------- modal & palette ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 60; display: grid; place-items: start center; padding: 8vh 16px 16px; overflow-y: auto; }
.modal { width: min(560px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.modal.wide { width: min(720px, 100%); }
.modal-h { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-h h3 { margin: 0; font-size: 15px; flex: 1; }
.modal-b { padding: 16px 18px 4px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.palette { width: min(600px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 14px 18px; font-size: 15px; outline: none; background: none; }
.palette .items { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette .it { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.palette .it.on { background: var(--accent-soft); }
.palette .it .hint { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.palette .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; }
.palette .foot { font-size: 11.5px; color: var(--muted); padding: 8px 14px; border-top: 1px solid var(--border); }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
.pdetail-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px 6px; background: var(--surface); flex-wrap: wrap; }
.pdetail-head .pname { font-size: 18px; font-weight: 600; flex: 1; min-width: 200px; }
.pdetail-meta { display: flex; gap: 16px; align-items: center; padding: 0 20px 10px; background: var(--surface); font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.pdetail-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.stat .v { font-size: 20px; font-weight: 600; }
.stat .k { font-size: 12px; color: var(--muted); }
.ms-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.ms-row:last-child { border-bottom: 0; }
.diamond { width: 10px; height: 10px; transform: rotate(45deg); background: var(--warn); border-radius: 2px; flex: none; }
.diamond.done { background: var(--ok); }
.proj-card { padding: 14px 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(200px, 2fr) 110px minmax(140px, 1.2fr) 150px 90px; gap: 14px; align-items: center; cursor: pointer; }
.proj-card:hover { background: var(--surface-2); }
.proj-card:last-child { border-bottom: 0; }

@media (max-width: 1000px) {
  .home-grid, .fin-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .proj-card { grid-template-columns: 1fr 100px; }
  .proj-card .hide-md { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 49; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
  .tabs { padding: 0 8px; }
  .pdetail-head, .pdetail-meta { padding-left: 16px; padding-right: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .trow { grid-template-columns: 1fr 34px 80px; }
  .trow .c-prio, .trow .c-extra { display: none; }
  .trow .c-assignee .aname { display: none; }
  .props { grid-template-columns: 100px 1fr; }
  .qr-box { grid-template-columns: 1fr; justify-items: center; }
  .qr-box > div:last-child { width: 100%; }
  .panel-b { padding: 14px 16px 28px; }
  .kpi .v { font-size: 18px; }
  .hide-sm { display: none !important; }
  .g-label-col { width: 140px; }
}
