/* Garage Bin Inventory — mobile-first */
/* V2 tokens — Garage Bins brand kit (design-v2): Safety Yellow / Shop Ink / Concrete.
   Rules: no green anywhere; never yellow text on a light background; Rust = destructive only. */
:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --yellow: #FFC20E; --yellow-press: #C99600; --yellow-soft: #FFF1C2;
  --ink: #1F2328; --steel: #5B6670; --tote: #DAD6CE; --chip: #E4E1DA; --concrete: #EEECE7;
  --rust: #B8461F; --rust-soft: #F8E3DA;
  --bg: var(--concrete);
  --surface: #FFFFFF;
  --surface-2: var(--chip);
  --border: var(--tote);
  --text: var(--ink);
  --text-muted: var(--steel);
  --accent: var(--ink);          /* links/text accents are ink on light (yellow is fill-only) */
  --accent-hover: #000000;
  --accent-soft: var(--yellow-soft);
  --tag-bg: var(--chip); --tag-text: var(--ink);
  --loc-bg: var(--chip); --loc-text: var(--ink);
  --success: var(--ink);
  --warn: #8A5A00;
  --danger: var(--rust);
  --highlight: var(--ink); --highlight-bg: var(--yellow-soft);
  --radius: 14px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(31,35,40,.06);
  --focus-ring: 0 0 0 3px rgba(255,194,14,.55);
  --header-bg: rgba(238,236,231,.94);
  --nav-bg: #FFFFFF;
  --input-bg: #FFFFFF;
  --binno-bg: var(--ink); --binno-fg: var(--yellow);
  --hero-bg: var(--ink); --hero-fg: #FFFFFF;
  --btn-dark-bg: var(--ink); --btn-dark-fg: #FFFFFF;
  --nav-h: 76px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181B; --surface: #22262B; --surface-2: #2C3137; --border: #353B42;
    --text: #F2F0EB; --text-muted: #A9B1B9;
    --accent: var(--yellow); --accent-hover: #FFD24D; /* yellow text OK on dark */
    --accent-soft: rgba(255,194,14,.14);
    --tag-bg: #2C3137; --tag-text: #F2F0EB; --loc-bg: #2C3137; --loc-text: #F2F0EB;
    --success: var(--yellow); --warn: #F0B429; --danger: #E07A55;
    --highlight: #1F2328; --highlight-bg: var(--yellow);
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --header-bg: rgba(22,24,27,.94); --nav-bg: #1C1F23; --input-bg: #2C3137;
    --binno-bg: var(--yellow); --binno-fg: var(--ink);
    --hero-bg: #22262B; --hero-fg: #F2F0EB;
    --btn-dark-bg: #F2F0EB; --btn-dark-fg: var(--ink);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--space-4));
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* Shared focus-visible rings */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.bin-card:focus-visible,
.btn:focus-visible,
.bottom-nav a:focus-visible,
.back-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Header — tightened for phone */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-2) var(--space-4) var(--space-3);
}

.app-header h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.app-header .subtitle {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.ok {
  background: var(--success);
}

.status-dot.err {
  background: var(--danger);
}

.status-dot.loading {
  background: var(--warn);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

/* Main */
main {
  padding: var(--space-4);
  max-width: 640px;
  margin: 0 auto;
}

.view {
  display: none;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Bottom nav — larger tap targets, readable labels */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  min-height: calc(var(--nav-h) + var(--safe-bottom));
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 550;
  line-height: 1.2;
  min-height: 44px;
  padding: 10px 2px;
  transition: color 0.15s;
}

.bottom-nav a.active,
.bottom-nav a[aria-current="page"] {
  color: var(--accent);
}

.bottom-nav a:hover {
  color: var(--accent-hover);
}

.bottom-nav a.active:hover,
.bottom-nav a[aria-current="page"]:hover {
  color: var(--accent);
}

.bottom-nav a svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Cards */
.bin-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.bin-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow);
  color: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.bin-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  color: inherit;
}

.bin-card:focus-visible {
  border-color: var(--accent);
  background: var(--surface-2);
  color: inherit;
}

.bin-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.bin-card-name {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
}

.bin-id-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  flex-shrink: 0;
}


.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-2);
}

.tag-row .category-tag,
.tag-row .location-tag {
  margin-bottom: 0;
}

.location-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--loc-text);
  background: var(--loc-bg);
  border: 1px solid rgba(0, 143, 187, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.location-tag::before {
  content: "📍 ";
  font-size: 0.65em;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.location-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-chip.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.filter-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.category-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tag-text);
  background: var(--tag-bg);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.item-preview {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Detail */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-3);
  padding: var(--space-1) 0;
  min-height: 44px;
  color: var(--accent);
  border-radius: var(--radius-sm);
}

.detail-header {
  margin-bottom: var(--space-5);
}

.detail-header h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.field-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}

.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 var(--space-2);
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.item-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.item-list li:first-child {
  padding-top: 0;
}

.notes-text {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
}

.empty-state {
  text-align: center;
  padding: 40px var(--space-5);
  color: var(--text-muted);
}

.empty-state p {
  margin: var(--space-2) 0 0;
  font-size: 0.9375rem;
}

/* Search */
.search-box {
  position: relative;
  margin-bottom: var(--space-4);
}

.search-box input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  font-size: 16px; /* avoid iOS zoom */
  font-family: inherit;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.search-box input:focus,
.search-box input:focus-visible {
  border-color: var(--accent);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}

.search-result-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

mark {
  background: var(--highlight-bg);
  color: var(--highlight);
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 600;
}

/* QR / forms */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* avoid iOS zoom */
  font-family: inherit;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group input:focus-visible,
.form-group select:focus,
.form-group select:focus-visible {
  border-color: var(--accent);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a3b4cc' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 18px;
  min-height: 44px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-danger {
  background: rgba(240, 113, 120, 0.18);
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.45);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(240, 113, 120, 0.3);
  color: var(--danger);
}

.delete-zone {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.delete-zone > .btn-danger {
  width: 100%;
}

.delete-confirm {
  margin-top: 0;
}

.delete-confirm-msg {
  margin: 0 0 var(--space-3);
  font-weight: 600;
  color: var(--text);
}

.delete-confirm-actions {
  margin-top: 0;
}

/* Primary action rows: stretch / stack on narrow screens */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.btn-row .btn,
.btn-row > a.btn {
  flex: 1 1 100%;
  width: 100%;
}

@media (min-width: 400px) {
  .btn-row .btn,
  .btn-row > a.btn {
    flex: 1 1 auto;
    width: auto;
    min-width: 140px;
  }
}

.qr-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.qr-preview canvas,
.qr-preview img {
  border-radius: 8px;
  background: #fff;
  padding: var(--space-3);
  max-width: 100%;
}

/* Full sticker card preview (already includes its own padding/quiet zone) */
.qr-preview canvas.sticker-card {
  border-radius: 12px;
  background: transparent;
  padding: 0;
  max-width: min(100%, 320px);
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  box-shadow: var(--shadow);
}

.qr-preview #qr-canvas-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.qr-url {
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
  text-align: center;
  max-width: 300px;
  line-height: 1.45;
  white-space: pre-line;
}

.help-note {
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--accent-soft);
  border: 1px solid rgba(0, 143, 187, 0.3);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.5;
}

.help-note h3 {
  margin: 0 0 var(--space-2);
  font-size: 0.9375rem;
  color: var(--accent);
}

.help-note ol,
.help-note ul {
  margin: 0;
  padding-left: 1.2em;
}

.help-note li {
  margin-bottom: var(--space-1);
}

.help-note li:last-child {
  margin-bottom: 0;
}

/* Settings panel (on QR / list) */
.settings-panel {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.settings-panel h3 {
  margin: 0 0 var(--space-3);
  font-size: 1rem;
}

.settings-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
  line-height: 1.45;
}

.error-banner {
  background: rgba(240, 113, 120, 0.15);
  border: 1px solid rgba(240, 113, 120, 0.4);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: var(--space-3) 14px;
  font-size: 0.875rem;
  margin-bottom: var(--space-4);
  line-height: 1.45;
}


.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* avoid iOS zoom */
  font-family: inherit;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  min-height: 96px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group textarea:focus,
.form-group textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.form-group input[readonly] {
  opacity: 0.75;
  cursor: default;
  color: var(--text-muted);
}

.form-status {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.45;
}

.form-status.info {
  background: var(--accent-soft);
  border: 1px solid rgba(0, 143, 187, 0.35);
  color: var(--tag-text);
}

.form-status.saving {
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.4);
  color: var(--warn);
}

.form-status.success {
  background: rgba(0, 143, 187, 0.12);
  border: 1px solid rgba(0, 143, 187, 0.4);
  color: var(--success);
}

.form-status.error {
  background: rgba(240, 113, 120, 0.15);
  border: 1px solid rgba(240, 113, 120, 0.4);
  color: var(--danger);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: var(--space-1) 0 0;
  line-height: 1.4;
}

/* Items field: Format as list + Dictate */
.items-field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.items-field-head label {
  margin-bottom: 0;
}

.items-field-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.btn-items-tool {
  padding: 8px 12px;
  min-height: 44px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.btn-items-tool.is-listening {
  background: rgba(240, 113, 120, 0.22);
  color: var(--danger);
  border-color: rgba(240, 113, 120, 0.55);
  box-shadow: 0 0 0 2px rgba(240, 113, 120, 0.25);
}

.dictate-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
  line-height: 1.4;
  min-height: 1.2em;
}

.dictate-status.listening {
  color: var(--warn);
  font-weight: 600;
}

.dictate-status.ok {
  color: var(--success);
}

.dictate-status.hint {
  color: var(--text-muted);
}

@media (min-width: 640px) {
  main {
    padding: var(--space-6);
  }

  .app-header {
    padding: var(--space-3) var(--space-6);
  }

  .app-header h1 {
    font-size: 1.3rem;
  }

  .btn-row .btn,
  .btn-row > a.btn {
    flex: 0 1 auto;
    width: auto;
  }
}

#qr-print-status {
  margin-top: var(--space-3);
}

/* QR print panel */
.print-panel {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.print-panel h3 {
  margin: 0 0 var(--space-3);
  font-size: 1rem;
}

.print-scale-banner {
  margin: 0 0 var(--space-4);
  padding: 12px 14px;
  background: rgba(240, 180, 41, 0.16);
  border: 1px solid rgba(240, 180, 41, 0.55);
  border-radius: var(--radius-sm);
  color: var(--warn);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.print-scale-banner strong {
  color: var(--warn);
}

.bin-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.bin-check-head label {
  margin: 0;
}

.bin-check-actions {
  display: flex;
  gap: var(--space-3);
}

.btn-text {
  background: none;
  border: none;
  padding: 4px 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--accent-hover);
}

.btn-text:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

.bin-check-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.bin-check-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
}

.bin-check-item:hover {
  background: var(--surface-2);
}

.bin-check-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.bin-check-id {
  font-size: 0.75rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 3.4em;
}

.bin-check-name {
  font-size: 0.9375rem;
  font-weight: 550;
}

.sheet-preview-wrap {
  margin-top: var(--space-4);
}

.sheet-preview-label {
  margin: 0 0 var(--space-2);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.sheet-preview-thumb {
  display: block;
  width: min(100%, 220px);
  height: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.qr-preview canvas.sticker-avery {
  max-width: min(100%, 280px);
}

/* —— Accessibility helpers —— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* —— Themes (QR sticker colors) —— */
.themes-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(0, 143, 187, 0.35);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 550;
}

.themes-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

@media (min-width: 720px) {
  .themes-layout {
    flex-direction: row;
    align-items: flex-start;
  }
  .themes-list-panel {
    flex: 0 0 240px;
  }
  .themes-editor-panel {
    flex: 1;
    min-width: 0;
  }
}

.themes-section-title {
  margin: 0 0 var(--space-3);
  font-size: 1rem;
}

.theme-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 320px;
  overflow: auto;
  padding: 2px;
}

.theme-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.theme-list-item:hover {
  border-color: var(--accent);
}

.theme-list-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-list-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.theme-list-name {
  font-weight: 650;
  font-size: 0.9375rem;
}

.theme-list-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.theme-builtin-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 1px 6px;
  border-radius: 999px;
}

.theme-swatch {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid var(--theme-mod, #000);
  background:
    linear-gradient(135deg, var(--theme-mod, #000) 50%, var(--theme-bg, #fff) 50%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.color-row input[type="color"] {
  width: 48px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.color-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: var(--chip, #000);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.color-chip:hover,
.color-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
}

.checkbox-inline input {
  width: 18px;
  height: 18px;
}

.theme-contrast-msg {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.theme-contrast-msg.ok {
  background: rgba(0, 143, 187, 0.12);
  color: var(--success);
  border: 1px solid rgba(0, 143, 187, 0.35);
}

.theme-contrast-msg.warn {
  background: rgba(240, 180, 41, 0.12);
  color: var(--warn);
  border: 1px solid rgba(240, 180, 41, 0.4);
}

.theme-contrast-msg.bad {
  background: rgba(240, 113, 120, 0.12);
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.4);
}

.theme-preview-wrap {
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 140px;
}

.theme-preview-wrap canvas,
.theme-preview-canvas {
  width: min(100%, 200px);
  height: auto;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.themes-apply-panel {
  margin-top: var(--space-2);
}

.bin-check-theme {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 550;
  max-width: 7.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 var(--space-4);
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.theme-chip-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 550;
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 0.875rem;
}

.theme-chip .theme-swatch {
  width: 20px;
  height: 20px;
}
