:root {
  --bg: #1a1f24;
  --bg-2: #232a31;
  --panel: #2b343d;
  --line: #3a4550;
  --text: #eef2f5;
  --muted: #9aa7b3;
  --accent: #3d9cf0;
  --in: #2f9e6b;
  --out: #d9772f;
  --error: #d64545;
  --ok: #2f9e6b;
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, #2a3a4a 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #2a3428 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

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

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.main-nav {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: min(100%, 520px);
  width: auto;
  max-width: 100%;
}
.main-nav a {
  flex: 1;
  text-align: center;
  color: var(--muted);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.main-nav a.active,
.main-nav a:hover {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
  text-decoration: none;
}

.main {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

.flash-wrap { width: min(1400px, 100%); margin: 0.75rem auto 0; padding: 0 1.5rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.flash-ok { background: rgba(47, 158, 107, 0.2); color: #8fe0b8; }
.flash-error { background: rgba(214, 69, 69, 0.2); color: #ffb0b0; }

.scan-stage {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.scan-input {
  width: 100%;
  font-size: 1.75rem;
  line-height: 1.3;
  min-height: 3.25rem;
  padding: 0.9rem 1.1rem;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #12161a;
  color: var(--text);
  outline: none;
}
.scan-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 156, 240, 0.25);
}

.scan-form {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 0.5rem;
}
.scan-form .field {
  display: grid;
  gap: 0.35rem;
}
.scan-form .field > span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.scan-form .btn {
  justify-self: start;
  min-width: 8rem;
}
.scan-form-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.scan-stage-live {
  position: relative;
}

.scan-confirm {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: 14px;
  border: 2px solid rgba(47, 158, 107, 0.65);
  background: rgba(20, 60, 40, 0.95);
  color: #e8fff2;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.scan-confirm.is-error {
  border-color: rgba(214, 69, 69, 0.7);
  background: rgba(70, 24, 24, 0.95);
  color: #ffe8e8;
}
.scan-confirm[hidden] {
  display: none !important;
}
.scan-confirm-badge {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #8fe0b8;
}
.scan-confirm.is-error .scan-confirm-badge {
  color: #ffb0b0;
}
.scan-confirm-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.15;
}
.scan-confirm-meta {
  font-size: 1.05rem;
  opacity: 0.9;
}
.scan-confirm-timer {
  margin-top: 0.25rem;
  font-size: 0.95rem;
  color: rgba(232, 255, 242, 0.75);
}
.scan-confirm.is-error .scan-confirm-timer {
  color: rgba(255, 232, 232, 0.75);
}

.tire-panel,
.idle-panel {
  margin-top: 1rem;
  padding: 1.1rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.tire-panel.status-in { border-color: rgba(47, 158, 107, 0.45); }
.tire-panel.status-out { border-color: rgba(217, 119, 47, 0.45); }
.tire-panel.status-damage { border-color: rgba(214, 69, 69, 0.55); }

.status-damage { background: rgba(214, 69, 69, 0.22); color: #ffb0b0; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.info-grid .full-row { grid-column: 1 / -1; }
.info-grid .full-row .scan-input { font-size: 1.4rem; }
.info-grid .note-label { margin-top: 0; }


.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.85rem 0 0.4rem;
  color: var(--text);
  font-weight: 600;
}
.check-row input {
  width: 1.15rem;
  height: 1.15rem;
}

select.note-input {
  appearance: none;
  -webkit-appearance: none;
  background-color: #12161a;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 10px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

@media (max-width: 640px) {
  .info-grid { grid-template-columns: 1fr; }
}

.tire-id {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  word-break: break-all;
}
.tire-label { color: var(--muted); margin-top: 0.25rem; }

.qty-big {
  margin-top: 0.85rem;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.qty-big span {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.qty-row { margin-top: 0.75rem; max-width: 140px; }
.qty-input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 0.9rem;
  line-height: 1.35;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #12161a;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
}

.qty-cell {
  font-size: 1.35rem;
  font-weight: 800;
}

.muted-sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.stock-summary {
  color: var(--muted);
  margin: 0.35rem 0 0;
}
.page-head + .stock-summary,
.page-head .stock-summary {
  margin-bottom: 0;
}
.size-groups {
  margin-top: 1rem;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}

.lookup-btn {
  margin-top: 0.75rem;
  min-width: 120px;
}

.dot-code {
  color: var(--muted);
  font-weight: 500;
}

.lot-list {
  margin-top: 1rem;
}
.lot-list h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}

.status-pill {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-in { background: rgba(47, 158, 107, 0.2); color: #8fe0b8; }
.status-out { background: rgba(217, 119, 47, 0.22); color: #ffc08a; }

.note-label {
  display: block;
  margin: 1rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.note-input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.7rem 0.9rem;
  line-height: 1.35;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #12161a;
  color: var(--text);
  font-size: 1rem;
}
select.note-input {
  padding-right: 2.5rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
}
.btn-out { background: var(--out); color: #1a1208; }
.btn-in { background: var(--in); color: #06150e; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }

.counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  text-align: center;
  color: var(--muted);
}
.counts span {
  display: block;
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 700;
}

.recent { margin-top: 1.5rem; }
.recent h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 600;
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-2);
}
.event-list li {
  display: grid;
  grid-template-columns: minmax(7.5rem, auto) minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.event-list li:last-child { border-bottom: none; }
.event-list li.event-reverted {
  opacity: 0.55;
}
.event-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  min-width: 0;
  box-sizing: border-box;
}
.event-action.check_out { background: rgba(217, 119, 47, 0.22); color: #ffc08a; }
.event-action.check_in { background: rgba(47, 158, 107, 0.2); color: #8fe0b8; }
.event-action.activity-people,
.event-action.activity-settings,
.event-action.activity-demand,
.event-action.activity-stock,
.event-action.activity-export,
.event-action.activity-other {
  background: rgba(61, 156, 240, 0.18);
  color: #9ec9f5;
  letter-spacing: 0.02em;
}
.event-code {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.event-time {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.event-undone { color: var(--muted); font-weight: 600; }
.event-revert-form { margin: 0; }
.event-revert-form .btn { width: auto; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.page-head h1 { margin: 0.25rem 0 0; font-size: 1.6rem; }
.back { color: var(--muted); font-size: 0.9rem; }

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  text-decoration: none;
  background: var(--bg-2);
}
.chip.active,
.chip:hover {
  color: var(--text);
  border-color: var(--accent);
  text-decoration: none;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.table th,
.table td {
  text-align: left;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.table th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }

.label-form {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.label-form label {
  display: block;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.label-row { display: flex; gap: 0.75rem; }
.label-row input {
  flex: 1;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #12161a;
  color: var(--text);
  font-size: 1rem;
}

.empty-state { color: var(--muted); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.editing-lot {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.lot-pick {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #12161a;
}
.lot-pick li {
  border-bottom: 1px solid var(--line);
}
.lot-pick li:last-child { border-bottom: none; }
.lot-pick a {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  color: var(--text);
  text-decoration: none;
}
.lot-pick li.active a {
  background: rgba(61, 156, 240, 0.15);
}
.lot-pick li.damaged a {
  border-left: 3px solid var(--error);
}
.lot-main { font-size: 0.95rem; }
.lot-qty {
  font-weight: 800;
  font-size: 1.15rem;
}

.size-groups {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.size-group {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.size-group > summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1.1rem;
  cursor: pointer;
  list-style: none;
}
.size-group > summary::-webkit-details-marker { display: none; }
.size-caret::before {
  content: "▸";
  color: var(--muted);
  display: inline-block;
  width: 1rem;
}
.size-group[open] .size-caret::before { content: "▾"; }
.size-name { font-size: 1.2rem; font-weight: 700; }
.size-meta { color: var(--muted); font-size: 0.9rem; }
.size-qty {
  font-size: 1.5rem;
  font-weight: 800;
  min-width: 2.5rem;
  text-align: right;
}
.size-lots { padding: 0 0.85rem 0.85rem; }
.table.nested { margin-top: 0; }
.lot-edit-card {
  background: #12161a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 0.75rem;
}
.lot-edit-card.damaged {
  border-left: 3px solid var(--error);
}
.lot-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem 0.85rem;
}
.lot-edit-grid .note-label {
  margin-top: 0.15rem;
}
.lot-edit-damage {
  grid-column: 1 / 3;
}
.lot-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.lot-edit-actions .btn {
  min-width: auto;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
}
.inventory-qty {
  padding: 0.75rem 0.9rem;
  font-size: 1.35rem;
}
.field-hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
input:disabled,
select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-head-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.page-head-actions .btn {
  min-width: auto;
}
.lot-edit-grid .qty-edit {
  max-width: 7rem;
  text-align: center;
  font-weight: 700;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.inventory-view-table th,
.inventory-view-table td {
  white-space: nowrap;
}
.inventory-view-table td:nth-child(5) {
  white-space: normal;
  min-width: 8rem;
  max-width: 16rem;
}
.row-damaged td:first-child {
  box-shadow: inset 3px 0 0 var(--error);
}
.row-actions {
  white-space: nowrap;
  text-align: right;
}
.compact-btn {
  min-width: auto !important;
  padding: 0.45rem 0.75rem !important;
  font-size: 0.85rem !important;
  display: inline-flex;
}
.search-form {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.size-search-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.size-search-grid .note-label {
  margin-top: 0;
}
.size-part {
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}
.search-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}
.search-options .btn {
  min-width: 140px;
}
.search-age {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 9rem;
}
.search-age .note-input {
  min-width: 9rem;
}
.search-fields-grid {
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  margin-top: 0.35rem;
}
@media (max-width: 520px) {
  .size-search-grid {
    grid-template-columns: 1fr;
  }
}
.qty-reduce-form {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.qty-reduce-form .qty-edit {
  max-width: 4.5rem;
  text-align: center;
  font-weight: 700;
  min-width: 3.5rem;
}
.compact-btn {
  min-width: auto !important;
  padding: 0.45rem 0.75rem !important;
  font-size: 0.85rem !important;
  display: inline-flex;
}
.size-actions {
  margin: 0.75rem 0.25rem 0.25rem;
  font-size: 0.95rem;
}
.size-actions a {
  font-weight: 700;
}

@media (max-width: 800px) {
  .lot-edit-grid {
    grid-template-columns: 1fr 1fr;
  }
  .lot-edit-damage {
    grid-column: 1 / -1;
  }
}
@media (max-width: 520px) {
  .lot-edit-grid {
    grid-template-columns: 1fr;
  }
}


.code-sample {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.9rem;
  background: #12161a;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #c8e0ff;
  overflow-x: auto;
  font-size: 0.95rem;
}
.help-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.55;
}
.help-list code {
  color: var(--text);
  background: #12161a;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.barcode-help h2 { margin-top: 0; }

.settings-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}
.settings-card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
}
.settings-add {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.settings-add .btn { min-width: auto; padding: 0.75rem 1rem; }
.settings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.settings-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.settings-list li:last-child { border-bottom: none; }
.link-btn {
  appearance: none;
  border: none;
  background: none;
  color: #ffb0b0;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.settings-grid-two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.scan-input-select {
  font-size: 1.4rem;
  font-weight: 700;
  min-height: 3.25rem;
}
.link-btn:hover { text-decoration: underline; }

/* Auth / login */
.login-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.login-flash {
  margin-top: 1rem;
}
.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}
.login-card {
  width: min(440px, 100%);
  padding: 2rem 1.75rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
.login-brand {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.login-title {
  margin: 0 0 0.65rem;
  font-size: 1.2rem;
  font-weight: 650;
  color: var(--text);
}
.login-hint {
  margin: 0 0 1.35rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.98rem;
}
.login-hint strong { color: var(--text); }
.login-setup-error {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: rgba(214, 69, 69, 0.15);
  color: #ffb0b0;
  line-height: 1.45;
}
.login-setup-error code {
  font-size: 0.9em;
  color: #ffd0d0;
}
.btn-google {
  width: 100%;
  gap: 0.65rem;
  background: #fff;
  color: #1f1f1f;
  min-width: 0;
}
.btn-google:hover { filter: brightness(0.96); }
.google-icon { flex-shrink: 0; }
.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.login-actions .btn { flex: 1; min-width: 120px; }

.user-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
#pwa-install:not([hidden]) {
  display: inline-flex;
}
.user-email {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-signout {
  min-width: 0;
  padding: 0.55rem 0.9rem;
  font-size: 0.95rem;
}

/* People admin */
.people-head h1,
.people-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}
.people-page .hint {
  margin: 0 0 0.5rem;
  max-width: 40rem;
}
.people-add {
  margin: 1rem 0 0.25rem;
  max-width: 36rem;
}
.people-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.people-add-row .note-input {
  flex: 1 1 14rem;
  min-width: 12rem;
}
.people-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}
.people-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.people-row.status-pending {
  border-color: rgba(217, 119, 47, 0.45);
}
.people-email {
  font-weight: 700;
  font-size: 1.05rem;
}
.people-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
  align-items: center;
}
.people-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.people-badge-pending {
  background: rgba(217, 119, 47, 0.22);
  color: #ffc08a;
}
.people-badge-approved {
  background: rgba(47, 158, 107, 0.2);
  color: #8fe0b8;
}
.people-badge-revoked {
  background: rgba(214, 69, 69, 0.22);
  color: #ffb0b0;
}
.people-badge-admin {
  background: rgba(61, 156, 240, 0.22);
  color: #9cccf7;
}
.people-badge-manage {
  background: rgba(47, 158, 107, 0.2);
  color: #8fe0b8;
}
.people-muted { color: var(--muted); font-size: 0.9rem; }
.people-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.btn-compact {
  min-width: 0;
  padding: 0.55rem 0.9rem;
  font-size: 0.95rem;
}

.export-panel {
  margin: 0 0 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 0.85rem;
}
.export-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
}
.export-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.export-card .muted-sub {
  margin: 0 0 0.85rem;
}
.export-form .export-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}
.export-form .export-fields > div {
  min-width: 9rem;
  flex: 1 1 9rem;
}
.export-submit {
  min-width: 0 !important;
  flex: 0 0 auto !important;
}
.history-section {
  margin: 0 0 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.history-section .people-head {
  margin-bottom: 0.75rem;
}
.event-actor {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}
.demand-embed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.demand-embed-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}
.demand-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.demand-filters-secondary {
  margin-top: -0.35rem;
}
.demand-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}
.demand-chip:hover,
.demand-chip.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(61, 156, 240, 0.15);
  text-decoration: none;
}
.demand-stats {
  display: grid;
  grid-template-columns: minmax(120px, 200px);
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
.demand-stats div {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  font-weight: 600;
}
.demand-stats span {
  display: block;
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.15rem;
}
.diff-neg { color: #ff9b9b; font-weight: 800; }
.diff-pos { color: #8fe0b8; font-weight: 800; }

.scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}
.scan-actions .btn {
  min-width: 10rem;
}
.scanner-wrap {
  margin: 0 0 1.25rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}
.scanner-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}
#torch-toggle.torch-on {
  border-color: rgba(255, 210, 80, 0.7);
  color: #ffe08a;
}
#qr-reader {
  width: min(100%, 480px);
  margin: 0 auto;
}
#qr-reader video {
  border-radius: 10px;
}

/* Public customer stock check */
.customer-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.customer-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1.25rem 3rem;
}
.customer-card {
  width: min(520px, 100%);
  padding: 2rem 1.75rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
.customer-brand {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.customer-title {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
  font-weight: 650;
}
.customer-hint {
  margin: 0 0 1.35rem;
  color: var(--muted);
  line-height: 1.45;
}
.customer-form .customer-submit {
  width: 100%;
  margin-top: 1.15rem;
}
.customer-result {
  margin-top: 1.35rem;
  padding: 1rem 1.05rem;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.customer-result.is-yes {
  border-color: rgba(47, 158, 107, 0.55);
  background: rgba(47, 158, 107, 0.12);
}
.customer-result.is-no {
  border-color: rgba(217, 119, 47, 0.5);
  background: rgba(217, 119, 47, 0.1);
}
.customer-result-title {
  margin: 0 0 0.55rem;
  font-size: 1.15rem;
  font-weight: 800;
}
.customer-result-note {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}
.customer-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.customer-result-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.customer-size { font-weight: 800; font-size: 1.1rem; }
.customer-qty { color: var(--text); font-weight: 650; }
.customer-brands { color: var(--muted); font-size: 0.95rem; }

@media (max-width: 640px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-add { flex-direction: column; }
}

@media (max-width: 640px) {
  .scan-input { font-size: 1.35rem; }
  .counts { grid-template-columns: 1fr; }
  .event-list li { grid-template-columns: minmax(6.5rem, auto) minmax(0, 1fr); }
  .event-time { grid-column: 2; }
  .event-revert-form { grid-column: 1 / -1; }
  .btn { width: 100%; }
  .label-row { flex-direction: column; }
  .size-group > summary {
    grid-template-columns: auto 1fr auto;
  }
  .size-meta { display: none; }
  .user-email { max-width: 140px; }
  .people-actions { width: 100%; }
  .people-actions .btn { flex: 1; }
}
