/* public_html/assets/css/app.css */
/* ============================================================
   WEBS Operations — shared styles
   Dark navy + WEBS orange (staff app). Light theme for the client
   portal and public tracking page via [data-theme="light"].
   ============================================================ */

:root {
  --bg: #0a1628;
  --surface: #112240;
  --surface2: #1a3358;
  --surface3: #24446e;
  --border: #1e3a5f;
  --text: #f0f4ff;
  --text-muted: #8aa6c8;
  --heading: #ffffff;
  --accent: #f39220;          /* WEBS orange (from logo) */
  --accent-hover: #ffa53d;
  --accent-soft: rgba(243,146,32,0.14);
  --navy: #1c2f6b;            /* WEBS navy (from logo) */
  --blue: #4f8fe0;
  --blue-soft: rgba(79,143,224,0.16);
  --ok: #22c55e;
  --ok-soft: rgba(34,197,94,0.14);
  --warn: #f5b00b;
  --warn-soft: rgba(245,176,11,0.15);
  --danger: #ef5050;
  --danger-soft: rgba(239,80,80,0.15);
  --purple: #9b7cf0;
  --purple-soft: rgba(155,124,240,0.15);
  --shadow: 0 16px 48px rgba(0,0,0,0.5);
  --radius: 12px;
  --mono: 'DM Mono', ui-monospace, Menlo, monospace;
  --num: 'DM Sans', system-ui, sans-serif;   /* numbers: plain zeros, digits line up (tabular) */
  --accent-text: var(--accent);               /* orange used AS TEXT (links, codes, active tab) */
  --on-accent: #fff;                          /* text on an orange button or badge */
  --overlay: rgba(4,10,22,.72);
  --card-shadow: none;
}

[data-theme="light"] {
  /* White pages, WEBS navy text, WEBS orange accents. Contrast checked against WCAG AA. */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface2: #f3f5fa;
  --surface3: #e4e9f2;
  --border: #dfe5ef;
  --text: #1f2a44;
  --text-muted: #5b6884;
  --heading: #1c2f6b;           /* WEBS navy */
  --accent: #f39220;            /* WEBS orange for fills */
  --accent-hover: #e8850f;
  --accent-soft: rgba(243,146,32,0.13);
  --accent-text: #ab5505;       /* orange that is readable as text on white */
  --on-accent: #1c2f6b;         /* navy on orange reads clearly; white on orange does not */
  --blue: #1d4ed8;
  --blue-soft: rgba(29,78,216,0.09);
  --ok: #15803d;
  --ok-soft: rgba(21,128,61,0.10);
  --warn: #b45309;
  --warn-soft: rgba(245,158,11,0.16);
  --danger: #b91c1c;
  --danger-soft: rgba(185,28,28,0.09);
  --purple: #6d28d9;
  --purple-soft: rgba(109,40,217,0.09);
  --shadow: 0 12px 40px rgba(20,32,74,0.16);
  --overlay: rgba(20,32,74,0.45);
  --card-shadow: 0 1px 2px rgba(20,32,74,0.05), 0 1px 3px rgba(20,32,74,0.04);
}

/* Light theme keeps the sidebar navy: the sidebar gets its own dark colours */
[data-theme="light"] .sidebar {
  --surface: #1c2f6b;
  --surface2: #253b80;
  --surface3: #2f478f;
  --border: #2f4686;
  --text: #eef2fc;
  --text-muted: #a9b7da;
  --heading: #ffffff;
  --accent-text: #f7a541;
  --accent-soft: rgba(243,146,32,0.18);
  --danger: #ff9b9b;
  color: var(--text);
  border-right-color: #1c2f6b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'DM Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
[data-lucide], svg.lucide { width: 15px; height: 15px; flex-shrink: 0; }

/* ── App shell ─────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 232px; min-width: 232px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; z-index: 40; }
.sidebar-logo { padding: 16px 16px 14px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.logo-img { width: 44px; height: 44px; object-fit: contain; background: #fff; padding: 5px; border-radius: 8px; }
.logo-text { font-size: 15px; font-weight: 700; color: var(--heading); line-height: 1.15; }
.logo-sub { font-size: 11px; color: var(--text-muted); }
.nav-section { padding: 12px 0 4px; }
.nav-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; padding: 0 18px 6px; }
button.nav-label { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left; }
button.nav-label:hover { color: var(--text); }
button.nav-label > i, button.nav-label > svg { margin-left: auto; transition: transform .15s; opacity: .7; }
.nav-section.folded button.nav-label > i, .nav-section.folded button.nav-label > svg { transform: rotate(-90deg); }
.nav-section.folded:not(.has-active) .nav-items { display: none; }
.nav-section.folded { padding-bottom: 0; }
.nav-sec-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.nav-sec-dot.danger { background: var(--danger); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 18px; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-left: 2px solid transparent; text-decoration: none; }
.nav-item:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); border-left-color: var(--accent); }
.nav-item.soon { opacity: .55; }
.nav-item .nav-badge { margin-left: auto; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.nav-item .nav-badge.danger { background: var(--danger); }
.nav-item .nav-tag { margin-left: auto; font-size: 9px; font-weight: 700; letter-spacing: .4px; color: var(--text-muted); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 16px; }
.user-pill { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface2); border-radius: 8px; border: 1px solid var(--border); }
.avatar { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: linear-gradient(135deg, var(--accent), #ff7a00); color: #fff; flex-shrink: 0; }
.user-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text-muted); }

.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar { height: 56px; min-height: 56px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 12px; }
.topbar-title { font-size: 15px; font-weight: 700; color: var(--heading); white-space: nowrap; }
.topbar-search { flex: 1; max-width: 360px; position: relative; margin-left: 12px; }
.topbar-search input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px 7px 34px; font-size: 13px; color: var(--text); font-family: inherit; outline: none; }
.topbar-search input:focus { border-color: var(--accent); }
.topbar-search .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 20px; }
.content-inner { max-width: 1400px; margin: 0 auto; }

.icon-btn { width: 34px; height: 34px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); position: relative; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--surface); }

/* ── Page header ───────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 700; color: var(--heading); letter-spacing: -.3px; }
.page-head .sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 10px; cursor: pointer; }
.back-link:hover { color: var(--accent-text); text-decoration: none; }

/* ── Cards / panels ────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; cursor: default; box-shadow: var(--card-shadow); }
.stat-card.link { cursor: pointer; }
.stat-card.link:hover { border-color: var(--accent); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--c, var(--accent)); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--heading); font-family: var(--num); letter-spacing: -1px; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); }
.panel + .panel { margin-top: 14px; }
.grid-2 > .panel, .grid-main > .panel, .grid-dash > .panel, .stack > .panel { margin-top: 0; }
.panel-header { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-title { font-size: 14px; font-weight: 700; color: var(--heading); display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.grid-dash { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; text-decoration: none; line-height: 1.2; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); border-color: var(--accent); }
.btn-success { background: var(--ok); color: #fff; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ── Badges ────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.b-open { background: var(--blue-soft); color: var(--blue); }
.b-on_hold { background: var(--warn-soft); color: var(--warn); }
.b-completed { background: var(--ok-soft); color: var(--ok); }
.b-cancelled { background: var(--surface3); color: var(--text-muted); }
.b-urgent { background: var(--danger-soft); color: var(--danger); }
.b-normal { background: var(--surface2); color: var(--text-muted); }
.b-low { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.b-late { background: var(--danger-soft); color: var(--danger); }
.b-client { background: var(--purple-soft); color: var(--purple); }
.b-stage { background: var(--accent-soft); color: var(--accent-text); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-muted { background: var(--surface2); color: var(--text-muted); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); background: var(--surface2); white-space: nowrap; }
.data-table td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tr.click { cursor: pointer; }
.data-table tr.click:hover { background: var(--surface2); }
.data-table .num { text-align: right; font-family: var(--num); }
.order-no { font-family: var(--mono); font-size: 12px; color: var(--accent-text); font-weight: 500; white-space: nowrap; }
.cell-title { font-weight: 500; }
.cell-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.progress-track { background: var(--surface3); border-radius: 4px; height: 5px; overflow: hidden; min-width: 60px; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.progress-fill.done { background: var(--ok); }

/* ── Filters / pagination ──────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.filter-select, .filter-input { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; font-size: 12px; color: var(--text); font-family: inherit; outline: none; }
.filter-select:focus, .filter-input:focus { border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; background: var(--surface); }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.chip .n { font-family: var(--num); margin-left: 4px; opacity: .8; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.pager .btns { display: flex; gap: 6px; }

/* ── Pipeline (dashboard) ──────────────────────────────────── */
.pipeline { display: flex; flex-direction: column; gap: 16px; }
.pipe-row-title { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 7px; text-transform: uppercase; letter-spacing: .4px; }
.pipe-stages { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(80px, 1fr); gap: 6px; overflow-x: auto; padding-bottom: 2px; align-items: start; }
.pipe-stage { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 9px; cursor: pointer; height: 68px; display: flex; flex-direction: column; justify-content: space-between; }
.pipe-stage:hover { border-color: var(--accent); }
.pipe-stage.zero { opacity: .5; }
.pipe-stage .nm { font-size: 11px; color: var(--text-muted); line-height: 1.25; }
.pipe-stage .ct { font-size: 20px; font-weight: 700; font-family: var(--num); color: var(--heading); display: flex; align-items: baseline; gap: 6px; }
.pipe-stage .lt { font-size: 10px; font-weight: 700; color: var(--danger); }

.bars { display: flex; align-items: flex-end; gap: 5px; height: 110px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.muted { background: var(--surface3); }
.bar-lbl { font-size: 9px; color: var(--text-muted); }
.bar-val { font-size: 10px; color: var(--text-muted); font-family: var(--num); }

/* ── Stepper (order detail) ────────────────────────────────── */
.stepper { display: flex; gap: 0; overflow-x: auto; padding: 4px 2px 6px; }
.step { flex: 1; min-width: 92px; text-align: center; position: relative; }
.step::after { content: ''; position: absolute; top: 13px; left: calc(50% + 15px); right: calc(-50% + 15px); height: 2px; background: var(--border); }
.step:last-child::after { display: none; }
.step.done::after { background: var(--accent); }
.step-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface2); display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); position: relative; z-index: 1; }
.step.done .step-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step.current .step-dot { background: var(--surface); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.step.current.late .step-dot { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.step-label { font-size: 11px; color: var(--text-muted); line-height: 1.25; padding: 0 4px; }
.step.done .step-label, .step.current .step-label { color: var(--text); font-weight: 600; }
.step-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.current-stage { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface2); }
.current-stage .lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.current-stage .nm { font-size: 16px; font-weight: 700; color: var(--heading); margin-top: 2px; }
.current-stage .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Key/value list ────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ── Timeline ──────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.tl-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); }
.tl-icon svg { width: 13px; height: 13px; }
.tl-icon.stage { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tl-icon.client { background: var(--purple-soft); color: var(--purple); border-color: transparent; }
.tl-icon.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tl-icon.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tl-body { flex: 1; min-width: 0; padding-top: 3px; }
.tl-title { font-size: 13px; font-weight: 600; }
.tl-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tl-note { font-size: 13px; color: var(--text); margin-top: 6px; background: var(--surface2); padding: 8px 11px; border-radius: 7px; border-left: 2px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-note.visible { border-left-color: var(--purple); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-label .req { color: var(--accent-text); }
.form-input, .form-select, .form-textarea { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13px; color: var(--text); font-family: inherit; outline: none; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-select option { background: var(--surface); color: var(--text); }
.form-hint { font-size: 11px; color: var(--text-muted); }
.field-error { font-size: 11px; color: var(--danger); }
.has-error .form-input, .has-error .form-select, .has-error .form-textarea { border-color: var(--danger); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.items-table td { padding: 6px 4px; border: none; }
.items-table .form-input { padding: 7px 9px; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(3px); padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); animation: rise .18s; }
@keyframes rise { from { transform: translateY(10px); opacity: .6; } }
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 860px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-title { font-size: 15px; font-weight: 700; color: var(--heading); }
.modal-body { padding: 20px; overflow-y: auto; }

/* ── Dropdown (notifications) ──────────────────────────────── */
.dropdown { position: absolute; top: 42px; right: 0; width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 60; overflow: hidden; cursor: default; }
.dropdown-head { padding: 11px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--heading); }
.dropdown-list { max-height: 380px; overflow-y: auto; }
.notif { padding: 11px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; cursor: pointer; text-align: left; }
.notif:hover { background: var(--surface2); }
.notif:last-child { border-bottom: none; }
.notif.unread { background: var(--accent-soft); }
.notif-ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface2); color: var(--text-muted); }
.notif-ic.sla, .notif-ic.client_action { color: var(--danger); background: var(--danger-soft); }
.notif-ic.new_order, .notif-ic.assigned { color: var(--accent-text); background: var(--accent-soft); }
.notif-t { font-size: 12px; font-weight: 600; color: var(--text); }
.notif-b { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-size: 13px; box-shadow: var(--shadow); min-width: 260px; max-width: 420px; animation: slide .25s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--blue); }
.toast.warn { border-left-color: var(--warn); }

/* ── Misc ──────────────────────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 44px 20px; color: var(--text-muted); text-align: center; gap: 6px; }
.empty .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--surface2); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; border: 1px solid var(--border); }
.empty .t { font-size: 14px; font-weight: 600; color: var(--text); }
.loading { padding: 40px; text-align: center; color: var(--text-muted); }
.spinner { width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 14px; overflow-x: auto; }
.tab { padding: 11px 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.doc-row:last-child { border-bottom: none; }
.doc-ic { width: 34px; height: 34px; border-radius: 8px; background: var(--surface2); display: flex; align-items: center; justify-content: center; color: var(--accent-text); flex-shrink: 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row.click { cursor: pointer; }
.list-row.click:hover { background: var(--surface2); }
.toggle { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: var(--surface3); border-radius: 11px; cursor: pointer; transition: background .2s; }
.toggle span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::before { transform: translateX(16px); }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.roadmap-card { border: 1px dashed var(--border); border-radius: 12px; padding: 20px; background: var(--surface); }
.roadmap-card li { margin: 6px 0 6px 18px; color: var(--text); line-height: 1.5; }
.sidebar-backdrop { display: none; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid-main, .grid-dash { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  .icon-btn.menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .topbar-search { display: none; }
  .content { padding: 14px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .stat-value { font-size: 24px; }
  .hide-sm { display: none; }
}


/* ── Phase 2: CRM, quotes, price list ──────────────────────── */
.b-draft { background: var(--surface2); color: var(--text-muted); }
.b-sent { background: var(--blue-soft); color: var(--blue); }
.b-accepted, .b-won { background: var(--ok-soft); color: var(--ok); }
.b-declined, .b-lost { background: var(--danger-soft); color: var(--danger); }
.b-expired { background: var(--warn-soft); color: var(--warn); }
.b-new { background: var(--surface2); color: var(--text); }
.b-contacted { background: var(--blue-soft); color: var(--blue); }
.b-qualified { background: var(--purple-soft); color: var(--purple); }
.notif-ic.quote, .notif-ic.lead { color: var(--blue); background: var(--blue-soft); }
.notif-ic.followup { color: var(--purple); background: var(--purple-soft); }

.funnel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.funnel-step { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; min-width: 0; }
.funnel-step:hover, .funnel-step.active { border-color: var(--accent); }
.funnel-step .nm { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.funnel-step .ct { font-size: 22px; font-weight: 700; font-family: var(--num); color: var(--heading); margin-top: 4px; }
.funnel-step .vl { font-size: 11px; color: var(--text-muted); font-family: var(--num); margin-top: 2px; overflow-wrap: anywhere; }

.money { font-family: var(--num); white-space: nowrap; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; font-size: 13px; max-width: 340px; margin-left: auto; }
.totals dt { color: var(--text-muted); }
.totals dd { text-align: right; font-family: var(--num); }
.totals .grand { font-size: 16px; font-weight: 700; color: var(--heading); padding-top: 8px; border-top: 1px solid var(--border); }

/* Quote builder lines: a grid on wide screens, stacked cards on phones */
.ql-head, .ql-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px 74px 52px 110px 34px; gap: 8px; align-items: start; }
.ql-head { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; padding: 0 2px 6px; border-bottom: 1px solid var(--border); }
.ql-row { padding: 10px 2px; border-bottom: 1px solid var(--border); }
.ql-row .form-input { padding: 7px 9px; }
.ql-row .lbl { display: none; font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 3px; }
.ql-amt { font-family: var(--num); text-align: right; padding-top: 8px; font-weight: 600; }
.ql-vat { display: flex; justify-content: center; padding-top: 8px; }
.ql-vat input { width: 16px; height: 16px; accent-color: var(--accent); }
.ql-num { text-align: right; }
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; margin-top: 4px; }
.picker-item { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; border-bottom: 1px solid var(--border); }
.picker-item:last-child { border-bottom: none; }
.picker-item:hover, .picker-item.on { background: var(--surface2); }
.sticky-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; z-index: 5; }

.quote-doc { background: #fff; color: #1f2a44; border-radius: 12px; padding: 28px; }
.quote-doc .muted { color: #66748f; }
.quote-doc table { width: 100%; border-collapse: collapse; }
.quote-doc th { background: #1c2f6b; color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; text-align: left; }
.quote-doc td { padding: 9px 10px; border-bottom: 1px solid #e1e6ef; font-size: 13px; vertical-align: top; }
.quote-doc .num { text-align: right; font-family: var(--num); white-space: nowrap; }
.quote-doc .grand { background: #f39220; color: #fff; padding: 10px 14px; border-radius: 6px; display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; }

@media (min-width: 641px) and (max-width: 960px) {
  .ql-head, .ql-row { grid-template-columns: minmax(0, 1fr) 70px 96px 62px 40px 96px 34px; gap: 6px; }
}


/* ── Phase 3: Support desk ─────────────────────────────────── */
.sla-row { display: flex; gap: 10px; flex-wrap: wrap; }
.sla-box { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; min-width: 170px; }
.sla-box .lbl { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.sla-box .val { font-size: 15px; font-weight: 700; color: var(--heading); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.sla-box .sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.sla-box.late { border-color: var(--danger); background: var(--danger-soft); }
.sla-box.late .val { color: var(--danger); }
.sla-box.done .val { color: var(--ok); }
.sla-late { color: var(--danger); font-weight: 700; }
.sla-ok { color: var(--text); }
.file-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); }
.file-chip:hover { border-color: var(--accent); text-decoration: none; }
.notif-ic.ticket { color: var(--blue); background: var(--blue-soft); }
.hours-days { display: flex; gap: 6px; flex-wrap: wrap; }
.hours-days label { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer; }
@media (max-width: 640px) { .sla-box { flex: 1 1 100%; } .current-stage { align-items: stretch; } }

/* ── Phones: filters and tables ────────────────────────────── */
@media (max-width: 640px) {
  .filter-bar > .filter-select, .filter-bar > .filter-input { flex: 1 1 calc(50% - 8px); min-width: 0 !important; }
  .filter-bar > input[type=search] { flex: 1 1 100% !important; }
  .filter-bar > span[style*="width:1px"] { display: none; }
  .page-head h1 { font-size: 18px; }
  .page-actions { width: 100%; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.lg, .modal.sm, .modal.xl { max-width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .modal-body { padding: 16px; }
  .form-actions { position: sticky; bottom: -16px; background: var(--surface); padding: 12px 0 4px; margin-top: 12px; }
  .form-actions .btn { flex: 1; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals { max-width: none; }

  /* Tables become one card per row, each cell labelled with its column name */
  .table-wrap { overflow-x: visible; }
  .data-table:not(.keep-table) thead { display: none; }
  .data-table:not(.keep-table), .data-table:not(.keep-table) tbody, .data-table:not(.keep-table) tr, .data-table:not(.keep-table) td { display: block; width: 100%; }
  .data-table:not(.keep-table) tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .data-table:not(.keep-table) tbody tr:last-child { border-bottom: none; }
  /* label in the left column, everything in the cell stacked in the right column */
  .data-table:not(.keep-table) td { border: none; padding: 3px 0; display: grid; grid-template-columns: minmax(84px, 38%) minmax(0, 1fr); column-gap: 12px; justify-items: end; align-items: start; text-align: right; max-width: none !important; }
  .data-table:not(.keep-table) td > * { grid-column: 2; min-width: 0; max-width: 100%; }
  .data-table:not(.keep-table) td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 6; justify-self: start; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; text-align: left; padding-top: 2px; }
  .data-table:not(.keep-table) td:first-child { display: block; justify-items: normal; text-align: left; padding-bottom: 6px; }
  .data-table:not(.keep-table) td:first-child::before, .data-table:not(.keep-table) td[data-label=""]::before { display: none; }
  .data-table:not(.keep-table) td[data-label=""] { display: flex; justify-content: flex-end; }
  .data-table:not(.keep-table) td.hide-sm { display: none; }
  .data-table:not(.keep-table) .cell-sub { white-space: normal !important; }
  .data-table:not(.keep-table) td.num { font-family: var(--num); }

  .ql-head { display: none; }
  .ql-row { grid-template-columns: 1fr 1fr; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
  .ql-row .ql-desc { grid-column: 1 / -1; }
  .ql-row .lbl { display: block; }
  .ql-row .ql-amt { text-align: left; padding-top: 0; }
  .ql-vat { justify-content: flex-start; padding-top: 0; }
  .quote-doc { padding: 16px; }
  .quote-doc .hide-sm { display: none; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app-shell, .main-area, .content { height: auto; overflow: visible; display: block; }
  body { background: #fff; color: #000; }
}

/* ── Phase 4: stock control, roles & access ─────────────── */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
button.file-chip { cursor: pointer; font-family: var(--num); }
button.file-chip:disabled { opacity: .4; cursor: default; }
.file-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.list-row.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.roles-layout { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 14px; }
.perm-module { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.perm-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--heading); padding: 9px 12px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.perm-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; cursor: pointer; border-top: 1px solid var(--border); }
.perm-row.first { border-top: none; }
.perm-row input { margin-top: 3px; accent-color: var(--accent); }
.perm-row .perm-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.perm-row.first .perm-label::after { content: ' (open the module)'; font-weight: 400; color: var(--text-muted); font-size: 11px; }
.perm-row:has(input:disabled) { cursor: default; opacity: .75; }
@media (max-width: 800px) {
  .roles-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* Order line items: description on its own row, stock item / qty / price below */
  .items-table tr { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--border); }
  .items-table tr td { padding: 0; width: auto !important; }
  .items-table tr td:first-child { grid-column: 1 / -1; }
  .items-table tr:has(select) td:nth-child(2) { grid-column: 1 / -1; }
}
/* Shelf lists can hold hundreds of serials: keep them to a scrollable box */
#mf-shelf, .chip-list[data-shelf] { max-height: 168px; overflow-y: auto; align-content: flex-start; padding-right: 4px; }
/* Developer credit, bottom of the staff sidebar */
.powered-by { margin-top: 10px; text-align: center; font-size: 10.5px; letter-spacing: .2px; color: var(--text-muted); opacity: .8; }
.powered-by strong { font-weight: 600; color: var(--text); }

/* ── Phase 6: document library ───────────────────────────── */
.docs-layout { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; }
.folder-panel { padding-bottom: 8px; position: sticky; top: 14px; }
.folder-row { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--text); border-left: 3px solid transparent; }
.folder-row:hover { background: var(--surface2); }
.folder-row.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.folder-row .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-row .fcount { font-size: 11px; color: var(--text-muted); font-family: var(--num); }
.folder-select { display: none; margin: 8px 12px 4px; width: calc(100% - 24px); }
.file-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-ic.lg { width: 46px; height: 46px; border-radius: 12px; }
.dropzone { min-height: 120px; transition: background .15s; }
.dropzone.over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -6px; }
.dropzone-box { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 22px 16px; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; color: var(--text); }
.dropzone-box:hover, .dropzone-box.over { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 800px) {
  .docs-layout { grid-template-columns: 1fr; }
  .folder-panel { position: static; }
  .folder-panel .folder-row, .folder-panel .panel-header { display: none; }
  .folder-select { display: block; }
}
/* With more modules the menu can be taller than the screen: the menu scrolls, the user card and credit stay pinned at the bottom */
.sidebar { overflow: hidden; }
#nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sidebar-footer { flex-shrink: 0; }
/* Custom note lines: description | serial | qty | notes | remove */
.note-line { display: grid; grid-template-columns: 2fr 1.1fr 70px 1.6fr 34px; gap: 6px; margin-bottom: 6px; align-items: center; }
.note-head { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
@media (max-width: 640px) {
  .note-line { grid-template-columns: 1fr 1fr 34px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .note-line [data-k=description] { grid-column: 1 / 3; grid-row: 1; }
  .note-line [data-rm] { grid-column: 3; grid-row: 1; }
  .note-line [data-k=serial_no] { grid-column: 1; grid-row: 2; }
  .note-line [data-k=qty] { grid-column: 2 / 4; grid-row: 2; }
  .note-line [data-k=notes] { grid-column: 1 / -1; grid-row: 3; }
  .note-head { display: none; }
}

/* ── Phase 7: staff, leave, procurement ───────────────────── */
.leave-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: middle; flex: none; }
.section-title { font-size: 13px; font-weight: 700; margin: 18px 0 10px; }
.leave-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.leave-card { border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 10px; padding: 12px 14px; background: var(--surface2); }
.leave-card .lc-name { font-size: 12px; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; }
.leave-card .lc-big { font-size: 26px; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.leave-card .lc-big span { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.leave-card .lc-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.cal-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.cal { border-collapse: collapse; width: 100%; font-size: 11px; }
.cal th, .cal td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; min-width: 24px; height: 30px; padding: 0; }
.cal th { font-weight: 600; color: var(--text-muted); line-height: 1.25; padding: 4px 0; background: var(--surface2); }
.cal th.today { color: var(--accent-text); box-shadow: inset 0 -2px 0 var(--accent); }
.cal .cal-name { text-align: left; padding: 0 10px; min-width: 140px; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; font-weight: 600; font-size: 12px; }
.cal th.cal-name { background: var(--surface2); }
.cal td.off, .cal th.off { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--border) 4px 5px); }
.cal td.on { background: var(--c); color: #fff; font-weight: 700; }
.cal td.on.pending { background: repeating-linear-gradient(135deg, var(--c) 0 5px, transparent 5px 9px); color: var(--text); }
.cal-list { display: none; margin-top: 12px; }
.req-line { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(160px, 1.6fr) 90px 110px 100px 32px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.req-line .lbl { display: none; }
.req-line .rl-amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.recv-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--border); }
@media (max-width: 800px) {
  .req-line { grid-template-columns: 1fr 1fr; padding: 12px 0; position: relative; }
  .req-line .rl-item, .req-line .rl-desc { grid-column: 1 / -1; }
  .req-line .rl-item { padding-right: 40px; }
  .req-line > [data-rm] { position: absolute; top: 12px; right: 0; }
  .req-line .lbl { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
  .req-line .rl-amt { text-align: left; }
  .cal-wrap { display: none; }
  .cal-list { display: block; }
}

/* ── Settings → System check rows ── */
.check-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.check-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--border); }
.check-row:first-child { border-top: 0; }
@media (max-width: 640px) { .check-row { grid-template-columns: 56px minmax(0, 1fr); } .check-row > :last-child { grid-column: 2; } }

/* ── Staff → Organogram (tree drawn from line managers) ── */
:root { --org-line: color-mix(in srgb, var(--text-muted) 45%, transparent); }
.org-scroll { overflow-x: auto; padding: 8px 4px 20px; }
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; }
.org-tree { display: flex; justify-content: center; min-width: max-content; gap: 24px; }
.org-tree ul { display: flex; justify-content: center; padding-top: 22px; position: relative; }
.org-tree li { position: relative; padding: 22px 8px 0; display: flex; flex-direction: column; align-items: center; }
.org-tree > li { padding-top: 0; }
.org-tree ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--org-line); }
.org-tree ul > li::before, .org-tree ul > li::after { content: ''; position: absolute; top: 0; width: 50%; height: 22px; border-top: 2px solid var(--org-line); }
.org-tree ul > li::before { right: 50%; }
.org-tree ul > li::after { left: 50%; border-left: 2px solid var(--org-line); }
.org-tree ul > li:only-child::before { display: none; }
.org-tree ul > li:only-child::after { width: 0; border-top: 0; }
.org-tree ul > li:first-child::before, .org-tree ul > li:last-child::after { border-top: 0; }
.org-tree ul > li:last-child::before { border-right: 2px solid var(--org-line); border-radius: 0 6px 0 0; }
.org-tree ul > li:first-child::after { border-radius: 6px 0 0 0; }
.org-card { display: block; width: 172px; padding: 10px 10px 9px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--org-c, var(--accent)); border-radius: 10px; text-align: center; color: var(--text); text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.org-card:hover { border-color: var(--accent); }
.org-card .avatar { margin: 0 auto 6px; width: 34px; height: 34px; font-size: 12px; }
.org-card .n { font-weight: 700; font-size: 13px; line-height: 1.25; }
.org-card .t { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }
.org-card .d { font-size: 11px; margin-top: 5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.org-card .badge { margin-top: 6px; }
.org-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-muted); }
.org-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }
@media print {
  .sidebar, .topbar, .page-actions, .filter-bar, .tabs-staff { display: none !important; }
  .org-scroll { overflow: visible; }
  .org-card { box-shadow: none; break-inside: avoid; }
}
.tabs-staff .tab { text-decoration: none; }

/* ── Help & guides ── */
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 12px; }
.help-toc .help-group { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); padding: 12px 14px 4px; }
.help-toc a { display: flex; gap: 9px; align-items: center; padding: 7px 14px; font-size: 13px; color: var(--text-muted); text-decoration: none; border-left: 2px solid transparent; }
.help-toc a:hover { background: var(--surface2); color: var(--text); }
.help-toc a.active { background: var(--accent-soft); color: var(--accent-text); border-left-color: var(--accent); font-weight: 600; }
.help-article { padding: 22px 26px 30px; max-width: 760px; line-height: 1.6; font-size: 14px; }
.help-article h1 { font-size: 22px; margin: 0 0 6px; display: flex; gap: 10px; align-items: center; }
.help-article .help-intro { color: var(--text-muted); margin: 0 0 18px; font-size: 14.5px; }
.help-article h3 { font-size: 15px; margin: 22px 0 8px; color: var(--heading); }
.help-article ol { padding-left: 22px; margin: 6px 0 10px; }
.help-article ol li { margin: 5px 0; padding-left: 4px; }
.help-article p { margin: 6px 0 10px; }
.help-tips { list-style: none; padding: 12px 14px; margin: 8px 0 12px; background: var(--surface2); border-radius: 10px; }
.help-tips li { margin: 5px 0; padding-left: 20px; position: relative; }
.help-tips li::before { content: ''; position: absolute; left: 4px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.help-hit { padding: 10px 14px; border-top: 1px solid var(--border); display: block; color: var(--text); text-decoration: none; }
.help-hit:hover { background: var(--surface2); }
.help-hit .small { color: var(--text-muted); }
mark.help-mark { background: var(--warn-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
@media (max-width: 860px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } .help-article { padding: 16px; } }
@media print { .help-toc, .help-search, .page-actions { display: none !important; } .help-layout { display: block; } .help-article { max-width: none; padding: 0; } }

/* ── Dashboard: Across WEBS today ── */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.mod-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px 12px; position: relative; overflow: hidden; cursor: pointer; box-shadow: var(--card-shadow); }
.mod-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--c, var(--accent)); }
.mod-card:hover { border-color: var(--accent); }
.mod-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.mod-value { font-size: 26px; font-weight: 700; color: var(--heading); margin-top: 6px; line-height: 1.1; }
.mod-value.zero { color: var(--text-muted); }
.mod-cap { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.mod-lines { display: flex; flex-direction: column; gap: 3px; }
.mod-line { font-size: 12px; color: var(--text); padding: 3px 0 0; border-top: 1px dashed var(--border); }
.mod-line:hover { color: var(--accent-text); text-decoration: underline; }
.mod-line.danger { color: var(--danger); font-weight: 600; }
.away-strip { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px; }
.away-chip { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.away-chip:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .mod-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mod-card { padding: 10px 11px; }
  .mod-value { font-size: 22px; margin-top: 4px; }
  .mod-head { font-size: 10px; }
  .mod-line, .mod-cap { font-size: 11.5px; }
}

/* ── Email templates (Settings) and email inbox (Support) ── */
.modal.xl { max-width: 1180px; }
.tpl-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tpl-group { margin-bottom: 18px; }
.tpl-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); padding: 6px 0; border-bottom: 1px solid var(--border); }
.tpl-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tpl-row:last-child { border-bottom: 0; }
.tpl-name { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tpl-always { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tpl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.tpl-tools { display: flex; gap: 4px; margin-bottom: 6px; }
.tpl-vars { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-vars .chip { font-family: var(--mono, monospace); font-weight: 600; padding: 4px 9px; }
.tpl-vars .chip .muted { font-family: inherit; font-weight: 400; font-size: 11px; margin-left: 4px; }
.tpl-preview-wrap { position: sticky; top: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #f3f4f6; }
.tpl-preview-head { padding: 8px 12px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.tpl-subject { padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 13px; overflow-wrap: anywhere; }
.tpl-preview { width: 100%; height: 520px; border: 0; display: block; background: #f3f4f6; }
.tpl-colour { width: 42px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); cursor: pointer; }
.mono-ish { font-family: var(--mono, ui-monospace, Consolas, monospace); font-size: 12.5px; line-height: 1.55; }
.inb-from { font-weight: 600; overflow-wrap: anywhere; }
.inb-body { white-space: pre-wrap; font-size: 13px; line-height: 1.55; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 340px; overflow: auto; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .tpl-edit { grid-template-columns: 1fr; }
  .tpl-preview-wrap { position: static; }
  .tpl-preview { height: 420px; }
  .modal.xl { max-width: 100%; }
}
@media (max-width: 640px) {
  .tpl-row { flex-wrap: wrap; }
  .tpl-row > div:first-child { flex-basis: 100%; }
}
.tab .n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 17px; text-align: center; font-family: var(--num); }
.tab .n.hidden { display: none; }
.inb-set { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.sig-pic { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sig-thumb { min-width: 120px; max-width: 260px; min-height: 56px; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; }
.sig-thumb img { max-width: 100%; max-height: 90px; display: block; }
.sig-thumb .muted { color: #6b7280; }

/* ── Tasks and weekly reports (14 Oct 2026) ── */
.task-quick { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) auto auto; gap: 8px; margin-bottom: 10px; }
.task-group { margin-bottom: 18px; }
.task-group-head { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--heading); margin-bottom: 6px; }
.task-group-head a { color: inherit; }
.task-none { padding: 8px 2px 4px; }
.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 6px; cursor: pointer; }
.task-row:hover { border-color: var(--accent); }
.task-row.is-done .task-title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border); }
.task-check { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px; border: 1.5px solid var(--text-muted); background: transparent; color: var(--on-accent); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.task-check:hover { border-color: var(--accent); }
.is-done .task-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12px; color: var(--text-muted); align-items: center; }
.task-meta span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.task-area { background: var(--accent-soft); color: var(--accent-text) !important; border-radius: 6px; padding: 1px 7px; font-weight: 600; }
.task-ref { font-size: 11.5px; }
.task-late { color: var(--danger) !important; font-weight: 600; }
.task-issue { color: var(--danger) !important; }
.task-last { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block !important; }
.weekly-report { max-width: 900px; }
.wr-title { font-weight: 700; font-size: 17px; color: var(--heading); text-align: center; letter-spacing: .02em; margin: 4px 0 12px; }
.wr-who { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; font-size: 13px; flex-wrap: wrap; }
.wr-section { margin-bottom: 14px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.wr-head { background: var(--surface2); padding: 7px 12px; font-weight: 700; font-size: 12px; color: var(--heading); letter-spacing: .03em; }
.wr-none { padding: 9px 12px; color: var(--text-muted); font-size: 13px; }
.wr-list { margin: 0; padding: 8px 12px 8px 30px; font-size: 13px; }
.wr-list li { margin: 2px 0; }
.wr-table td .wr-list { padding: 2px 0 2px 18px; }
.wr-progress { color: var(--text); }
.wr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wr-table th, .wr-table td { border-top: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.wr-table tbody th { width: 150px; font-weight: 600; background: var(--surface); }
.wr-cols thead th { font-size: 11.5px; color: var(--text-muted); font-weight: 600; background: var(--surface); }
@media (max-width: 720px) {
  .task-quick { grid-template-columns: 1fr; }
  .task-row .btn { display: none; }
  .wr-table tbody th { width: 90px; }
}

/* ── Contracts (14 Oct 2026) ── */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 12px; max-height: 180px; overflow: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }

/* ── Handovers (14 Oct 2026) ── */
.ho-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: var(--surface); }
.ho-item-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ho-item-btns { display: flex; gap: 2px; margin-left: auto; }
.ho-num { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 12px; }
.ho-grid { gap: 10px 14px; }
.ho-sec { margin-bottom: 10px; }
.ho-lab { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px; }
.ho-txt { white-space: pre-wrap; font-size: 13.5px; overflow-wrap: anywhere; }
.ho-steps { margin: 0; padding-left: 20px; font-size: 13.5px; }
.ho-steps li { margin: 2px 0; }
.ho-who { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin: 6px 0 10px; align-items: center; }
.ho-who span { display: inline-flex; align-items: center; gap: 5px; }
.ho-refs { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.ho-file { display: inline-flex; align-items: center; gap: 4px; }
.ho-note { padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ho-note:first-child { border-top: 0; }
@media (max-width: 720px) { .ho-item-head .form-input { max-width: none !important; } }

/* Elements marked hidden (for example the Install app button) stay hidden even when they are buttons */
[hidden] { display: none !important; }