:root {
  --brand: #c8102e;          /* Continental red */
  --brand-600: #a30d25;
  --brand-100: #fbe9ec;
  --accent: #c8102e;
  --accent-bg: #fbe9ec;
  --side: #17181c;           /* near-black sidebar */
  --side-text: #c9ccd3;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1a1b1f;
  --muted: #6b7280;
  --line: #e4e5ea;
  --danger: #b91c1c;
  --danger-bg: #fdecec;
  --warn: #b45309;
  --warn-bg: #fef3e2;
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --info: #374151;
  --info-bg: #eceef2;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(17, 17, 20, .06);
  --sidebar-w: 236px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-600); 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; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); font-size: .9em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.boot { padding: 3rem; text-align: center; color: var(--muted); }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--side); color: var(--side-text); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto; z-index: 20; }
.brand { display: flex; align-items: center; justify-content: center; padding: 6px 8px 16px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.brand img { width: 150px; height: auto; display: block; }
.brand .logo { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; }
.brand .logo img { width: 40px; height: 40px; object-fit: contain; }
.brand-full { display: block; margin: 0 auto 10px; max-width: 180px; height: auto; }
.brand .name { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.brand .sub { font-size: .75rem; opacity: .75; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; color: var(--side-text); font-weight: 500; border-left: 3px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(200,16,46,.18); color: #fff; border-left-color: var(--brand); }
.nav .section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; padding: 14px 10px 6px; }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar .user { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.sidebar .user b { display: block; color: #fff; }
.sidebar .user a { color: var(--side-text); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; padding: 22px 26px 60px; }
.topbar { display: none; }
.bottombar { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 14px 14px 90px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--side); color: #fff; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); position: sticky; top: 0; z-index: 15; }
  .topbar .name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
  .topbar .name img { height: 34px; width: auto; }
  .topbar a { color: #fff; }
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .bottombar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; font-size: .68rem; color: var(--muted); font-weight: 600; }
  .bottombar a.active { color: var(--brand); }
  .bottombar a.active svg { stroke-width: 2.4; }
  .bottombar svg { width: 22px; height: 22px; }
  .bottombar a.scan svg { width: 26px; height: 26px; }
}

/* Page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.card h2, .card h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h2 .small, .card h3 .small { font-weight: 500; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }

/* Stat tiles */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; }
.stat:hover { border-color: #c9d3dc; }
.stat .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat .value.danger { color: var(--danger); }
.stat .value.warn { color: var(--warn); }
.stat .value.ok { color: var(--ok); }
.stat .foot { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 650; white-space: nowrap; background: #eef1f4; color: #3a4654; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.available, .badge.completed, .badge.good, .badge.new, .badge.low { background: var(--ok-bg); color: var(--ok); }
.badge.checked_out, .badge.in_progress, .badge.medium { background: var(--info-bg); color: var(--info); }
.badge.customer { background: var(--brand-100); color: var(--brand); }
.badge.in_maintenance, .badge.on_hold, .badge.fair, .badge.high { background: var(--warn-bg); color: var(--warn); }
.badge.missing, .badge.urgent, .badge.poor, .badge.overdue { background: var(--danger-bg); color: var(--danger); }
.badge.retired, .badge.cancelled { background: #eceff2; color: #7b8794; }
.badge.open { background: var(--brand-100); color: var(--brand); }
.badge.plain::before { display: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: #f5f7f9; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.btn.primary:hover { background: var(--brand-600); }
.btn.accent { background: #17181c; border-color: #17181c; color: #fff; }
.btn.danger { color: var(--danger); border-color: #f1c4bf; background: #fff; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: .82rem; }
.btn.lg { padding: 12px 18px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
.form { display: grid; gap: 14px; }
.form.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .form.cols-2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span-2 { grid-column: 1 / -1; }
.field label { font-size: .82rem; font-weight: 600; color: #3a4654; }
.field .hint { font-size: .78rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid #cfd7df; border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(200, 16, 46, .2); border-color: var(--brand); }
textarea { min-height: 86px; resize: vertical; }
input[type="checkbox"] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; grid-column: 1 / -1; padding-top: 6px; }
.error-box { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 10px 12px; font-size: .9rem; grid-column: 1 / -1; }
.notice { background: var(--info-bg); color: var(--info); border-radius: 8px; padding: 10px 12px; font-size: .9rem; }

/* Toolbar / filters */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"], .toolbar input[type="text"] { flex: 1 1 220px; }
.toolbar select { width: auto; flex: 0 1 auto; max-width: 200px; }
.search-wrap { position: relative; flex: 1 1 220px; display: flex; }
.search-wrap input { padding-left: 34px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: #fafbfc; white-space: nowrap; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #f6f9fb; }
td .title { font-weight: 600; }
td .sub { font-size: .8rem; color: var(--muted); }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }

@media (max-width: 700px) {
  table.responsive thead { display: none; }
  table.responsive tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.responsive td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  table.responsive td::before { content: attr(data-label); font-size: .75rem; color: var(--muted); font-weight: 600; text-align: left; flex: none; }
  table.responsive td.primary { display: block; text-align: left; padding-bottom: 6px; }
  table.responsive td.primary::before { display: none; }
  table.responsive td.sel { justify-content: flex-start; }
  table.responsive td.sel::before { display: none; }
}

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .title { font-weight: 600; }
.list .sub { font-size: .8rem; color: var(--muted); }
.list a.row { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 10px; color: inherit; }
.list a.row:hover { text-decoration: none; }

/* Detail layout */
.detail-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.detail-head .photo { width: 120px; height: 120px; border-radius: 10px; background: #eceef2; display: grid; place-items: center; overflow: hidden; flex: none; color: #374151; cursor: pointer; }
.detail-head .photo img { width: 100%; height: 100%; object-fit: cover; }
.detail-head .photo svg { width: 34px; height: 34px; opacity: .7; }
.detail-head .info { flex: 1; min-width: 220px; }
.detail-head .tag { font-family: var(--mono); color: var(--muted); font-size: .9rem; }
.detail-head .qr { width: 96px; height: 96px; flex: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; margin-top: 8px; } }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 18px 20px 24px; animation: up .18s ease-out; }
.modal.wide { max-width: 860px; }
@media (min-width: 700px) { .modal-backdrop { align-items: center; padding: 20px; } .modal { border-radius: 14px; padding: 22px 24px; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal h2 { margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.modal .x { background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px; }

/* Toasts */
#toasts { position: fixed; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: 360px; }
@media (max-width: 700px) { #toasts { top: auto; bottom: 80px; left: 14px; right: 14px; max-width: none; } }
.toast { background: #1b2430; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: .9rem; animation: up .18s ease-out; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, #3a1016 0%, #17181c 55%, #0f1012 100%); }
.login { background: #fff; border-radius: 14px; padding: 28px 26px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login .brand { color: var(--brand); padding-bottom: 14px; }
.login .brand .logo { background: transparent; }
.login .login-logo { display: block; width: 210px; margin: 0 auto 18px; }
.login .links { text-align: center; margin-top: 12px; font-size: .9rem; }

/* Scanner */
.scanner { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 3/4; max-height: 70vh; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 15% 12%; border: 2px solid rgba(255,255,255,.85); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; }
.scanner .msg { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.scan-result { margin-top: 14px; }

/* Labels print */
.label-sheet { display: grid; background: #fff; }
.plabel { display: flex; align-items: center; gap: 6px; overflow: hidden; padding: 4px 6px; border: 1px dashed #d9dee3; }
.plabel img { height: 100%; aspect-ratio: 1; }
.plabel .t { min-width: 0; line-height: 1.15; }
.plabel .tag { font-family: var(--mono); font-weight: 700; }
.plabel .n { font-size: .8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plabel .c { font-size: .7em; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plabel .co { font-size: .62em; color: #777; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .bottombar, .no-print, #toasts { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .card { border: 0; box-shadow: none; padding: 0; margin: 0; }
  .plabel { border-color: transparent; }
  @page { margin: 0; }
}

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.checklist li.done span { text-decoration: line-through; color: var(--muted); }
.checklist input { width: 18px; height: 18px; }

/* Notes / timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; padding: 8px 0; }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); margin-top: 5px; }
.timeline .when { font-size: .78rem; color: var(--muted); }
.note { background: #f7f9fb; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.note .who { font-size: .78rem; color: var(--muted); margin-bottom: 2px; }

/* Misc */
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .82rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.progress { height: 8px; background: #e9eef2; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #eceef2; color: #374151; display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; overflow: hidden; }
.fab { position: fixed; right: 18px; bottom: 84px; width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: #fff; display: none; place-items: center; box-shadow: 0 8px 24px rgba(200, 16, 46, .35); z-index: 18; border: 0; }
.fab svg { width: 24px; height: 24px; }
@media (max-width: 900px) { .fab { display: grid; } }
.skeleton { color: var(--muted); padding: 20px; text-align: center; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.selectable td.sel { width: 36px; }
.bar { height: 8px; border-radius: 99px; background: var(--brand); }

/* Sortable headers */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--brand); }
th .sort-ind { opacity: .5; font-size: .7em; }
th.sorted .sort-ind { opacity: 1; }

/* Metric panels */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.metric { background: #f7f9fb; border-radius: 8px; padding: 10px 12px; }
.metric .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.metric .v { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.metric .v.ok { color: var(--ok); } .metric .v.danger { color: var(--danger); } .metric .v.warn { color: var(--warn); }
.metric .s { font-size: .78rem; color: var(--muted); }

/* Employee chip / lookup */
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; background: var(--accent-bg); color: var(--brand); font-weight: 600; font-size: .9rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--brand); color: #fff; }
.inline-add { display: flex; gap: 6px; align-items: stretch; }
.inline-add select, .inline-add input { flex: 1; min-width: 0; }
.chip .x { background: none; border: 0; cursor: pointer; color: inherit; font-size: 1.1rem; line-height: 1; padding: 0 2px; }
.lookup-results { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 6px; background: #fff; }
.lookup-results button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; text-align: left; cursor: pointer; }
.lookup-results button:hover { background: #f5f8fb; }
.lookup-results button:last-child { border-bottom: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar img, .photo-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.photo-sm { width: 40px; height: 40px; border-radius: 8px; background: #eceef2; display: inline-grid; place-items: center; color: #374151; font-weight: 700; overflow: hidden; }

/* Employee badge (CR80 3.375in x 2.125in) */
.badge-card { width: 3.375in; height: 2.125in; background: #fff; border-radius: .12in; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 1px 4px rgba(0,0,0,.15); font-family: var(--font); color: #111; position: relative; break-inside: avoid; }
.badge-card .top { height: .42in; background: #17181c; display: flex; align-items: center; justify-content: space-between; padding: 0 .14in; }
.badge-card .top img { height: .34in; width: auto; }
.badge-card .top .co { color: #fff; font-weight: 700; font-size: 8.5pt; letter-spacing: .04em; text-transform: uppercase; }
.badge-card .body { flex: 1; display: flex; align-items: center; gap: .12in; padding: .1in .14in; }
.badge-card .photo { width: 1.05in; height: 1.25in; border-radius: .08in; background: #f1f1f4; overflow: hidden; display: grid; place-items: center; color: #17181c; font-weight: 700; font-size: 20pt; flex: none; }
.badge-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.badge-card .info { flex: 1; min-width: 0; }
.badge-card .name { font-size: 12.5pt; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; overflow: hidden; }
.badge-card .title { font-size: 8.5pt; color: #c8102e; font-weight: 700; margin-top: .04in; }
.badge-card .no { font-family: var(--mono); font-size: 8pt; color: #444; margin-top: .06in; }
.badge-card .qr { width: .85in; height: .85in; flex: none; }
.badge-card .qr img { width: 100%; height: 100%; }
.badge-card .strip { height: .12in; background: #c8102e; }
.badge-sheet { display: grid; grid-template-columns: repeat(2, 3.375in); gap: .25in; justify-content: center; padding: .4in 0; }
.badge-preview { transform-origin: top left; }
@media print {
  .badge-sheet { gap: .2in; padding: 0; page-break-after: always; }
  .badge-card { box-shadow: none; outline: 1px dashed #bbb; border-radius: 0; }
  .badge-page { page-break-after: always; display: grid; place-items: center; }
}

/* Invoice — fits US Letter portrait (8.5 × 11in, 0.5in margins) */
.invoice { background: #fff; color: #111; width: 7.5in; max-width: 100%; margin: 0 auto; padding: .45in .5in; font-size: 10pt; line-height: 1.35; box-sizing: border-box; }
.invoice header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid #c8102e; padding-bottom: 12px; margin-bottom: 14px; }
.invoice header img { height: 70px; width: auto; display: block; }
.invoice .from-block { font-size: 9pt; color: #333; margin-top: 6px; line-height: 1.4; }
.invoice h1 { font-size: 24pt; margin: 0 0 4px; color: #17181c; letter-spacing: .04em; font-weight: 800; }
.invoice .meta { text-align: right; font-size: 9.5pt; }
.invoice .meta b { display: inline-block; min-width: 80px; text-align: left; color: #666; font-weight: 600; }
.invoice .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 14px; }
.invoice .parties h4 { margin: 0 0 3px; font-size: 7.5pt; text-transform: uppercase; letter-spacing: .1em; color: #888; }
.invoice table { font-size: 9.5pt; width: 100%; }
.invoice th { background: #17181c; color: #fff; font-size: 7.5pt; letter-spacing: .08em; padding: 7px 8px; }
.invoice td { padding: 7px 8px; border-bottom: 1px solid #e6e6ea; vertical-align: top; }
.invoice td.num, .invoice th.num { text-align: right; white-space: nowrap; }
.invoice .pricing { font-size: 8.5pt; color: #555; }
.invoice .totals { margin-left: auto; width: 3in; margin-top: 8px; }
.invoice .totals div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #eee; }
.invoice .totals .grand { font-size: 12.5pt; font-weight: 800; border-top: 2px solid #c8102e; border-bottom: 0; color: #17181c; padding-top: 6px; }
.invoice .terms { margin-top: 16px; font-size: 8.5pt; color: #555; border-top: 1px solid #eee; padding-top: 8px; white-space: pre-wrap; }
.invoice .foot { margin-top: 10px; font-size: 8pt; color: #777; text-align: center; }
.invoice .stamp { position: absolute; right: 1in; top: 1.6in; border: 3px solid; border-radius: 8px; padding: 4px 14px; font-weight: 800; font-size: 1.3rem; transform: rotate(-12deg); opacity: .45; }
.invoice-wrap { position: relative; }
@media (max-width: 760px) { .invoice { width: 100%; padding: 16px; } .invoice header { flex-direction: column; } .invoice .meta { text-align: left; } .invoice .parties { grid-template-columns: 1fr; } .invoice .totals { width: 100%; } }
@media print {
  @page { size: letter portrait; margin: .5in; }
  .invoice { width: 7.5in; padding: 0; }
  .invoice tr { page-break-inside: avoid; }
  .invoice-wrap .card { border: 0; }
}
.line-edit input { padding: 5px 7px; font-size: .9rem; }
.line-edit td { vertical-align: middle; }
.print-head { display: none; }
@media print { .print-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; border-bottom: 2px solid #c8102e; padding-bottom: 10px; } .print-head img { height: 48px; } .print-head b { font-size: 1.1rem; } }
.report-print-note { display: none; }
@media print { .report-print-note { display: block; font-size: .8rem; color: #666; margin-top: 10px; } }
.danger-zone { border-color: #f1c4bf; }
.help { font-size: .85rem; color: var(--muted); }

/* Concise report index */
.report-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 28px; }
.report-group h4 { margin: 0 0 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.report-group ul { list-style: none; margin: 0; padding: 0; }
.report-group li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; font-size: .9rem; }
.report-group li a:first-child { color: var(--text); font-weight: 500; }
.report-group li a:first-child:hover { color: var(--brand); text-decoration: none; }
.report-group .csv { color: var(--muted); opacity: .6; display: inline-flex; }
.report-group .csv:hover { opacity: 1; color: var(--brand); }
.report-group .csv svg { width: 14px; height: 14px; }
.line-edit textarea { min-height: 54px; font-size: .88rem; padding: 6px 8px; }
.line-edit input[list] { min-width: 180px; }
@media print { .tabs, .fab, .toolbar { display: none !important; } }

/* Multi-select dropdown */
.ms { position: relative; }
.ms-trigger { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; text-align: left; cursor: pointer; min-height: 42px; }
.ms-trigger[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(200, 16, 46, .12); }
.ms-ph { color: var(--muted); }
.ms-sum { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { color: var(--muted); font-size: .85rem; }
.ms-panel { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); padding: 8px; }
.ms-search { width: 100%; margin-bottom: 6px; }
.ms-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.ms-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); font-weight: 500; }
.ms-opt:last-child { border-bottom: 0; }
.ms-opt:hover { background: #f7f7f8; }
.ms-opt input { width: 18px; height: 18px; flex: none; }
.ms-txt { display: flex; flex-direction: column; line-height: 1.2; }
.ms-add { padding: 6px 0 0; }
.ms-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; }
@media (max-width: 700px) { .ms-panel { position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; max-height: 70vh; display: flex; flex-direction: column; } .ms-panel.hidden { display: none; } .ms-list { max-height: 48vh; } }
