/* TaskFlow - worker task management. Warm neutrals, one teal accent, quiet shadows. */
:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --line: #e6e3da;
  --line-strong: #d4d0c4;
  --text: #1d1c18;
  --muted: #6c6a60;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --accent-soft: #e0f1ee;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --ok: #15803d;
  --ok-soft: #e6f5ec;
  --info-soft: #e8f0fe;
  --c-none: #8a887d;
  --c-prog: #2563eb;
  --c-hold: #d97706;
  --c-wait: #7c3aed;
  --c-done: #16a34a;
  --c-rej: #dc2626;
  --shadow: 0 1px 2px rgba(29, 28, 24, 0.04), 0 1px 1px rgba(29, 28, 24, 0.03);
  --shadow-lg: 0 18px 50px rgba(29, 28, 24, 0.18);
  --radius: 12px;
  --side: 252px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121412;
  --surface: #1a1d1b;
  --surface-2: #202421;
  --line: #2b302d;
  --line-strong: #3a403c;
  --text: #ecebe5;
  --muted: #9b9a90;
  --accent: #2bb3a3;
  --accent-strong: #4cc9ba;
  --accent-soft: #14312e;
  --accent-ink: #06201d;
  --danger: #f08577;
  --danger-soft: #3a1d1a;
  --warn: #f0b25a;
  --warn-soft: #3a2b12;
  --ok: #5fcf88;
  --ok-soft: #14301f;
  --info-soft: #172338;
  --c-none: #8d8b80;
  --c-prog: #6b9bff;
  --c-hold: #f0a43a;
  --c-wait: #a98bff;
  --c-done: #4cc97a;
  --c-rej: #f06a62;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 24px; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 18px; letter-spacing: -0.01em; }
h3 { font-size: 15px; letter-spacing: -0.005em; }
h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.pad { padding: 10px 2px; }
.icon-btn.only-mobile { display: none; }
.print-only { display: none; }
em { font-style: normal; }
.icon { flex: none; }
.row-gap { display: flex; align-items: center; gap: 8px; }
.row-gap.wrap, .wrap { flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.narrow { max-width: 420px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2.gap { margin: 16px 0; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--line); z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; padding: 4px 8px 16px; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; text-decoration: none; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar nav a.on { background: var(--accent-soft); color: var(--accent-strong); }
.sidebar nav a span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar nav a em { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; min-width: 20px; text-align: center; }
.sidebar nav a em.red { background: var(--c-rej); color: #fff; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; gap: 10px; align-items: center; padding: 0 6px; min-width: 0; }
.me > div { min-width: 0; }
.me b, .me small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--muted); font-size: 12px; }
.nav-out { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 8px 10px; border-radius: 9px; color: var(--muted); text-align: left; }
.nav-out:hover { background: var(--surface-2); color: var(--text); }
.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.topbar-space { flex: 1; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-done); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); animation: pulse 2.4s infinite; }
.live.off i { background: var(--c-hold); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
.content { padding: 8px 28px 60px; max-width: 1280px; width: 100%; margin: 0 auto; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 18px; flex-wrap: wrap; }
.sub { color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-h { font-size: 15px; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-h em, .card-head h3 em, h4 em { background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; font-size: 11.5px; padding: 0 7px; color: var(--muted); font-weight: 600; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin: 8px 0 6px; color: var(--muted); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card.attention { border-color: color-mix(in srgb, var(--c-wait) 40%, var(--line)); background: color-mix(in srgb, var(--c-wait) 5%, var(--surface)); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats.small { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { display: flex; gap: 12px; align-items: center; padding: 14px 16px; margin: 0; color: inherit; text-decoration: none !important; transition: border-color 0.15s, transform 0.15s; }
.stat.link:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.stat-ic.t-green { background: var(--ok-soft); color: var(--ok); }
.stat-ic.t-blue { background: var(--info-soft); color: var(--c-prog); }
.stat-ic.t-violet { background: color-mix(in srgb, var(--c-wait) 14%, var(--surface)); color: var(--c-wait); }
.stat-ic.t-red { background: var(--danger-soft); color: var(--danger); }
.stat-ic.t-amber { background: var(--warn-soft); color: var(--warn); }
.stat-n { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat-l { color: var(--muted); font-size: 12.5px; }
.stat-s { color: var(--muted); font-size: 11.5px; }
.grid-main { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.grid-main > .card { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 8px; }
.card-grid .card { margin: 0; }
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 0; max-width: 860px; }
.chart-note { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background 0.12s, border-color 0.12s, transform 0.05s; }
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
:root[data-theme="dark"] .btn-success { color: #06210f; }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); background: var(--ok); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #2a0b07; }
.btn-danger:hover:not(:disabled) { background: var(--danger); filter: brightness(1.08); }
.btn-danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
.btn.block { display: flex; width: 100%; height: 42px; }
.btn-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: none; color: var(--muted); position: relative; text-decoration: none !important; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.icon-btn.bell em { position: absolute; top: -3px; right: -3px; background: var(--c-rej); color: #fff; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 99px; min-width: 17px; text-align: center; line-height: 17px; border: 2px solid var(--bg); }
.link-btn { background: none; border: 0; color: var(--accent-strong); padding: 4px 2px; font-weight: 600; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 11px; min-height: 38px; transition: border-color 0.12s, box-shadow 0.12s; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--accent); flex: none; }
input[type="range"] { padding: 0; accent-color: var(--accent); min-height: 28px; }
select { width: auto; min-width: 0; padding-right: 28px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field select, .field input, .field textarea { width: 100%; }
.field-label { font-weight: 600; font-size: 12.5px; }
.field-hint { color: var(--muted); font-size: 12px; }
.field-error { color: var(--danger); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; max-height: 190px; overflow: auto; padding: 4px 2px; }
.input-btn { display: flex; gap: 6px; }
.input-btn .icon-btn { border-color: var(--line-strong); flex: none; height: 38px; width: 38px; }
.search { position: relative; display: flex; align-items: center; min-width: 220px; }
.search.grow { flex: 1 1 240px; }
.search .icon { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-row select { flex: 0 1 auto; }
.filter-row.dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.count { color: var(--muted); font-size: 12.5px; margin: 0 0 8px 2px; }
.inline-form { display: flex; gap: 8px; align-items: flex-start; }
.inline-form textarea { flex: 1; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs button em { font-size: 11px; background: var(--line); border-radius: 99px; padding: 0 6px; }

/* ---------- tables ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; margin-bottom: 16px; }
.card .table-wrap { border: 0; box-shadow: none; margin-bottom: 0; }
.table-wrap.tall { max-height: 320px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.dense td, .tbl.dense th { padding: 7px 14px; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl tr.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--c-rej); }
.title-cell { min-width: 200px; }
.title-cell b { font-weight: 600; margin-right: 6px; }
.actions-col { width: 1%; white-space: nowrap; text-align: right; }
.who { display: inline-flex; align-items: center; gap: 8px; }
.overdue { color: var(--danger); font-weight: 600; }
.overdue small { font-weight: 500; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: var(--c); white-space: nowrap; --c: var(--c-none); }
.badge i, .prio i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-none { --c: var(--c-none); } .st-prog { --c: var(--c-prog); } .st-hold { --c: var(--c-hold); } .st-wait { --c: var(--c-wait); } .st-done { --c: var(--c-done); } .st-rej { --c: var(--c-rej); }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.prio-medium { color: var(--c-prog); } .prio-high { color: var(--c-hold); } .prio-urgent { color: var(--c-rej); }
.prio-urgent i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-rej) 25%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.big { font-size: 13px; padding: 4px 12px; color: var(--text); }
.chip.big b { margin-left: 6px; color: var(--danger); }
.chip.dec-approved { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.dec-rejected { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.dec-pending { background: color-mix(in srgb, var(--c-wait) 14%, var(--surface)); color: var(--c-wait); border-color: transparent; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; flex: none; background: hsl(var(--h) 45% 90%); color: hsl(var(--h) 55% 28%); }
:root[data-theme="dark"] .avatar { background: hsl(var(--h) 30% 22%); color: hsl(var(--h) 60% 80%); }
.progress { position: relative; height: 18px; min-width: 90px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.progress div { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 35%, var(--surface)); }
.progress span { position: relative; display: block; text-align: center; font-size: 11px; font-weight: 700; line-height: 16px; }

/* ---------- empty / loading / notices ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-ic { width: 54px; height: 54px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 12px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.spinner { display: flex; gap: 6px; justify-content: center; }
.spinner span { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: bounce 1s infinite ease-in-out; }
.spinner span:nth-child(2) { animation-delay: 0.15s; } .spinner span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }
.center-pad { padding: 60px 0; }
.notice { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; background: var(--info-soft); margin: 10px 0; }
.notice p { margin: 4px 0; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.success { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--info-soft); color: var(--c-prog); }

/* ---------- modal / drawer / toasts ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(15, 17, 15, 0.45); display: grid; place-items: center; padding: 16px; animation: fade 0.15s ease; }
.modal { background: var(--surface); border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); width: min(480px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop 0.18s ease; }
.modal.wide { width: min(680px, 100%); }
@keyframes pop { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.modal-body { padding: 8px 18px 16px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.confirm-msg { margin-bottom: 12px; color: var(--muted); }
pre.cred { background: var(--surface-2); border: 1px dashed var(--line-strong); padding: 12px 14px; border-radius: 10px; font: 13.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; white-space: pre-wrap; word-break: break-all; }
.drawer-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(15, 17, 15, 0.35); display: flex; justify-content: flex-end; animation: fade 0.15s ease; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow-y: auto; animation: slide 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-inner { padding: 14px 22px 40px; display: flex; flex-direction: column; gap: 14px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badges { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.drawer-title { font-size: 21px; letter-spacing: -0.02em; line-height: 1.25; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.meta.wide { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); border: 0; padding: 4px 0 0; background: none; }
.meta dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.meta dd { margin: 0; }
.meta .span-all { grid-column: 1 / -1; }
.prose { white-space: pre-wrap; word-break: break-word; }
.note-box { background: var(--warn-soft); padding: 10px 12px; border-radius: 10px; }
blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.approval-panel { border: 1px solid color-mix(in srgb, var(--c-wait) 45%, var(--line)); background: color-mix(in srgb, var(--c-wait) 6%, var(--surface)); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.approval-panel h3 { display: flex; gap: 8px; align-items: center; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.panel.highlight { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.timeline { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.timeline.compact li { padding: 7px 12px; }
.timeline li.tl-feedback { border-left: 3px solid var(--c-wait); }
.timeline li.tl-sub-rejected { border-left: 3px solid var(--c-rej); }
.timeline li.tl-sub-approved { border-left: 3px solid var(--c-done); }
.tl-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.tl-top time { margin-left: auto; color: var(--muted); font-size: 12px; }
.timeline p { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop 0.2s ease; cursor: pointer; }
.toast .icon { margin-top: 2px; }
.toast-success .icon { color: var(--c-done); } .toast-error .icon { color: var(--c-rej); } .toast-notify .icon { color: var(--c-hold); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10.5px; }
.chart .val { fill: var(--text); font-size: 10.5px; font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.legend.col { flex-direction: column; gap: 5px; list-style: none; padding: 0; margin: 0; flex: 1; min-width: 150px; }
.legend.col li { display: flex; align-items: center; color: var(--text); }
.legend.col b { margin-left: auto; padding-left: 12px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-n { font-size: 24px; font-weight: 700; fill: var(--text); }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 34px; gap: 10px; align-items: center; font-size: 13px; }
.hb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { height: 9px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.hb-track div { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s; }
.hbar b { text-align: right; }
.load { position: relative; height: 18px; min-width: 70px; background: var(--surface-2); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.load div { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--c-hold) 35%, var(--surface)); }
.load span { position: relative; font-size: 11.5px; font-weight: 700; padding-left: 7px; line-height: 16px; }
.notes-list { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }

/* ---------- lists ---------- */
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list li > div { flex: 1; min-width: 0; }
.plain-list li small { display: block; color: var(--muted); font-size: 12.5px; }
.plain-list li.clickable { cursor: pointer; border-radius: 8px; }
.plain-list li.clickable:hover { background: var(--surface-2); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 12px; padding: 7px 0; position: relative; }
.activity li:not(:last-child)::before { content: ""; position: absolute; left: 4px; top: 22px; bottom: -7px; width: 1px; background: var(--line); }
.activity .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.activity p { font-size: 13.5px; }
.activity time { color: var(--muted); font-size: 12px; }
.notif-list { list-style: none; padding: 4px 0; }
.notif-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list li.unread { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.notif-list li.clickable { cursor: pointer; }
.notif-list li.clickable:hover { background: var(--surface-2); }
.n-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--muted); }
.n-task_approved, .n-ic.n-task_approved { background: var(--ok-soft); color: var(--ok); }
.n-task_rejected, .n-task_overdue, .n-worker_overdue { background: var(--danger-soft); color: var(--danger); }
.n-task_submitted { background: color-mix(in srgb, var(--c-wait) 14%, var(--surface)); color: var(--c-wait); }
.n-task_assigned, .n-announcement { background: var(--info-soft); color: var(--c-prog); }
.n-body { flex: 1; min-width: 0; }
.n-body p { color: var(--muted); font-size: 13.5px; word-break: break-word; }
.notif-list li.unread .n-body b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 7px; }
.n-body time { font-size: 12px; color: var(--muted); }

/* ---------- worker pages ---------- */
.task-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 8px; }
.tcard { display: flex; flex-direction: column; gap: 10px; text-align: left; margin: 0; width: 100%; transition: border-color 0.15s, transform 0.15s; }
.tcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.tcard h3 { font-size: 15.5px; line-height: 1.3; }
.tcard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tcard-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.tcard.row-overdue { border-left: 3px solid var(--c-rej); }

/* ---------- workers / approvals / templates ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-head.flat { margin-bottom: 8px; }
.ph-main { flex: 1; min-width: 200px; }
.approval-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.approval { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.approval header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.approval footer { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.submission small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px; font-weight: 600; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tpl { display: flex; flex-direction: column; gap: 8px; }
.tpl header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tpl footer { margin-top: auto; padding-top: 6px; }

/* ---------- calendar ---------- */
.cal-title { font-size: 17px; margin-left: 8px; }
.legend-toggle .check { padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0; overflow: hidden; }
.cal-dow { padding: 8px 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 108px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { background: color-mix(in srgb, var(--bg) 60%, var(--surface)); color: var(--muted); }
.cal-cell.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-num { align-self: flex-start; font-size: 12.5px; font-weight: 700; min-width: 24px; height: 24px; line-height: 24px; text-align: center; border-radius: 99px; padding: 0 5px; }
.ev { display: flex; align-items: center; gap: 5px; border: 0; width: 100%; text-align: left; padding: 2px 6px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--info-soft); color: var(--c-prog); overflow: hidden; }
.ev-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-k { font-size: 10px; flex: none; }
.ev-assigned { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-strong); }
.ev-completed { background: var(--ok-soft); color: var(--ok); }
.ev-deadline.p-high { background: var(--warn-soft); color: var(--warn); }
.ev-deadline.p-urgent { background: var(--danger-soft); color: var(--danger); }
.ev-deadline.p-low { background: var(--surface-2); color: var(--text); }
.more { font-size: 11.5px; color: var(--muted); padding-left: 4px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.cal-col { margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.cal-col.today { border-color: var(--accent); }
.cal-col h4 { cursor: pointer; margin: 0; }
.cal-item { display: flex; flex-direction: column; gap: 2px; }
.cal-item time { font-size: 11px; color: var(--muted); }
.cal-day section + section { margin-top: 18px; }

/* ---------- auth ---------- */
.auth-page { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 24px 16px; background: radial-gradient(1000px 500px at 50% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent), var(--bg); position: relative; }
.auth-card { width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.auth-card.center { align-items: center; text-align: center; }
.auth-card h1 { font-size: 22px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.auth-theme { position: absolute; top: 14px; right: 14px; }
.auth-foot { color: var(--muted); font-size: 12.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw); transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg); }
  .menu-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15, 17, 15, 0.4); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .menu-open .scrim { opacity: 1; pointer-events: auto; }
  .icon-btn.only-mobile { display: inline-grid; }
  .topbar { padding: 8px 14px; }
  .content { padding: 4px 14px 60px; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-cell { min-height: 74px; padding: 3px; }
  .cal-cell .ev-t { display: none; }
  .cal-cell .ev { width: auto; padding: 1px 4px; }
  .cal-cell { flex-direction: row; flex-wrap: wrap; align-content: flex-start; }
  .cal-cell .cal-num { flex-basis: 100%; }
  .cal-cell .more { flex-basis: 100%; }
}
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { gap: 8px; }
  .stat { padding: 10px 12px; gap: 9px; }
  .stat-n { font-size: 22px; }
  .stat-ic { width: 32px; height: 32px; }
  .approval-grid { grid-template-columns: 1fr; }
  .meta { grid-template-columns: 1fr 1fr; }
  .drawer-inner { padding: 12px 14px 40px; }
  .hbar { grid-template-columns: 84px 1fr 30px; }
  .search { min-width: 0; flex: 1 1 100%; }
  .filter-row select, .toolbar select { flex: 1 1 100%; width: 100%; }
  .overlay { align-items: end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-foot { border-radius: 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .live { display: none; }
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  table.responsive, table.responsive tbody { display: block; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  table.responsive td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 5px 0; border: 0; text-align: right; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  table.responsive td.title-cell { display: block; text-align: left; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  table.responsive td.title-cell::before, table.responsive td[data-label=""]::before { display: none; }
  table.responsive td.actions-col { justify-content: flex-end; width: auto; }
  .tbl tr.clickable:hover td { background: none; }
  .tbl tr.row-overdue { border-left: 3px solid var(--c-rej); }
  .tbl tr.row-overdue td:first-child { box-shadow: none; }
  .card .table-wrap { margin: 0; }
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 21px; }
  .btn { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- print ---------- */
@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #f6f6f6; --line: #ddd; --text: #000; --muted: #444; }
  .sidebar, .topbar, .no-print, .toasts, .page-actions, .scrim, .drawer-wrap { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; animation: none; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
  .print-only { display: block; margin-bottom: 8px; }
  body { font-size: 11pt; }
  .table-wrap.tall { max-height: none; overflow: visible; }
}
