/* Offline till — self-contained (works without the portal's Tailwind build). Colours follow the portal's indigo/gray. */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --good: #047857;
  --good-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #be123c;
  --bad-soft: #fff1f2;
  --radius: 0.75rem;
  color-scheme: light;
}

.dark {
  --bg: #0b1120;
  --surface: #1f2937;
  --text: #f9fafb;
  --muted: #9ca3af;
  --border: #374151;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.15);
  --good: #34d399;
  --good-soft: rgba(16, 185, 129, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --bad: #fb7185;
  --bad-soft: rgba(244, 63, 94, 0.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }

[hidden] { display: none !important; }

.till-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.till-header-text { min-width: 0; }
.till-eyebrow { margin: 0; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); }
.till-title { margin: 0.1rem 0 0; font-size: 1.05rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.till-event-picker { margin-top: 0.35rem; max-width: 100%; font: inherit; font-size: 0.85rem; padding: 0.3rem 0.5rem; border-radius: 0.5rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.till-header-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.till-pill { font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 9999px; }
.till-pill-offline { background: var(--warn-soft); color: var(--warn); }
.till-pill-online { background: var(--good-soft); color: var(--good); }

.till-count { display: inline-flex; min-width: 1.35rem; justify-content: center; margin-left: 0.35rem; padding: 0 0.35rem; border-radius: 9999px; background: var(--primary); color: #fff; font-size: 0.75rem; }
.till-count.is-attention { background: var(--bad); }

.till-notices { display: grid; gap: 0.5rem; padding: 0.75rem 1rem 0; }
.till-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.65rem 0.85rem; border-radius: var(--radius); font-size: 0.85rem; line-height: 1.4; }
.till-notice p { margin: 0; flex: 1 1 14rem; }
.till-notice-offline, .till-notice-warning { background: var(--warn-soft); color: var(--warn); }
.till-notice-online { background: var(--good-soft); color: var(--good); }
.till-notice-info { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.till-empty { margin: 2rem auto; max-width: 26rem; padding: 1.5rem; text-align: center; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
.till-empty h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.till-empty p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

.till-main { padding: 0.75rem 1rem 1rem; }
.till-toolbar { display: grid; gap: 0.6rem; margin-bottom: 0.75rem; }
.till-input { width: 100%; font: inherit; font-size: 1rem; padding: 0.7rem 0.85rem; border-radius: 0.6rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.till-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.till-input-money { font-size: 1.35rem; font-weight: 700; text-align: right; }

.till-categories, .till-quick { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.15rem; scrollbar-width: none; }
.till-chip { flex-shrink: 0; font: inherit; font-size: 0.85rem; font-weight: 600; padding: 0.45rem 0.8rem; border-radius: 9999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.till-chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

.till-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.6rem; }
.till-item { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; min-height: 6.5rem; padding: 0.75rem; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; touch-action: manipulation; }
.till-item:active { transform: scale(0.98); }
.till-item:disabled { opacity: 0.5; cursor: not-allowed; }
.till-item.is-out { border-style: dashed; }
.till-item-name { font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.till-item-category { font-size: 0.75rem; color: var(--muted); }
.till-item-foot { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 0.25rem; margin-top: auto; font-size: 0.9rem; }
.till-item-stock { font-size: 0.7rem; color: var(--muted); }
.till-item.is-out .till-item-stock { color: var(--bad); }
.till-item-product { border-color: var(--primary); }
.till-variant-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.75rem; }
.till-variant { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; min-height: 4.5rem; padding: 0.6rem 0.4rem; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; touch-action: manipulation; }
.till-variant:active { transform: scale(0.97); }
.till-variant.is-out { border-style: dashed; opacity: 0.6; }
.till-variant.is-out .till-variant-label { text-decoration: line-through; }
.till-variant.is-out .till-item-stock { color: var(--bad); }
.till-variant-label { font-size: 1.15rem; font-weight: 800; line-height: 1.1; }
.till-variant-price { font-size: 0.75rem; font-weight: 600; }
.till-item-badge { position: absolute; top: -0.4rem; right: -0.4rem; min-width: 1.6rem; height: 1.6rem; display: inline-flex; align-items: center; justify-content: center; padding: 0 0.35rem; border-radius: 9999px; background: var(--primary); color: #fff; font-size: 0.8rem; font-weight: 700; }

.till-cart-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 0.6rem; padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08); }
.till-cart-summary { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font: inherit; padding: 0.7rem 0.9rem; border-radius: 0.6rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; }
.till-cart-total { font-weight: 800; font-size: 1.1rem; }

.till-button { display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; font: inherit; font-size: 0.9rem; font-weight: 700; padding: 0.7rem 1rem; border-radius: 0.6rem; border: 1px solid transparent; cursor: pointer; text-decoration: none; touch-action: manipulation; }
.till-button:disabled { opacity: 0.5; cursor: not-allowed; }
.till-button-primary { background: var(--primary); color: #fff; }
.till-button-primary:not(:disabled):hover { background: var(--primary-hover); }
.till-button-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.till-button-block { width: 100%; margin-top: 1rem; padding: 0.9rem; font-size: 1rem; }
.till-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; font: inherit; font-size: 1.1rem; border-radius: 9999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }

.till-sheet { width: min(32rem, 100%); max-height: 88vh; margin: auto auto 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); border: none; border-radius: 1rem 1rem 0 0; background: var(--surface); color: var(--text); overflow-y: auto; }
.till-sheet::backdrop { background: rgba(17, 24, 39, 0.45); }
.till-sheet-center { margin: auto; border-radius: 1rem; text-align: center; padding-bottom: 1rem; }
@media (min-width: 640px) { .till-sheet { margin: auto; border-radius: 1rem; } }
.till-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.till-sheet h2 { margin: 0; font-size: 1.1rem; }
.till-sheet-total { display: flex; justify-content: space-between; align-items: baseline; padding: 0.75rem 0; border-top: 1px solid var(--border); font-size: 1.05rem; }
.till-sheet-total strong { font-size: 1.35rem; }
.till-sheet-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.till-sheet-actions .till-button-primary { flex: 1; }
.till-sheet-actions-wrap { flex-wrap: wrap; margin-top: 0.75rem; }

.till-lines { list-style: none; margin: 0; padding: 0; }
.till-line { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.till-line-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.till-line-name { font-weight: 600; }
.till-muted { color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.till-stepper { display: flex; align-items: center; gap: 0.5rem; }
.till-stepper-value { min-width: 1.5rem; text-align: center; font-weight: 700; }
.till-promotions { padding: 0.4rem 0; }
.till-promotion { margin: 0.25rem 0; font-size: 0.82rem; color: var(--good); }

.till-due { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 0.75rem; font-size: 1rem; }
.till-due strong { font-size: 1.5rem; }
.till-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
@media (min-width: 30rem) { .till-methods { grid-template-columns: repeat(4, 1fr); } }
.till-method { font: inherit; font-weight: 700; padding: 0.9rem 0.5rem; border-radius: 0.6rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; }
.till-method.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.till-cash { display: grid; gap: 0.5rem; margin-top: 1rem; }
.till-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.till-change { display: flex; justify-content: space-between; margin: 0.25rem 0 0; font-size: 1rem; }
.till-change strong { font-size: 1.25rem; color: var(--good); }

.till-done-icon { width: 3.5rem; height: 3.5rem; margin: 0.5rem auto 0.75rem; display: flex; align-items: center; justify-content: center; border-radius: 9999px; background: var(--good-soft); color: var(--good); font-size: 1.75rem; font-weight: 800; }
.till-done-change { font-size: 1.25rem; font-weight: 800; color: var(--good); }

.till-status { flex-shrink: 0; font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 9999px; }
.till-status-pending { background: var(--warn-soft); color: var(--warn); }
.till-status-needs-attention { background: var(--bad-soft); color: var(--bad); }
.till-status-synced { background: var(--good-soft); color: var(--good); }
