:root {
  --navy-900: #08192f;
  --navy-800: #0b2545;
  --navy-700: #143a6b;
  --navy-600: #1b4a85;
  --blue: #2563eb;
  --blue-600: #1d4ed8;
  --blue-50: #eff5ff;
  --ink: #0f172a;
  --muted: #5b6b84;
  --line: #e3e9f2;
  --line-strong: #cfd9e8;
  --bg: #f5f8fc;
  --white: #fff;
  --green: #0f9d58;
  --green-bg: #e9f8f0;
  --red: #d92d20;
  --red-bg: #fdecea;
  --amber: #b45309;
  --amber-bg: #fef5e7;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 6px 24px rgba(15, 34, 66, .08);
  --sidebar: 258px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; letter-spacing: -.01em; color: var(--navy-800); }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 13px; font-weight: 700; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--white); color: var(--navy-800); font: inherit; font-weight: 600;
  cursor: pointer; transition: .15s; white-space: nowrap; min-height: 38px;
}
.btn:hover { background: #f8fafc; border-color: #b8c6db; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .25); }
.btn-primary:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn-navy { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-navy:hover { background: var(--navy-700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--navy-700); }
.btn-ghost:hover { background: #eef3fa; }
.btn-danger { color: var(--red); border-color: #f3c9c5; background: #fff; }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 6px 10px; min-height: 30px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; min-height: 32px; width: 32px; }

.field { margin-bottom: 14px; }
.field > label, .label {
  display: block; font-size: 12px; font-weight: 600; color: var(--navy-800);
  margin-bottom: 5px; letter-spacing: .01em;
}
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  font: inherit; color: var(--ink); background: #fff; transition: .15s; min-height: 38px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
input::placeholder, textarea::placeholder { color: #9aa8bd; }
textarea { resize: vertical; min-height: 74px; }
input[type=checkbox], input[type=radio] { accent-color: var(--blue); width: 15px; height: 15px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.help { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.input-group { display: flex; }
.input-group input { border-radius: 9px 0 0 9px; }
.input-group .addon { display: flex; align-items: center; padding: 0 11px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 9px 9px 0; background: #f3f6fb; font-weight: 600; color: var(--muted); }
.err { color: var(--red); font-size: 12.5px; margin: 8px 0 0; }
.okmsg { color: var(--green); font-size: 12.5px; margin: 8px 0 0; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar); background: var(--navy-900);
  color: #dbe6f5; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column;
  padding: 18px 14px; z-index: 40; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #38bdf8); color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 12px rgba(56, 189, 248, .3);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { font-size: 10.5px; color: #8ea6c8; letter-spacing: .04em; text-transform: uppercase; }
.nav-group { margin-bottom: 6px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f89ad; padding: 12px 10px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  color: #c3d3e8; font-weight: 500; font-size: 13.3px; cursor: pointer; border: 0; background: none;
  width: 100%; text-align: left; font-family: inherit; margin-bottom: 2px;
}
.nav-item svg { width: 17px; height: 17px; opacity: .85; flex: 0 0 17px; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.active { background: #1d4ed8; color: #fff; box-shadow: 0 4px 14px rgba(29, 78, 216, .35); }
.nav-item.active svg { opacity: 1; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #1e3a8a; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 34px; border: 1px solid rgba(255,255,255,.2); }
.user-meta { min-width: 0; }
.user-meta .nm { color: #fff; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .em { color: #8ea6c8; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar); display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar .crumb { font-size: 12px; color: var(--muted); }
.topbar .title { font-weight: 700; font-size: 15.5px; color: var(--navy-800); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 24px; max-width: 1320px; width: 100%; }
.menu-toggle { display: none; }

.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head p { color: var(--muted); margin: 4px 0 0; font-size: 13px; max-width: 720px; }

/* ---------- cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.card-head .grow { flex: 1; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.section-gap { margin-bottom: 22px; }

/* stat cards */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.stat .val { font-size: 22px; font-weight: 700; color: var(--navy-800); margin-top: 5px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent { background: linear-gradient(135deg, var(--navy-800), #1b4a85); border-color: var(--navy-800); }
.stat.accent .lbl { color: #a9c1e2; }
.stat.accent .val { color: #fff; }
.stat.accent .sub { color: #bcd0ea; }

/* banners */
.banner { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 12.8px; border: 1px solid; align-items: flex-start; }
.banner svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; }
.banner-info { background: var(--blue-50); border-color: #cfdffb; color: #1e40af; }
.banner-warn { background: var(--amber-bg); border-color: #f5d9a8; color: #92400e; }
.banner-bad { background: var(--red-bg); border-color: #f4c4bf; color: #a01b12; }
.banner-good { background: var(--green-bg); border-color: #bfe8d2; color: #0b6b3d; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--navy-700); background: #f4f7fc; padding: 9px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-weight: 700;
}
table.data td { padding: 8px 10px; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data td input, table.data td select { min-height: 32px; padding: 5px 8px; font-size: 12.5px; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td { font-weight: 700; background: #f8fafd; border-top: 2px solid var(--line); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #eef3fa; color: var(--navy-700); }
.badge-green { background: var(--green-bg); color: #0b6b3d; }
.badge-red { background: var(--red-bg); color: #a01b12; }
.badge-amber { background: var(--amber-bg); color: #92400e; }
.badge-blue { background: var(--blue-50); color: #1d4ed8; }

/* tabs & segmented */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--muted); border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-family: inherit; }
.tab:hover { color: var(--navy-800); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.segmented { display: inline-flex; background: #eef2f8; padding: 3px; border-radius: 10px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font: inherit; font-weight: 600;
  font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.segmented button.active { background: #fff; color: var(--navy-800); box-shadow: var(--shadow-sm); }

/* toggles */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--navy-800); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; transition: .18s; flex: 0 0 40px; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* theme picker */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.theme-chip { border: 2px solid var(--line); border-radius: 10px; padding: 0; background: #fff; cursor: pointer; overflow: hidden; text-align: left; transition: .15s; }
.theme-chip:hover { border-color: #a9c1e2; }
.theme-chip.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.theme-chip .swatch { height: 46px; display: flex; align-items: flex-end; padding: 6px; gap: 3px; }
.theme-chip .swatch span { display: block; height: 8px; border-radius: 2px; }
.theme-chip .nm { font-size: 10.5px; font-weight: 600; padding: 5px 6px; color: var(--ink); line-height: 1.25; }

/* file cards */
.file-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.file-card:hover { border-color: #c7d6ea; box-shadow: var(--shadow-sm); }
.file-ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); flex: 0 0 36px; }
.file-ico svg { width: 17px; height: 17px; }
.file-card .meta { min-width: 0; flex: 1; }
.file-card .nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(8, 25, 47, .5); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 460px; box-shadow: 0 24px 60px rgba(8,25,47,.3); max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 720px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* toast */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 36px); }
.toast { background: var(--navy-800); color: #fff; padding: 11px 15px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); animation: slideIn .18s ease-out; max-width: 380px; }
.toast.good { background: #0b6b3d; }
.toast.bad { background: #a01b12; }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- auth page ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero { background: radial-gradient(1200px 600px at 10% 0%, #1b4a85 0%, var(--navy-900) 60%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(56,189,248,.22), transparent 65%); bottom: -140px; right: -100px; }
.auth-hero .brand { padding: 0 0 32px; }
.auth-hero h1 { color: #fff; font-size: 34px; line-height: 1.18; margin-bottom: 14px; max-width: 460px; }
.auth-hero .lead { color: #b9cbe6; font-size: 14.5px; max-width: 430px; }
.auth-feats { display: grid; gap: 14px; margin-top: 28px; max-width: 460px; }
.auth-feat { display: flex; gap: 12px; align-items: flex-start; }
.auth-feat .ic { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex: 0 0 34px; border: 1px solid rgba(255,255,255,.15); }
.auth-feat .ic svg { width: 16px; height: 16px; color: #7dd3fc; }
.auth-feat b { display: block; font-size: 13.5px; }
.auth-feat span { font-size: 12.5px; color: #a9c1e2; }
.auth-foot { font-size: 11.5px; color: #7f99bd; margin-top: 32px; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 36px 24px; background: #fff; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; margin-bottom: 4px; }
.auth-tabs { display: flex; background: #f1f5fb; border-radius: 10px; padding: 4px; margin: 18px 0 20px; }
.auth-tabs button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.auth-tabs button.active { background: #fff; color: var(--navy-800); box-shadow: var(--shadow-sm); }

/* ---------- document preview (invoice themes) ---------- */
.doc-scroll { background: #e8eef7; padding: 18px; border-radius: 12px; overflow-x: auto; }
.doc {
  width: 100%; max-width: 720px; margin: 0 auto; background: #fff; min-height: 880px;
  padding: 34px 36px; box-shadow: 0 8px 30px rgba(15, 34, 66, .12); font-size: 12px; color: #1a1a1a;
  position: relative; overflow: hidden;
}
.doc .d-head { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; padding-bottom: 16px; margin-bottom: 18px; }
.doc .d-logo { width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 17px; overflow: hidden; flex: 0 0 52px; }
.doc .d-logo img { width: 100%; height: 100%; object-fit: cover; }
.doc .d-company { font-weight: 800; font-size: 16px; line-height: 1.2; }
.doc .d-doctype { font-size: 21px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.doc .d-meta { font-size: 11px; margin-top: 6px; }
.doc .d-meta div { display: flex; gap: 6px; justify-content: flex-end; }
.doc .d-meta b { min-width: 78px; font-weight: 600; }
.doc .d-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.doc .party { padding: 12px; border-radius: 8px; }
.doc .party .t { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; margin-bottom: 4px; }
.doc .party .n { font-weight: 700; font-size: 12.5px; margin-bottom: 2px; }
.doc table.d-items { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.doc table.d-items th { padding: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.doc table.d-items td { padding: 8px; border-bottom: 1px solid rgba(0,0,0,.08); }
.doc table.d-items td.num, .doc table.d-items th.num { text-align: right; }
.doc .d-totals { margin-left: auto; width: 290px; margin-top: 14px; }
.doc .d-totals .tr { display: flex; justify-content: space-between; padding: 5px 8px; font-size: 11.5px; }
.doc .d-totals .tr.grand { font-weight: 800; font-size: 13.5px; padding: 9px 8px; margin-top: 4px; }
.doc .d-note { margin-top: 20px; font-size: 11px; line-height: 1.5; }
.doc .d-foot { margin-top: 24px; font-size: 9.5px; text-align: center; padding-top: 10px; }
.doc .sign { display: flex; gap: 40px; margin-top: 28px; font-size: 10.5px; }
.doc .sign .box { flex: 1; text-align: center; }
.doc .sign .line { margin-top: 46px; border-top: 1px solid currentColor; padding-top: 4px; opacity: .8; }
.doc .d-deco { position: absolute; pointer-events: none; }

/* ---------- misc ---------- */
.preview-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mini-stat { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 9px; background: #f7f9fd; border: 1px solid var(--line); font-size: 12.5px; }
.mini-stat b { font-variant-numeric: tabular-nums; }
.result-box { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; }
.result-box.hl { background: linear-gradient(135deg, #0b2545, #1b4a85); color: #fff; border: 0; }
.result-box.hl .lbl { color: #a9c1e2; }
.result-box.hl .big { color: #fff; }
.result-box .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.result-box .big { font-size: 24px; font-weight: 700; color: var(--navy-800); margin-top: 4px; }
.insight { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.insight .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 8px; background: var(--blue); }
.insight.good .dot { background: var(--green); }
.insight.warn .dot { background: #f59e0b; }
.insight.bad .dot { background: var(--red); }
.insight b { display: block; font-size: 13px; margin-bottom: 2px; }
.insight span { font-size: 12.5px; color: var(--muted); }
.dropzone { border: 2px dashed var(--line-strong); border-radius: 12px; padding: 26px 18px; text-align: center; background: #fbfcfe; transition: .15s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-50); }
.dropzone svg { width: 26px; height: 26px; color: var(--blue); margin-bottom: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; font-size: 11.5px; cursor: pointer; font-family: inherit; color: var(--navy-700); }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 30px; height: 30px; margin-bottom: 8px; opacity: .5; }
.skeleton { background: linear-gradient(90deg, #eef2f8, #f7f9fd, #eef2f8); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.pill-note { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }

/* marketplace comparison */
.mkt-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.mkt-tab { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 12.5px; cursor: pointer; font-family: inherit; color: var(--navy-700); }
.mkt-tab.active { border-color: var(--blue); background: var(--blue-50); color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.mkt-dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 22px; }
  .auth-hero h1 { font-size: 25px; }
  .auth-feats { display: none; }
  .auth-foot { margin-top: 14px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 16px 14px 90px; }
  .topbar { padding: 0 14px; height: 56px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .doc { padding: 20px 16px; min-height: 0; }
  .doc .d-head { flex-direction: column; }
  .doc .d-meta div { justify-content: flex-start; }
  .doc .d-parties { grid-template-columns: 1fr; }
  .doc .d-totals { width: 100%; }
  .page-head h1 { font-size: 21px; }
  .modal-foot .btn { flex: 1; }
  .scrim { position: fixed; inset: 0; background: rgba(8,25,47,.45); z-index: 35; }
  h1 { font-size: 22px; }
}
@media print {
  .sidebar, .topbar, .preview-toolbar, .no-print { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .doc-scroll { background: #fff; padding: 0; }
  .doc { box-shadow: none; max-width: none; }
}

/* two-column document workspace */
.workspace-2col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 44%); gap: 20px; align-items: start; }
@media (max-width: 1140px) { .workspace-2col { grid-template-columns: 1fr; } #previewCol { position: static !important; } }
.fp-box { border: 1px solid #7b1e2b; border-radius: 6px; overflow: hidden; }
.fp-box .hd { background: #7b1e2b; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 5px 8px; text-transform: uppercase; }
.fp-box .bd { padding: 8px; font-size: 11.5px; }
.mkt-bar { height: 8px; border-radius: 999px; background: #eef2f8; overflow: hidden; }
.mkt-bar span { display: block; height: 100%; border-radius: 999px; }

/* prevent wide tables from stretching grid/flex tracks on small screens */
.workspace-2col > * { min-width: 0; }
.stack, .stack-sm, .card, .grid > * { min-width: 0; }
.table-wrap { max-width: 100%; }

/* ---------- deskripsi item: editor & pratinjau dokumen ---------- */
table.data td textarea {
  width: 100%;
  min-height: 58px;
  padding: 7px 9px;
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}
table.data td .desc-tools { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.link-btn {
  border: 0; background: none; padding: 0; font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--blue-600); }

.doc table.d-items td.desc { vertical-align: top; }
.doc .d-desc-title { font-weight: 700; line-height: 1.45; }
.doc .d-desc-line { line-height: 1.5; }
.doc .d-desc-point {
  line-height: 1.5; padding-left: 13px; position: relative; text-indent: 0;
}
.doc .d-desc-point::before {
  content: '•'; position: absolute; left: 3px; top: 0; color: currentColor; opacity: .75;
}
.doc .d-desc-note { margin-top: 3px; font-size: 10.5px; opacity: .72; line-height: 1.45; }
.doc table.d-items td, .doc table.d-items th { vertical-align: top; }
.doc table.d-items { table-layout: fixed; }
.doc table.d-items td.desc { overflow-wrap: anywhere; word-break: break-word; }
.doc table.d-items th, .doc table.d-items td { padding: 8px 6px; }

/* ---------- kalkulator pinjaman ---------- */
.loan-tabs { width: 100%; }
.loan-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 10px; font-size: 13px; }
.loan-tabs button svg { width: 15px; height: 15px; }

input[type=range].slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 6px 0 0; padding: 0; border: 0;
  box-shadow: none; min-height: 0; cursor: pointer;
}
input[type=range].slider:focus { box-shadow: none; outline: none; }
input[type=range].slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, #1d4ed8 0%, #3b82f6 100%);
}
input[type=range].slider::-moz-range-track { height: 6px; border-radius: 999px; background: #cfdaea; }
input[type=range].slider::-moz-range-progress { height: 6px; border-radius: 999px; background: #1d4ed8; }
input[type=range].slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid #1d4ed8; margin-top: -7px; box-shadow: 0 2px 6px rgba(15,34,66,.22);
}
input[type=range].slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #1d4ed8;
  box-shadow: 0 2px 6px rgba(15,34,66,.22);
}
.range-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.chips .chip.active { background: var(--blue-50); border-color: var(--blue); color: var(--blue); font-weight: 700; }

.agunan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.agunan-card {
  display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 14px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer;
  font-family: inherit; color: var(--ink); transition: .15s;
}
.agunan-card:hover { border-color: #b8c9e0; }
.agunan-card.active { border-color: var(--blue); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.agunan-card .ico {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: #eef3fa; color: var(--navy-700); margin-bottom: 4px;
}
.agunan-card.active .ico { background: #fff; color: var(--blue); }
.agunan-card .ico svg { width: 18px; height: 18px; }
.agunan-card b { font-size: 13px; line-height: 1.3; }

.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut { width: 132px; height: 132px; flex: 0 0 132px; }
.donut-big { font-size: 21px; font-weight: 800; fill: var(--navy-800); }
.donut-small { font-size: 9px; fill: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; }
.donut-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.donut-legend b { display: block; font-size: 13px; color: var(--navy-800); }

.scheme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.scheme { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fbfcfe; }
.scheme.best { border-color: #9fd6b6; background: var(--green-bg); }
.scheme-title { font-size: 12px; font-weight: 700; color: var(--navy-800); margin-bottom: 10px; line-height: 1.35; }

@media (max-width: 860px) {
  .agunan-grid { grid-template-columns: 1fr; }
  .scheme-grid { grid-template-columns: 1fr; }
  .loan-tabs { flex-direction: column; }
  .loan-tabs button { width: 100%; }
  .donut { width: 112px; height: 112px; flex-basis: 112px; }
}

/* ---------- simulasi asuransi ---------- */
.crit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.crit-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; cursor: pointer; font-size: 12.5px; transition: .15s;
}
.crit-item:hover { border-color: #b8c9e0; }
.crit-item.active { border-color: var(--blue); background: var(--blue-50); font-weight: 600; color: #1e40af; }
.crit-item input { flex: 0 0 15px; }

.prog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.prog-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; }
.prog-card.declined { background: #fdf2f1; border-color: #f4c4bf; }
.prog-title { font-weight: 700; font-size: 13px; color: var(--navy-800); }
.prog-cover { font-size: 20px; font-weight: 800; color: var(--navy-800); margin-top: 6px; letter-spacing: -.02em; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px 4px; }
.tl-dot { position: absolute; left: -21px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; box-shadow: 0 0 0 2px #cfdffb; }
.tl-item.good .tl-dot { background: var(--green); box-shadow: 0 0 0 2px #bfe8d2; }
.tl-item.warn .tl-dot { background: #f59e0b; box-shadow: 0 0 0 2px #f5d9a8; }
.tl-item.bad .tl-dot { background: var(--red); box-shadow: 0 0 0 2px #f4c4bf; }
.tl-when { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tl-title { font-weight: 700; font-size: 13px; color: var(--navy-800); margin: 1px 0 2px; }

tr.best-row td { background: #eff8f3; }

@media (max-width: 860px) {
  .crit-grid { grid-template-columns: 1fr; }
  .prog-grid { grid-template-columns: 1fr; }
}
