:root { --ink:#1d2430; --muted:#6b7485; --line:#e2e6ec; --bg:#f4f6f9; --card:#fff; --brand:#1f5fae; --brand-d:#174a88; --danger:#b42318; --ok:#067647; }
* { box-sizing: border-box; }
body { margin:0; font:14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color:var(--ink); background:var(--bg); }
a { color:var(--brand); text-decoration:none; } a:hover { text-decoration:underline; }
h1 { font-size:22px; margin:0 0 16px; } h2 { font-size:16px; margin:4px 0 12px; }
small, .muted { color:var(--muted); }
.pre { white-space:pre-line; }
.r { text-align:right; } .nowrap { white-space:nowrap; }

.topbar { display:flex; align-items:center; gap:20px; background:#13233b; color:#fff; padding:0 20px; min-height:52px; flex-wrap:wrap; }
.topbar a { color:#cfd8e6; }
.topbar .brand { color:#fff; font-weight:700; font-size:16px; display:flex; align-items:center; gap:10px; }
.topbar .brand img { height:32px; display:block; }
.topbar .brand img.pill { background:#fff; border-radius:4px; padding:2px 4px; }
.topbar nav { display:flex; gap:4px; flex:1; flex-wrap:wrap; }
.topbar nav a { padding:15px 10px; border-bottom:3px solid transparent; }
.topbar nav a.on, .topbar nav a:hover { color:#fff; border-bottom-color:#5aa0ff; text-decoration:none; }
.topbar .me { display:flex; gap:14px; font-size:13px; }
.topbar .me small { color:#9fb0c8; }
main { max-width:1200px; margin:0 auto; padding:24px 20px 60px; }

.card { background:var(--card); border:1px solid var(--line); border-radius:8px; padding:16px 18px; margin-bottom:18px; }
.head { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.head h1 { margin:0; }
.btns { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:10px; }
.head .btns { margin-top:0; }
.btn { display:inline-block; padding:7px 14px; border:1px solid #c7cfdb; background:#fff; color:var(--ink); border-radius:6px; cursor:pointer; font:inherit; }
.btn:hover { background:#f0f3f7; text-decoration:none; }
.btn.primary { background:var(--brand); border-color:var(--brand); color:#fff; }
.btn.primary:hover { background:var(--brand-d); }
.btn.danger { color:var(--danger); border-color:#f0b3ad; }
.btn.wide { width:100%; padding:10px; }
button.link { background:none; border:0; color:var(--danger); cursor:pointer; font-size:15px; }
form.inline { display:inline-flex; gap:8px; align-items:flex-end; margin:0; }
form.inline label { margin:0; }

.flash { padding:10px 14px; border-radius:6px; margin-bottom:14px; background:#ecfdf3; color:var(--ok); border:1px solid #abefc6; }
.flash.err { background:#fef3f2; color:var(--danger); border-color:#fecdca; }

.form label { display:block; margin-bottom:12px; font-weight:500; }
.form label small { font-weight:400; }
input, select, textarea { width:100%; padding:7px 9px; border:1px solid #c7cfdb; border-radius:6px; font:inherit; background:#fff; color:inherit; margin-top:3px; }
textarea { resize:vertical; }
input:focus, select:focus, textarea:focus { outline:2px solid #9cc3ff; border-color:var(--brand); }
label.check { display:flex; align-items:center; gap:8px; padding-top:22px; }
label.check input { width:auto; margin:0; }
.row2, .row3 { display:grid; gap:16px; } .row2 { grid-template-columns:1fr 1fr; } .row3 { grid-template-columns:1fr 1fr 1fr; }
.form.narrow { max-width:480px; }
.actions { display:flex; gap:10px; margin-top:10px; }
.filters { display:flex; gap:8px; align-items:center; margin-bottom:14px; flex-wrap:wrap; }
.filters input, .filters select { width:auto; margin:0; }
.filters input[name=s] { min-width:260px; }
.filters label { display:flex; gap:6px; align-items:center; }

table { border-collapse:collapse; width:100%; }
table.list th, table.list td { padding:8px 10px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
table.list th { font-size:12px; text-transform:uppercase; letter-spacing:.03em; color:var(--muted); background:#fafbfc; }
table.list th.r, table.list td.r { text-align:right; }
table.list tr.inactive td { color:#9aa3b2; }
table.list tr.sumrow td { font-weight:600; border-bottom:0; }
table.list tr.grand td { font-size:16px; }
table.list.card { padding:0; overflow:hidden; display:table; }
table.kv th { text-align:left; color:var(--muted); font-weight:500; padding:4px 14px 4px 0; vertical-align:top; width:130px; }
table.kv td { padding:4px 0; }

.badge { display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; font-weight:600; background:#eef1f5; color:#475467; vertical-align:middle; }
.badge.issued { background:#e8f1fd; color:#1f5fae; }
.badge.accepted, .badge.delivered { background:#ecfdf3; color:var(--ok); }
.badge.cancelled { background:#fef3f2; color:var(--danger); }
.badge.draft { background:#fffaeb; color:#b54708; }

.stats { display:grid; grid-template-columns:repeat(3, 1fr); gap:14px; margin-bottom:18px; }
.stat { background:#fff; border:1px solid var(--line); border-radius:8px; padding:14px 18px; color:var(--ink); display:flex; flex-direction:column; }
.stat:hover { border-color:var(--brand); text-decoration:none; }
.stat .label { color:var(--muted); font-size:13px; } .stat .num { font-size:28px; font-weight:700; } .stat .sub { color:var(--muted); }
.quick { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:18px; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.grid2 .card { margin-bottom:18px; }

.doc-form .addr { white-space:pre-line; margin:-6px 0 12px; font-size:13px; }
table.lines { margin:8px 0; }
table.lines th { font-size:12px; color:var(--muted); text-align:left; padding:6px 4px; border-bottom:1px solid var(--line); }
table.lines td { padding:4px; vertical-align:top; border-bottom:1px solid #f0f2f5; }
table.lines input, table.lines select, table.lines textarea { margin:0; }
.c-no { width:30px; color:var(--muted); padding-top:12px !important; } .c-item { width:210px; } .c-qty { width:80px; } .c-uom { width:80px; }
.c-price { width:120px; } .c-amt { width:110px; padding-top:12px !important; } .c-del { width:30px; }
table.totals { width:100%; max-width:360px; margin-left:auto; }
table.totals th { text-align:right; font-weight:500; padding:5px 10px; color:var(--muted); }
table.totals td { padding:3px 0; width:150px; } table.totals td.r { padding-right:10px; }
table.totals input { text-align:right; }
table.totals tr.grand th, table.totals tr.grand td { font-size:17px; font-weight:700; color:var(--ink); border-top:2px solid var(--ink); padding-top:8px; }
.is-do .price { display:none; }

.login-page { display:flex; align-items:center; justify-content:center; min-height:100vh; background:linear-gradient(160deg, #13233b, #1f5fae); }
.login-box { background:#fff; padding:32px; border-radius:10px; width:360px; box-shadow:0 10px 40px rgba(0,0,0,.25); }
.login-box h1 { margin-bottom:4px; } .login-box p { margin-top:0; }
.login-box label { display:block; margin-bottom:12px; font-weight:500; }
.login-logo { max-height:60px; margin-bottom:10px; }

@media (max-width: 800px) {
  .row2, .row3, .grid2, .stats { grid-template-columns:1fr; }
  table.lines .c-item { width:120px; }
  .topbar nav a { padding:10px 6px; }
}

/* module switcher */
.modswitch { display:flex; background:rgba(255,255,255,.08); border-radius:8px; padding:3px; gap:2px; }
.modswitch a { color:#cfd8e6; padding:5px 12px; border-radius:6px; font-size:13px; font-weight:600; white-space:nowrap; }
.modswitch a.on { background:#fff; color:#13233b; }
.modswitch a:hover { text-decoration:none; color:#fff; } .modswitch a.on:hover { color:#13233b; }
fieldset.access { border:1px solid var(--line); border-radius:8px; padding:8px 14px 12px; margin:0 0 12px; }
fieldset.access legend { font-weight:600; padding:0 6px; }
fieldset.access label.check { padding-top:6px; margin-bottom:4px; }
.topbar { gap:14px; }
.topbar nav { flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
.topbar nav a { padding:15px 8px; font-size:13.5px; white-space:nowrap; }
.topbar .me { font-size:12.5px; gap:10px; white-space:nowrap; }
@media (max-width:1400px) { .topbar .me span { display:none; } }
.navbadge { display:inline-block; min-width:18px; padding:1px 6px; border-radius:10px; background:#f04438; color:#fff; font-size:11px; font-weight:700; text-align:center; }
.pending-box { border-color:#fec84b; background:#fffcf2; }
.pending-box h2 { color:#93370d; }
.export-menu { display:inline-flex; gap:6px; padding-right:8px; margin-right:2px; border-right:1px solid var(--line); }
nav.tabs { display:flex; gap:4px; border-bottom:2px solid var(--line); margin-bottom:12px; }
nav.tabs a { padding:8px 14px; color:var(--muted); font-weight:600; border-bottom:2px solid transparent; margin-bottom:-2px; }
nav.tabs a.on { color:var(--brand); border-bottom-color:var(--brand); } nav.tabs a:hover { text-decoration:none; color:var(--ink); }
nav.tabs small { font-weight:500; color:var(--muted); margin-left:3px; }
.badge.nadi { background:#e3f4f0; color:#0d5e56; font-size:11px; padding:1px 7px; }
input.ro, textarea.ro { background:#f2f5f8; color:#5b6b82; }
.custfilter { margin-bottom:6px; font-size:13px; padding:6px 9px; }
.refbox { background:#f0f6ff; border:1px solid #d6e4ff; border-radius:8px; padding:8px 12px; margin:-4px 0 14px; font-size:13px; color:#34425a; }
.refbox span { display:inline-block; margin-left:12px; } td.refs span { display:block; white-space:nowrap; font-size:12.5px; }
