/* ============================================================
   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;
}

[data-theme="light"] {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface2: #f1f4f9;
  --surface3: #e3e8f1;
  --border: #e1e6ef;
  --text: #1f2a44;
  --text-muted: #66748f;
  --heading: #14204a;
  --accent: #e8850f;
  --accent-hover: #f39220;
  --accent-soft: rgba(243,146,32,0.12);
  --blue: #2f6bd1;
  --blue-soft: rgba(47,107,209,0.1);
  --ok: #16a34a;
  --ok-soft: rgba(22,163,74,0.1);
  --warn: #b7791f;
  --warn-soft: rgba(245,176,11,0.14);
  --danger: #d43c3c;
  --danger-soft: rgba(212,60,60,0.1);
  --purple: #6d4fd8;
  --purple-soft: rgba(109,79,216,0.1);
  --shadow: 0 12px 40px rgba(20,32,74,0.14);
}

* { 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; }
a { color: var(--accent); 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; }
.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); border-left-color: var(--accent); }
.nav-item.soon { opacity: .55; }
.nav-item .nav-badge { margin-left: auto; background: var(--accent); color: #fff; 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); }
.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-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; }
.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(--mono); 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; }
.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: #fff; }
.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); }
.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(--mono); }
.order-no { font-family: var(--mono); font-size: 12px; color: var(--accent); 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); border-color: var(--accent); }
.chip .n { font-family: var(--mono); 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(--mono); 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(--mono); }

/* ── 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: #fff; }
.step.current .step-dot { background: var(--surface); border-color: var(--accent); color: var(--accent); 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); }
.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: rgba(4,10,22,.72); 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); 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); 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); 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; }
}

@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; }
}
