* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 8px; }
.boot { padding: 80px; text-align: center; color: var(--text-2); }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* sandbox banner */
.sandbox-banner { position: sticky; top: 0; z-index: 50; background: repeating-linear-gradient(45deg, #fff4d6, #fff4d6 12px, #ffecb8 12px, #ffecb8 24px); color: #6b4a00; text-align: center; font-weight: 600; font-size: 13px; padding: 6px 12px; border-bottom: 1px solid #f0d58a; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - 32px); }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: 32px; height: calc(100vh - 32px); overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand img { width: 36px; height: 36px; }
.brand b { display: block; font-size: 15px; }
.brand span { font-size: 11px; color: var(--text-3); }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-strong); }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 14px 10px 4px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .who { text-align: right; line-height: 1.2; }
.topbar .who small { display: block; color: var(--text-3); }
.bell { position: relative; display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border); color: var(--text); }
.bell:hover { background: var(--surface-2); text-decoration: none; }
.bell .count[hidden] { display: none; }
.bell .count { position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.content { padding: 24px; flex: 1; max-width: 1280px; width: 100%; }
.footer { padding: 12px 24px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer .sample { background: var(--warn-soft); color: var(--warn); padding: 1px 8px; border-radius: 10px; font-weight: 600; }

/* page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.crumbs { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }

/* cards & stats */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card > .card-body { padding: 16px; }
.card > .card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: block; color: inherit; }
a.stat:hover { border-color: var(--brand); text-decoration: none; }
.stat .label { font-size: 12px; color: var(--text-2); }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat.bad .value { color: var(--bad); }
.stat.warn .value { color: var(--warn); }
.stat.ok .value { color: var(--ok); }
.inhand { background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: #fff; border: 0; }
.inhand .label, .inhand .hint { color: rgba(255, 255, 255, .75); }
.inhand .parts { display: flex; gap: 24px; margin-top: 10px; font-size: 13px; }
.inhand .parts b { display: block; font-size: 16px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tfoot td { font-weight: 650; background: var(--surface-2); }
.empty { padding: 28px; text-align: center; color: var(--text-3); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--muted-soft); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge.demo { background: #fff4d6; color: #6b4a00; border: 1px dashed #e0b84a; }

/* forms */
label.field { display: block; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
label.field > small { display: block; color: var(--text-3); font-size: 12px; margin-top: 3px; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; flex: 1; min-width: 160px; background: #fff; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice small { display: block; color: var(--text-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { color: var(--bad); border-color: #f1c1bd; }
.btn.ok { color: var(--ok); border-color: #b9e0cb; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd4db; border-radius: 10px; transition: .15s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand-strong); border-bottom-color: var(--brand); }

/* notes & callouts */
.note { border-radius: var(--radius-sm); padding: 10px 12px; background: var(--info-soft); color: #173f6d; font-size: 13px; }
.note.warn { background: var(--warn-soft); color: #6d3f00; }
.note.bad { background: var(--bad-soft); color: #7a1a14; }
.note.ok { background: var(--ok-soft); color: #145536; }
.note.demo { background: #fff8e6; color: #6b4a00; border: 1px dashed #e0b84a; }

/* steps */
.steps { display: flex; gap: 0; margin: 4px 0 8px; }
.step { flex: 1; position: relative; padding-top: 26px; text-align: center; font-size: 12px; color: var(--text-3); }
.step::before { content: ''; position: absolute; top: 9px; left: 0; right: 0; height: 2px; background: var(--border); }
.step:first-child::before { left: 50%; }
.step:last-child::before { right: 50%; }
.step i { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--border); }
.step.done { color: var(--text); }
.step.done i { background: var(--ok); border-color: var(--ok); }
.step.done::before { background: var(--ok); }
.step.rejected i { background: var(--bad); border-color: var(--bad); }
.step.rejected { color: var(--bad); }
.step b { display: block; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }

/* language */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.lang-pick select { width: auto; padding: 5px 8px; font-size: 13px; }
.lang-links { display: flex; gap: 10px; font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }
.lang-links .on { font-weight: 700; text-decoration: underline; }
html[data-lang="ml"] body, html[data-lang="kn"] body { line-height: 1.6; }
html[data-lang="ml"] .btn, html[data-lang="kn"] .btn { white-space: normal; text-align: center; }

/* login */
.auth { min-height: calc(100vh - 32px); display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 460px; }
.auth-card .card-body { padding: 28px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.auth-brand img { width: 48px; height: 48px; }
.demo-accounts { display: grid; gap: 8px; margin-top: 8px; }
.demo-accounts button { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--border); background: #fff; border-radius: var(--radius-sm); padding: 8px 12px; cursor: pointer; font: inherit; }
.demo-accounts button:hover { border-color: var(--brand); background: var(--brand-soft); }
.otp-input { font-size: 22px; letter-spacing: .5em; text-align: center; font-family: var(--mono); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal .body { padding: 20px; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal .error { margin-top: 12px; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--text); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); max-width: 380px; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }

/* notifications */
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif.unread { background: #f4f8ff; }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); margin-top: 7px; flex: none; }
.notif.read .dot { background: transparent; }

/* permission matrix */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .grp td { background: var(--surface-2); font-weight: 650; font-size: 12px; color: var(--text-2); text-align: left; }

/* fake checkout */
.checkout { max-width: 520px; margin: 0 auto; }
.checkout .gw { background: #111827; color: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 16px 20px; display: flex; justify-content: space-between; }
.test-card { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }

/* printable pages */
.printable { background: #fff; max-width: 820px; margin: 0 auto; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); }
.printable .ph { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--text); padding-bottom: 12px; margin-bottom: 16px; }
.printable .ph img { width: 44px; height: 44px; }
.watermark { color: #b45309; font-weight: 700; border: 2px solid #b45309; padding: 2px 8px; border-radius: 4px; display: inline-block; transform: rotate(-4deg); }
.print-only { display: none; }

@media print {
  .side, .topbar, .footer .links, .no-print, .sandbox-banner, .toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .printable { border: 0; padding: 0; max-width: none; }
  .print-only { display: block; }
  .card { box-shadow: none; }
  a { color: inherit; }
}

@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .grid.c2, .grid.c3, .grid.c4, .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}
