/* ============ Tokens ============ */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e5e7ef;
  --border-strong: #d4d7e2;
  --text: #171a29;
  --text-2: #5b6178;
  --text-3: #8a90a6;
  /* Light mode uses the Control Technology brand colours */
  --primary: #194d7c;
  --primary-hover: #133d63;
  --primary-soft: #e7eff7;
  --brand-dark: #3a3f47;
  --accent-grad: linear-gradient(135deg, #194d7c, #2f6fa8);
  --good: #10b981;
  --good-soft: #e7f8f1;
  --warn: #f59e0b;
  --warn-soft: #fff6e5;
  --bad: #ef4444;
  --bad-soft: #fdecec;
  --info-soft: #e8f4fd;
  --track: #eceef5;
  --chart-1: #2a6bab;
  --st-todo: #94a3b8;
  --st-progress: #3b82f6;
  --st-review: #f59e0b;
  --st-done: #10b981;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px -12px rgba(16, 24, 40, .25);
  --radius: 12px;
  --sidebar: 232px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1018; --surface: #161925; --surface-2: #1b1f2d; --border: #262b3c; --border-strong: #333a50;
    --text: #e8eaf3; --text-2: #a3a9c0; --text-3: #737a94; --primary: #7c74ff; --primary-hover: #8f88ff; --primary-soft: #23244a;
    --good-soft: #0f2e25; --warn-soft: #33270d; --bad-soft: #3a1717; --info-soft: #132a3d; --track: #262b3c; --chart-1: #818cf8; --accent-grad: linear-gradient(135deg, #6366f1, #8b5cf6);
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 20px 50px -12px rgba(0,0,0,.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1018; --surface: #161925; --surface-2: #1b1f2d; --border: #262b3c; --border-strong: #333a50;
  --text: #e8eaf3; --text-2: #a3a9c0; --text-3: #737a94; --primary: #7c74ff; --primary-hover: #8f88ff; --primary-soft: #23244a;
  --good-soft: #0f2e25; --warn-soft: #33270d; --bad-soft: #3a1717; --info-soft: #132a3d; --track: #262b3c; --chart-1: #818cf8; --accent-grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 20px 50px -12px rgba(0,0,0,.7); color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 18px; }
h3 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
h4 { font-size: 14px; }
p { margin: 4px 0 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ic { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.block { display: block; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.txt-bad { color: var(--bad) !important; }
.txt-warn { color: var(--warn) !important; }
.strike { text-decoration: line-through; color: var(--text-3); }
.row { display: flex; align-items: center; }
.row.between, .between { justify-content: space-between; }
.gap { gap: 10px; } .gap-s { gap: 6px; display: inline-flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ml-auto { margin-inline-start: auto; } .mr-auto { margin-inline-end: auto; }
.mt { margin-top: 18px; } .mt-s { margin-top: 8px; } .mt-xs { margin-top: 4px; } .mb { margin-bottom: 16px; }
.w-full { width: 100%; }
.pad { padding: 16px 18px; }
.right { text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mobile-only { display: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; vertical-align: middle; }
.dot.lg { width: 14px; height: 14px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ============ Buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 8px;
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--good); border-color: var(--good); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-ghost-danger { color: var(--bad); border-color: transparent; background: transparent; }
.btn-ghost-danger:hover { background: var(--bad-soft); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; background: transparent; color: var(--text-2);
  border-radius: 8px; cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.xs { width: 26px; height: 26px; border-radius: 6px; }
.icon-btn.play { color: var(--primary); background: var(--primary-soft); }
.icon-btn.ok { color: var(--good); } .icon-btn.no { color: var(--bad); }
.linklike { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 8px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 7px 10px; min-height: 36px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: var(--primary); margin: 0; }
.form { display: grid; gap: 14px; }
.form.grid-2 { grid-template-columns: 1fr 1fr; }
.form .span-2 { grid-column: span 2; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 550; font-size: 13px; color: var(--text-2); }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--text); cursor: pointer; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
label.inline input { width: auto; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0; }
legend { font-size: 13px; font-weight: 550; color: var(--text-2); padding: 0 4px; }
.member-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.form-error { color: var(--bad); background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; margin: 0; font-size: 13px; }
.swatches { display: flex; gap: 8px; flex-direction: row !important; flex-wrap: wrap; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--border); }
.swatch input:checked + span { border-color: var(--surface); box-shadow: 0 0 0 2px var(--c); }
.swatch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ============ Layout ============ */
#app { min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar); background: var(--surface); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px; z-index: 40; transition: transform .2s;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; padding: 4px 8px 18px; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.brand.big { font-size: 24px; } .brand.big .brand-mark { width: 40px; height: 40px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a, .sidebar-foot a, .sidebar-foot .linklike {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--text-2); font-weight: 550; width: 100%;
}
.nav a:hover, .sidebar-foot a:hover, .sidebar-foot .linklike:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active, .sidebar-foot a.active { background: var(--primary-soft); color: var(--primary); }
.nav-badge { margin-inline-start: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 6px; line-height: 18px; }
.nav-badge:empty { display: none; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-scrim { display: none; }
.main { margin-inline-start: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-right { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-title { margin: 26px 0 12px; font-size: 16px; }

/* Timer widget */
.timer-widget { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 16px 4px 4px; min-width: 0; max-width: 460px; }
.timer-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--primary); color: #fff; cursor: pointer; flex-shrink: 0; }
.timer-btn.running { background: var(--bad); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.45); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }
.timer-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.timer-info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.timer-info small { color: var(--text-2); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.timer-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; margin-inline-start: 4px; }
.att-widget { display: flex; align-items: center; gap: 6px; }
.att-status { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.att-status.in { background: var(--good-soft); color: var(--good); }
.att-status.break { background: var(--warn-soft); color: var(--warn); }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 999px; color: var(--text); }
.me-chip:hover { background: var(--surface-2); text-decoration: none; }
.me-name { display: flex; flex-direction: column; line-height: 1.2; }
.me-name small { color: var(--text-3); text-transform: capitalize; font-size: 11.5px; }

/* Notifications */
.notif-wrap { position: relative; }
.dot-count { position: absolute; top: 3px; inset-inline-end: 2px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; }
.dropdown { position: absolute; inset-inline-end: 0; top: 44px; width: 340px; max-height: 440px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 50; }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: var(--primary-soft); }
.notif small { color: var(--text-3); }

/* ============ Cards & stats ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.no-pad { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-head.pad { margin: 0; border-bottom: 1px solid var(--border); }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.stat.good .stat-icon { background: var(--good-soft); color: var(--good); }
.stat.bad .stat-icon { background: var(--bad-soft); color: var(--bad); }
.stat.accent .stat-icon { background: var(--accent-grad); color: #fff; }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.stat-value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-value.sm { font-size: 16px; }
.stat-sub { font-size: 12px; color: var(--text-3); }
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; background: var(--warn-soft); color: var(--text); margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.banner .ic { color: var(--warn); }
.banner.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--st-progress) 30%, transparent); }
.banner.info .ic { color: var(--st-progress); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 18px; text-transform: none; }
.badge-soft { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.st-todo { background: color-mix(in srgb, var(--st-todo) 18%, transparent); color: var(--text-2); }
.st-progress { background: color-mix(in srgb, var(--st-progress) 16%, transparent); color: var(--st-progress); }
.st-review { background: color-mix(in srgb, var(--st-review) 18%, transparent); color: #b45309; }
.st-done { background: color-mix(in srgb, var(--st-done) 16%, transparent); color: #047857; }
:root[data-theme="dark"] .st-review, :root[data-theme="dark"] .st-done { color: inherit; }
.pr-low { background: var(--surface-2); color: var(--text-2); }
.pr-medium { background: color-mix(in srgb, #3b82f6 14%, transparent); color: #2563eb; }
.pr-high { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #c2410c; }
.pr-urgent { background: color-mix(in srgb, #ef4444 15%, transparent); color: #dc2626; }
.pres-working { background: var(--good-soft); color: #047857; }
.pres-online { background: color-mix(in srgb, #3b82f6 14%, transparent); color: #2563eb; }
.pres-break { background: var(--warn-soft); color: #b45309; }
.pres-out, .pres-offline { background: var(--surface-2); color: var(--text-3); }
.pres-leave { background: color-mix(in srgb, #8b5cf6 15%, transparent); color: #7c3aed; }
.kpi-achieved { --k: var(--good); } .kpi-on { --k: #3b82f6; } .kpi-risk { --k: var(--warn); } .kpi-off { --k: var(--bad); } .kpi-none { --k: var(--text-3); }
.badge.kpi-achieved, .badge.kpi-on, .badge.kpi-risk, .badge.kpi-off, .badge.kpi-none { background: color-mix(in srgb, var(--k) 15%, transparent); color: var(--k); }
.tag { font-size: 11.5px; color: var(--text-2); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.score { display: inline-block; min-width: 34px; text-align: center; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.score.good { background: var(--good-soft); color: var(--good); } .score.warn { background: var(--warn-soft); color: #b45309; } .score.bad { background: var(--bad-soft); color: var(--bad); }
.rank { width: 18px; color: var(--text-3); font-weight: 700; font-size: 12px; }

/* Avatars */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; letter-spacing: .02em; border: 2px solid var(--surface); }
.avatar.has-photo { overflow: hidden; padding: 0; background: var(--track) !important; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-empty { background: var(--track); color: var(--text-3); border-style: dashed; border-color: var(--border-strong); }
.avatars { display: flex; margin-top: 14px; }
.avatars .avatar { margin-inline-start: -6px; } .avatars .avatar:first-child { margin-inline-start: 0; }
.avatar.more { width: 26px; height: 26px; background: var(--surface-2); color: var(--text-2); font-size: 11px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 9px 14px; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table a { color: var(--text); }
.card:not(.no-pad) .table th:first-child, .card:not(.no-pad) .table td:first-child { padding-inline-start: 0; }
.card:not(.no-pad) .table th { background: none; }
.table-scroll { overflow-x: auto; }
.table.sheet td.today, .table.sheet th.today { background: var(--primary-soft); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.inline-select { width: auto; min-height: 30px; padding: 3px 8px; font-size: 13px; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.day-head > span:last-child { margin-inline-start: auto; font-weight: 700; }

/* Tabs / segmented */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 550; padding: 5px 12px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 550; color: var(--text-2); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.week-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.week-nav select { width: auto; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar select { width: auto; }
.search { position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; max-width: 320px; }
.search .ic { position: absolute; inset-inline-start: 10px; color: var(--text-3); }
.search input { padding-inline-start: 34px; }

/* ============ Board ============ */
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px); min-height: 200px; }
.column header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.column header h3 { font-size: 13.5px; }
.col-dot { width: 10px; height: 10px; border-radius: 50%; }
.col-dot.st-todo { background: var(--st-todo); } .col-dot.st-progress { background: var(--st-progress); } .col-dot.st-review { background: var(--st-review); } .col-dot.st-done { background: var(--st-done); }
.count { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: 11.5px; font-weight: 700; padding: 0 7px; color: var(--text-2); }
.col-body { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; border-radius: 0 0 var(--radius) var(--radius); transition: background .15s; }
.col-body.drop-hover { background: var(--primary-soft); }
.col-empty { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: grab; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s; }
.kcard:hover { box-shadow: 0 6px 16px -6px rgba(16,24,40,.2); border-color: var(--border-strong); }
.kcard.dragging { opacity: .5; transform: rotate(1.5deg); }
.kcard h4 { font-size: 14px; font-weight: 600; margin: 8px 0 6px; line-height: 1.35; }
.kcard-top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.kcard-meta { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 12px; margin-top: 10px; flex-wrap: wrap; }
.kcard-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.proj-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--text-2); max-width: 70%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 2px 8px 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 12%, transparent); }
.proj-chip::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c); flex-shrink: 0; }
a.proj-chip:hover { text-decoration: none; filter: brightness(.95); }

/* Task detail */
.task-detail { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; }
.title-input { font-size: 20px; font-weight: 700; border: 1px solid transparent; padding: 4px 8px; margin: -4px -8px 10px; width: calc(100% + 16px); }
.title-input:hover { border-color: var(--border); }
.soft-input { background: var(--surface-2); }
.lbl { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; display: block; margin: 8px 0 6px; }
.section-head { margin: 20px 0 8px; }
.section-head h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); }
.checklist { list-style: none; padding: 0; margin: 0 0 8px; }
.checklist li { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: 6px; }
.checklist li:hover { background: var(--surface-2); }
.comments { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.comment { display: flex; gap: 10px; }
.comment p { margin: 2px 0 0; white-space: pre-wrap; }
.comment-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.task-side { display: flex; flex-direction: column; gap: 12px; border-inline-start: 1px solid var(--border); padding-inline-start: 20px; }
.props { display: grid; grid-template-columns: 100px 1fr; gap: 8px 10px; margin: 0; align-items: center; font-size: 13px; }
.props dt { color: var(--text-2); }
.props dd { margin: 0; display: flex; align-items: center; gap: 4px; }
.props select, .props input { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.mini-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.mini-list li { display: flex; align-items: center; gap: 8px; }
.mini-list li b { margin-inline-start: auto; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 18, 30, .5); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-wide { max-width: 900px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* Toasts */
#toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1e2235; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; transform: translateY(10px); opacity: 0; transition: all .25s; border-inline-start: 4px solid var(--good); max-width: 360px; }
.toast-error { border-inline-start-color: var(--bad); }
.toast.show { transform: none; opacity: 1; }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart rect:hover { opacity: .8; }
.chart .target-line { stroke: var(--bad); stroke-dasharray: 5 4; stroke-width: 1.5; }
.chart-tip { position: fixed; pointer-events: none; background: #1e2235; color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; opacity: 0; transition: opacity .1s; z-index: 300; white-space: nowrap; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut-center { font-size: 20px; font-weight: 750; fill: var(--text); }
.donut-sub { font-size: 10px; fill: var(--text-3); }
.donut-wrap circle[data-tip] { cursor: pointer; transition: stroke-width .15s; }
.donut-wrap circle[data-tip]:hover { stroke-width: 19; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; flex: 1; min-width: 140px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.gauge-text { font-size: 15px; font-weight: 750; fill: var(--text); }
.gauge { flex-shrink: 0; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr 50px; gap: 10px; align-items: center; font-size: 13px; }
.hbar-label { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hbar-track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; }
.hbar-val { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
.progress { height: 7px; background: var(--track); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s; }

/* Dashboard lists */
.people { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.people li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.people li:last-child { border-bottom: 0; }
.people li > a { position: relative; }
.people b { display: block; font-size: 13.5px; }
.people small { display: flex; align-items: center; gap: 4px; }
.people.compact li { padding: 7px 0; }
.people.compact a { color: var(--text); }
.presence-dot { position: absolute; bottom: 0; inset-inline-end: 0; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface); }
.presence-dot.pres-working { background: var(--good); } .presence-dot.pres-online { background: #3b82f6; } .presence-dot.pres-break { background: var(--warn); }
.presence-dot.pres-out, .presence-dot.pres-offline { background: var(--st-todo); } .presence-dot.pres-leave { background: #8b5cf6; }
.presence-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.task-mini { list-style: none; padding: 0; margin: 0; }
.task-mini li { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 6px; }
.task-mini li:hover { background: var(--surface-2); }
.task-mini li:last-child { border-bottom: 0; }
.task-mini b { font-size: 13.5px; font-weight: 600; }
.task-mini small { display: flex; align-items: center; gap: 6px; }
.due { font-size: 12.5px; white-space: nowrap; }
.feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.feed li { display: flex; gap: 8px; align-items: flex-start; }
.feed i { color: var(--text-2); }
.kpi-mini { display: flex; flex-direction: column; gap: 10px; }
.kpi-mini-row { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.kpi-mini-row b { display: block; font-size: 13.5px; }
.kpi-mini-row small { display: block; }

/* Projects */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.proj-card { color: var(--text); display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--c); transition: transform .15s, box-shadow .15s; }
.proj-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(16,24,40,.25); }
.proj-card h3 { gap: 8px; }
.proj-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.proj-stats div, .mini-stats div { display: flex; flex-direction: column; }
.proj-stats small, .mini-stats small { color: var(--text-3); font-size: 11.5px; }

/* Team */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.member-card { color: var(--text); display: flex; flex-direction: column; gap: 12px; transition: transform .15s, box-shadow .15s; }
.member-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(16,24,40,.25); }
.member-card.inactive { opacity: .55; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); text-align: center; }
.now-working { margin: 0; color: var(--good); font-weight: 550; display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.center-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.metric-row { text-align: start; margin-top: 14px; }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.kpi-card { position: relative; border-inline-start: 4px solid var(--k); }
.kpi-card h3 { margin-top: 4px; }
.kpi-values { margin-top: 10px; display: flex; align-items: baseline; gap: 6px; }
.kpi-actual { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.kpi-card .progress-fill { background: var(--k); }
.kpi-actions { position: absolute; top: 8px; inset-inline-end: 90px; display: none; gap: 2px; }
.kpi-card:hover .kpi-actions, .kpi-card:focus-within .kpi-actions { display: flex; }
.explain { margin: 8px 0 0; padding-inline-start: 18px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }

/* Attendance heatmap */
.heat { border-collapse: separate; border-spacing: 3px; padding: 8px 14px 14px; }
.heat th { font-size: 11px; color: var(--text-3); font-weight: 600; text-align: center; min-width: 22px; }
.heat td { text-align: center; font-size: 13px; }
.cell { display: inline-block; width: 20px; height: 20px; border-radius: 5px; background: var(--track); vertical-align: middle; }
.cell.present { background: var(--good); } .cell.late { background: var(--warn); } .cell.absent { background: var(--bad); opacity: .75; } .cell.weekend { background: var(--surface-2); border: 1px dashed var(--border-strong); }
.legend-inline { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend-inline .cell { width: 12px; height: 12px; margin-inline-start: 8px; }

/* Empty / loading */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--text-3); }
.empty h3 { justify-content: center; color: var(--text); }
.loading { display: grid; place-items: center; padding: 80px; }
.loading.full { min-height: 100vh; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--track); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Auth */
.auth-root { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: linear-gradient(145deg, #0d2a45, #194d7c 60%, #2a6bab); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.auth-hero h1 { font-size: 38px; line-height: 1.15; max-width: 520px; }
.auth-hero p { color: rgba(255,255,255,.82); font-size: 16px; max-width: 520px; }
.auth-hero .brand-mark { background: rgba(255,255,255,.18); }
.hero-points { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.hero-points li { display: flex; gap: 10px; align-items: center; }
.auth-card { align-self: center; justify-self: center; width: 100%; max-width: 420px; padding: 40px 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-card h2 { font-size: 26px; }
.demo-box { background: var(--primary-soft); border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.8; }

/* ============ Responsive ============ */
@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .me-name { display: none; }
}
@media (max-width: 1024px) {
  .grid-3-1, .grid-1-2, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .att-status { display: none; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar.open + .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-inline-start: 0; }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 16px; }
  .timer-info b { max-width: 120px; }
  .task-detail { grid-template-columns: 1fr; }
  .task-side { border-inline-start: 0; padding-inline-start: 0; border-top: 1px solid var(--border); padding-top: 16px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 20px; }
  .auth-hero h1 { font-size: 26px; }
  .hero-points { display: none; }
}
@media (max-width: 640px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form.grid-2 { grid-template-columns: 1fr; }
  .form .span-2 { grid-column: auto; }
  .timer-info { display: none; }
  .timer-widget { padding-inline-end: 10px; }
  .att-widget .btn-sm { padding: 0 8px; }
  .att-widget #breakBtn { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { flex-direction: column; gap: 8px; padding: 12px; }
  .stat-value { font-size: 20px; }
  .board { grid-template-columns: repeat(4, 85vw); scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }
  .table-scroll, .card.no-pad { overflow-x: auto; }
  .page-head h1 { font-size: 21px; }
  .dropdown { position: fixed; inset-inline-start: 12px; inset-inline-end: 12px; width: auto; top: 60px; }
  .search { max-width: none; }
  .kpi-actions { display: flex; }
}

/* ---- fixes ---- */
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.icon-btn.mobile-only { display: none; }
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.hbar-row { grid-template-columns: minmax(110px, 1.5fr) 1.5fr 50px; }
@media (max-width: 860px) { .icon-btn.mobile-only { display: inline-grid; } }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #themeBtn, .me-chip { display: none; }
  .timer-widget { gap: 6px; flex-shrink: 1; }
  .timer-clock { font-size: 13px; }
  .topbar-right { gap: 4px; }
  .content, .main { max-width: 100vw; overflow-x: hidden; }
}

/* ============ Branding / logo ============ */
.logo { display: inline-flex; align-items: center; }
.logo img { display: block; height: auto; max-width: 100%; }
.logo .logo-for-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo .logo-for-light { display: none; }
  :root:not([data-theme="light"]) .logo .logo-for-dark { display: block; }
}
:root[data-theme="dark"] .logo .logo-for-light { display: none; }
:root[data-theme="dark"] .logo .logo-for-dark { display: block; }
/* The sign-in hero has a dark blue background in both themes, so it always uses the white logo */
.logo-hero .logo-for-light { display: none !important; }
.logo-hero .logo-for-dark { display: block !important; }
.logo-hero img { width: 300px; max-width: 80%; margin-bottom: 8px; }
.brand { flex-direction: column; align-items: flex-start; gap: 6px; padding: 6px 8px 18px; }
.brand:hover { text-decoration: none; }
.brand .logo img { width: 188px; }
.brand-app { font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; padding-inline-start: 2px; }
.auth-card-logo { display: none; }
.auth-card-logo img { width: 220px; }

/* ============ New components ============ */
.btn-lg { height: 44px; font-size: 15px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.menu-wrap { position: relative; }
.quick-menu { width: 290px; padding: 6px; }
.quick-menu button { display: flex; gap: 12px; align-items: flex-start; width: 100%; border: 0; background: none; color: var(--text); font: inherit; text-align: start; padding: 10px; border-radius: 8px; cursor: pointer; }
.quick-menu button:hover { background: var(--surface-2); }
.quick-menu button .ic { color: var(--primary); margin-top: 2px; }
.quick-menu b { display: block; font-size: 13.5px; }
.quick-menu small { color: var(--text-3); font-size: 12px; }
.seats { font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; }
.seats b { color: var(--text); }
.seats.full { border-color: var(--bad); color: var(--bad); }
.seat-bar .progress { margin-top: -6px; height: 5px; }
.getting-started { border-inline-start: 4px solid var(--primary); }
.gs-steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.gs-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.gs-steps li a { color: var(--text); display: flex; flex-direction: column; }
.gs-steps li.ok { opacity: .6; }
.gs-steps li.ok b { text-decoration: line-through; }
.gs-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; }
.gs-steps li.ok .gs-check { background: var(--good); border-color: var(--good); color: #fff; }
.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-opt { display: flex; flex-direction: column; gap: 8px; cursor: pointer; border: 2px solid var(--border); border-radius: 12px; padding: 10px; font-weight: 550; font-size: 13px; }
.theme-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.theme-opt input { position: absolute; opacity: 0; }
.theme-preview { height: 54px; border-radius: 8px; display: grid; grid-template-columns: 1fr 3fr; grid-template-rows: 1fr 1fr; gap: 4px; padding: 6px; }
.theme-preview i { border-radius: 3px; }
.theme-preview i:first-child { grid-row: span 2; }
.theme-opt.light .theme-preview { background: #f5f6fa; border: 1px solid #e5e7ef; } .theme-opt.light .theme-preview i { background: #fff; } .theme-opt.light .theme-preview i:nth-child(2) { background: #194d7c; }
.theme-opt.dark .theme-preview { background: #0e1018; } .theme-opt.dark .theme-preview i { background: #1b1f2d; } .theme-opt.dark .theme-preview i:nth-child(2) { background: #7c74ff; }
.theme-opt.system .theme-preview { background: linear-gradient(90deg, #f5f6fa 50%, #0e1018 50%); } .theme-opt.system .theme-preview i { background: rgba(127,127,127,.35); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.help-card ol { margin: 10px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.help-card ol b { color: var(--text); }
.help-ic { width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-inline-end: 4px; }
.banner a { font-weight: 600; }
@media (max-width: 860px) {
  .auth-card-logo { display: block; }
  .auth-hero { display: none; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .theme-picker { grid-template-columns: 1fr 1fr 1fr; }
  .quick-menu { position: fixed; inset-inline-start: 12px; inset-inline-end: 12px; width: auto; top: 60px; }
}

.stat-value { white-space: nowrap; }
@media (min-width: 641px) { .stats.stats-6 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
.dot-count[hidden], .nav-badge:empty { display: none; }

/* Period picker */
.range-picker { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 4px 8px; }
.range-picker .rp-icon { color: var(--primary); display: inline-flex; }
.range-picker select, .range-picker input { width: auto; border: 0; min-height: 30px; padding: 2px 4px; background: transparent; box-shadow: none; }
.range-picker select { font-weight: 600; }
.range-picker .rp-dates { display: inline-flex; align-items: center; gap: 6px; border-inline-start: 1px solid var(--border); padding-inline-start: 8px; }
.range-picker .rp-dates[hidden] { display: none; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); }
@media (max-width: 640px) { .range-picker { width: 100%; } .range-picker .rp-dates { border-inline-start: 0; padding-inline-start: 0; } }

/* Notes & attachments panel */
.np { display: flex; flex-direction: column; gap: 10px; }
.np-head h4 { display: flex; align-items: center; gap: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); }
.np-notes { display: flex; flex-direction: column; gap: 12px; max-height: 320px; overflow-y: auto; }
.np-notes .comment p { white-space: pre-wrap; }
.np-del { float: inline-end; }
.np-form { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.np-files { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.np-files li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); min-width: 0; }
.np-files li.muted { background: none; padding-inline-start: 0; }
.np-open { min-width: 0; flex: 1; text-align: start; }
.np-open span { max-width: 100%; }
.np-drop { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--border-strong); border-radius: 10px; padding: 12px; cursor: pointer; color: var(--primary); font-weight: 600; font-size: 13px; text-align: center; }
.np-drop:hover, .np-drop.over { background: var(--primary-soft); border-color: var(--primary); }
.np-drop small { width: 100%; font-weight: 400; }
.preview-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 8px; }
.pre { white-space: pre-wrap; }

/* Locations */
.loc-map { height: 320px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; z-index: 0; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.loc-card.inactive { opacity: .6; }
.loc-card .avatars { margin-top: 6px; }
.mb-s { margin-bottom: 8px; }
.banner.success { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.banner.success .ic { color: var(--good); }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; display: inline-block; vertical-align: middle; }
a.badge:hover { text-decoration: none; filter: brightness(.95); }
.leaflet-container { font: inherit; }
.np-files li:not(.muted) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; align-items: center; }
.np-files li .np-open { grid-column: 1; }
.np-files li small { grid-column: 1; grid-row: 2; padding-inline-start: 24px; }
.np-files li .icon-btn { grid-column: 2; grid-row: 1 / span 2; }

/* ============ v2: alarms, approvals, balances, payroll ============ */
.txt-good { color: var(--good) !important; }
.banner.danger { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.banner.danger .ic { color: var(--bad); }
.banner.success { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.banner.success .ic { color: var(--good); }
.banner.warn .ic { color: var(--warn); }
a.banner { color: var(--text); text-decoration: none; }
a.banner:hover { filter: brightness(.98); }
.alarm-banner.danger .ic { animation: ring 1.6s ease-in-out infinite; }

/* Overdue (red) and due-soon (yellow) alarms */
.alarm { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 18px; vertical-align: middle; }
.alarm .ic { flex: none; }
.alarm-red { background: var(--bad); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.alarm-red .ic { animation: ring 1.6s ease-in-out infinite; transform-origin: 50% 10%; }
.alarm-yellow { background: #facc15; color: #422006; box-shadow: 0 0 0 3px color-mix(in srgb, #facc15 25%, transparent); }
@keyframes ring { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .alarm-red .ic, .alarm-banner .ic { animation: none; } }
.kcard-overdue { border-inline-start: 4px solid var(--bad) !important; }
.kcard-due_soon { border-inline-start: 4px solid #facc15 !important; }
tr.row-overdue td:first-child, li.row-overdue { box-shadow: inset 3px 0 0 var(--bad); }
tr.row-due_soon td:first-child, li.row-due_soon { box-shadow: inset 3px 0 0 #facc15; }
.mt-xs { margin-top: 4px; }

/* Approval chain stepper */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.stepper li { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.stepper li + li::before { content: ''; width: 14px; height: 2px; background: var(--border-strong); margin-inline-end: 2px; }
.step-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-3); }
.step-approved .step-dot { background: var(--good); border-color: var(--good); color: #fff; }
.step-rejected .step-dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.step-pending .step-dot { background: var(--warn); border-color: var(--warn); color: #fff; }
.step-pending .step-label { color: var(--text); font-weight: 650; }
.step-skipped { opacity: .5; } .step-skipped .step-label { text-decoration: line-through; }

/* Decision dialogs */
.review-summary { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.review-summary p { margin: 6px 0 0; }
.decision-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.decision { display: flex !important; flex-direction: row !important; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 10px; border: 2px solid var(--border-strong); cursor: pointer; font-weight: 650; }
.decision input { position: absolute; opacity: 0; pointer-events: none; }
.decision.approve:has(input:checked) { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.decision.reject:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.decision:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.confirm-quality { padding: 10px 12px; border-radius: 10px; background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); align-items: flex-start !important; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.review-list li { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border-inline-start: 3px solid var(--border-strong); }
.review-list li p { margin: 4px 0 0; }
.review-list .rv-approved { border-inline-start-color: var(--good); }
.review-list .rv-rejected { border-inline-start-color: var(--bad); }
.review-list .rv-submitted { border-inline-start-color: var(--warn); }
.approval-banner .btn { margin-inline-end: 6px; }

/* Vacation balance */
.balance-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); }
.balance-strip small, .balance-grid small { display: block; color: var(--text-2); font-size: 11.5px; }
.balance-strip b { font-size: 16px; }
.balance-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.balance-grid > div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.balance-grid b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.balance-grid span { font-size: 11.5px; color: var(--text-3); }
.balance-grid .big { background: var(--accent-grad); color: #fff; border: 0; }
.balance-grid .big small, .balance-grid .big span { color: rgba(255,255,255,.85); }
@media (max-width: 900px) { .balance-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .balance-grid, .balance-strip { grid-template-columns: repeat(2, 1fr); } }

.stat-value.small-value { font-size: 17px; }
.btn-xs { padding: 2px 8px; font-size: 12px; min-height: 0; }

/* Payroll */
.pay-num { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.pay-total td { font-weight: 750; background: var(--surface-2); }
.pay-neg { color: var(--bad); }
.pay-notes { font-size: 11.5px; color: var(--text-3); max-width: 260px; }
.pay-break { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; font-size: 13px; }
.pay-break .sep { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 4px 0; }
.pay-break .tot { font-weight: 750; }
.comp-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; align-items: end; }
@media (max-width: 560px) { .comp-row { grid-template-columns: 1fr 1fr; } }
.locked-badge { background: var(--good-soft); color: var(--good); }

/* v3 */
.review-panel { border: 2px solid var(--st-review); background: color-mix(in srgb, var(--st-review) 6%, var(--surface)); margin-bottom: 16px; }
.review-panel .decision-pick { margin-bottom: 4px; }
.photo-edit { display: flex; align-items: center; gap: 14px; }
.photo-edit .avatar { font-size: 28px !important; }
.contact-line { display: inline-flex; align-items: center; gap: 6px; }
.util-card .gauge-wrap { display: grid; place-items: center; }
.util-bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; min-width: 80px; }
.util-bar > span { display: block; height: 100%; border-radius: inherit; }
.util-good { background: var(--good); } .util-warn { background: var(--warn); } .util-bad { background: var(--bad); }
.explorer-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.explorer-pick select { min-width: 220px; }
.metric-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.metric-tile { padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.metric-tile .lbl { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.metric-tile .val { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; }
.metric-tile .sub { font-size: 12px; color: var(--text-3); }
.audit-table td { vertical-align: top; }
.audit-table .when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lang-switch { display: inline-flex; gap: 4px; }

/* Arabic / right-to-left */
html[lang="ar"] body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", "Arabic UI Text", Arial, sans-serif; }
html[dir="rtl"] .table th, html[dir="rtl"] .stat-label { letter-spacing: 0; text-transform: none; }
html[dir="rtl"] input[type="tel"], html[dir="rtl"] input[type="email"], html[dir="rtl"] .mono, html[dir="rtl"] code { direction: ltr; text-align: end; }
html[dir="rtl"] .timer-clock, html[dir="rtl"] .when { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .stepper li + li::before { margin-inline-end: 2px; }
@media (max-width: 860px) { html[dir="rtl"] .sidebar:not(.open) { transform: translateX(100%); } }
.auth-lang { margin: 0 auto 14px; display: flex; width: max-content; }
/* text people typed keeps its own direction inside the Arabic layout */
html[dir="rtl"] textarea, html[dir="rtl"] input[type="text"], html[dir="rtl"] input:not([type]), html[dir="rtl"] .title-input,
html[dir="rtl"] .comment p, html[dir="rtl"] .np-note p, html[dir="rtl"] .review-list p { unicode-bidi: plaintext; }
