/* Voltrace — app styles. Touch-first: 44px+ targets, bottom tab bar under 960px. */
:root {
  --ink: #10151C;
  --ink-2: #1B222C;
  --ink-3: #2A3340;
  --charge: #C5F82A;
  --charge-2: #B0E61A;
  --charge-soft: #F1FDD0;
  --bg: #F4F5F0;
  --surface: #FFFFFF;
  --line: #E3E5DD;
  --line-2: #D2D5CB;
  --text: #10151C;
  --muted: #5E6670;
  --faint: #8B929A;
  --ok: #17803D;
  --ok-bg: #E4F6E9;
  --warn: #A35F00;
  --warn-bg: #FFF2D6;
  --bad: #C2312F;
  --bad-bg: #FDE6E4;
  --info: #2457C5;
  --info-bg: #E6EEFC;
  --closed: #5E6670;
  --closed-bg: #ECEDEA;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 21, 28, .05), 0 4px 16px rgba(16, 21, 28, .05);
  --font: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sidebar: 252px;
  --tabbar: 68px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, svg { display: block; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.15; margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 12px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; }
.mono { font-family: var(--mono); font-feature-settings: 'zero'; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--ink); color: #E8ECEF;
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand span { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.03em; color: #fff; }
.client-chip { margin: 0 8px 18px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--ink-2); font-size: 12px; color: #AEB6BF; line-height: 1.35; }
.client-chip b { display: block; color: #fff; font-weight: 600; font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6F7A86; padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none;
  color: #C4CBD2; font-weight: 500; min-height: 44px;
}
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-3); color: #fff; }
.nav a.active .icon { color: var(--charge); }
.nav .scan-link { background: var(--charge); color: var(--ink); font-weight: 650; margin-bottom: 10px; }
.nav .scan-link:hover { background: var(--charge-2); color: var(--ink); }
.nav .scan-link .icon { color: var(--ink) !important; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--ink-3); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--charge); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.sidebar-foot .who { min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; }
.sidebar-foot .who b { display: block; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { color: #8B95A0; text-transform: capitalize; }
.sidebar-foot button { background: none; border: 0; color: #8B95A0; padding: 8px; border-radius: 8px; cursor: pointer; }
.sidebar-foot button:hover { color: #fff; background: var(--ink-2); }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.demo-bar { background: var(--charge); color: var(--ink); font-size: 13px; padding: 8px 24px; display: flex; gap: 8px; align-items: center; justify-content: center; text-align: center; font-weight: 500; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 22px 32px 6px; }
.topbar .titles { flex: 1; min-width: 0; }
.topbar .eyebrow { font-size: 13px; color: var(--muted); margin-bottom: 2px; display: flex; gap: 6px; align-items: center; }
.topbar .eyebrow a { color: var(--muted); text-decoration: none; }
.topbar .eyebrow a:hover { color: var(--text); }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 18px 32px 48px; flex: 1; width: 100%; max-width: 1280px; }
.mobile-top, .tabbar, .scrim { display: none; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head a { font-size: 13px; color: var(--muted); text-decoration: none; font-weight: 500; }
.card-head a:hover { color: var(--text); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 11px; border: 1px solid transparent; font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer;
  background: var(--ink); color: #fff; transition: background .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn-charge { background: var(--charge); color: var(--ink); }
.btn-charge:hover { background: var(--charge-2); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: #F7F8F4; }
.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #A52826; }
.btn-warn { background: #E89A0C; color: var(--ink); }
.btn-warn:hover { background: #D48A05; }
.btn-lg { min-height: 56px; font-size: 17px; padding: 0 24px; border-radius: 14px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.link { color: var(--info); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

label.field, .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], input[type=tel], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 11px; background: #fff;
  font: 400 16px/1.3 var(--font); color: var(--text); appearance: none; -webkit-appearance: none;
}
textarea { min-height: 92px; resize: vertical; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235E6670' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(197, 248, 42, .55); }
input.serial-input { font-family: var(--mono); text-transform: uppercase; letter-spacing: .02em; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); margin: 0; flex: none; }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.radio-cards label { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; cursor: pointer; font-weight: 500; font-size: 14px; color: var(--text); }
.radio-cards label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #FAFCF4; }
.radio-cards input { accent-color: var(--ink); width: 18px; height: 18px; margin: 2px 0 0; }
.radio-cards small { display: block; color: var(--muted); font-weight: 400; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: 14.5px; font-weight: 500; margin-bottom: 16px; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--ok-bg); color: #0F5C2B; }
.alert-error { background: var(--bad-bg); color: #8E1F1D; }
.alert-warning { background: var(--warn-bg); color: #6E4000; }
.alert-info { background: var(--info-bg); color: #1A3F91; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-expiring { background: var(--warn-bg); color: var(--warn); }
.badge-expired { background: var(--bad-bg); color: var(--bad); }
.badge-none { background: var(--info-bg); color: var(--info); }
.badge-closed { background: var(--closed-bg); color: var(--closed); }
.badge-claim { background: #FFE9D9; color: #B4470B; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 6px; background: #EEF0EA; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }

/* KPI tiles */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.kpi .sub { font-size: 12.5px; color: var(--faint); }
a.kpi:hover { border-color: var(--line-2); }
.kpi.attention .value { color: #B4470B; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FAFBF8; white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: #FAFBF6; }
.table a.rowlink { text-decoration: none; font-weight: 600; }
.cell-sub { display: block; font-size: 12.5px; color: var(--muted); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .icon { margin: 0 auto 10px; width: 32px; height: 32px; color: var(--faint); }

/* Mobile list rows used instead of tables on small screens */
.list { display: none; }
.list a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.list a:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 260px; position: relative; }
.toolbar .search .icon { position: absolute; left: 14px; top: 13px; color: var(--faint); }
.toolbar .search input { padding-left: 42px; }
.toolbar select { width: auto; min-width: 160px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; scrollbar-width: none; }
.chips a { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; text-decoration: none; font-size: 13.5px; font-weight: 600; color: var(--ink-3); min-height: 38px; display: inline-flex; align-items: center; }
.chips a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }

/* Dashboard */
.hero-scan { display: flex; align-items: center; gap: 20px; padding: 22px 24px; background: var(--ink); color: #fff; border-radius: var(--radius); text-decoration: none; position: relative; overflow: hidden; }
.hero-scan::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(197,248,42,.28), transparent 70%); }
.hero-scan .scan-ic { width: 60px; height: 60px; border-radius: 16px; background: var(--charge); color: var(--ink); display: grid; place-items: center; flex: none; }
.hero-scan h2 { font-size: 21px; color: #fff; }
.hero-scan p { margin: 2px 0 0; color: #AEB6BF; font-size: 14px; }
.hero-scan .go { margin-left: auto; color: var(--charge); }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.quick a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; font-weight: 600; font-size: 14.5px; }
.quick a .qi { width: 38px; height: 38px; border-radius: 10px; background: var(--charge-soft); display: grid; place-items: center; flex: none; }
.quick a:hover { border-color: var(--line-2); }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 168px; padding: 12px 20px 0; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar { width: 100%; max-width: 46px; background: var(--ink); border-radius: 6px 6px 2px 2px; position: relative; min-height: 3px; }
.bars .col:last-child .bar { background: var(--charge-2); }
.bars .num { font-size: 12.5px; font-weight: 650; color: var(--ink-3); }
.bars .lbl { font-size: 12px; color: var(--muted); padding-bottom: 14px; }
.feed { list-style: none; margin: 0; padding: 4px 0; }
.feed li { display: flex; gap: 12px; padding: 11px 20px; font-size: 14px; align-items: flex-start; }
.feed .dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: #EEF0EA; color: var(--ink-3); }
.feed .dot .icon { width: 16px; height: 16px; }
.feed .dot.sold { background: var(--ok-bg); color: var(--ok); }
.feed .dot.claimed { background: #FFE9D9; color: #B4470B; }
.feed .dot.replaced, .feed .dot.replacement { background: var(--info-bg); color: var(--info); }
.feed .txt { flex: 1; min-width: 0; }
.feed .when { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* Battery / warranty check */
.status-hero { border-radius: 18px; padding: 24px; color: var(--ink); display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.status-hero .big-ic { width: 64px; height: 64px; border-radius: 18px; background: rgba(255,255,255,.7); display: grid; place-items: center; }
.status-hero .big-ic .icon { width: 36px; height: 36px; stroke-width: 2.2; }
.status-hero h2 { font-size: 26px; font-weight: 750; }
.status-hero .sub { font-size: 15px; margin-top: 2px; opacity: .85; }
.status-active { background: #D9F5C0; }
.status-active .big-ic { color: var(--ok); }
.status-expiring { background: #FFE7B0; }
.status-expiring .big-ic { color: var(--warn); }
.status-expired { background: #FFD5D1; }
.status-expired .big-ic { color: var(--bad); }
.status-none { background: #DCE7FB; }
.status-none .big-ic { color: var(--info); }
.status-closed { background: #E4E6E1; }
.status-closed .big-ic { color: var(--closed); }
.status-claim { background: #FFDCC2; }
.status-claim .big-ic { color: #B4470B; }
.meter { grid-column: 1 / -1; }
.meter .track { height: 10px; border-radius: 99px; background: rgba(16,21,28,.12); overflow: hidden; }
.meter .fill { height: 100%; background: var(--ink); border-radius: 99px; }
.meter .ends { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 6px; opacity: .8; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.facts div { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.facts div:nth-child(odd) { border-right: 1px solid var(--line); }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 3px; }
.facts dd { margin: 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.facts dd a { text-decoration: none; }
.facts dd a:hover { text-decoration: underline; }
.serial-title { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.action-card { border: 2px solid var(--ink); }
.action-card .card-head { background: var(--ink); color: #fff; border-radius: 12px 12px 0 0; border-bottom: 0; }
.action-card .card-head h2 { color: #fff; display: flex; gap: 10px; align-items: center; }
.action-card .card-head .icon { color: var(--charge); }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--charge); color: var(--ink); display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; }
details.more { border-top: 1px solid var(--line); }
details.more summary { padding: 14px 20px; cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 10px; color: var(--ink-3); }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: '+'; margin-left: auto; font-size: 20px; color: var(--faint); }
details.more[open] summary::after { content: '–'; }
details.more .inner { padding: 0 20px 18px; }
.timeline { list-style: none; margin: 0; padding: 8px 20px 16px; position: relative; }
.timeline li { position: relative; padding: 10px 0 10px 28px; font-size: 14px; }
.timeline li::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.timeline li:first-child::before { top: 18px; }
.timeline li:last-child::before { bottom: calc(100% - 18px); }
.timeline li::after { content: ''; position: absolute; left: 2px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); }
.timeline li.t-sold::after { border-color: var(--ok); background: var(--ok); }
.timeline li.t-claimed::after { border-color: #E06A1A; background: #E06A1A; }
.timeline li.t-replaced::after, .timeline li.t-replacement::after { border-color: var(--info); background: var(--info); }
.timeline li.t-claim_closed::after { border-color: var(--ok); }
.timeline li.t-returned::after { border-color: var(--bad); }
.timeline b { font-weight: 650; }
.timeline .meta { color: var(--muted); font-size: 12.5px; }
.timeline .note { margin-top: 4px; padding: 8px 12px; background: #F6F7F2; border-radius: 9px; font-size: 13.5px; }
.qr-box { display: flex; gap: 16px; align-items: center; padding: 16px 20px; }
.qr-box .qr { width: 96px; height: 96px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; flex: none; }
.qr-box .qr svg { width: 100%; height: 100%; }
.linked { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--info-bg); color: #1A3F91; text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 16px; }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 30px rgba(16,21,28,.14); max-height: 280px; overflow-y: auto; z-index: 20; display: none; }
.combo-list.open { display: block; }
.combo-list button { display: block; width: 100%; text-align: left; padding: 12px 14px; border: 0; background: none; font: 500 15px var(--font); cursor: pointer; border-bottom: 1px solid var(--line); }
.combo-list button:last-child { border-bottom: 0; }
.combo-list button:hover, .combo-list button.hl { background: var(--charge-soft); }
.combo-list small { display: block; color: var(--muted); font-size: 12.5px; }
.selected-customer { display: none; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--charge-soft); border: 1px solid #DDF3A0; }
.selected-customer.show { display: flex; }
.selected-customer b { display: block; }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Scanner */
.scanner { position: relative; background: #000; border-radius: 18px; overflow: hidden; aspect-ratio: 1 / 1; max-height: 62vh; width: 100%; margin: 0 auto; }
.scanner video { width: 100% !important; height: 100% !important; object-fit: cover; }
.scanner #reader, .scanner .reader { width: 100%; height: 100%; border: 0 !important; }
.scanner #reader__dashboard, .scanner [id$="__dashboard"] { display: none !important; }
.scanner .frame { position: absolute; inset: 18%; border-radius: 18px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scanner .frame::before, .scanner .frame::after { content: ''; position: absolute; inset: -3px; border-radius: 20px; border: 4px solid var(--charge); clip-path: polygon(0 0, 28% 0, 28% 4px, 4px 4px, 4px 28%, 0 28%, 0 72%, 4px 72%, 4px calc(100% - 4px), 28% calc(100% - 4px), 28% 100%, 72% 100%, 72% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 72%, 100% 72%, 100% 28%, calc(100% - 4px) 28%, calc(100% - 4px) 4px, 72% 4px, 72% 0, 100% 0, 100% 100%, 0 100%); }
.scanner .frame::after { display: none; }
.scanner .laser { position: absolute; left: 20%; right: 20%; height: 2px; background: var(--charge); box-shadow: 0 0 12px var(--charge); top: 50%; animation: laser 2.2s ease-in-out infinite; pointer-events: none; }
@keyframes laser { 0%, 100% { top: 22%; } 50% { top: 78%; } }
.scanner .placeholder { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #C4CBD2; padding: 24px; }
.scanner .placeholder .icon { margin: 0 auto 12px; width: 44px; height: 44px; color: var(--charge); }
.scanner.live .placeholder { display: none; }
.scanner:not(.live) .laser, .scanner:not(.live) .frame { display: none; }
.scan-found { position: absolute; inset: 0; background: rgba(197,248,42,.92); display: none; place-items: center; color: var(--ink); font-weight: 700; font-size: 18px; text-align: center; }
.scan-found.show { display: grid; }
.scan-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.mini-scanner { aspect-ratio: 4 / 3; max-height: 300px; }

/* Customer */
.contact-list { list-style: none; margin: 0; padding: 6px 0; }
.contact-list li { display: flex; gap: 12px; padding: 10px 20px; align-items: center; font-size: 14.5px; }
.contact-list .icon { color: var(--faint); }

/* Guide */
.prose { max-width: 760px; }
.prose h2 { font-size: 22px; margin: 32px 0 10px; }
.prose h3 { margin: 20px 0 6px; font-size: 16px; }
.prose p, .prose li { color: #2E3640; font-size: 15.5px; line-height: 1.65; }
.prose ol, .prose ul { padding-left: 22px; margin: 0 0 12px; }
.prose code { font-family: var(--mono); font-size: 13.5px; background: #EEF0EA; padding: 1px 6px; border-radius: 5px; }
.toc { position: sticky; top: 20px; }
.toc a { display: block; padding: 7px 12px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 14px; border-radius: 8px; }
.toc a:hover { background: #fff; color: var(--text); }

/* Upload */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--line-2); border-radius: 16px; padding: 36px 20px; text-align: center; background: #FAFBF7; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--ink); background: var(--charge-soft); }
.dropzone input { display: none; }
.dropzone .icon { width: 34px; height: 34px; color: var(--ink-3); }
.dropzone .fname { font-family: var(--mono); font-size: 13px; color: var(--ok); font-weight: 600; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-art { background: var(--ink); color: #fff; padding: 44px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-art::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -160px; background: radial-gradient(circle, rgba(197,248,42,.22), transparent 68%); }
.auth-art .quote { margin-top: auto; position: relative; }
.auth-art h2 { font-size: 40px; line-height: 1.05; letter-spacing: -.035em; color: #fff; max-width: 460px; }
.auth-art h2 em { font-style: normal; color: var(--charge); }
.auth-art p { color: #AEB6BF; max-width: 420px; margin-top: 14px; font-size: 16px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 30px; margin-bottom: 6px; }
.demo-note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--charge-soft); border: 1px solid #DDF3A0; font-size: 13.5px; color: #3D4A12; margin: 18px 0 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 959px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 290px; box-shadow: 0 0 40px rgba(0,0,0,.3); overflow-y: auto; }
  body.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(16,21,28,.45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .mobile-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; padding-top: calc(12px + env(safe-area-inset-top)); }
  .mobile-top .brand { padding: 0; }
  .mobile-top .brand img { width: 30px; height: 30px; }
  .mobile-top .brand span { font-size: 19px; }
  .mobile-top button { margin-left: auto; background: none; border: 0; color: #fff; padding: 8px; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
  .topbar { padding: 18px 16px 4px; flex-wrap: wrap; }
  .topbar h1 { font-size: 24px; }
  .content { padding: 14px 16px 32px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); z-index: 30; }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; font: 600 11px var(--font); color: var(--muted); background: none; border: 0; }
  .tabbar .on { color: var(--ink); }
  .tabbar .on .icon { color: var(--ink); }
  .tabbar .tab-scan { position: relative; }
  .tabbar .tab-scan span.fab { width: 60px; height: 60px; border-radius: 20px; background: var(--charge); color: var(--ink); display: grid; place-items: center; margin-top: -26px; box-shadow: 0 6px 18px rgba(16,21,28,.25); border: 4px solid var(--bg); }
  .tabbar .tab-scan span.fab .icon { width: 28px; height: 28px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .scan-layout { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: minmax(0, 1fr); }
  .demo-bar { padding: 8px 16px; font-size: 12.5px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { padding: 28px 24px; min-height: auto; }
  .auth-art .quote { margin-top: 28px; }
  .auth-art h2 { font-size: 28px; }
}
@media (max-width: 720px) {
  .table-wrap.responsive { display: none; }
  .list { display: block; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts div:nth-child(odd) { border-right: 0; }
  .status-hero { padding: 20px; gap: 14px; }
  .status-hero h2 { font-size: 22px; }
  .status-hero .big-ic { width: 54px; height: 54px; }
  .serial-title { font-size: 21px; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; }
  .radio-cards { grid-template-columns: minmax(0, 1fr); }
  .hero-scan { padding: 18px; }
  .hero-scan .go { display: none; }
  .kpi .value { font-size: 28px; }
  .toolbar select { flex: 1; min-width: 0; }
  .auth-art .hide-sm { display: none; }
}
@media print {
  .sidebar, .tabbar, .mobile-top, .demo-bar, .topbar-actions, .no-print { display: none !important; }
  .main { margin: 0; }
}

.detail-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 959px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
[hidden] { display: none !important; }
.side-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 959px) { .side-grid { grid-template-columns: minmax(0, 1fr); } }
.guide-grid { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
@media (max-width: 959px) { .guide-grid { grid-template-columns: minmax(0, 1fr); } .guide-grid .toc { display: none; } }
