* { box-sizing: border-box; }

  html, body {
    width: 100%;
    min-height: 100%;
  }

  body {
    margin: 0;
    padding: 16px 10px 32px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    background-color: #fcecd7;
  }

  [hidden] { display: none !important; }

  .container {
    max-width: 560px;
    margin: 0 auto;
  }

  .brand-header {
    text-align: center;
    margin-bottom: 14px;
  }

  .header-subtext {
    display: block;
    color: #8b0000;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  h1 {
    margin: 4px 0;
    color: #8b0000;
    font-size: 1.45rem;
  }

  h2 {
    margin: 18px 0 8px;
    color: #8b0000;
    font-size: 1.05rem;
  }

  .signed-in {
    margin: 0;
    color: #666;
    font-size: 0.8rem;
    word-break: break-all;
  }

  .card {
    background: #fdfbf7;
    border: 1px solid #ebd2b9;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 2px 6px rgba(139, 0, 0, 0.08);
  }

  .slot-picker {
    margin-bottom: 12px;
  }

  .slot-picker label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #8b0000;
  }

  .slot-picker select {
    width: 100%;
    min-height: 46px;
    padding: 8px 10px;
    border: 2px solid #8b0000;
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
    font-weight: 600;
  }

  .camera-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    margin-bottom: 12px;
  }

  .camera-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .camera-target {
    position: absolute;
    inset: 15%;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
    pointer-events: none;
  }

  .camera-frame[data-scanning="true"] .camera-target::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #78ffb0 3px, rgba(120, 255, 176, 0.25) 4px, transparent 14px);
    will-change: transform;
    animation: qr-sweep 2s ease-in-out infinite alternate;
  }

  @keyframes qr-sweep {
    from { transform: translateY(0); }
    to { transform: translateY(calc(100% - 14px)); }
  }

  @media (prefers-reduced-motion: reduce) {
    .camera-frame[data-scanning="true"] .camera-target::after {
      animation: none;
      transform: translateY(50%);
      will-change: auto;
    }
  }

  .button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 140px;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #8b0000;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
  }

  .primary {
    background: #8b0000;
    color: #fff;
  }

  .secondary {
    background: #fff;
    color: #8b0000;
  }

  button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .wide {
    width: 100%;
    margin-top: 12px;
  }

  .manual-form {
    margin-top: 14px;
  }

  .manual-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #555;
  }

  .manual-row {
    display: flex;
    gap: 8px;
  }

  .manual-row input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 46px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    text-transform: uppercase;
  }

  .manual-row button {
    flex: 0 0 auto;
  }

  .status {
    margin: 12px 0 0;
    font-size: 0.9rem;
    color: #555;
    min-height: 1.2em;
  }

  .status.error { color: #b00020; }
  .status.success { color: #1b5e20; font-weight: 600; }

  .banner {
    padding: 14px;
    border-radius: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
  }

  .banner.success { background: #2e7d32; }
  .banner.error { background: #b00020; }
  .banner.warning { background: #e67700; }

  .result-message {
    margin: 12px 0 0;
    font-weight: 600;
    word-break: break-word;
  }

  .details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 12px;
    margin: 14px 0 0;
  }

  .payment-summary {
    margin-top: 14px;
    padding: 16px;
    border: 2px solid #8b0000;
    border-radius: 8px;
    background: #fff4e5;
    color: #8b0000;
    text-align: center;
  }

  .payment-summary h2 { margin: 0; }

  .payment-amount {
    margin: 6px 0;
    font-size: 2.25rem;
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .payment-note {
    margin: 0;
    color: #555;
    font-size: 0.85rem;
  }

  .details dt {
    color: #666;
    font-size: 0.85rem;
  }

  .details dd {
    margin: 0;
    font-weight: 600;
    word-break: break-word;
  }

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

  .slot-list li {
    border: 1px solid #ebd2b9;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: #fff;
  }

  .slot-list li.current {
    border-color: #8b0000;
    border-width: 2px;
  }

  .slot-title {
    font-weight: 600;
  }

  .slot-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #8b0000;
    color: #fff;
    font-size: 0.75rem;
  }

  .slot-checkin {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1b5e20;
  }

  .slot-services {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
  }

  .slot-detail {
    padding: 6px 8px;
    border: 1px solid #ebd2b9;
    border-radius: 6px;
    background: #fff4e5;
    font-size: 0.9rem;
    font-weight: 600;
    color: #8b0000;
    word-break: break-word;
  }

  .slot-no-services {
    color: #555;
    font-size: 0.85rem;
  }

  .notice {
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #ebd2b9;
    font-size: 0.9rem;
  }

  .notice.warning {
    background: #fff4e5;
    border-color: #f0a040;
    color: #6d3b00;
  }

  .count-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px;
  }

  .count-buttons button {
    min-height: 56px;
    font-size: 1.25rem;
    background: #fff;
    color: #8b0000;
  }

  .count-buttons button[aria-pressed="true"] {
    background: #8b0000;
    color: #fff;
  }

  details {
    margin-top: 14px;
  }

  pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    font-size: 0.8rem;
  }