/* =========================================================
   GSTBill Pro — Demo  |  Design tokens & components
   ========================================================= */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e5e9f2;
  --border-2: #d6dce8;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --success: #059669;
  --success-50: #ecfdf5;
  --warn: #b45309;
  --warn-50: #fffbeb;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --info: #0369a1;
  --info-50: #f0f9ff;
  --sidebar: #0b1220;
  --sidebar-2: #151f33;
  --sidebar-text: #a9b4c8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .10);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .28);
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.r { text-align: right; }
.c { text-align: center; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 18px 14px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #06b6d4); color: #fff; font-weight: 800; font-size: 19px;
  box-shadow: 0 6px 16px -4px rgba(99, 102, 241, .6);
}
.brand-text b { display: block; color: #fff; font-size: 16px; letter-spacing: -.01em; }
.brand-text small { color: #7c8aa5; font-size: 12px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5d6b85; padding: 16px 10px 6px; font-weight: 600; }
#mainNav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px;
  color: var(--sidebar-text); font-weight: 500; transition: background .15s, color .15s; margin-bottom: 2px;
}
#mainNav a:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
#mainNav a.active { background: rgba(99, 102, 241, .18); color: #fff; box-shadow: inset 3px 0 0 #818cf8; }
#mainNav a.active svg { color: #a5b4fc; }
.side-card {
  margin-top: auto; background: linear-gradient(160deg, #1e2a4a, #151f33); border: 1px solid #24314f;
  border-radius: 12px; padding: 16px; color: #c9d3e6;
}
.side-card b { color: #fff; display: block; margin: 8px 0 4px; }
.side-card p { font-size: 12.5px; margin-bottom: 12px; color: #93a0b8; }
.side-card-icon { width: 34px; height: 34px; border-radius: 9px; background: rgba(129, 140, 248, .18); color: #a5b4fc; display: grid; place-items: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.icon-btn.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; display: flex; align-items: center; }
.search > span { position: absolute; left: 12px; color: var(--muted); display: flex; }
.search input {
  width: 100%; height: 40px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 0 12px 0 38px; font: inherit; color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); background: #fff; }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); display: none; max-height: 380px; overflow: auto; padding: 6px;
}
.search-results.open { display: block; }
.sr-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; font-weight: 600; }
.sr-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.sr-item:hover { background: var(--primary-50); text-decoration: none; }
.sr-item small { color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--primary-50); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 1px solid var(--primary-100);
}
.view { padding: 28px; max-width: 1320px; width: 100%; margin: 0 auto; outline: none; }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px;
  border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: background .15s, border .15s, box-shadow .15s, color .15s; white-space: nowrap;
  text-decoration: none !important;
}
.btn svg.i { width: 16px; height: 16px; }
.btn:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-100); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .35); }
.btn-primary:hover { background: var(--primary-600); }
.btn-outline { background: #fff; border-color: var(--border-2); color: var(--text-2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--primary-50); color: var(--primary); }
.btn-soft:hover { background: var(--primary-100); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-soft { background: var(--danger-50); color: var(--danger); }
.btn-danger-soft:hover { background: #fee2e2; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-50); }
.icon-btn svg.i { width: 16px; height: 16px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 18px; }
.card-title { font-size: 15px; font-weight: 650; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title small { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.card-toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.card.flush { padding: 0; }
.card.flush .card-toolbar { padding: 16px 18px 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-top: 18px; }
.mt { margin-top: 18px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-label { color: var(--muted); font-weight: 500; font-size: 13px; }
.kpi-value { font-size: 25px; font-weight: 750; letter-spacing: -.02em; margin-top: 8px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.kpi-icon.indigo { background: var(--primary-50); color: var(--primary); }
.kpi-icon.green { background: var(--success-50); color: var(--success); }
.kpi-icon.amber { background: var(--warn-50); color: var(--warn); }
.kpi-icon.sky { background: var(--info-50); color: var(--info); }

/* Bar chart */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 220px; padding: 10px 4px 0; border-bottom: 1px solid var(--border); }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar-val { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.bar {
  width: 100%; max-width: 54px; background: linear-gradient(180deg, #818cf8, #4f46e5); border-radius: 7px 7px 3px 3px;
  min-height: 3px; transition: height .5s ease, filter .15s; cursor: default;
}
.bar:hover { filter: brightness(1.1); }
.bar.current { background: linear-gradient(180deg, #22d3ee, #0891b2); }
.chart-labels { display: flex; gap: 14px; padding: 8px 4px 0; }
.chart-labels span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }

.hbar { margin-bottom: 14px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.hbar-track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.hbar-fill { height: 100%; border-radius: 99px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: #fafbff; }
.table th.r, .table td.r { text-align: right; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.green { background: var(--success-50); color: var(--success); }
.badge.amber { background: var(--warn-50); color: var(--warn); }
.badge.red { background: var(--danger-50); color: var(--danger); }
.badge.gray { background: #f1f5f9; color: #64748b; }
.badge.indigo { background: var(--primary-50); color: var(--primary); }
.badge.sky { background: var(--info-50); color: var(--info); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 16px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field .hint.ok { color: var(--success); }
.field .hint.err { color: var(--danger); }
input, select, textarea {
  font: inherit; color: var(--text); width: 100%; height: 38px; border: 1px solid var(--border-2); border-radius: 8px;
  padding: 0 11px; background: #fff; outline: none; transition: border .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
input.invalid, select.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px #fee2e2; }
.input-group { display: flex; gap: 8px; }
.input-icon { position: relative; display: flex; align-items: center; min-width: 240px; flex: 1; max-width: 360px; }
.input-icon svg { position: absolute; left: 11px; color: var(--muted); }
.input-icon input { padding-left: 36px; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* Invoice form */
.form-layout > .card + .card, .form-layout > .grid-2 { margin-top: 18px; }
.cust-info { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-2); font-size: 13px; color: var(--text-2); display: none; }
.cust-info.show { display: flex; gap: 24px; flex-wrap: wrap; }
.cust-info b { color: var(--text); }
.tax-type { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 9px; font-size: 13px; font-weight: 500; }
.tax-type.intra { background: var(--success-50); color: #065f46; }
.tax-type.inter { background: var(--info-50); color: #075985; }
.items-table td { padding: 8px 6px; }
.items-table th { padding: 10px 6px; }
.items-table input, .items-table select { height: 36px; }
.items-table .it-prod { min-width: 200px; }
.items-table .it-hsn { width: 90px; }
.items-table .it-qty { width: 80px; }
.items-table .it-rate { width: 110px; }
.items-table .it-disc { width: 70px; }
.items-table .it-gst { width: 80px; }
.items-table .it-amt { font-weight: 600; white-space: nowrap; min-width: 110px; }
.items-table .unit { display: block; font-size: 11px; margin-top: 2px; }
.add-row { margin-top: 12px; }
.totals-row { display: flex; justify-content: space-between; padding: 7px 0; color: var(--text-2); }
.totals-row.grand { border-top: 2px solid var(--text); margin-top: 8px; padding-top: 12px; font-size: 19px; font-weight: 750; color: var(--text); }
.words { margin-top: 10px; font-size: 12.5px; color: var(--muted); font-style: italic; }
.form-actions {
  position: sticky; bottom: 0; margin: 18px -28px -28px; padding: 14px 28px; background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px); border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; z-index: 5; flex-wrap: wrap;
}

/* Tips & info */
.tip {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 11px; background: var(--primary-50);
  border: 1px solid var(--primary-100); color: #3730a3; margin-bottom: 18px; font-size: 13.5px;
}
.tip svg { margin-top: 1px; color: var(--primary); }
.tip .tip-x { margin-left: auto; flex: none; width: 26px; height: 26px; color: #6366f1; }
.info-card { background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 100%); border: 1px solid var(--primary-100); }
.flow { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-top: 14px; }
.flow-step { flex: 1; min-width: 150px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; position: relative; }
.flow-step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-bottom: 8px; }
.flow-step b { display: block; font-size: 13.5px; }
.flow-step span { font-size: 12.5px; color: var(--muted); }
.flow-arrow { display: grid; place-items: center; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat b { display: block; font-size: 21px; margin-top: 2px; letter-spacing: -.01em; }

/* Lists */
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.li-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.li-icon.amber { background: var(--warn-50); color: var(--warn); }
.li-icon.red { background: var(--danger-50); color: var(--danger); }
.li-icon.green { background: var(--success-50); color: var(--success); }
.li-body { flex: 1; min-width: 0; }
.li-body b { display: block; font-size: 13.5px; font-weight: 600; }
.li-body small { color: var(--muted); font-size: 12.5px; }

/* Checklist */
.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; margin: 4px 0 14px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #06b6d4); border-radius: 99px; transition: width .4s; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; transition: border .15s, background .15s; color: var(--text); }
.check-item:hover { border-color: var(--primary); background: var(--primary-50); text-decoration: none; }
.check-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-2); display: grid; place-items: center; flex: none; color: #fff; }
.check-item.done .check-dot { background: var(--success); border-color: var(--success); }
.check-item.done b { text-decoration: line-through; color: var(--muted); }
.check-item b { display: block; font-size: 13.5px; font-weight: 600; }
.check-item small { color: var(--muted); font-size: 12px; }
.check-item .go { margin-left: auto; color: var(--muted); }

/* Empty state */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-icon svg { width: 26px; height: 26px; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- Invoice paper ---------- */
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.action-bar .spacer { flex: 1; }
.status-line { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.paper { background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); padding: 36px; max-width: 920px; margin: 0 auto; color: #111827; font-size: 13px; }
.paper-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 2px solid #111827; }
.paper-logo { width: 46px; height: 46px; border-radius: 11px; background: linear-gradient(135deg, #6366f1, #06b6d4); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 17px; margin-bottom: 10px; }
.paper-head h2 { font-size: 19px; margin-bottom: 4px; }
.paper-head p { color: #4b5563; line-height: 1.6; }
.paper-title { text-align: right; }
.paper-title h1 { font-size: 24px; letter-spacing: .06em; color: var(--primary); }
.paper-title small { color: #6b7280; display: block; margin-bottom: 10px; }
.kv { border-collapse: collapse; margin-left: auto; }
.kv td { padding: 2px 0 2px 14px; text-align: right; }
.kv td:first-child { color: #6b7280; }
.kv td:last-child { font-weight: 600; }
.irn-strip { display: flex; justify-content: space-between; gap: 20px; align-items: center; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; margin-top: 18px; }
.irn-strip .mono { word-break: break-all; }
.irn-strip .qr { width: 112px; flex: none; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }
.parties h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; margin-bottom: 6px; }
.parties p { line-height: 1.6; }
.paper-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.paper-table th { background: #111827; color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; text-align: left; font-weight: 600; }
.paper-table td { padding: 9px 10px; border-bottom: 1px solid #e5e7eb; }
.paper-table th.r, .paper-table td.r { text-align: right; }
.paper-table.small th { background: #f3f4f6; color: #374151; }
.paper-bottom { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; margin-top: 18px; }
.paper-totals .totals-row { padding: 5px 0; }
.paper-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 30px; padding-top: 16px; border-top: 1px solid #e5e7eb; }
.sign { text-align: right; }
.sign .line { margin-top: 42px; border-top: 1px solid #9ca3af; padding-top: 6px; font-size: 12px; color: #6b7280; }
.demo-stamp { font-size: 11px; color: #9ca3af; }
.ewb-number { font-size: 26px; font-weight: 800; letter-spacing: .08em; }
.barcode { height: 54px; width: 100%; max-width: 320px; }

/* ---------- Guide ---------- */
.guide-hero {
  background: radial-gradient(1200px 300px at 10% -40%, rgba(255, 255, 255, .18), transparent), linear-gradient(135deg, #4338ca, #0e7490);
  color: #fff; border-radius: 16px; padding: 32px; display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap;
  box-shadow: var(--shadow-md);
}
.guide-hero h1 { font-size: 26px; letter-spacing: -.02em; margin-bottom: 8px; }
.guide-hero p { color: #e0e7ff; max-width: 560px; }
.guide-hero .btn-light { background: #fff; color: var(--primary-600); height: 44px; padding: 0 20px; font-size: 14.5px; }
.guide-hero .btn-light:hover { background: #eef2ff; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.module { border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.module .li-icon { background: var(--primary-50); color: var(--primary); margin-bottom: 4px; }
.module b { font-size: 14px; }
.module p { font-size: 12.5px; color: var(--muted); flex: 1; }
.module .btn { align-self: flex-start; margin-top: 6px; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.gloss div { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.gloss b { color: var(--primary-600); display: block; margin-bottom: 3px; }
.gloss span { font-size: 13px; color: var(--text-2); }
details.faq { border: 1px solid var(--border); border-radius: 10px; padding: 0 16px; margin-bottom: 10px; background: #fff; }
details.faq summary { padding: 14px 0; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: 18px; color: var(--muted); line-height: 1; }
details.faq[open] summary::after { content: "−"; }
details.faq p { padding-bottom: 14px; color: var(--text-2); }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .2s; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.lg { max-width: 780px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
.steps-progress .sp { display: flex; align-items: center; gap: 12px; padding: 9px 0; color: var(--muted); }
.steps-progress .sp i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-2); display: grid; place-items: center; flex: none; }
.steps-progress .sp.run { color: var(--text); font-weight: 600; }
.steps-progress .sp.run i { border-color: var(--primary); border-top-color: transparent; animation: spin .7s linear infinite; }
.steps-progress .sp.ok { color: var(--success); }
.steps-progress .sp.ok i { background: var(--success); border-color: var(--success); color: #fff; }
.steps-progress .sp.ok i svg { width: 13px; height: 13px; stroke-width: 3; }
@keyframes spin { to { transform: rotate(360deg); } }
.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13.5px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; font-weight: 500; word-break: break-all; }
.irn-box { display: flex; gap: 20px; align-items: flex-start; }
.irn-box .qr { width: 150px; flex: none; border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.note { font-size: 12.5px; padding: 10px 12px; border-radius: 9px; background: var(--warn-50); color: #92400e; border: 1px solid #fde68a; margin-top: 12px; }
.note.info { background: var(--info-50); color: #075985; border-color: #bae6fd; }
.note.ok { background: var(--success-50); color: #065f46; border-color: #a7f3d0; }

/* ---------- Toast ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 40px); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 400px; animation: slide .25s ease; }
.toast.success svg { color: #34d399; }
.toast.warn svg { color: #fbbf24; }
.toast.error svg { color: #f87171; }
.toast.info svg { color: #93c5fd; }
@keyframes slide { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Tour ---------- */
.tour-block { position: fixed; inset: 0; z-index: 200; }
.tour-spot {
  position: fixed; z-index: 201; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 4px rgba(129, 140, 248, .9), 0 0 0 9999px rgba(11, 18, 32, .62);
  transition: top .3s ease, left .3s ease, width .3s ease, height .3s ease;
}
.tour-spot.center { box-shadow: 0 0 0 9999px rgba(11, 18, 32, .62); }
.tour-pop {
  position: fixed; z-index: 202; width: 350px; max-width: calc(100vw - 24px); background: #fff; border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 18px 18px 14px; transition: top .3s ease, left .3s ease; border: 1px solid var(--border);
}
.tour-pop.center { width: 440px; padding: 26px 24px 18px; }
.tp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tp-step { font-size: 11.5px; font-weight: 700; color: var(--primary); background: var(--primary-50); padding: 3px 9px; border-radius: 99px; letter-spacing: .02em; }
.tp-x { width: 28px; height: 28px; }
.tour-pop h4 { font-size: 16.5px; margin-bottom: 6px; letter-spacing: -.01em; }
.tour-pop.center h4 { font-size: 20px; }
.tour-pop p { color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.tp-bar { height: 4px; background: var(--surface-2); border-radius: 99px; margin: 14px 0 12px; overflow: hidden; }
.tp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #06b6d4); transition: width .3s; }
.tp-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tp-foot > div { display: flex; gap: 6px; }
.tp-keys { font-size: 11px; color: var(--muted); margin-top: 8px; text-align: center; }
.tp-arrow { position: absolute; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); border: 1px solid var(--border); }
.tp-arrow.top { top: -8px; border-right: 0; border-bottom: 0; }
.tp-arrow.bottom { bottom: -8px; border-left: 0; border-top: 0; }
.tp-arrow.left { left: -8px; border-right: 0; border-top: 0; }
.tp-arrow.right { right: -8px; border-left: 0; border-bottom: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; display: none; }
  body.nav-open .nav-backdrop { display: block; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 10px; }
  .view { padding: 20px 16px; }
  .form-actions { margin: 18px -16px -20px; padding: 12px 16px; }
  .grid-2, .grid-3, .stat-row { grid-template-columns: 1fr 1fr; }
  .paper { padding: 22px; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .kpis, .grid-2, .grid-3, .stat-row, .form-grid, .form-grid.cols-2, .form-grid.cols-3, .parties, .paper-bottom { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .paper-head { flex-direction: column; }
  .paper-title { text-align: left; }
  .kv { margin-left: 0; }
  .kv td { text-align: left; padding: 2px 14px 2px 0; }
  .irn-strip, .irn-box { flex-direction: column; }
  .input-icon { min-width: 0; max-width: none; }
  .page-head h1 { font-size: 21px; }
  .detail-grid { grid-template-columns: 1fr; gap: 2px; }
  .detail-grid dd { margin-bottom: 8px; }
  .guide-hero { padding: 22px; }
  .flow-arrow { display: none; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .sidebar, .topbar, .no-print, #toasts, .nav-backdrop, .form-actions { display: none !important; }
  .view { padding: 0; max-width: none; }
  .paper { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .paper-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Split layouts (kept after responsive rules would be overridden, so re-declared below) */
.grid-2.split-a { grid-template-columns: 1.5fr 1fr; align-items: start; }
.grid-2.split-b { grid-template-columns: 1fr 1.4fr; align-items: start; }
.stat-row.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 960px) { .grid-2.split-a, .grid-2.split-b { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .stat-row.three { grid-template-columns: 1fr; } }
.grid > .card, .grid-2 > .card, .grid-3 > .card, .dash-grid > .card { margin-top: 0; }
.dash-grid { align-items: start; }
.icon-btn[disabled] { opacity: .3; cursor: not-allowed; }
.dash-grid > *, .grid > *, .grid-2 > *, .grid-3 > *, .kpis > *, .stat-row > * { min-width: 0; }
input::placeholder { text-transform: none; }
