/* Design system v1.0: tokens */
@font-face { font-family: "Inter"; src: url("../vendor/fonts/inter-latin.30a274cd01b6.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-soft: #EFF4FF;
  --primary-disabled: #BFD0F7;
  --navy: #0A1C37;
  --accent: #F26419;
  --accent-hover: #D9530C;
  --navy-2: #173561;
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-soft: #F0F2F5;
  --text: #111827;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --success: #10B981;
  --success-ink: #047857;
  --success-soft: #ECFDF5;
  --danger: #EF4444;
  --danger-ink: #B91C1C;
  --danger-soft: #FEF2F2;
  --warning-ink: #B45309;
  --warning-soft: #FFFBEB;
  --info-soft: #EFF6FF;
  --violet-soft: #F3F0FF;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --e1: 0 1px 2px rgba(16, 24, 40, .05);
  --e2: 0 4px 12px rgba(16, 24, 40, .08);
  --e3: 0 12px 32px rgba(16, 24, 40, .14);
  --brand: #D71920; /* company brand colour: logo mark + PDFs */
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color-rgb: 37, 99, 235;
}
html, body { background: var(--bg); color: var(--text); font-family: var(--bs-body-font-family); font-size: 14px; line-height: 20px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.num, .value, .figure { font-variant-numeric: tabular-nums; }
h1, .h1 { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -.02em; }
h2, .h2 { font-size: 24px; line-height: 32px; font-weight: 600; }
h3, .h3 { font-size: 18px; line-height: 28px; font-weight: 600; }
.caption { font-size: 12px; line-height: 16px; color: var(--muted); }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; padding: 8px 0 8px 8px; gap: 0; }
.sidebar {
  width: 248px; flex: 0 0 248px; background: var(--navy); color: #C7D2E5; border-radius: var(--r-md);
  position: sticky; top: 8px; height: calc(100vh - 16px); overflow-y: auto; scrollbar-width: thin;
}
.sidebar .brand { padding: 20px 16px 18px; display: flex; gap: 12px; align-items: center; }
.sidebar .brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: #fff; padding: 3px; }
.sidebar .brand .mark { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; flex: none; }
.sidebar .brand .name { color: #fff; font-weight: 600; font-size: 15px; line-height: 20px; }
.sidebar .brand small { color: #93A3BE; font-size: 12px; line-height: 16px; display: block; }
.sidebar nav { padding: 0 10px 24px; }
.sidebar .section { padding: 18px 8px 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #8193B2; font-weight: 600; }
.sidebar a.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin: 2px 0; border-radius: var(--r-sm); color: #D5DEEC; font-weight: 450; }
.sidebar a.nav-item i { font-size: 17px; width: 20px; text-align: center; color: #AAB8D0; }
.sidebar a.nav-item:hover { background: var(--navy-2); color: #fff; }
.sidebar a.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }
.sidebar a.nav-item.active i { color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 28px; position: sticky; top: 0; z-index: 20; background: rgba(246, 248, 251, .9); backdrop-filter: blur(8px); }
.search { position: relative; flex: 1; max-width: 460px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 56px 9px 36px; font-size: 14px; color: var(--text); box-shadow: var(--e1); }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: var(--border-soft); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; font-size: 11px; padding: 2px 6px; font-family: inherit; }
.top-tools { display: flex; align-items: center; gap: 18px; color: var(--text); }
.top-date { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; white-space: nowrap; }
.top-date i { color: var(--muted); }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--muted); background: transparent; border: 0; }
.icon-btn:hover { background: var(--surface); color: var(--text); box-shadow: var(--e1); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
.who { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.content { padding: 8px 28px 48px; width: 100%; max-width: 1520px; }

/* ---------- page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 4px 0 24px; }
.page-head h1 { font-size: 32px; line-height: 40px; font-weight: 700; margin: 0; letter-spacing: -.02em; color: var(--text); }
.page-head .sub { color: var(--muted); font-size: 15px; margin-top: 4px; }
.page-head .d-flex { flex-wrap: wrap; }

/* ---------- cards ---------- */
.card { border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--e1); background: var(--surface); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border-soft); font-weight: 600; font-size: 16px; line-height: 24px; padding: 16px 20px; color: var(--text); border-radius: var(--r-md) var(--r-md) 0 0 !important; }
.card-header a.small, .card-header .small { font-size: 13px; font-weight: 500; }
.card-body { padding: 20px; }
.list-group-item { border-color: var(--border-soft); padding: 12px 20px; }

/* stat card */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--e1); padding: 18px 20px; height: 100%; }
.stat .label { color: var(--text); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.stat .value { font-size: 26px; line-height: 34px; font-weight: 700; margin-top: 14px; letter-spacing: -.02em; color: var(--text); }
.stat .foot { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stat .value.pos, .value.pos { color: var(--success-ink); }
.stat .value.neg, .value.neg { color: var(--danger-ink); }
.ico { width: 32px; height: 32px; border-radius: var(--r-sm); display: inline-grid; place-items: center; font-size: 16px; flex: none; }
.ico.red { background: var(--danger-soft); color: var(--danger); }
.ico.violet { background: var(--violet-soft); color: #6D5BD0; }
.ico.amber { background: var(--warning-soft); color: #D97706; }
.ico.blue { background: var(--info-soft); color: var(--primary); }
.ico.green { background: var(--success-soft); color: var(--success); }

/* cash docket */
.docket { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--e1); overflow: hidden; height: 100%; }
.docket.cash { border-top: 3px solid var(--success); }
.docket.bank { border-top: 3px solid var(--primary); }
.docket .docket-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.docket .docket-head h2 { font-size: 17px; line-height: 24px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 10px; }
.docket.cash .docket-head h2 .ico { background: var(--success-soft); color: var(--success); }
.docket.bank .docket-head h2 .ico { background: var(--info-soft); color: var(--primary); }
.docket .docket-head a { font-size: 13.5px; font-weight: 500; }
.docket .perf { display: none; }
.docket .flow { display: grid; grid-template-columns: repeat(3, 1fr) auto; padding: 14px 20px 20px; gap: 12px; align-items: center; }
.docket .flow .k { color: var(--muted); font-size: 13.5px; margin-bottom: 6px; }
.docket .flow .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.docket .flow .v.in { color: var(--success-ink); }
.docket .flow .v.out { color: var(--danger); }
.docket .flow .close { border-radius: var(--r-sm); padding: 10px 16px; text-align: center; min-width: 120px; }
.docket.cash .flow .close { background: var(--success-soft); }
.docket.bank .flow .close { background: var(--info-soft); }
.docket .flow .close .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

/* ---------- tables ---------- */
.table { margin: 0; --bs-table-bg: transparent; --bs-table-hover-bg: #F9FAFB; font-size: 13.5px; }
.table > :not(caption) > * > * { padding: 12px 16px; border-bottom-color: var(--border-soft); }
.table thead th { background: #F9FAFB; color: var(--muted); font-weight: 500; font-size: 12.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table-sm > :not(caption) > * > * { padding: 9px 14px; }
.table tfoot td, .table tfoot th { background: #F9FAFB; font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }
.table td a:not(.btn) { font-weight: 500; }
.table tr.table-light td { --bs-table-bg: #F9FAFB; color: var(--muted); }
.card > .table-responsive:last-child .table tr:last-child td, .card > .table:last-child tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos { color: var(--success-ink); }
.neg { color: var(--danger-ink); }
code { color: var(--navy); background: var(--border-soft); padding: 2px 6px; border-radius: 6px; font-size: 12px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty-state .ring { width: 56px; height: 56px; border-radius: 50%; background: var(--border-soft); display: grid; place-items: center; margin: 0 auto 14px; font-size: 22px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 2px; }

/* ---------- filters & forms ---------- */
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--e1); padding: 14px 16px; margin: 0 0 16px; }
.form-control, .form-select { border-color: var(--border); border-radius: var(--r-sm); padding: 9px 12px; font-size: 14px; color: var(--text); background-color: var(--surface); }
.form-control::placeholder { color: var(--faint); }
.form-control-sm, .form-select-sm { padding: 6px 10px; font-size: 13px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.form-control:disabled { background: var(--border-soft); }
.form-label { font-weight: 500; font-size: 13.5px; margin-bottom: 6px; color: var(--text); }
.helptext { color: var(--muted); font-size: 12px; line-height: 16px; margin-top: 4px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-control-color { width: 64px; height: 40px; padding: 4px; }

/* ---------- buttons ---------- */
.btn { border-radius: var(--r-sm); font-weight: 500; font-size: 14px; padding: 8px 16px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-brand, .btn-primary, .btn-dark { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-brand:hover, .btn-brand:focus, .btn-primary:hover, .btn-dark:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-brand:disabled, .btn-primary:disabled { background: var(--primary-disabled); border-color: var(--primary-disabled); }
.btn-outline-secondary, .btn-outline-dark { color: var(--text); border-color: var(--border); background: var(--surface); box-shadow: var(--e1); }
.btn-outline-secondary:hover, .btn-outline-dark:hover { background: #F9FAFB; color: var(--text); border-color: #D1D5DB; }
.btn-outline-success { color: var(--success-ink); border-color: #A7F3D0; background: var(--surface); }
.btn-outline-success:hover { background: var(--success-soft); color: var(--success-ink); border-color: var(--success); }
.btn-outline-danger { color: var(--danger-ink); border-color: #FECACA; background: var(--surface); }
.btn-outline-danger:hover { background: var(--danger-soft); color: var(--danger-ink); border-color: var(--danger); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--border-soft); }
.btn-group .btn { box-shadow: none; }
.btn-group .btn-dark { background: var(--primary); }
.dropdown-menu { border-color: var(--border); border-radius: var(--r-md); box-shadow: var(--e3); padding: 6px; font-size: 14px; }
.dropdown-item { border-radius: 6px; padding: 8px 12px; }
.dropdown-item:active { background: var(--primary); }
.dropdown-header { font-size: 12px; color: var(--muted); }
.pagination { gap: 6px; }
.pagination .page-link { color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm) !important; min-width: 32px; text-align: center; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ---------- badges ---------- */
.badge-status { font-weight: 500; font-size: 12px; padding: 4px 10px; border-radius: 20px; border: 1px solid transparent; }
.s-draft { background: #F3F4F6; color: #374151; border-color: #E5E7EB; }
.s-pending, .s-unpaid { background: #FEF9C3; color: #854D0E; border-color: #FDE68A; }
.s-submitted, .s-partial, .s-info { background: #DBEAFE; color: #1D4ED8; border-color: #BFDBFE; }
.s-approved { background: #EDE9FE; color: #5B21B6; border-color: #DDD6FE; }
.s-paid, .s-completed { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.s-rejected, .s-cancelled { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }
.badge.text-bg-light { background: #F3F4F6 !important; color: #374151 !important; font-weight: 500; border: 1px solid var(--border); }

/* ---------- toasts ---------- */
.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 1080; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.app-toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--r-md); box-shadow: var(--e3); padding: 14px 40px 14px 14px; display: flex; gap: 12px; position: relative; animation: toast-in .25s ease-out; }
.app-toast.success { border-left-color: var(--success); }
.app-toast.error { border-left-color: var(--danger); }
.app-toast.warning { border-left-color: #F59E0B; }
.app-toast .ico { width: 28px; height: 28px; }
.app-toast strong { display: block; font-weight: 600; font-size: 14px; }
.app-toast span { color: var(--muted); font-size: 13px; }
.app-toast .btn-close { position: absolute; top: 12px; right: 12px; font-size: 11px; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- alerts (inline) ---------- */
.alert { border-radius: var(--r-md); border: 1px solid transparent; font-size: 14px; }
.alert-success { background: var(--success-soft); color: var(--success-ink); border-color: #A7F3D0; }
.alert-danger { background: var(--danger-soft); color: var(--danger-ink); border-color: #FECACA; }
.alert-info { background: var(--info-soft); color: #1D4ED8; border-color: #BFDBFE; }

/* ---------- confirm dialog page ---------- */
.confirm-card { max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--e3); padding: 24px; margin: 40px auto; }
.confirm-card h1 { font-size: 18px; line-height: 28px; font-weight: 600; margin: 0 0 8px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { background: var(--navy); color: #C7D2E5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h2 { color: #fff; font-size: 34px; line-height: 42px; font-weight: 700; letter-spacing: -.02em; max-width: 16ch; margin: 0; }
.login-art p { max-width: 42ch; color: #9DAECB; margin: 14px 0 0; font-size: 15px; line-height: 24px; }
.login-art .waybill { position: absolute; right: 56px; bottom: 110px; width: 300px; background: #fff; color: var(--text); border-radius: var(--r-md); padding: 18px 20px; transform: rotate(-6deg); box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.login-art .waybill .bars { height: 46px; background: repeating-linear-gradient(90deg, var(--navy) 0 2px, transparent 2px 4px, var(--navy) 4px 7px, transparent 7px 9px, var(--navy) 9px 10px, transparent 10px 13px); margin: 10px 0 8px; }
.login-art .waybill .perf { border-top: 2px dashed var(--border); margin: 12px -20px; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 26px; line-height: 34px; font-weight: 700; margin: 0 0 4px; }

/* ---------- responsive ---------- */
.mobile-toggle { display: none; }
.scrim { display: none; }
@media (max-width: 1200px) { .top-date { display: none; } }
@media (max-width: 992px) {
  .app { padding: 0; }
  .sidebar { position: fixed; left: -270px; top: 0; height: 100vh; border-radius: 0; z-index: 40; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .sidebar.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 39, 73, .35); z-index: 30; }
  .mobile-toggle { display: inline-flex; }
  .content { padding: 8px 16px 48px; }
  .topbar { padding: 10px 16px; }
  .search kbd { display: none; }
  .page-head h1 { font-size: 26px; line-height: 34px; }
  .docket .flow { grid-template-columns: repeat(3, 1fr); }
  .docket .flow .close { grid-column: 1 / -1; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 576px) { .search { display: none; } .who .d-sm-inline { display: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar, .app-toast { transition: none; animation: none; } }
@media print { .sidebar, .topbar, .no-print, .filters, .scrim, .toast-stack { display: none !important; } .content { padding: 0; } .app { padding: 0; } }
.page-head .btn-sm { padding: 8px 16px; font-size: 14px; }
.page-head .form-control-sm { padding: 8px 12px; font-size: 14px; }

/* ---------- density pass: match reference proportions ---------- */
.app { padding: 8px 0 8px 8px; }
.sidebar { width: 232px; flex-basis: 232px; }
.sidebar .brand { padding: 16px 14px 14px; }
.sidebar .brand img, .sidebar .brand .mark { width: 36px; height: 36px; font-size: 16px; }
.sidebar .brand .name { font-size: 14px; }
.sidebar .section { padding: 14px 8px 6px; font-size: 10.5px; }
.sidebar a.nav-item { padding: 7px 10px; font-size: 13.5px; gap: 11px; }
.sidebar a.nav-item i { font-size: 16px; }
.topbar { padding: 10px 24px; }
.search input { padding: 8px 56px 8px 36px; font-size: 13.5px; }
.content { padding: 6px 24px 40px; max-width: none; }
.page-head { margin: 2px 0 18px; }
.page-head h1 { font-size: 28px; line-height: 36px; }
.page-head .sub { font-size: 14px; margin-top: 2px; }
.card-header { font-size: 15px; padding: 13px 18px; }
.card-body { padding: 16px 18px; }
.stat { padding: 14px 16px; }
.stat .label { font-size: 13px; gap: 9px; }
.stat .value { font-size: 22px; line-height: 30px; margin-top: 10px; }
.stat .foot { font-size: 12.5px; margin-top: 2px; }
.ico { width: 30px; height: 30px; font-size: 15px; }
.docket .docket-head { padding: 14px 18px 4px; }
.docket .docket-head h2 { font-size: 15.5px; }
.docket .flow { padding: 10px 18px 16px; }
.docket .flow .k { font-size: 12.5px; margin-bottom: 4px; }
.docket .flow .v { font-size: 16px; }
.docket .flow .close { padding: 8px 14px; min-width: 110px; }
.docket .flow .close .v { font-size: 21px; }
.table > :not(caption) > * > * { padding: 10px 14px; }
.table-sm > :not(caption) > * > * { padding: 8px 12px; }
.chart-box { position: relative; height: 210px; }
.empty-state { padding: 26px 16px; }
.empty-state .ring { width: 48px; height: 48px; font-size: 20px; margin-bottom: 10px; }
.form-card { width: 100%; }
.range-select { width: auto; padding: 5px 30px 5px 10px; font-size: 13px; }

/* ---------- sectioned forms ---------- */
.form-section { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 22px 22px; border-bottom: 1px solid var(--border-soft); }
.form-section:last-of-type { border-bottom: 0; }
.form-section-head h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 0; color: var(--text); }
.form-section-head p { font-size: 12.5px; line-height: 18px; color: var(--muted); margin: 4px 0 0; }
.form-actions { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: #FAFBFC; border-radius: 0 0 var(--r-md) var(--r-md); }
.route { display: grid; grid-template-columns: 1fr 36px 1fr; align-items: stretch; }
.route-leg { background: #FAFBFC; border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px 16px; }
.route-title { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.route-title i { color: var(--primary); }
.route-arrow { display: grid; place-items: center; color: var(--faint); font-size: 18px; }
@media (max-width: 992px) {
  .form-section { grid-template-columns: 1fr; gap: 12px; padding: 18px 16px; }
  .route { grid-template-columns: 1fr; gap: 10px; }
  .route-arrow { transform: rotate(90deg); height: 20px; }
  .form-actions { padding: 12px 16px; }
}
.docket .flow .v { white-space: nowrap; }

/* ---- phones ---- */
@media (max-width: 768px) {
  /* tables placed straight in a card scroll inside the card instead of widening the page */
  .card > .table, .card > form > .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table td, .table th { white-space: nowrap; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-header .d-flex { flex-wrap: wrap; }
  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-head > div:last-child { width: 100%; }
  .page-head h1 { font-size: 22px; line-height: 30px; }
  .page-head .sub { font-size: 13px; }
  .content { padding: 4px 12px 32px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 20px; line-height: 28px; margin-top: 6px; }
  .filters { padding: 10px; }
  /* 16px inputs stop iOS zooming into the field on focus */
  .form-control, .form-select, input, select, textarea { font-size: 16px; }
  .btn, .form-control, .form-select { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  .toast-stack { left: 12px; right: 12px; }
}
/* installed app: room for the iPhone notch / home bar */
@supports (padding: env(safe-area-inset-top)) {
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); }
  .content { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
}

/* ---- Logitech Express theme: orange for primary actions and the current page ---- */
.btn-brand { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 14px -6px rgba(242,100,25,.6); }
.btn-brand:hover, .btn-brand:focus, .btn-brand:active, .btn-brand.show { background: var(--accent-hover) !important; border-color: var(--accent-hover) !important; color: #fff !important; }
.sidebar a.nav-item.active { background: var(--accent); box-shadow: 0 6px 16px rgba(242,100,25,.38); }
.sidebar .brand.brand-img { padding: 14px 12px 10px; }
.sidebar .brand.brand-img img { width: 100%; max-width: 208px; height: auto; background: none; padding: 0; border-radius: 0; object-fit: contain; }
.chart-box { height: 240px; }

/* ---- welcome tour ---- */
.tour-layer { position: fixed; inset: 0; z-index: 2000; animation: tour-in .2s ease; }
.tour-layer.is-hero { background: rgba(10, 18, 34, .62); backdrop-filter: blur(2px); }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10, 18, 34, .6); transition: all .28s cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.tour-spot::after { content: ""; position: absolute; inset: -4px; border-radius: 14px; border: 2px solid var(--accent); animation: tour-pulse 1.6s ease-out infinite; }
.tour-layer.is-hero .tour-spot { box-shadow: none; }
.tour-pop { position: fixed; background: #fff; border-radius: 16px; padding: 18px 18px 16px; box-shadow: 0 24px 60px rgba(0,0,0,.32); transition: top .28s cubic-bezier(.2,.8,.2,1), left .28s cubic-bezier(.2,.8,.2,1); }
.tour-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; padding-right: 26px; position: relative; }
.tour-ico { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #FF8A3D, var(--accent)); color: #fff; display: grid; place-items: center; font-size: 19px; flex: none; box-shadow: 0 6px 14px -4px rgba(242,100,25,.6); }
.tour-count { font-size: 11.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.tour-pop h3 { font-size: 17px; line-height: 23px; font-weight: 700; margin: 1px 0 0; color: var(--text); }
.tour-pop p { font-size: 14px; line-height: 21px; color: #374151; margin: 0 0 14px; }
.tour-x { position: absolute; right: -6px; top: -4px; border: 0; background: none; color: var(--faint); width: 30px; height: 30px; border-radius: 8px; }
.tour-x:hover { background: var(--border-soft); color: var(--text); }
.tour-bar { height: 4px; border-radius: 4px; background: var(--border-soft); overflow: hidden; margin-bottom: 14px; }
.tour-bar span { display: block; height: 100%; background: linear-gradient(90deg, #FF8A3D, var(--accent)); border-radius: 4px; transition: width .3s; }
.tour-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tour-actions .btn-light { background: #F3F4F6; border-color: #F3F4F6; }
.tour-skip:not(.tour-x) { border: 0; background: none; color: var(--muted); font-size: 14px; padding: 6px 0; }
.tour-skip:not(.tour-x):hover { color: var(--text); text-decoration: underline; }
.tour-arrow { position: absolute; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); }
.tour-arrow.at-left { left: -7px; margin-top: -7px; }
.tour-arrow.at-top { top: -7px; margin-left: -7px; }
.tour-arrow.at-bottom { bottom: -7px; margin-left: -7px; }
.tour-pop.tour-hero { padding: 0; overflow: hidden; border-radius: 20px; }
.tour-art { height: 150px; background: center 60% / cover no-repeat; }
.tour-hero .tour-body { padding: 22px 26px 22px; text-align: center; }
.tour-hero .tour-logo { height: 46px; margin: -48px auto 12px; display: block; background: #0A1C37; border-radius: 12px; padding: 8px 12px; box-shadow: 0 10px 24px rgba(10,28,55,.3); }
.tour-hero h3 { font-size: 22px; line-height: 28px; margin-bottom: 8px; }
.tour-hero p { font-size: 14.5px; line-height: 22px; margin-bottom: 18px; }
.tour-hero .tour-actions .btn { padding: 10px 20px; font-weight: 600; }
.tour-done-ico { width: 56px; height: 56px; border-radius: 50%; background: #DCFCE7; color: #16A34A; display: grid; place-items: center; font-size: 30px; margin: -50px auto 12px; border: 4px solid #fff; }
.tour-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: -4px 0 18px; }
.tour-link { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-weight: 600; color: var(--text); font-size: 13.5px; }
.tour-link:hover { border-color: var(--accent); color: var(--accent); }
@keyframes tour-pulse { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.06); } }
@keyframes tour-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tour-layer, .tour-spot, .tour-pop, .tour-bar span { transition: none; animation: none; } .tour-spot::after { animation: none; } }

/* ---- type-to-search dropdowns ---- */
.combo { position: relative; }
.combo-input { padding-right: 32px; background: var(--surface) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236B7280'%3e%3cpath d='M11.7 10.3a6 6 0 1 0-1.4 1.4l3.3 3.3 1.4-1.4zM7 11a4 4 0 1 1 0-8 4 4 0 0 1 0 8'/%3e%3c/svg%3e") no-repeat right 11px center / 14px; }
.combo .ac-list, .ac-list { position: absolute; z-index: 1060; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(15,23,42,.12); max-height: 280px; overflow-y: auto; padding: 4px; min-width: 220px; }
.ac-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.ac-item.active, .ac-item:hover { background: #F1F5F9; }
.ac-item mark { background: #FDE68A; padding: 0; }
.ac-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }

/* ---- page artwork strip behind the header ---- */
.main { position: relative; }
.page-strip { position: absolute; top: 0; left: 16%; right: 24%; height: 150px; background: center 58% / cover no-repeat; pointer-events: none; z-index: 0;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 32%, #000 82%, transparent 100%), linear-gradient(to bottom, #000 55%, transparent 100%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent 0%, #000 32%, #000 82%, transparent 100%), linear-gradient(to bottom, #000 55%, transparent 100%); mask-composite: intersect; opacity: .95; }
.topbar { background: transparent; backdrop-filter: none; transition: background .2s, box-shadow .2s; }
.topbar.scrolled { background: rgba(246, 248, 251, .94); backdrop-filter: blur(8px); box-shadow: 0 1px 0 var(--border); }
.topbar, .content { position: relative; z-index: 1; }
.topbar { position: sticky; z-index: 20; }
.topbar .search { background: rgba(255,255,255,.96); }
.top-date, .who { text-shadow: 0 0 12px rgba(255,255,255,.9); }
@media (max-width: 992px) { .page-strip { left: 0; right: 0; height: 120px; opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .topbar { transition: none; } }
