/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Backgrounds — layered depth */
  --bg:        #F2F4F8;
  --surface:   #FFFFFF;
  --surface2:  #EEF0F6;
  --surface3:  #E4E7F2;
  --border:    #D8DCF0;
  --border2:   #C2C7DD;

  /* Brand — industrial amber */
  --primary:   #D97706;
  --primary-h: #F59E0B;
  --primary-d: #92400E;
  --primary-glow: rgba(217,119,6,.10);

  /* Semantic */
  --success:   #16A34A;
  --success-bg:rgba(22,163,74,.10);
  --warning:   #D97706;
  --danger:    #DC2626;
  --danger-bg: rgba(220,38,38,.10);
  --info:      #0284C7;

  /* Text */
  --text:      #1A1D2A;
  --text-muted:#6B7080;
  --text-dim:  #9CA3AF;

  /* Layout */
  --radius:    12px;
  --radius-sm: 8px;
  --nav-h:     68px;
  --header-h:  60px;

  /* Mono font for numbers/codes */
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Courier New', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

/* ── App Shell ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
}

/* ── Top Header ── */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .02em;
  color: var(--text);
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 18px; height: 18px; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-text .logo-top {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--primary);
  text-transform: uppercase;
}
.logo-text .logo-sub {
  font-size: .6rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.header-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--mono);
}
.header-dot {
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.4); }
}

.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: background .15s, border-color .15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { background: var(--surface3); border-color: var(--border2); }
.badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: .58rem;
  font-weight: 800;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

/* ── Page Content ── */
.pages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.page { display: none; padding: 14px; }
.page.active { display: block; }

/* ── Bottom Nav ── */
.bottom-nav {
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .15s;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: none;
  background: none;
  padding: 10px 4px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-item::after {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--primary);
  border-radius: 0 0 2px 2px;
  opacity: 0;
  transition: opacity .15s;
}
.nav-item.active { color: var(--primary); }
.nav-item.active::after { opacity: 1; }
.nav-svg {
  width: 24px; height: 24px;
  transition: transform .15s;
  flex-shrink: 0;
}
.nav-item.active .nav-svg { transform: translateY(-1px); }

/* ── Section Titles ── */
.section-title {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin: 18px 0 10px;
}
.section-title:first-child { margin-top: 4px; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-card .label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}
.stat-card .change {
  font-size: .72rem;
  font-weight: 600;
  margin-top: 5px;
}
.up   { color: var(--success); }
.down { color: var(--danger); }

/* ── Chart Card ── */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.chart-card .chart-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
}
.bar {
  flex: 1;
  background: var(--primary-d);
  border-radius: 4px 4px 0 0;
  opacity: .7;
  transition: opacity .15s;
  cursor: pointer;
}
.bar:hover, .bar.highlight { background: var(--primary); opacity: 1; }
.bar-labels {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}
.bar-labels span {
  flex: 1;
  text-align: center;
  font-size: .6rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .04em;
}

/* ── Activity List ── */
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
}
.activity-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.activity-icon.blue   { background: rgba(56,189,248,.12); }
.activity-icon.green  { background: rgba(34,197,94,.12); }
.activity-icon.yellow { background: rgba(245,158,11,.12); }
.activity-icon.red    { background: rgba(239,68,68,.12); }
.activity-body { flex: 1; min-width: 0; }
.activity-body .title {
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-body .sub {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.activity-time {
  font-size: .65rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: var(--mono);
}

/* ── Reports Page ── */
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.report-card .report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.report-card .report-title {
  font-size: .88rem;
  font-weight: 700;
}
.pill {
  font-size: .62rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pill.green  { background: var(--success-bg); color: var(--success); }
.pill.yellow { background: rgba(245,158,11,.12); color: var(--primary); }
.pill.red    { background: var(--danger-bg); color: var(--danger); }
.progress-bar {
  height: 7px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width .7s cubic-bezier(.4,0,.2,1);
  width: 0;
}
.progress-fill.green  { background: var(--success); }
.progress-fill.yellow { background: var(--primary); }
.report-meta {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Settings Page ── */
.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.settings-item {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 12px 14px;
  gap: 12px;
  cursor: pointer;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.settings-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.settings-item:active { background: var(--surface2); }
.settings-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.settings-label {
  flex: 1;
  font-size: .9rem;
  font-weight: 500;
}
.settings-value {
  font-size: .78rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.chevron { font-size: .75rem; color: var(--text-dim); margin-left: 4px; }

/* Toggle */
.toggle {
  width: 44px; height: 24px;
  background: var(--border2);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.toggle.on::after { transform: translateX(20px); }

/* ── Install Banner ── */
#install-banner {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--primary-glow);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
#install-banner.visible { display: flex; }
#install-banner .install-text { flex: 1; font-size: .82rem; }
#install-banner .install-text strong { display: block; font-size: .9rem; margin-bottom: 2px; }

/* ── Buttons ── */
.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .04em;
  transition: opacity .15s, transform .1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: .85; transform: scale(.98); }
.btn-primary {
  background: var(--primary);
  color: #0B0D14;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
  z-index: 999;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Greeting ── */
.greeting { margin-bottom: 16px; }
.greeting .hello { font-size: 1.15rem; font-weight: 800; }
.greeting .sub   { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── BLE Warning ── */
.ble-warning {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,.3);
  color: #FCA5A5;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .82rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ── BLE Status ── */
.ble-status {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .03em;
  margin-bottom: 12px;
}
.ble-disconnected { background: var(--danger-bg);              color: #FCA5A5; }
.ble-connecting   { background: rgba(245,158,11,.10);          color: var(--primary); }
.ble-connected    { background: var(--success-bg);             color: var(--success); }

/* ── BLE Device Info ── */
.ble-device-info {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: .82rem;
}
.ble-device-info strong { color: var(--primary); }

/* ── WiFi Live Status ── */
.wifi-live-status {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  word-break: break-all;
  font-family: var(--mono);
}
.wifi-live-status .wifi-ip { color: var(--success); }

/* ── BLE Log ── */
.ble-log-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 4px 0;
}
.ble-log {
  font-family: var(--mono);
  font-size: .68rem;
  color: #5A6480;
  background: #F6F7FC;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  max-height: 130px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid var(--border);
}
.ble-log-line {
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
}
.ble-log-line:last-child { border-bottom: none; }

/* ── Settings: Setup Steps ── */
.setup-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.step-label {
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.step-num {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--primary-glow);
  border: 1px solid rgba(245,158,11,.25);
  color: var(--primary);
  padding: 3px 9px;
  border-radius: 99px;
}
.device-count {
  font-size: .72rem;
  color: var(--text-muted);
}
.step-desc {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.55;
}

/* ── Scan Status (BLE connect area) ── */
.scan-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.scan-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background .3s;
}
.scan-dot.active {
  background: var(--primary);
  animation: pulse 1s infinite;
}
.scan-dot.bt-on { background: var(--info); }
.scan-text {
  flex: 1;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.scan-text.active { color: var(--primary); }
.bt-pill {
  font-size: .65rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: all .18s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.bt-pill.on {
  border-color: rgba(245,158,11,.5);
  color: var(--primary);
  background: var(--primary-glow);
}

/* ── Device list ── */
.device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.device-empty {
  text-align: center;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 18px 0;
  letter-spacing: .04em;
}
.device-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface2);
  min-height: 64px;
  -webkit-tap-highlight-color: transparent;
}
.device-item:active { opacity: .85; }
.device-item.selected {
  border-color: var(--primary-h);
  background: var(--primary-glow);
}
.device-item.pairing {
  border-color: var(--primary-h);
  background: var(--primary-glow);
}
.device-item.unavailable { opacity: .4; cursor: not-allowed; }
.device-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.device-info { flex: 1; min-width: 0; }
.device-name {
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-sn {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--mono);
}
.device-status {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.device-status.pairing { color: var(--primary); }
.device-status.paired  { color: var(--success); }
.spin {
  display: inline-block;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Config Status Bar ── */
.config-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-glow);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--primary);
}
.config-icon { font-style: normal; font-size: 1rem; }

/* ── Form Fields ── */
.field-group { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.field-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .15s;
  min-height: 50px;
}
.field-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245,158,11,.08);
}
.field-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .92rem;
  padding: 13px 14px;
  font-family: inherit;
  min-height: 50px;
}
.field-input::placeholder { color: var(--text-dim); }
.field-icon-btn {
  width: 48px; height: 48px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.field-icon-btn:active { color: var(--text); }

/* ── SSID Dropdown ── */
.ssid-dropdown {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  overflow: hidden;
  display: none;
}
.ssid-dropdown.open { display: block; }
.ssid-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}
.ssid-option:not(:last-child) { border-bottom: 1px solid var(--border); }
.ssid-option:active { background: var(--surface3); }
.ssid-signal { font-size: .7rem; color: var(--text-muted); font-family: var(--mono); }

/* ── WiFi Actions ── */
.wifi-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(245,158,11,.5);
  color: var(--primary);
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 0 14px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  -webkit-tap-highlight-color: transparent;
}
.btn-outline:active { background: var(--primary-glow); }
.btn.btn-primary {
  min-height: 48px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--primary);
  color: #0B0D14;
  width: 100%;
}

/* ── Printer Section ── */
.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 0 14px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(245,158,11,.5);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.refresh-btn:active { background: var(--primary-glow); }
.refresh-btn.spinning svg { animation: spin .6s linear infinite; }

.printer-scan-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}
.printer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.printer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  background: var(--surface2);
  transition: border-color .15s;
  cursor: pointer;
  min-height: 70px;
  -webkit-tap-highlight-color: transparent;
}
.printer-item.default-printer {
  border-color: rgba(245,158,11,.45);
  background: var(--primary-glow);
}
.printer-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 38px;
  text-align: center;
}
.printer-info { flex: 1; min-width: 0; }
.printer-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}
.printer-name {
  font-size: .88rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
}
.default-badge {
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .07em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--primary);
  color: #0B0D14;
  flex-shrink: 0;
  text-transform: uppercase;
}
.printer-ip {
  font-size: .72rem;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-family: var(--mono);
}
.printer-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
}
.status-led {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-led.online,
.status-led.ready   { background: var(--success); }
.status-led.offline { background: var(--danger); }
.status-led.warning { background: var(--primary); }
.status-label.online,
.status-label.ready   { color: var(--success); font-weight: 700; }
.status-label.offline { color: var(--danger); font-weight: 700; }
.status-label.warning { color: var(--primary); font-weight: 700; }
.status-extra { color: var(--text-muted); font-size: .68rem; }
.printer-action { flex-shrink: 0; }
.set-default-btn {
  font-size: .72rem;
  font-weight: 800;
  padding: 8px 11px;
  border-radius: 7px;
  border: 1.5px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1.3;
  text-align: center;
  transition: border-color .15s, color .15s;
  letter-spacing: .03em;
  -webkit-tap-highlight-color: transparent;
}
.set-default-btn:active {
  border-color: rgba(245,158,11,.5);
  color: var(--primary);
}
.default-check { color: var(--success); font-size: 1.3rem; }

.manual-config { margin-top: 6px; }
.manual-config-title {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.manual-config-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Pro Tip ── */
.pro-tip {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.pro-tip-icon { font-size: 1.8rem; flex-shrink: 0; align-self: flex-start; }
.pro-tip-body strong {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.pro-tip-body p {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ════════════════════════════════════════════
   SCANNER PAGE
════════════════════════════════════════════ */
.page[data-page="scanner"] {
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 10px;
}
.page[data-page="scanner"].active { display: flex; }

/* ── Viewfinder ── */
.scanner-viewfinder {
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0,0,0,.32);
}
.scan-frame {
  width: 62%;
  aspect-ratio: 3/2;
  position: relative;
}

/* Corner brackets — amber */
.corner {
  position: absolute;
  width: 24px; height: 24px;
  border-color: var(--primary);
  border-style: solid;
}
.corner.tl { top: 0; left: 0;  border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.corner.bl { bottom: 0; left: 0;  border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

/* Animated scan line */
.scan-line {
  position: absolute;
  left: 5%; right: 5%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--primary) 40%, var(--primary-h) 50%, var(--primary) 60%, transparent 100%);
  border-radius: 1px;
  top: 0;
  display: none;
  box-shadow: 0 0 8px var(--primary);
}
.scan-line.active {
  display: block;
  animation: scanMove 2.2s ease-in-out infinite;
}
@keyframes scanMove {
  0%   { top: 6%; }
  50%  { top: 88%; }
  100% { top: 6%; }
}
.scan-label {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(8,10,16,.72);
  padding: 6px 16px;
  border-radius: 99px;
  backdrop-filter: blur(6px);
}

/* No-camera fallback */
.scanner-nocam {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  padding: 20px;
}
.nocam-icon { font-size: 2.8rem; }
.nocam-text {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.nocam-sub {
  font-size: .78rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* ── Scanner Status Bar ── */
.scanner-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  min-height: 48px;
}
.scanner-led {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background .3s;
}
.scanner-led.active {
  background: var(--success);
  animation: pulse 1.5s infinite;
}
.scanner-led.found {
  background: var(--primary);
  animation: none;
  box-shadow: 0 0 8px var(--primary);
}
.scanner-status-text {
  flex: 1;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.scanner-status-text.active { color: var(--success); }
.scanner-status-text.found  { color: var(--primary); }
.scanner-toggle-btn {
  font-size: .72rem;
  font-weight: 800;
  padding: 0 16px;
  min-height: 36px;
  border-radius: 6px;
  border: 1.5px solid rgba(245,158,11,.5);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.scanner-toggle-btn:active { background: var(--primary-glow); }
.scanner-toggle-btn.stop {
  border-color: rgba(239,68,68,.4);
  color: #FCA5A5;
}
.scanner-toggle-btn.stop:active { background: var(--danger-bg); }

/* ── Scan Result Card ── */
.scan-result-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  animation: fadeSlideUp .22s ease;
  transition: border-color .2s, box-shadow .2s;
}
.scan-result-card.detected {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
  animation: detectedPop .28s cubic-bezier(.4,0,.2,1);
}
@keyframes detectedPop {
  0%   { transform: scale(.97); }
  60%  { transform: scale(1.015); }
  100% { transform: scale(1); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Detected banner — hidden until .detected is applied */
.scan-detected-banner {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--success-bg);
  border: 1px solid rgba(22,163,74,.3);
  color: var(--success);
  border-radius: 6px;
  padding: 9px 12px;
  margin-bottom: 14px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.scan-result-card.detected .scan-detected-banner {
  display: flex;
}
.scan-result-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.scan-field-label {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.scan-field-value {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
  font-family: var(--mono);
}
.process-btn {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--primary);
  color: #0B0D14;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.process-btn:active { opacity: .88; transform: scale(.99); }

/* ── Idle Hint ── */
.scan-hint {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  padding: 16px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.55;
}
.scan-hint-icon { font-size: 1.8rem; flex-shrink: 0; }

/* ════════════════════════════════════════════
   WEIGH SCREEN
════════════════════════════════════════════ */
.weigh-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.weigh-screen.open { transform: translateX(0); }

/* ── Weigh Header ── */
.weigh-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex-shrink: 0;
}
.weigh-back-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.weigh-back-btn:active { background: var(--surface3); }
.weigh-title {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.weigh-refresh-hdr {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.weigh-refresh-hdr:active { background: var(--surface3); color: var(--text); }
.weigh-refresh-hdr.spinning svg { animation: spin .6s linear infinite; }

/* ── Weigh Body ── */
.weigh-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 6px;
}

/* ── Status Badges ── */
.ws-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ws-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 7px 13px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all .2s;
}
.ws-badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
  flex-shrink: 0;
}
.ws-badge.connected {
  border-color: rgba(34,197,94,.4);
  background: var(--success-bg);
  color: var(--success);
}
.ws-badge.ready {
  border-color: rgba(245,158,11,.4);
  background: var(--primary-glow);
  color: var(--primary);
}

/* ── Weight Display Card ── */
.weigh-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.wc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.wc-label {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.wc-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
}
.ws-stability {
  margin-left: auto;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.ws-stability.stable  {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(34,197,94,.3);
}
.ws-stability.reading {
  background: rgba(245,158,11,.08);
  color: var(--primary);
  border-color: rgba(245,158,11,.3);
}

/* ── Weight Number ── */
.ws-weight-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.ws-weight-val {
  font-size: 64px;
  font-weight: 200;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -3px;
  font-family: var(--mono);
  color: var(--text);
}
.ws-weight-unit {
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
  font-family: var(--mono);
  letter-spacing: 0;
}
.ws-last-scan {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-family: var(--mono);
}

/* ── Progress Bar (Weigh) ── */
.ws-progress-wrap { }
.ws-progress-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
  border: 1px solid var(--border);
}
.ws-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.ws-progress-fill.warn  { background: var(--warning); }
.ws-progress-fill.over  { background: var(--danger); }
.ws-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: .65rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* ── Transaction Fields ── */
.wc-field-row {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.wc-field-label {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.wc-field-value {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}
.wc-field-value.mono {
  font-family: var(--mono);
  color: var(--primary-h);
}

/* ── Recent Logs ── */
.ws-log-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.ws-log-empty {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 10px 0;
  text-align: center;
}
.ws-log-item {
  display: flex;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.ws-log-item:last-child { border-bottom: none; }
.ws-log-weight {
  font-size: 1rem;
  font-weight: 800;
  min-width: 76px;
  color: var(--text);
  font-family: var(--mono);
}
.ws-log-info { flex: 1; min-width: 0; }
.ws-log-code {
  font-size: .8rem;
  font-weight: 700;
  color: var(--primary-h);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
}
.ws-log-name {
  font-size: .7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.ws-log-time {
  font-size: .65rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: var(--mono);
}

/* ── Tare Button (inside Current Reading card) ── */
.ws-tare-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border2);
  background: transparent;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.ws-tare-btn:not(:disabled):active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}
.ws-tare-btn:not(:disabled):hover {
  border-color: var(--primary-h);
  color: var(--primary);
}
.ws-tare-btn:disabled {
  opacity: .38;
  cursor: not-allowed;
}

/* ── Weigh Action Buttons ── */
.ws-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ws-btn-scan,
.ws-btn-print {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.ws-btn-scan:active,
.ws-btn-print:active { opacity: .85; transform: scale(.98); }
.ws-btn-scan {
  background: var(--surface2);
  border: 1.5px solid var(--border2);
  color: var(--text);
}
.ws-btn-print {
  background: var(--primary);
  color: #0B0D14;
}

/* ── Scale Live Card (legacy compat) ── */
.scale-live-card {
  background: var(--surface);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.scale-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.scale-card-title { font-size: .85rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.scale-connected-badge { font-size: .72rem; font-weight: 700; color: var(--success); }
.weight-display { text-align: center; padding: 10px 0 4px; line-height: 1; }
.weight-big {
  font-size: 64px;
  font-weight: 200;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -3px;
  font-family: var(--mono);
}
.weight-unit-label { font-size: 22px; color: var(--primary); margin-left: 6px; font-family: var(--mono); }
.stability-label {
  text-align: center;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
}
.stability-label.stable  { color: var(--success); }
.stability-label.reading { color: var(--primary); }
.scale-btn-row { display: flex; gap: 10px; }
.scale-action-btn {
  flex: 1;
  min-height: 48px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 800;
}
.scale-placeholder {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  font-size: .82rem;
  color: var(--text-muted);
}
.scale-placeholder-icon { font-size: 1.5rem; }

/* ── Calibration ── */
.calib-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.calib-row .field-group { flex: 1; margin-bottom: 0; }
.calib-btn {
  min-height: 50px;
  padding: 0 18px;
  flex-shrink: 0;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #0B0D14;
  cursor: pointer;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.calib-btn:active { opacity: .85; }
.calib-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ════════════════════════════════════════════
   PRINT HISTORY (Reports Tab)
════════════════════════════════════════════ */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.history-count {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--mono);
}
.history-clear-btn {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 99px;
  border: 1.5px solid var(--border2);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.history-clear-btn:active { border-color: var(--danger); color: var(--danger); }

.history-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.history-date-group { }
.history-date-label {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 9px 16px 7px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.history-date-count {
  font-size: .62rem;
  font-weight: 700;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 99px;
  font-family: var(--mono);
}

.history-item {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.history-item:last-child { border-bottom: none; }
.history-item-weight {
  font-size: 1rem;
  font-weight: 800;
  min-width: 68px;
  font-family: var(--mono);
  color: var(--primary);
  flex-shrink: 0;
}
.history-item-info {
  flex: 1;
  min-width: 0;
}
.history-item-code {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  margin-bottom: 3px;
}
.history-item-name {
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-time {
  flex-shrink: 0;
  text-align: right;
}
.history-time {
  font-size: .8rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
}
.history-date-small {
  font-size: .62rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 2px;
}

.history-empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
}
.history-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  opacity: .5;
}
.history-empty-title {
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.history-empty-sub {
  font-size: .78rem;
  line-height: 1.6;
}
