:root {
  --blue: #07579a;
  --blue-dark: #063d6b;
  --yellow: #f3c600;
  --ink: #17212b;
  --muted: #647384;
  --line: #d9e0e7;
  --bg: #f4f7fa;
  --ok: #18794e;
  --warn: #a15c00;
  --bad: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--blue); }
header { background: var(--blue-dark); color: white; border-top: 7px solid var(--yellow); }
.topbar { max-width: 1480px; margin: auto; padding: 14px 24px; display: flex; align-items: center; gap: 26px; }
.brand { color: white; font-size: 20px; font-weight: 750; text-decoration: none; white-space: nowrap; }
nav { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
nav a { color: white; padding: 7px 10px; text-decoration: none; border-radius: 6px; }
nav a:hover { background: rgba(255,255,255,.12); }
.userbox { white-space: nowrap; font-size: 13px; }
.container { max-width: 1480px; margin: 0 auto; padding: 24px; }
h1 { font-size: 28px; margin: 0 0 20px; }
h2 { font-size: 20px; margin: 0 0 14px; }
h3 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 18px; box-shadow: 0 1px 2px rgba(15,35,55,.04); }
.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)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: white; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; padding: 14px; }
.stat span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat strong { display: block; font-size: 24px; margin-top: 4px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.toolbar .grow { flex: 1; }
.space-top { margin-top: 24px; }
.space-top-small { margin-top: 8px; }
.space-bottom { margin-bottom: 16px; }
button, .button { appearance: none; border: 1px solid var(--blue); border-radius: 6px; background: var(--blue); color: white; padding: 8px 12px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; display: inline-block; }
button:hover, .button:hover { background: var(--blue-dark); }
.button.secondary, button.secondary { background: white; color: var(--blue); }
.button.danger, button.danger { background: white; color: var(--bad); border-color: var(--bad); }
.button.small, button.small { padding: 5px 8px; font-size: 12px; }
label { display: block; font-weight: 650; margin-bottom: 4px; }
input, select, textarea { width: 100%; border: 1px solid #b9c4cf; border-radius: 6px; background: white; color: var(--ink); padding: 8px 9px; font: inherit; }
input[type="checkbox"], input[type="radio"] { width: auto; }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 12px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.inline-form .field { margin: 0; min-width: 130px; flex: 1; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 9px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #edf3f8; font-size: 12px; text-transform: uppercase; letter-spacing: .025em; color: #435367; }
tr:last-child td { border-bottom: 0; }
.number { text-align: right; white-space: nowrap; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 8px; background: #e8eef5; font-size: 12px; white-space: nowrap; }
.badge.ok { color: var(--ok); background: #e9f7f0; }
.badge.warn { color: var(--warn); background: #fff4df; }
.badge.bad { color: var(--bad); background: #ffefed; }
.flash { padding: 11px 14px; border-radius: 7px; margin-bottom: 14px; background: #e8eef5; }
.flash.success { color: var(--ok); background: #e9f7f0; }
.flash.error { color: var(--bad); background: #ffefed; }
details { background: white; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; }
summary { cursor: pointer; padding: 12px 14px; font-weight: 700; }
details > .details-body { padding: 0 14px 14px; }
.logo-thumb { width: 120px; height: 70px; object-fit: contain; object-position: center; background: white; border: 1px solid var(--line); border-radius: 5px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(150deg, #063d6b, #07579a); }
.auth-card { width: min(430px, 100%); background: white; border-top: 8px solid var(--yellow); border-radius: 10px; padding: 28px; box-shadow: 0 18px 60px rgba(0,0,0,.25); }
.auth-card h1 { color: var(--blue-dark); }
.qr { display: block; width: 220px; max-width: 100%; margin: 14px auto; }
.invoice-preview { max-width: 800px; margin: auto; background: white; padding: 30px; border: 1px solid var(--line); }
.invoice-preview .amount { text-align: center; font-weight: 800; font-size: 24px; margin: 30px; }
.logo-wall { height: 100vh; overflow: hidden; background: white; padding: 3vh 3vw; display: flex; flex-direction: column; }
.logo-wall h1 { text-align: center; color: var(--blue); }
.logo-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); grid-auto-rows: minmax(0, 1fr); align-items: stretch; gap: clamp(6px, 1.5vw, 24px); }
.logo-cell { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
.logo-cell img { width: 100%; height: 100%; min-height: 0; object-fit: contain; object-position: center; }
.portal { max-width: 680px; margin: 40px auto; }
code { background: #eef2f6; padding: 2px 5px; border-radius: 4px; }
@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .container { padding: 16px; }
  .userbox { display: none; }
}
@media print {
  header, .toolbar, button, .button, .no-print { display: none !important; }
  body, .container { background: white; padding: 0; }
  .card, .table-wrap { box-shadow: none; border: 0; }
}
