/* === FILE: assets/css/app.css === */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --yellow: #a16207;
  --yellow-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --gray: #475569;
  --gray-soft: #f1f5f9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .18);
  --sidebar-w: 244px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
}

/* ---------- Layout ---------- */
.app { min-height: 100vh; display: flex; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #0b1220;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.1rem 1.1rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
  color: #f8fafc;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff; font-weight: 800; font-size: .95rem; flex: 0 0 auto;
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: .92rem; color: #f8fafc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: .72rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .09em; }

.nav { padding: .7rem .6rem 1.5rem; overflow-y: auto; flex: 1; }
.nav-group { margin-top: .9rem; }
.nav-group:first-child { margin-top: 0; }
.nav-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: #64748b; padding: .45rem .65rem; font-weight: 650;
}
.nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .65rem; margin: 1px 0;
  border-radius: 8px; color: #cbd5e1; font-size: .88rem; font-weight: 500;
  text-decoration: none;
}
.nav a:hover { background: rgba(148, 163, 184, .1); color: #f1f5f9; text-decoration: none; }
.nav a.active { background: rgba(20, 184, 166, .16); color: #5eead4; font-weight: 600; }
.nav a .ico { width: 18px; height: 18px; flex: 0 0 18px; opacity: .9; }
.nav a .count {
  margin-left: auto; background: rgba(239, 68, 68, .2); color: #fca5a5;
  border-radius: 999px; font-size: .7rem; padding: .05rem .4rem; font-weight: 700;
}

.sidebar-foot {
  padding: .85rem 1rem; border-top: 1px solid rgba(148, 163, 184, .14);
  font-size: .74rem; color: #64748b;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 1.05rem; margin: 0; font-weight: 650; }
.topbar .crumb { color: var(--muted); font-size: .8rem; }
.topbar-spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: .55rem; padding: .3rem .55rem .3rem .3rem;
  border: 1px solid var(--border); border-radius: 999px; background: #fff;
  font-size: .82rem;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: .74rem;
}
.user-chip .role { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }

.menu-toggle {
  display: none; background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; color: var(--text); align-items: center; justify-content: center;
}

.content { padding: 1.35rem 1.35rem 3rem; max-width: 1500px; width: 100%; }

.page-head {
  display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.page-head .grow { flex: 1; min-width: 240px; }
.page-head h1 { margin-bottom: .15rem; }
.page-head .sub { color: var(--muted); font-size: .86rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-head {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .grow { flex: 1; }
.card-body { padding: 1.1rem; }
.card-body.tight { padding: .5rem .6rem; }
.card-foot { padding: .8rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 1rem; }
.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)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Stat cards ---------- */
.stat { padding: 1rem 1.1rem; }
.stat .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.stat .value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin-top: .2rem; }
.stat .hint { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.stat.accent { border-left: 3px solid var(--brand); }
.stat.warn { border-left: 3px solid #f59e0b; }
.stat.danger { border-left: 3px solid #ef4444; }
.stat.info { border-left: 3px solid #3b82f6; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .48rem .85rem; border-radius: 8px; border: 1px solid var(--border-strong);
  background: #fff; color: var(--text); font: inherit; font-size: .86rem; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.3;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--gray-soft); }
.btn-sm { padding: .3rem .6rem; font-size: .79rem; border-radius: 7px; }
.btn-lg { padding: .7rem 1.15rem; font-size: .95rem; }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > label, .label {
  font-size: .8rem; font-weight: 650; color: #334155;
}
.field .help { font-size: .76rem; color: var(--muted); }
.field .error { font-size: .76rem; color: var(--red); font-weight: 550; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; padding: .48rem .65rem; border: 1px solid var(--border-strong);
  border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: .88rem;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .13);
}
input.has-error, select.has-error, textarea.has-error { border-color: var(--red); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: -2px; }
.check { display: flex; align-items: flex-start; gap: .5rem; font-size: .86rem; }
.check input { margin-top: .15rem; }
.field-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-radius: 8px 0 0 8px; }
.input-suffix .suffix {
  display: grid; place-items: center; padding: 0 .6rem; border: 1px solid var(--border-strong);
  border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-2); font-size: .8rem; color: var(--muted);
}

.filters {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end;
}
.filters .field { min-width: 140px; }
.filters .field.wide { min-width: 220px; flex: 1; }
.filters .field.narrow { min-width: 100px; }
.filters .actions { display: flex; gap: .4rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th {
  text-align: left; padding: .55rem .7rem; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border); font-weight: 700; white-space: nowrap;
}
table.data td { padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #f8fafc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data .sub { color: var(--muted); font-size: .76rem; }
table.data tr.row-flag td { background: #fffbeb; }
table.data tr.row-danger td { background: #fef2f2; }
table.compact td, table.compact th { padding: .4rem .55rem; }

.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: .25rem; font-size: .95rem; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .14rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 650;
  white-space: nowrap; border: 1px solid transparent;
}
.badge-blue { background: var(--blue-soft); color: var(--blue); border-color: #bfdbfe; }
.badge-green { background: var(--green-soft); color: var(--green); border-color: #bbf7d0; }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); border-color: #fde68a; }
.badge-red { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.badge-gray { background: var(--gray-soft); color: var(--gray); border-color: var(--border); }
.badge-teal { background: var(--brand-soft); color: var(--brand-dark); border-color: #99f6e4; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Flash ---------- */
.flashes { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.flash {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .7rem .9rem; border-radius: 10px; border: 1px solid; font-size: .86rem;
}
.flash-success { background: var(--green-soft); border-color: #bbf7d0; color: #14532d; }
.flash-error { background: var(--red-soft); border-color: #fecaca; color: #7f1d1d; }
.flash-warning { background: var(--yellow-soft); border-color: #fde68a; color: #78350f; }
.flash-info { background: var(--blue-soft); border-color: #bfdbfe; color: #1e3a8a; }
.flash .close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; font-size: 1rem; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; padding: .8rem 1.1rem; }
.page-link {
  min-width: 32px; height: 32px; padding: 0 .55rem; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text);
  font-size: .82rem; font-weight: 550; text-decoration: none;
}
.page-link:hover { background: var(--surface-2); text-decoration: none; }
.page-link.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-link.disabled { opacity: .45; }
.page-gap { padding: 0 .2rem; color: var(--muted); }

.list-meta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; color: var(--muted); font-size: .8rem; padding: .6rem 1.1rem; }
.list-meta .grow { flex: 1; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a {
  padding: .55rem .8rem; font-size: .86rem; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.tiny { font-size: .72rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.strong { font-weight: 650; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; gap: .5rem; align-items: center; }
.flex-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

.kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: .35rem 1rem; font-size: .86rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.note-box {
  padding: .7rem .85rem; border-radius: 9px; font-size: .84rem;
  background: var(--surface-2); border: 1px solid var(--border);
}
.note-box.warn { background: var(--yellow-soft); border-color: #fde68a; color: #78350f; }
.note-box.info { background: var(--blue-soft); border-color: #bfdbfe; color: #1e3a8a; }
.note-box.danger { background: var(--red-soft); border-color: #fecaca; color: #7f1d1d; }

.summary-box { display: grid; gap: .35rem; font-size: .86rem; }
.summary-box .row { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border-bottom: 1px dashed var(--border); }
.summary-box .row:last-child { border-bottom: 0; }
.summary-box .row.total { font-weight: 700; font-size: .95rem; border-top: 2px solid var(--text); margin-top: .25rem; padding-top: .45rem; }
.summary-box .row .num { font-variant-numeric: tabular-nums; }

/* ---------- Scanner ---------- */
.scanner-shell { max-width: 760px; margin: 0 auto; }
.scanner-card {
  background: #0b1220; color: #e2e8f0; border-radius: 16px; padding: 1.5rem;
  box-shadow: 0 24px 60px -20px rgba(15, 23, 42, .55);
}
.scanner-card h1 { color: #f8fafc; }
.scan-input-wrap { position: relative; margin: 1.1rem 0; }
.scan-input {
  width: 100%; padding: 1rem 1.1rem; font-size: 1.25rem; font-family: ui-monospace, monospace;
  border-radius: 12px; border: 2px solid #334155; background: #111c31; color: #f8fafc; letter-spacing: .04em;
}
.scan-input:focus { outline: none; border-color: #2dd4bf; box-shadow: 0 0 0 4px rgba(45, 212, 191, .18); }
.scan-input::placeholder { color: #64748b; }
.scan-input.shake { animation: shake .35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
.scan-feedback {
  border-radius: 12px; padding: 1rem 1.1rem; font-size: .95rem;
  background: #111c31; border: 1px solid #1e293b; min-height: 92px;
}
.scan-feedback.ok { background: rgba(21, 128, 61, .18); border-color: #15803d; color: #bbf7d0; }
.scan-feedback.err { background: rgba(185, 28, 28, .18); border-color: #b91c1c; color: #fecaca; }
.scan-feedback.warn { background: rgba(161, 98, 7, .18); border-color: #a16207; color: #fde68a; }
.scan-feedback .big { font-size: 1.1rem; font-weight: 700; display: block; margin-bottom: .2rem; }
.scan-modes { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem; }
.mode-btn {
  padding: .4rem .8rem; border-radius: 999px; border: 1px solid #334155; background: transparent;
  color: #cbd5e1; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.mode-btn.active { background: #2dd4bf; border-color: #2dd4bf; color: #042f2e; }
.mode-btn[data-mode=return].active { background: #fbbf24; border-color: #fbbf24; color: #451a03; }
.scan-log { margin-top: 1.1rem; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: .35rem; }
.scan-log-item {
  display: flex; gap: .6rem; align-items: center; font-size: .82rem;
  padding: .45rem .6rem; border-radius: 8px; background: #111c31; border: 1px solid #1e293b;
}
.scan-log-item .t { color: #64748b; font-variant-numeric: tabular-nums; font-size: .74rem; }
.scan-log-item .trk { font-family: ui-monospace, monospace; color: #e2e8f0; }
.scan-hint { color: #94a3b8; font-size: .8rem; margin-top: .6rem; }
.scanner-stats { display: flex; gap: 1.5rem; margin-top: 1rem; flex-wrap: wrap; }
.scanner-stats .s .n { font-size: 1.35rem; font-weight: 700; color: #f8fafc; }
.scanner-stats .s .l { font-size: .72rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1100px 600px at 15% -10%, #134e4a 0%, transparent 55%),
              radial-gradient(900px 500px at 110% 110%, #1e293b 0%, transparent 50%), #0b1220;
}
.auth-card {
  width: min(430px, 100%); background: #fff; border-radius: 16px; padding: 1.75rem;
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, .6);
}
.auth-card .brand-mark { width: 44px; height: 44px; font-size: 1.1rem; margin-bottom: 1rem; }
.auth-card h1 { font-size: 1.3rem; }
.auth-card .sub { color: var(--muted); font-size: .86rem; margin-bottom: 1.25rem; }
.auth-foot { text-align: center; font-size: .78rem; color: #94a3b8; margin-top: 1rem; }
.auth-card .form-grid { grid-template-columns: 1fr; }

/* ---------- Invoice ---------- */
.recon-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.recon-box { padding: .9rem 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.recon-box h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .5rem; }
.recon-box .big { font-size: 1.25rem; font-weight: 700; }
.recon-box .rows { font-size: .82rem; }
.recon-box .rows div { display: flex; justify-content: space-between; gap: .75rem; padding: .12rem 0; }

.inline-edit input { padding: .25rem .4rem; font-size: .82rem; }
.inline-edit td { padding: .35rem .45rem; }

.progress { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.35rem; border-left: 2px solid var(--border); margin-left: .4rem; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--brand); border: 2px solid #fff;
}
.timeline .when { font-size: .74rem; color: var(--muted); }
.timeline .what { font-size: .86rem; }

details.raw pre {
  max-height: 340px; overflow: auto; background: #0b1220; color: #cbd5e1;
  padding: .85rem; border-radius: 9px; font-size: .76rem; margin: .5rem 0 0;
}

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 12px; padding: 2rem 1rem;
  text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.dropzone strong { display: block; color: var(--text); margin-bottom: .2rem; }

.text-danger { color: var(--red); }
.edit-row td { background: var(--surface-2); }
pre.raw-json {
  max-height: 220px; overflow: auto; background: #0b1220; color: #cbd5e1;
  padding: .6rem .7rem; border-radius: 7px; font-size: .7rem; margin: .25rem 0 .5rem;
  max-width: 520px; white-space: pre-wrap;
}
.sticky-actions {
  position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem;
  margin-top: 1rem; box-shadow: 0 -8px 24px -18px rgba(15, 23, 42, .5);
}

/* ---------- 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) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .4);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 35;
  }
  .menu-toggle { display: inline-flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem .85rem 3rem; }
  .topbar { padding: 0 .85rem; }
}
@media (max-width: 560px) {
  .filters .field, .filters .field.wide { min-width: 100%; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .kv { grid-template-columns: 1fr; gap: .1rem .5rem; }
  .kv dd { margin-bottom: .5rem; }
}

@media print {
  .sidebar, .topbar, .page-actions, .pagination, .filters, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #999; }
}
