/* Total Design Lab HQ: clean, clinical, calm. */
:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --border: #e2e7ea;
  --border-strong: #cfd7db;
  --text: #15232b;
  --text-2: #4d5f68;
  --muted: #7d8f98;
  --accent: #0e6e73;
  --accent-hover: #0a5a5e;
  --accent-weak: #e2f1f1;
  --danger: #c0392b;
  --danger-weak: #fcebe9;
  --warn: #a8640c;
  --warn-weak: #fdf3e1;
  --ok: #2b7a4b;
  --ok-weak: #e4f3ea;
  --side-bg: #0f2a33;
  --side-text: #c4d3d8;
  --side-muted: #7f979f;
  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: rgba(94, 205, 199, 0.14);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 40, 50, 0.05), 0 1px 3px rgba(16, 40, 50, 0.04);
  --shadow-lg: 0 20px 50px rgba(16, 40, 50, 0.18);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.icon { width: 18px; height: 18px; flex: none; }
.text-danger { color: var(--danger) !important; }
.muted { color: var(--muted); }
.sep { margin: 0 6px; color: var(--border-strong); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 240px; flex: none;
  background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-name { display: block; color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { display: block; color: var(--side-muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(140deg, #19a39c, #0e6e73); color: #fff; flex: none; }
.logo .icon { width: 20px; height: 20px; }
.logo-lg { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 18px; }
.logo-lg .icon { width: 32px; height: 32px; }
.logo-sm { width: 28px; height: 28px; border-radius: 7px; }
.logo-sm .icon { width: 16px; height: 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; }
.nav-link .icon { color: var(--side-muted); }
.nav-link:hover { background: var(--side-hover); color: #fff; }
.nav-link.active { background: var(--side-active); color: #fff; }
.nav-link.active .icon { color: #6fd6cf; }
.nav-badge { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 10px; font-size: 11px; font-weight: 600; text-align: center; }
.nav-badge-danger { background: #e2554a; color: #fff; }
.nav-badge-warn { background: #e8a33d; color: #2a1a00; }
.nav-badge-accent { background: #3fbab2; color: #062224; }
.nav-badge-muted { background: rgba(255, 255, 255, 0.12); color: var(--side-text); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.me-text { flex: 1; min-width: 0; }
.me-name { display: block; color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { display: block; color: var(--side-muted); font-size: 12px; }
.me .icon-btn { color: var(--side-muted); }
.me .icon-btn:hover { background: var(--side-hover); color: #fff; }

.main { flex: 1; min-width: 0; }
.view { max-width: 1240px; margin: 0 auto; padding: 28px 32px 60px; }
.mobile-bar { display: none; }
.scrim { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-sub { margin: 4px 0 0; color: var(--text-2); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 500; margin-bottom: 10px; }
.back-link:hover { color: var(--accent); }
.back-link .icon { width: 16px; height: 16px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-weak); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-sm .icon { width: 14px; height: 14px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 17px; height: 17px; }
.link { color: var(--accent); font-weight: 600; font-size: 13px; }
.link:hover { text-decoration: underline; }
button.link { background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head .count { color: var(--muted); font-weight: 500; margin-left: 6px; }
.card-body { padding: 16px 18px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { display: block; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: border-color 0.12s; }
.stat:hover { border-color: var(--border-strong); }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border-strong); }
.stat-danger::before { background: var(--danger); }
.stat-warn::before { background: #e3a03a; }
.stat-ok::before { background: var(--ok); }
.stat-accent::before { background: var(--accent); }
.stat-label { color: var(--text-2); font-weight: 500; font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-danger .stat-value { color: var(--danger); }
.stat-warn .stat-value { color: var(--warn); }
.stat-note { color: var(--muted); font-size: 12.5px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }

/* ---------- Rows / lists ---------- */
.list > .row + .row { border-top: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; min-height: 58px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; display: flex; align-items: center; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; gap: 8px; flex: none; }
.sub-link { color: var(--text-2); font-weight: 500; }
.sub-link:hover { color: var(--accent); text-decoration: underline; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border-strong); }
.dot-overdue { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-weak); }
.dot-due { background: #e3a03a; box-shadow: 0 0 0 3px var(--warn-weak); }
.dot-ok { background: #9fb3ba; }
.row.status-overdue { background: linear-gradient(90deg, rgba(192, 57, 43, 0.045), transparent 60%); }
.tag-critical { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--danger); border: 1px solid rgba(192, 57, 43, 0.35); padding: 0 5px; border-radius: 4px; line-height: 16px; }
.as-btn { background: none; border: 0; padding: 0; text-align: left; }
.as-btn:hover .row-title { color: var(--accent); }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-danger { background: var(--danger-weak); color: var(--danger); }
.pill-warn { background: var(--warn-weak); color: var(--warn); }
.pill-ok { background: var(--ok-weak); color: var(--ok); }
.pill-neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.pill-accent { background: var(--accent-weak); color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--text-2); margin-right: 10px; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--chip); }
.due { display: inline-flex; align-items: center; gap: 4px; }
.due .icon { width: 13px; height: 13px; }

/* Tasks */
.checkbox { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; padding: 0; flex: none; color: transparent; }
.checkbox:hover { border-color: var(--accent); color: var(--accent-weak); }
.checkbox .icon { width: 13px; height: 13px; stroke-width: 3; }
.checkbox.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.task.is-done .row-title { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.prio { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); display: inline-block; }
.group-label { padding: 10px 18px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.group-label:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.group-label.danger { color: var(--danger); }

/* Avatars */
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-size: 12px; font-weight: 700; flex: none; background: #dfe6e9; color: var(--text-2); }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar-a { background: #d5ecea; color: #0a5a5e; }
.avatar-b { background: #e3e4f8; color: #3c48a6; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 8px 18px 14px; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.timeline li:not(:last-child)::after { content: ''; position: absolute; left: 11px; top: 36px; bottom: -4px; width: 1px; background: var(--border); }
.tl-dot { width: 23px; height: 23px; border-radius: 50%; background: var(--ok-weak); color: var(--ok); display: grid; place-items: center; flex: none; }
.tl-dot .icon { width: 12px; height: 12px; stroke-width: 3; }
.tl-title { font-weight: 600; font-size: 13.5px; }
.tl-sub { color: var(--text-2); font-size: 12.5px; display: flex; flex-wrap: wrap; }
.tl-note { margin-top: 4px; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }

/* Empty */
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .icon { width: 26px; height: 26px; color: var(--ok); margin-bottom: 6px; }
.empty-title { font-weight: 600; color: var(--text); }
.empty-text { font-size: 13px; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap; border: 1px solid transparent; }
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { background: var(--surface); border-color: var(--border); color: var(--accent); box-shadow: var(--shadow); }
.tab-count { font-size: 11.5px; color: var(--muted); background: var(--surface-2); border-radius: 9px; padding: 0 6px; }
.tab.active .tab-count { background: var(--accent-weak); color: var(--accent); }

/* ---------- Equipment ---------- */
.eq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.eq-card { display: flex; flex-direction: column; padding: 16px 18px; transition: border-color 0.12s, transform 0.12s; }
.eq-card + .eq-card { margin-top: 0; }
.eq-card:hover { border-color: var(--accent); }
.eq-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.eq-cat { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.eq-card h3 { font-size: 15.5px; font-weight: 600; }
.eq-model { color: var(--text-2); font-size: 13px; }
.eq-next { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.eq-next span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 0; padding: 16px 18px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.notes-box { padding: 0 18px 16px; color: var(--text-2); font-size: 13px; white-space: pre-wrap; }
.input.status-select { height: 36px; width: auto; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: 13.5px; }
.banner .icon { margin-top: 1px; }
.banner-warn { background: var(--warn-weak); color: #7a4a06; border: 1px solid #f2d9ac; }
.banner-danger { background: var(--danger-weak); color: #8f2a20; border: 1px solid #f3c7c2; }
.banner-info { background: var(--accent-weak); color: #0a4f53; border: 1px solid #c3e2e1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13.5px; }
.table td:first-child { min-width: 220px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fbfcfc; }
.table .cell-title { font-weight: 600; }
.table .cell-sub { color: var(--muted); font-size: 12px; }
.table .num { font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; padding: 0; color: var(--text-2); }
.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-btn .icon { width: 13px; height: 13px; }
.qty-val { min-width: 54px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.qty-val small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1; }
.flags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- Compliance ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 16px 18px; }
.quick-btn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); background: var(--surface-2); text-align: left; font-weight: 600; font-size: 13px; }
.quick-btn:hover { border-color: var(--accent); border-style: solid; color: var(--accent); background: var(--accent-weak); }
.quick-btn .plus { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); flex: none; }
.quick-btn .plus .icon { width: 14px; height: 14px; }
.quick-today { display: block; font-weight: 500; font-size: 11.5px; color: var(--ok); }
.card-tools { display: flex; align-items: center; gap: 8px; }
.card-tools .input { height: 32px; font-size: 13px; width: auto; max-width: 220px; }

/* ---------- Messages ---------- */
.msg-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - 160px); min-height: 460px; overflow: hidden; }
.msg-list { border-right: 1px solid var(--border); overflow-y: auto; }
.thread { display: flex; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); position: relative; align-items: flex-start; }
.thread:hover { background: var(--surface-2); }
.thread.active { background: var(--accent-weak); }
.thread-main { flex: 1; min-width: 0; }
.thread-top { display: flex; justify-content: space-between; gap: 8px; }
.thread-subject { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread.unread .thread-subject { color: var(--text); font-weight: 700; }
.thread-time { color: var(--muted); font-size: 12px; flex: none; }
.thread-link { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); font-weight: 500; }
.thread-link .icon { width: 12px; height: 12px; }
.thread-snippet { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); position: absolute; right: 14px; bottom: 18px; }
.msg-pane { display: flex; flex-direction: column; min-width: 0; }
.msg-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.msg-head h2 { font-size: 16px; font-weight: 600; }
.msg-head .back { display: none; }
.msg-scroll { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); }
.msg { display: flex; gap: 10px; max-width: 78%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 9px 13px; white-space: pre-wrap; word-break: break-word; }
.msg.mine .bubble { background: var(--accent); border-color: var(--accent); color: #fff; }
.msg-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.msg.mine .msg-meta { text-align: right; }
.composer { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end; }
.composer textarea { resize: none; min-height: 40px; max-height: 140px; }
.composer .btn { height: 40px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field-label { font-weight: 600; font-size: 13px; }
.field-hint { font-size: 12px; color: var(--muted); }
.input { width: 100%; height: 38px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); font: inherit; color: var(--text); }
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid.three { grid-template-columns: 1fr 1fr 1.3fr; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; font-size: 13.5px; }
.check-item input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.checklist { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px 6px; margin: 0 0 16px; background: var(--surface-2); }
.checklist legend { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 0 4px; }

/* ---------- Modal ---------- */
.modal { border: 0; padding: 0; border-radius: 14px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); color: var(--text); background: var(--surface); }
.modal-wide { width: min(680px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(12, 30, 38, 0.45); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.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; font-weight: 600; }
.modal-body { padding: 18px 20px 6px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.spacer { flex: 1; }
.modal-context { background: var(--accent-weak); border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px; }
.mc-title { font-weight: 600; }
.mc-sub { font-size: 12.5px; color: var(--text-2); }

/* Toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; background: var(--side-bg); color: #fff; padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-weight: 500; animation: toast-in 0.2s ease-out; transition: opacity 0.3s, transform 0.3s; }
.toast .icon { color: #6fd6cf; width: 16px; height: 16px; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, #d8ecec, var(--bg) 60%); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 36px 32px 28px; text-align: center; }
.login-card h1 { font-size: 22px; font-weight: 700; }
.login-sub { color: var(--text-2); margin: 6px 0 26px; }
.btn-ms { width: 100%; height: 44px; background: #fff; border: 1px solid #8c8c8c; color: #2f2f2f; font-weight: 600; font-size: 14.5px; border-radius: 6px; gap: 12px; }
.btn-ms:hover { background: #f5f5f5; }
.login-secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.login-secure .icon { width: 14px; height: 14px; }
.demo-box { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); text-align: left; }
.demo-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warn); }
.demo-box p { margin: 4px 0 12px; color: var(--text-2); font-size: 13px; }
.demo-users { display: flex; flex-direction: column; gap: 8px; }
.demo-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-align: left; }
.demo-user:hover { border-color: var(--accent); background: var(--accent-weak); }
.demo-user span:not(.avatar) { flex: 1; display: flex; flex-direction: column; }
.demo-user small { color: var(--muted); font-size: 12px; }
.demo-user .icon { color: var(--muted); }

/* Auth forms */
.auth-form { text-align: left; }
.auth-text { color: var(--text-2); font-size: 13.5px; margin: -14px 0 20px; }
.btn-block { width: 100%; height: 42px; }
.auth-alt { display: inline-block; margin-top: 14px; }
.form-error { display: flex; gap: 8px; align-items: flex-start; background: var(--danger-weak); color: #8f2a20; border: 1px solid #f3c7c2; border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.form-error .icon { width: 16px; height: 16px; margin-top: 1px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-opt { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.role-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.role-opt input { accent-color: var(--accent); margin-top: 3px; }
.role-opt span { display: flex; flex-direction: column; }
.role-opt small { color: var(--muted); font-size: 12px; }
.role-opt.is-taken { opacity: 0.55; cursor: not-allowed; }
.setup-options { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.setup-opt { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); text-align: left; }
.setup-opt:hover { border-color: var(--accent); background: var(--accent-weak); }
.setup-opt span { color: var(--text-2); font-size: 13px; }
.banner-link { color: #0a4f53; }
.banner-link:hover { border-color: var(--accent); }
.banner-link > div { flex: 1; }
.sync { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 12px; color: var(--side-muted); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.sync-dot.ok { background: #3fbab2; }
.sync-dot.saving { background: #e8a33d; }
.sync-dot.error { background: #e2554a; }
.sync-dot.preview { background: var(--side-muted); }

/* Settings */
.settings-email { padding: 0 18px; margin-top: -8px; font-size: 12.5px; color: var(--text-2); }
.setting-form { padding: 14px 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.setting-form .t { font-weight: 600; margin-bottom: 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.settings-grid .card + .card { margin-top: 0; }
.settings-user { display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px; align-items: end; padding: 14px 18px 0; }
.settings-user .avatar { margin-bottom: 17px; }
.card-foot { padding: 0 18px 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; }
.setting-row + .setting-row { border-top: 1px solid var(--border); }
.setting-row .t { font-weight: 600; }
.setting-row .d { color: var(--text-2); font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .layout-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(12, 30, 38, 0.4); z-index: 40; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: 54px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .mobile-title { font-weight: 600; }
  .view { padding: 20px 16px 48px; }
  .msg-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 150px); }
  .msg-layout.has-thread .msg-list { display: none; }
  .msg-layout:not(.has-thread) .msg-pane { display: none; }
  .msg-head .back { display: inline-grid; }
}
@media (max-width: 600px) {
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 24px; }
  .page-head h1 { font-size: 21px; }
  .row { flex-wrap: wrap; padding: 12px 16px; }
  .row-main { flex-basis: calc(100% - 40px); }
  .row.status-overdue .row-end, .row .row-end { width: 100%; padding-left: 20px; justify-content: flex-start; }
  .row.task { flex-wrap: nowrap; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  .settings-user { grid-template-columns: 1fr; }
  .settings-user .avatar { display: none; }
}
