/* LUPO Agency brand tokens.
   Brand green #1EA058 is used for fills, progress, active indicators and the logo; text/buttons on white use the
   deeper #13803F (white text 5.0:1). Dark mode uses near-black #060807 surfaces with the brand green and
   near-black text on green buttons (5.95:1). Supporting accents (blue, violet, teal, pink, coral, amber) give
   statuses, priorities, projects and charts their own colours. Contrast checked to WCAG AA. */
:root {
  color-scheme: light;
  --brand: #1EA058;
  --brand-ink: #060807;
  --bg: #F3F6F4;
  --surface: #FFFFFF;
  --surface-2: #EFF4F1;
  --surface-3: #E2EBE6;
  --sidebar: #060807;
  --sidebar-2: #131A16;
  --sidebar-3: #1B2520;
  --sidebar-text: #D5DED9;
  --sidebar-muted: #8A9A92;
  --border: #E0E8E3;
  --border-strong: #C8D4CD;
  --text: #0E1411;
  --text-2: #4C5A53;
  --muted: #5F6D66;
  --accent: #13803F;
  --accent-2: #0F6B35;
  --accent-soft: #E3F5EA;
  --accent-soft-2: #C6EBD5;
  --accent-text: #FFFFFF;
  --ring: rgba(30, 160, 88, .32);
  --danger: #B5352D; --danger-soft: #FCE6E4;
  --warn: #9A5B00; --warn-soft: #FDF1DA;
  --ok: #0F7038; --ok-soft: #E3F5EA;
  --info: #1D5BC4; --info-soft: #E8F0FD;
  --violet: #6D4AD6; --violet-soft: #F0EBFD;
  --teal: #0A7472; --teal-soft: #DDF4F2;
  --pink: #B4235A; --pink-soft: #FCE7F0;
  --coral: #B83A0A; --coral-soft: #FDEAE3;
  --shadow: 0 1px 2px rgba(6, 8, 7, .05), 0 8px 24px rgba(6, 8, 7, .08);
  --radius: 10px;
  /* chart series: brand-derived, validated with the dataviz palette checker (secondary encoding: bar order, gaps, line) */
  --series-rev: #1EA058;
  --series-exp: #F0643C;
  --series-profit: #2F6FDB;
  --grid: #E6ECE9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #060807; --surface: #0E1311; --surface-2: #151C19; --surface-3: #1E2823;
    --sidebar: #030504; --sidebar-2: #111814; --sidebar-3: #18231D; --sidebar-text: #D5DED9; --sidebar-muted: #8A9A92;
    --border: #1F2925; --border-strong: #2E3A34;
    --text: #EDF3EF; --text-2: #B3C0B9; --muted: #85948C;
    --accent: #1EA058; --accent-2: #2BB566; --accent-soft: #0F2A1B; --accent-soft-2: #154028; --accent-text: #060807; --ring: rgba(30, 160, 88, .45);
    --danger: #F07A70; --danger-soft: #3A1916; --warn: #F0B44A; --warn-soft: #3A2A10;
    --ok: #3FCB7E; --ok-soft: #0F2A1B; --info: #7AA8F5; --info-soft: #14233D;
    --violet: #A894F5; --violet-soft: #221A3D; --teal: #4FD1C5; --teal-soft: #0E2C2A;
    --pink: #F38BB5; --pink-soft: #3A1526; --coral: #F59A74; --coral-soft: #3A1C10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
    --series-rev: #1EA058; --series-exp: #E5582E; --series-profit: #3D7DE8; --grid: #1B2420;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060807; --surface: #0E1311; --surface-2: #151C19; --surface-3: #1E2823;
  --sidebar: #030504; --sidebar-2: #111814; --sidebar-3: #18231D; --sidebar-text: #D5DED9; --sidebar-muted: #8A9A92;
  --border: #1F2925; --border-strong: #2E3A34;
  --text: #EDF3EF; --text-2: #B3C0B9; --muted: #85948C;
  --accent: #1EA058; --accent-2: #2BB566; --accent-soft: #0F2A1B; --accent-soft-2: #154028; --accent-text: #060807; --ring: rgba(30, 160, 88, .45);
  --danger: #F07A70; --danger-soft: #3A1916; --warn: #F0B44A; --warn-soft: #3A2A10;
  --ok: #3FCB7E; --ok-soft: #0F2A1B; --info: #7AA8F5; --info-soft: #14233D;
  --violet: #A894F5; --violet-soft: #221A3D; --teal: #4FD1C5; --teal-soft: #0E2C2A;
  --pink: #F38BB5; --pink-soft: #3A1526; --coral: #F59A74; --coral-soft: #3A1C10;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
  --series-rev: #1EA058; --series-exp: #E5582E; --series-profit: #3D7DE8; --grid: #1B2420;
}

* { 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-3); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav-item.active svg { color: var(--brand); }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--brand); color: var(--brand-ink); 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; min-height: 0; }
.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(--brand); box-shadow: 0 0 0 3px var(--ring); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
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-active { background: var(--info-soft); color: var(--info); }
.s-pending, .s-on_hold { background: var(--warn-soft); color: var(--warn); }
.s-review { background: var(--violet-soft); color: var(--violet); }
.s-approved { background: var(--teal-soft); color: var(--teal); }
.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(--coral); } .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 svg { width: 13px; height: 13px; }
.avatar.unassigned { box-sizing: border-box; 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: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.home-grid > *, .cards > * { min-width: 0; }
.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(--brand); 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: linear-gradient(90deg, var(--brand), #4CCB85); 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(--violet); }
.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(--violet); } .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: minmax(0, 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; }
}

/* date cell + popover */
.date-cell { border: 1px solid transparent; background: none; border-radius: 6px; padding: 3px 6px; cursor: pointer; font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.date-cell:hover { border-color: var(--border); background: var(--surface); }
.date-cell.empty { color: var(--muted); opacity: .55; }
.trow:hover .date-cell.empty, .props .date-cell.empty, .date-cell.empty:focus-visible { opacity: 1; }
.date-cell.overdue { color: var(--danger); font-weight: 500; }
.date-cell svg { width: 14px; height: 14px; }
.date-pop { position: fixed; z-index: 90; width: 220px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; }
.dp-it { display: flex; justify-content: space-between; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; text-align: left; }
.dp-it:hover { background: var(--surface-2); }
.dp-it.danger { color: var(--danger); border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; }
.g-row.nodate .g-label-col { cursor: grab; }
.g-track.drop-hint { background: repeating-linear-gradient(90deg, transparent 0 13px, var(--accent-soft) 13px 14px); }
.g-group { display: flex; height: 30px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.g-group .g-label-col { background: var(--surface-2); font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* history timeline (task panel) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { display: flex; gap: 12px; padding: 5px 0; font-size: 13px; position: relative; }
.timeline .tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); margin-top: 5px; flex: none; z-index: 1; }
.timeline time { display: block; font-size: 11.5px; color: var(--muted); }
.role-row { display: grid; grid-template-columns: 104px 1fr; gap: 10px; align-items: start; padding: 5px 0; }
.role-row .pill { justify-content: center; }
.role-giam_doc { background: var(--accent-soft); color: var(--accent); }
.role-quan_ly { background: var(--info-soft); color: var(--info); }
.role-truong_nhom { background: var(--warn-soft); color: var(--warn); }
.role-nhan_su { background: var(--surface-3); color: var(--text-2); }

/* ---------- chat ---------- */
.nav-item.unread { color: #fff; font-weight: 600; }
.nav-item .count.soft { background: var(--sidebar-2); color: #fff; border: 1px solid #3c4542; }
.count.mention { background: var(--danger) !important; color: #fff !important; font-size: 11px; border-radius: 10px; padding: 0 7px; font-weight: 600; }
.count.soft { font-size: 11px; border-radius: 10px; padding: 0 7px; background: var(--surface-3); color: var(--text-2); font-weight: 600; margin-left: auto; }
.hash { width: 14px; text-align: center; color: var(--sidebar-muted); font-weight: 600; display: inline-grid; place-items: center; }
.hash svg { width: 12px; height: 12px; }
.avatar.xs { width: 18px; height: 18px; font-size: 8.5px; }
.hash-lg { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-3); display: inline-grid; place-items: center; font-weight: 700; color: var(--text-2); flex: none; }
.b { font-weight: 600; }
.only-sm { display: none; }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-desc { padding: 8px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.search-banner { display: flex; align-items: center; gap: 8px; padding: 8px 20px; background: var(--warn-soft); font-size: 13px; }
.chat-search .input { width: 200px; padding: 5px 10px; }
.msgs { flex: 1; overflow-y: auto; padding: 8px 0 12px; outline: none; }
.chan-start { padding: 24px 20px 8px; display: flex; flex-direction: column; gap: 4px; }
.load-more { text-align: center; padding: 8px; }
.day-sep, .new-sep { display: flex; align-items: center; gap: 10px; margin: 14px 20px 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.day-sep::before, .day-sep::after, .new-sep::before, .new-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.new-sep { color: var(--danger); } .new-sep::before, .new-sep::after { background: var(--danger); opacity: .5; }
.msg { display: grid; grid-template-columns: 44px 1fr; gap: 0 8px; padding: 6px 20px 4px; position: relative; }
.msg.compact { padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: var(--surface-2); }
.msg-av { padding-top: 2px; }
.msg-time-h { visibility: hidden; font-size: 10.5px; color: var(--muted); display: block; text-align: right; padding-top: 4px; font-variant-numeric: tabular-nums; }
.msg:hover .msg-time-h { visibility: visible; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head time { font-size: 11.5px; color: var(--muted); }
.msg-main { min-width: 0; }
.msg-body { word-break: break-word; line-height: 1.55; }
.msg-body ul, .msg-body ol { margin: 4px 0; padding-left: 22px; }
.msg-body code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.msg-body pre { background: var(--surface-3); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 6px 0; }
.msg-body pre code { background: none; padding: 0; }
.msg-body mark { background: var(--warn-soft); color: inherit; border-radius: 2px; }
.msg.deleted .msg-body { font-style: italic; }
.mention { background: var(--info-soft); color: var(--info); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mention.me { background: var(--warn-soft); color: var(--warn); }
.chip { display: inline-flex; align-items: center; gap: 3px; background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: 0 6px; font-weight: 600; font-size: 12.5px; text-decoration: none !important; white-space: nowrap; }
.chip:hover { filter: brightness(.95); }
.msg-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.link-card { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; max-width: 320px; font-size: 12.5px; background: var(--surface); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 0 8px; font-size: 13px; cursor: pointer; line-height: 22px; }
.react span { font-size: 11.5px; color: var(--text-2); }
.react.on { border-color: var(--accent); background: var(--accent-soft); }
.thread-link { border: 0; background: none; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 0; display: inline-flex; align-items: center; gap: 4px; }
.thread-link svg { width: 13px; height: 13px; }
.msg-tools { position: absolute; right: 16px; top: -12px; display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 2px; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: flex; }
.emoji-pop { position: fixed; z-index: 95; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; display: grid; grid-template-columns: repeat(5, 34px); }
.emoji-pop button { border: 0; background: none; font-size: 18px; cursor: pointer; border-radius: 6px; height: 34px; }
.emoji-pop button:hover { background: var(--surface-2); }
.chat-composer { position: relative; margin: 0 20px 16px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); padding: 8px 10px 6px; flex: none; }
.chat-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-composer textarea { width: 100%; border: 0; outline: none; resize: none; background: none; min-height: 24px; max-height: 200px; line-height: 1.5; }
.cc-bar { display: flex; align-items: center; gap: 2px; }
.cc-bar .btn.icon.sm { width: 28px; height: 28px; justify-content: center; font-size: 13px; }
.cc-links { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-links:not(:empty) { margin-bottom: 6px; }
.link-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 12px; max-width: 260px; }
.link-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; }
.ac { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; padding: 4px; z-index: 20; }
.ac-it { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; min-width: 0; }
.ac-it.on { background: var(--accent-soft); }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.thread-b { padding: 0 0 12px; }
.thread-parent { border-bottom: 1px solid var(--border); padding: 8px 0; }
.thread-count { padding: 8px 20px 0; }
.thread-compose .chat-composer { margin: 0 16px 16px; }
.search-hit { cursor: default; }
.search-hit[data-thread] { cursor: pointer; }
@media (max-width: 760px) {
  .only-sm { display: inline-flex; }
  .msg { padding-left: 12px; padding-right: 12px; grid-template-columns: 36px 1fr; }
  .chat-composer { margin: 0 10px 10px; }
  .msg-tools { position: static; box-shadow: none; border: 0; background: none; grid-column: 2; justify-content: flex-start; }
  .msg:hover .msg-tools { display: none; }
  .msg.show-tools .msg-tools { display: flex; }
  .msg-tools .btn.icon.sm { padding: 2px 4px; }
  .day-sep, .new-sep { margin-left: 12px; margin-right: 12px; }
}

/* ---------- LUPO brand ---------- */
.brand-logo { display: block; height: auto; }
.sb-head { padding: 16px 14px 10px; gap: 8px; }
.sb-brand { min-width: 0; }
.sb-head .wordmark { width: 118px; }
.sb-head .icon-mark { width: 30px; height: 30px; display: none; }
.sb-head .sb-role { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--sidebar-muted); margin-top: 6px; }
.sb-collapse { margin-left: auto; background: none; border: 0; color: var(--sidebar-muted); cursor: pointer; padding: 6px; border-radius: 6px; display: grid; align-self: flex-start; }
.sb-collapse:hover { background: var(--sidebar-2); color: #fff; }
.sidebar { background: radial-gradient(120% 60% at 0% 0%, rgba(30, 160, 88, .16), transparent 60%), var(--sidebar); }
.sb-search kbd { border-color: #2c3832; }
.nav-item .count.soft { border-color: #2c3832; }

/* collapsed sidebar (desktop): icon logo, icons only */
@media (min-width: 761px) {
  .app.collapsed { grid-template-columns: 68px 1fr; }
  .app.collapsed .sb-head { flex-direction: column; align-items: center; padding: 14px 8px 8px; }
  .app.collapsed .sb-head .wordmark, .app.collapsed .sb-head .sb-role { display: none; }
  .app.collapsed .sb-head .icon-mark { display: block; }
  .app.collapsed .sb-collapse { margin: 6px 0 0; align-self: center; transform: rotate(180deg); }
  .app.collapsed .sb-search { justify-content: center; margin: 4px 10px 8px; padding: 8px; }
  .app.collapsed .sb-search span, .app.collapsed .sb-search kbd { display: none; }
  .app.collapsed .sb-scroll { padding: 4px 10px 12px; }
  .app.collapsed .nav-item { justify-content: center; padding: 9px 0; font-size: 0; gap: 0; }
  .app.collapsed .nav-item .count, .app.collapsed .nav-item .ellipsis { display: none; }
  .app.collapsed .nav-item .dot { width: 12px; height: 12px; }
  .app.collapsed .sb-label { justify-content: center; font-size: 0; padding: 6px 0; border-top: 1px solid var(--sidebar-2); }
  .app.collapsed .sb-label button { font-size: 12px; }
  .app.collapsed .sb-foot { flex-direction: column; padding: 10px 6px; gap: 4px; }
  .app.collapsed .sb-foot .who { display: none; }
}

/* login */
.login { background: radial-gradient(80% 60% at 15% 10%, rgba(30, 160, 88, .28), transparent 60%), radial-gradient(60% 50% at 90% 90%, rgba(47, 111, 219, .18), transparent 60%), var(--brand-ink); }
.login-card { border: 0; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
.login-card .wordmark { width: 200px; margin: 4px auto 0; }
.login-card .login-sub { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 18px 0 2px; }
.login-card h1 { margin-top: 0; }
.login-card .btn.primary { font-size: 14px; }

/* colourful KPI cards */
.kpi { position: relative; overflow: hidden; border-top: 3px solid var(--tone, var(--border)); background: linear-gradient(160deg, var(--tone-soft, var(--surface)) 0%, var(--surface) 75%); }
.kpi.tone-green { --tone: var(--brand); --tone-soft: var(--accent-soft); }
.kpi.tone-coral { --tone: #F0643C; --tone-soft: var(--coral-soft); }
.kpi.tone-blue { --tone: #2F6FDB; --tone-soft: var(--info-soft); }
.kpi.tone-violet { --tone: #7C5CE0; --tone-soft: var(--violet-soft); }
.kpi.tone-amber { --tone: #E8A317; --tone-soft: var(--warn-soft); }
.kpi.tone-teal { --tone: #0EA5A4; --tone-soft: var(--teal-soft); }
.kpi.tone-pink { --tone: #E0529B; --tone-soft: var(--pink-soft); }
.stat { border-top: 3px solid var(--tone, var(--border)); }

/* primary buttons get a subtle brand glow */
.btn.primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 2px 8px rgba(30, 160, 88, .25); }
.topbar h1 .dot { width: 11px; height: 11px; }
.greet h2 { background: linear-gradient(90deg, var(--text), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* account button in the sidebar footer */
.sb-foot .sb-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px; margin: -4px; text-align: left; color: var(--sidebar-text); }
.sb-foot .sb-me:hover { background: var(--sidebar-2); color: #fff; }
.sb-foot .sb-me .who { display: flex; flex-direction: column; }
.sb-foot .sb-me .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 761px) { .app.collapsed .sb-foot .sb-me { flex: none; margin: 0; justify-content: center; } }
.tg-badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; color: var(--info); background: var(--info-soft); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.fx-line { font-size: 12.5px; color: var(--text-2); background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; margin: -4px 0 12px; cursor: help; }
.fx-line.err { background: var(--danger-soft); color: var(--danger); }
.fx-line:empty { display: none; }

/* Finance page: compact layout */
.fin .toolbar { margin-bottom: 10px; }
.fin .kpis { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.fin .kpi { padding: 10px 14px; }
.fin .kpi .k .d { margin: 0 0 0 auto; font-size: 11.5px; color: var(--text-2); }
.fin .kpi .v { font-size: 20px; margin-top: 2px; }
.fin .fin-grid { gap: 12px; margin-bottom: 12px; }
.fin .card-h { padding: 9px 14px; }
.fin .card-b { padding: 10px 14px; }
.fin .hbar { padding: 3px 0; }
.fin-filters { flex-wrap: wrap; row-gap: 6px; }
.fin-filters .seg { margin-left: auto; }
.fin-filters .seg button { padding: 3px 10px; font-size: 12.5px; }
.fin-filters .input { width: auto; height: 30px; padding: 3px 8px; font-size: 13px; }
.fin-filters #f-text { min-width: 120px; max-width: 220px; }
.fin .tbl th { padding: 6px 12px; }
.fin .tbl td { padding: 6px 12px; }
.fin .tbl td.acts { white-space: nowrap; padding-top: 2px; padding-bottom: 2px; }
.fin .tbl td.acts .btn { opacity: .45; }
.fin .tbl tr:hover td.acts .btn, .fin .tbl td.acts .btn:focus-visible { opacity: 1; }
@media (max-width: 760px) {
  .fin .kpis { grid-template-columns: 1fr 1fr; }
  .fin .kpis .kpi:last-child { grid-column: 1 / -1; }
  .fin-filters .seg { margin-left: 0; }
  .fin-filters #f-text { max-width: none; }
}

/* Notifications: bell, dropdown, list */
.bell-wrap { position: relative; flex: none; }
.bell { position: relative; }
.bell-badge { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; pointer-events: none; }
.notif-pop { position: absolute; right: 0; top: calc(100% + 6px); width: min(380px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.16); z-index: 60; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: min(460px, 65vh); overflow-y: auto; }
.notif-list.page { max-height: none; }
.notif { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.notif:hover { background: var(--surface-2, var(--accent-soft)); }
.notif.unread { background: var(--accent-soft); }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.notif-text { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.notif.unread .notif-text { font-weight: 500; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; margin-top: 6px; }
.notif-foot { display: block; text-align: center; padding: 9px; font-size: 13px; font-weight: 500; }
.notif-filters .input { width: auto; }
.onb-row, .set-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.onb-row { align-items: center; justify-content: space-between; }
.set-row:last-of-type { margin-bottom: 8px; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: var(--border-strong); transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.tg-connect { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.tg-qr { background: #fff; padding: 6px; border-radius: 8px; line-height: 0; flex: none; }
.tg-qr svg { width: 150px; height: 150px; }
.dev { display: inline-flex; gap: 4px; align-items: center; background: var(--surface-2); border-radius: 6px; padding: 1px 6px; margin: 2px 2px 0 0; }
.dev a { text-decoration: none; color: var(--muted); }
.chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; background: var(--accent-soft); border-radius: 12px; padding: 3px 10px; }
.chip a { text-decoration: none; }
.pill.dl-sent { background: var(--accent-soft); color: var(--accent); }
.pill.dl-failed { background: var(--danger-soft); color: var(--danger); }
.pill.dl-pending, .pill.dl-sending { background: var(--info-soft); color: #2F6FDB; }
.pill.dl-skipped { background: var(--surface-3); color: var(--text-2); }

/* ---- Report Daily ---- */
.page-max-wide { max-width: 1360px; margin: 0 auto; }
.rd .alert { background: var(--warn-soft); color: var(--warn); }
.rd .kpi .d { font-size: 11.5px; color: var(--muted); }
.rd-shift { min-width: 128px; text-align: center; }
.rd-grid { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.rd-grid.report { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
.rd-grid.stocks { grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); }
.rd-side { display: flex; flex-direction: column; gap: 16px; }
.rd-big { padding: 10px 14px; font-size: 14px; justify-content: center; }
.rd-check { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; cursor: pointer; min-height: 44px; box-sizing: border-box; }
.rd-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.input.warn { border-color: var(--coral); box-shadow: 0 0 0 2px var(--coral-soft); }
.rd-slot { display: flex; gap: 8px; align-items: flex-start; border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin: -2px 0 12px; }
.rd-slot svg { width: 16px; height: 16px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; }
.rd-slot.warn { background: var(--coral-soft); color: var(--coral); }
.rd-slot.ok { background: var(--ok-soft); color: var(--ok); }
.linkish { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.rd-sched-h { flex-wrap: wrap; row-gap: 8px; }
.rd-sched-h select { width: auto; max-width: 180px; }
.rd-chips { display: flex; gap: 6px; padding: 10px 16px 0; overflow-x: auto; }
.rd-chips button { flex: none; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.rd-chips button.on { background: var(--text); border-color: var(--text); color: var(--surface); font-weight: 600; }
.rd-table { padding-top: 6px; }
.rd-table table { min-width: 760px; }
.rd-vid { max-width: 260px; }
.rd-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 16px 14px; }
.pill.rd-wait, .pill.rd-done { background: var(--surface-3); color: var(--text-2); }
.pill.rd-read { background: var(--info-soft); color: var(--info); }
.pill.rd-hit, .pill.rd-v-keep { background: var(--ok-soft); color: var(--ok); }
.pill.rd-miss, .pill.rd-v-watch { background: var(--warn-soft); color: var(--warn); }
.pill.rd-manual { background: var(--violet-soft); color: var(--violet); }
.pill.rd-error, .pill.rd-v-drop { background: var(--danger-soft); color: var(--danger); }
.rd-cards { display: none; }
.rd-card { display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.rd-card:hover { background: var(--surface-2); }
.rd-card-v { font-size: 13.5px; color: var(--text-2); }
.rd-card .row { gap: 12px; }
.rd-fab { display: none; }
.rd-people { display: flex; flex-direction: column; gap: 12px; }
.rd-people .avatar { background: var(--info-soft); color: var(--info); }
.rd-stock { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.rd-stock:hover { background: var(--surface-2); }
.rd-stock.on { background: var(--accent-soft); font-weight: 600; }
.rd-pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 12px; }
tr.rd-bad td { background: var(--danger-soft); }
@media (max-width: 1100px) {
  .rd-grid, .rd-grid.report, .rd-grid.stocks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .rd .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .rd-form-card { display: none; }
  .rd-table { display: none; }
  .rd-cards { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
  .rd-legend { display: none; }
  .rd-sched-h select { max-width: none; flex: 1; }
  .rd-fab { display: inline-flex; align-items: center; gap: 8px; position: fixed; right: 18px; bottom: 22px; z-index: 30; height: 54px; padding: 0 22px; border-radius: 27px; border: 0; background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 15px; box-shadow: 0 6px 16px rgba(19, 128, 63, .35); cursor: pointer; }
  .rd-fab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; }
  .rd { padding-bottom: 72px; }
}

/* ---- Report Daily standalone shell ---- */
.rd-app { display: flex; flex-direction: column; height: 100%; }
.rd-top { height: 54px; display: flex; align-items: center; gap: 10px; padding: 0 20px; background: var(--brand-ink); color: #EDF3EF; flex: none; }
.rd-top h1 { font-size: 14px; font-weight: 500; margin: 0 0 0 8px; color: #B3C0B9; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-top .btn.ghost { color: #D5DED9; }
.rd-top .btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.rd-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 16px; text-decoration: none !important; white-space: nowrap; }
.rd-me { display: inline-flex; }
@media (max-width: 760px) {
  .rd-top { padding: 0 10px; gap: 4px; }
  .rd-top h1 { display: none; }
  .rd-top .rd-brand { flex: 1; }
}
