/* URBAN Door Counter — Urban Gate design system (mobile + desktop) */

:root {
  --brand: #ef4536;
  --brand-hover: #d63c2e;
  --brand-soft: rgba(239, 69, 54, 0.12);
  --brand-glow: rgba(239, 69, 54, 0.22);

  --bg: #0f1011;
  --bg-elevated: #18191a;
  --surface: #242526;
  --surface-2: #2d2e2f;
  --surface-3: #3a3b3c;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #f0f2f5;
  --text-secondary: #b0b3b8;
  --text-muted: #8a8d91;

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.14);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --topbar-h: 56px;
  --app-max-w: 480px;
  --door-pad: var(--space-4);
  --door-pad-lg: clamp(20px, 2.5vw, 40px);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 180ms var(--ease);

  --z-toast: 1200;
  --z-modal: 1300;
  --z-topbar: 90;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
}

/* Kiosk UI: labels/stats are not editable text — no I-beam cursor */
body.door-app,
body.login-page {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  cursor: default;
  -webkit-touch-callout: none;
}

body.door-app input,
body.door-app select,
body.door-app textarea,
body.login-page input,
body.login-page textarea {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

body.door-app select,
body.door-app .event-select {
  cursor: pointer;
}

body.door-app button,
body.door-app .sale-btn,
body.door-app .qty-btn,
body.door-app .icon-btn,
body.door-app .undo-btn,
body.login-page button,
body.login-page label {
  cursor: pointer;
  touch-action: manipulation;
}

body.door-app button:disabled,
body.door-app .sale-btn:disabled,
body.door-app .undo-btn:disabled {
  cursor: not-allowed;
}

.app-shell :is(
  .door-hero,
  .door-hero__label,
  .door-hero__value,
  .panel-title,
  .field-label,
  .actions-label,
  .brand-name,
  .brand-sub,
  .gate-badge,
  .price-badge,
  .qty-readout,
  .qty-value,
  .stat-card,
  .stat-card__label,
  .stat-card__value,
  .recent-list,
  .recent-item,
  .recent-empty,
  .toast
) {
  -webkit-user-modify: read-only;
}

button, input, select {
  font: inherit;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  -webkit-user-drag: none;
  user-drag: none;
}

.app-shell svg {
  flex-shrink: 0;
  pointer-events: none;
}

.app-shell [class*="__icon"]:not(.select-wrap__chev):not(.stats-toggle-btn__icon) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Loading ── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, var(--brand-glow), transparent),
    var(--bg);
}

.loading-screen[hidden],
.loading-screen.is-hidden {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

.loading-screen .brand-mark {
  width: 56px;
  height: 56px;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-screen p {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.loading-screen--error .loading-spinner { display: none; }

.loading-screen--error p {
  color: var(--danger);
  max-width: 300px;
  text-align: center;
  line-height: 1.5;
  padding: 0 var(--space-4);
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseValue {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ── App shell ── */
.app-shell {
  min-height: 100dvh;
  max-width: var(--app-max-w);
  margin: 0 auto;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  animation: fadeUp 320ms var(--ease);
}

.app-shell.is-ready .door-hero,
.app-shell.is-ready .door-layout > * {
  animation: fadeUp 400ms var(--ease) backwards;
}

.app-shell.is-ready .door-col--side {
  animation-delay: 80ms;
}

/* ── Top bar ── */
.top-bar {
  position: relative;
  z-index: var(--z-topbar);
  height: var(--topbar-h);
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.top-bar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text-wrap { min-width: 0; }

.brand-name {
  display: block;
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
  line-height: 1.2;
}

.brand-sub {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.gate-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stats-toggle-btn {
  position: relative;
}

.stats-toggle-btn .stats-toggle-btn__icon {
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
  display: block;
  flex-shrink: 0;
}

.stats-toggle-btn[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: rgba(239, 69, 54, 0.35);
  color: #ff9a8f;
}

.stats-toggle-btn .stats-toggle-btn__icon--hide {
  display: none;
}

.stats-toggle-btn[aria-pressed="true"] .stats-toggle-btn__icon--show {
  display: none;
}

.stats-toggle-btn[aria-pressed="true"] .stats-toggle-btn__icon--hide {
  display: block;
}

/* Mask sensitive stats (privacy toggle): hero totals, all stat cards, recent amounts */
.app-shell.is-stats-masked .door-sensitive {
  color: transparent !important;
  position: relative;
  user-select: none;
  pointer-events: none;
}

.app-shell.is-stats-masked .door-sensitive::after {
  content: '···';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.door-hero__value.door-sensitive::after,
.stat-card__value.door-sensitive::after {
  left: 50%;
  transform: translate(-50%, -50%);
}

.recent-item__amount.door-sensitive::after {
  right: 0;
  left: auto;
}

.gate-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  border: 1px solid rgba(239, 69, 54, 0.28);
  color: #ff8a7a;
  white-space: nowrap;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
  display: block;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

.icon-btn:active { transform: scale(0.96); }

.icon-btn:focus-visible,
.qty-btn:focus-visible,
.sale-btn:focus-visible,
.undo-btn:focus-visible,
.event-select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── Hero summary strip ── */
.door-hero {
  display: flex;
  align-items: stretch;
  gap: var(--space-4);
  margin: var(--space-4);
  padding: var(--space-5) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid rgba(239, 69, 54, 0.18);
}

.door-hero__metric {
  flex: 1;
  min-width: 0;
}

.door-hero__metric--primary { flex: 1.4; }

.door-hero__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.door-hero__value {
  display: block;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  transition: transform 200ms var(--ease);
}

.door-hero__value.is-pulse { animation: pulseValue 320ms var(--ease); }

.door-hero__value--people { color: var(--success); }

.door-hero__value--voided { color: var(--text-muted); }

.door-hero__divider {
  width: 1px;
  background: var(--border-strong);
  align-self: stretch;
}

/* ── Layout ── */
.door-layout {
  padding: 0 var(--space-4) calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.door-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* ── Panels ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

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

.panel__head .field-label {
  margin-bottom: 0;
}

@media (min-width: 900px) {
  .app-shell--cashier .door-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.5fr);
  }

  .app-shell--cashier .panel--recent {
    min-height: 280px;
  }
}

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

.panel-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.field-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.price-badge {
  font-size: var(--text-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  border: 1px solid rgba(239, 69, 54, 0.25);
  color: #ff9a8f;
}

.select-wrap {
  position: relative;
}

.select-wrap__chev {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.event-select {
  width: 100%;
  min-height: 52px;
  padding: 0 40px 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.event-select:hover { border-color: var(--border-strong); }

.event-select:focus {
  outline: none;
  border-color: rgba(239, 69, 54, 0.55);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* ── Quantity ── */
.qty-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.qty-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 80ms ease;
}

.qty-btn svg {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  display: block;
}

.qty-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.qty-btn:active { transform: scale(0.94); }

.qty-btn--plus {
  background: var(--brand-soft);
  border-color: rgba(239, 69, 54, 0.3);
  color: #ff8a7a;
}

.qty-btn--plus:hover {
  background: rgba(239, 69, 54, 0.2);
}

.qty-readout {
  text-align: center;
  min-width: 88px;
}

.qty-value {
  display: block;
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.qty-readout__sub {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Sale actions ── */
.panel--actions {
  padding: var(--space-4);
}

.actions-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  text-align: center;
}

.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.sale-btn {
  min-height: 132px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: 700;
  transition: transform 80ms ease, background var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.sale-btn:active { transform: scale(0.97); }

.sale-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.sale-btn__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sale-btn__icon svg {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  display: block;
}

.sale-btn__label {
  font-size: var(--text-lg);
  letter-spacing: 0.02em;
}

.sale-btn__amount {
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.sale-btn--cash {
  background: rgba(251, 191, 36, 0.12);
  color: #fef3c7;
  border-color: rgba(251, 191, 36, 0.28);
}

.sale-btn--card {
  background: rgba(96, 165, 250, 0.12);
  color: #dbeafe;
  border-color: rgba(96, 165, 250, 0.28);
}

.sale-btn--flash {
  animation: pulseValue 400ms var(--ease);
}

/* ── Stats grid (Urban KPI layout) ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--border);
  min-width: 0;
  min-height: 76px;
  height: 100%;
}

.stat-card--accent {
  border-color: rgba(239, 69, 54, 0.22);
  background: rgba(239, 69, 54, 0.06);
}

.stat-card__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
}

.stat-card__icon svg {
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
  display: block;
}

.stat-card__icon--people {
  background: var(--success-soft);
  color: var(--success);
}

.stat-card__icon--cash {
  background: var(--warning-soft);
  color: var(--warning);
}

.stat-card__icon--card {
  background: var(--info-soft);
  color: var(--info);
}

.stat-card__icon--total {
  background: var(--brand-soft);
  color: var(--brand);
}

.stat-card__body {
  min-width: 0;
  flex: 1;
}

.stat-card__label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.2;
}

.stat-card__value {
  display: block;
  font-size: var(--text-base);
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card__value--cash { color: var(--warning); }
.stat-card__value--card { color: var(--info); }
.stat-card__value--total {
  color: #ff9a8f;
  font-size: var(--text-base);
}

.stat-card__meta {
  display: block;
  margin-top: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card__value--cash + .stat-card__meta { color: rgba(251, 191, 36, 0.75); }
.stat-card__value--card + .stat-card__meta { color: rgba(96, 165, 250, 0.75); }

/* ── Recent list ── */
.undo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition), transform 80ms ease;
}

.undo-btn svg {
  width: 14px;
  height: 14px;
  max-width: 14px;
  max-height: 14px;
  display: block;
}

.undo-btn:hover { background: rgba(248, 113, 113, 0.22); }
.undo-btn:active { transform: scale(0.96); }
.undo-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.recent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
}

.recent-item__left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.recent-item__method {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.recent-item__method--cash {
  background: var(--warning-soft);
  color: var(--warning);
}

.recent-item__method--card {
  background: var(--info-soft);
  color: var(--info);
}

.recent-item__meta {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item__amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  flex-shrink: 0;
}

.recent-item--voided {
  opacity: 0.85;
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(248, 113, 113, 0.06);
}

.recent-item--voiding {
  animation: recentVoidPulse 420ms var(--ease);
}

@keyframes recentVoidPulse {
  0% {
    background: rgba(248, 113, 113, 0.28);
    transform: scale(1.01);
  }
  100% {
    background: rgba(248, 113, 113, 0.06);
    transform: scale(1);
  }
}

.recent-item--voided .recent-item__method {
  opacity: 0.7;
}

.recent-item--voided .recent-item__meta {
  text-decoration: line-through;
  text-decoration-color: rgba(248, 113, 113, 0.45);
}

.recent-item__voided {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--danger);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.recent-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--space-6) var(--space-3);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(0);
  max-width: min(92vw, 380px);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  z-index: var(--z-toast);
  animation: fadeUp 220ms var(--ease);
}

.toast--ok { border-color: rgba(52, 211, 153, 0.4); }
.toast--err { border-color: rgba(248, 113, 113, 0.4); }

/* ── Confirm modal ── */
.door-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.door-modal[hidden] {
  display: none !important;
}

.door-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.door-modal__panel {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--danger);
  animation: fadeUp 240ms var(--ease);
}

.door-modal__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-full);
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
}

.door-modal__icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.door-modal__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.door-modal__text {
  margin: 0 0 var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-secondary);
  text-align: center;
  white-space: pre-line;
}

body.door-modal-open {
  overflow: hidden;
}

.door-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.door-modal__btn {
  min-height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 80ms ease, border-color var(--transition);
}

.door-modal__btn:active {
  transform: scale(0.98);
}

.door-modal__btn--ghost {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-secondary);
}

.door-modal__btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.door-modal__btn--danger {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
}

.door-modal__btn--danger:hover {
  background: rgba(248, 113, 113, 0.24);
  border-color: rgba(248, 113, 113, 0.55);
}

/* ── Login ── */
body.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, var(--brand-glow), transparent),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: var(--space-8) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  border-top: 3px solid var(--brand);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-header .brand-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-5);
}

.login-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.login-alert {
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
  font-size: var(--text-sm);
  line-height: 1.45;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.login-form .form-group { margin: 0; }

.login-form .form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input-field {
  position: relative;
  display: flex;
  align-items: center;
}

.input-field__icon {
  position: absolute;
  left: var(--space-4);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.input-field__icon svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  display: block;
  flex-shrink: 0;
}

.login-form .input-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--space-4) 0 calc(var(--space-4) + 26px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-form .input-field input::placeholder { color: var(--text-muted); }

.login-form .input-field input:hover { border-color: var(--border-strong); }

.login-form .input-field input:focus {
  outline: none;
  border-color: rgba(239, 69, 54, 0.55);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition), transform 80ms ease, box-shadow var(--transition);
}

.btn:active { transform: scale(0.98); }

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

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-full {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--space-4);
  font-size: var(--text-base);
}

/* ── Tablet ── */
@media (min-width: 520px) {
  .actions-grid { gap: var(--space-4); }
  .sale-btn { min-height: 148px; }
  .gate-badge {
    font-size: 0.6875rem;
    padding: 5px 10px;
  }
}

/* ── Desktop: full-width workspace ── */
@media (min-width: 900px) {
  body.door-app {
    background: var(--bg-elevated);
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    max-width: none;
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    border: none;
    border-radius: 0;
  }

  .top-bar {
    position: sticky;
    top: 0;
    flex-shrink: 0;
    height: 64px;
    padding: 0 var(--door-pad-lg);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
  }

  .door-hero {
    flex-shrink: 0;
    margin: 0;
    padding: var(--space-5) var(--door-pad-lg);
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }

  .door-hero__metric--primary {
    flex: 1;
  }

  .door-hero__value {
    font-size: clamp(2rem, 3vw, 2.75rem);
  }

  .door-layout {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: var(--space-5);
    padding: var(--space-5) var(--door-pad-lg) var(--space-6);
    align-items: stretch;
    min-height: 0;
  }

  .door-col--primary {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-height: 0;
  }

  .door-col--side {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-height: 0;
  }

  .panel {
    padding: var(--space-5);
    transition: border-color var(--transition);
  }

  .panel:hover {
    border-color: var(--border-strong);
  }

  .panel--qty {
    flex-shrink: 0;
  }

  .panel--actions {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: var(--space-5);
  }

  .actions-label {
    text-align: left;
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
  }

  .actions-grid {
    flex: 1;
    gap: var(--space-4);
    align-items: stretch;
    min-height: clamp(180px, 28vh, 320px);
  }

  .sale-btn {
    min-height: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    gap: var(--space-3);
  }

  .sale-btn__icon {
    width: 44px;
    height: 44px;
  }

  .sale-btn__icon svg {
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
  }

  .sale-btn__label {
    font-size: clamp(1.125rem, 1.5vw, 1.375rem);
  }

  .sale-btn__amount {
    font-size: var(--text-base);
  }

  .sale-btn--cash:hover {
    background: rgba(251, 191, 36, 0.18);
    border-color: rgba(251, 191, 36, 0.42);
  }

  .sale-btn--card:hover {
    background: rgba(96, 165, 250, 0.18);
    border-color: rgba(96, 165, 250, 0.42);
  }

  .qty-btn:hover {
    background: var(--surface-2);
  }

  .qty-btn--plus:hover {
    background: rgba(239, 69, 54, 0.2);
  }

  .event-select {
    min-height: 56px;
    font-size: var(--text-base);
  }

  .qty-control {
    margin-top: var(--space-4);
    gap: var(--space-5);
  }

  .qty-btn {
    width: 64px;
    height: 64px;
  }

  .qty-value {
    font-size: clamp(2rem, 3vw, 2.5rem);
  }

  .panel--stats {
    flex-shrink: 0;
  }

  .panel--recent {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .panel--recent .panel-head {
    flex-shrink: 0;
  }

  .stats-grid {
    gap: var(--space-3);
  }

  .stat-card {
    min-height: 84px;
    padding: var(--space-3) var(--space-4);
  }

  .stat-card__value {
    font-size: var(--text-lg);
  }

  .stat-card__value--total {
    font-size: var(--text-lg);
  }

  .recent-list {
    flex: 1;
    max-height: none;
    min-height: 160px;
    overflow-y: auto;
  }
}

@media (min-width: 1200px) {
  .door-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.55fr);
    gap: clamp(20px, 2vw, 32px);
    padding: clamp(20px, 2.5vw, 36px) var(--door-pad-lg) clamp(24px, 3vw, 40px);
  }

  .door-col--primary {
    gap: clamp(16px, 1.5vw, 24px);
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 92px;
  }

  .stat-card__icon {
    width: 44px;
    height: 44px;
  }

  .stat-card__icon svg {
    width: 22px;
    height: 22px;
    max-width: 22px;
    max-height: 22px;
  }
}

@media (min-width: 1600px) {
  .door-layout {
    grid-template-columns: minmax(0, 1.5fr) minmax(420px, 0.5fr);
  }

  .actions-grid {
    min-height: clamp(220px, 32vh, 360px);
  }

  .sale-btn__label {
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
