:root {
  --navy: #0F1C2E;
  --navy-soft: #16253A;
  --charcoal: #1C2838;
  --ink: #152033;
  --muted: #6B7A90;
  --line: #E4E8EF;
  --surface: #F4F6F9;
  --card: #FFFFFF;
  --champagne: #C4A46A;
  --champagne-soft: #E8D7B0;
  --success: #1F7A4D;
  --success-bg: #E8F6EF;
  --danger: #9B2C2C;
  --danger-bg: #FDECEC;
  --warning: #8A6A1F;
  --warning-bg: #FFF6DE;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(15, 28, 46, 0.06);
  --shadow-sm: 0 4px 14px rgba(15, 28, 46, 0.05);
  --sidebar: 260px;
  --font-display: "Libre Baskerville", Baskerville, Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  color-scheme: light;
}

html.dark {
  --surface: #0B1220;
  --card: #121C2C;
  --ink: #E8EEF7;
  --muted: #9AABBF;
  --line: #243247;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(196, 164, 106, 0.12), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(15, 28, 46, 0.06), transparent 50%),
    var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.display, h1, .page-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 .35rem;
  line-height: 1.25;
}
h1 { font-size: clamp(1.7rem, 2.1vw, 2.05rem); }
h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 0 0 .5rem;
  line-height: 1.35;
}
h3 {
  margin: 0 0 .4rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}
.eyebrow {
  margin: 0 0 .4rem;
  font-family: var(--font-body);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--champagne);
}
.muted { color: var(--muted); letter-spacing: -0.005em; }
.metric-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: .15rem 0;
  line-height: 1.15;
}
.metric-label {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0;
}

.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--navy) 0%, var(--charcoal) 100%);
  color: #F3F6FA;
  padding: 1.4rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin-top: .15rem;
  line-height: 1.25;
}
.sidebar-nav .nav-link {
  font-weight: 500;
  letter-spacing: -0.01em;
}
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; overflow: auto; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: rgba(243, 246, 250, .78);
  padding: .7rem .8rem;
  border-radius: 10px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(196,164,106,.22), rgba(196,164,106,.08));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--champagne);
}
.nav-link i { width: 18px; height: 18px; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 1rem; display: grid; gap: .75rem; }
.user-chip strong { display: block; font-size: .95rem; }
.user-chip .muted { color: rgba(243,246,250,.55); font-size: .8rem; }

.app-main { min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
html.dark .topbar { background: rgba(18,28,44,.8); }
.content { padding: 1.4rem 1.5rem 2.5rem; max-width: 1400px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.panel, .stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.2rem;
}
.stat-card {
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(196,164,106,.18), transparent 70%);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.split-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.stack { display: grid; gap: 1rem; }

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: .65rem 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .15s ease, color .15s ease;
}
.btn i { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-soft); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; }
.sidebar .btn-ghost { color: rgba(243,246,250,.85); border: 1px solid rgba(255,255,255,.12); width: 100%; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-champagne {
  background: linear-gradient(135deg, #C4A46A, #A98545);
  color: #1a1408;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: 999px;
  padding: .28rem .7rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-live { background: var(--success-bg); color: var(--success); }
.badge-upcoming { background: #EEF3FA; color: #335278; }
.badge-completed { background: #EEEFF2; color: #555; }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-void { background: var(--danger-bg); color: var(--danger); }

.progress {
  height: 8px;
  background: #E8EDF4;
  border-radius: 999px;
  overflow: hidden;
  margin-top: .75rem;
}
html.dark .progress { background: #243247; }
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--champagne));
  border-radius: inherit;
  transition: width .4s ease;
}

.table-wrap { overflow: auto; border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th {
  text-align: left;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(15,28,46,.03);
  padding: .85rem .9rem;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: .9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(196,164,106,.05); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: .4rem; }
.field label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea,
input[type="text"], input[type="password"], input[type="email"], input[type="date"],
input[type="datetime-local"], input[type="number"], input[type="search"], input[type="color"],
select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: .7rem .8rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus,
input:focus, select:focus, textarea:focus {
  border-color: rgba(196,164,106,.8);
  box-shadow: 0 0 0 3px rgba(196,164,106,.18);
}
.checkbox-row { display: flex; align-items: center; gap: .55rem; margin-top: 1.4rem; }

.flash {
  border-radius: 12px;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: var(--card);
}
.flash-success { background: var(--success-bg); border-color: #c6e6d4; color: var(--success); }
.flash-error { background: var(--danger-bg); border-color: #f0c2c2; color: var(--danger); }
.flash-info { background: #EEF3FA; color: #335278; }

.event-switcher, .pill-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.event-switcher .nav-link {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: .55rem .9rem;
  font-size: .9rem;
}
.event-switcher .nav-link.active {
  background: var(--navy);
  color: #fff;
  box-shadow: none;
  border-color: var(--navy);
}

.chart-box { min-height: 260px; position: relative; }
.chart-box canvas { max-height: 280px; }

.qr-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.qr-card {
  display: grid;
  gap: .85rem;
}
.qr {
  min-height: 240px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
}
.qr img,
.qr canvas:not(.qr-print-canvas) {
  width: min(100%, 280px) !important;
  height: auto !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.qr-print-canvas { display: none !important; }
.qr-hires { background: #fff; }
.qr-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
code.token-url {
  display: block;
  font-size: .75rem;
  word-break: break-all;
  background: var(--surface);
  border-radius: 8px;
  padding: .55rem .7rem;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  display: grid;
  place-items: center;
  gap: .6rem;
}
.empty-state i { width: 36px; height: 36px; color: var(--champagne); }

.activity-list { display: grid; gap: .55rem; }
.activity-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .92rem;
}
.activity-item:last-child { border-bottom: 0; }

.feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.feed-list li {
  display: grid;
  gap: .15rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.feed-list li:last-child { border-bottom: 0; }
.feed-list small { color: var(--muted); font-size: .8rem; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(900px 420px at 20% 0%, rgba(196,164,106,.18), transparent 60%),
    linear-gradient(160deg, #0F1C2E 0%, #1C2838 45%, #24344A 100%);
}
.auth-card {
  width: min(440px, 100%);
  background: #fff;
  color: #152033;
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
}
.auth-card .brand,
.auth-card .display {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: .2rem 0 1rem;
  line-height: 1.25;
}
.btn, button.btn {
  font-family: var(--font-body);
  letter-spacing: -0.01em;
}
.data-table {
  font-variant-numeric: tabular-nums;
}
.data-table th {
  font-family: var(--font-body);
  font-weight: 700;
}
.auth-card form { display: grid; gap: .9rem; }
.auth-card button { width: 100%; }

.mobile-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(700px 360px at 50% 0%, rgba(196,164,106,.25), transparent 55%),
    linear-gradient(165deg, #0F1C2E, #18263A 55%, #101927);
  color: #F7F4EE;
  text-align: center;
}
.mobile-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  padding: 2rem 1.4rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.mobile-card h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: #fff;
}
.mobile-illu {
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, #E8D7B0, #C4A46A 55%, #8C6B2F);
  color: #1a1408;
  animation: pop .55s ease both;
}
.mobile-illu i { width: 48px; height: 48px; }
/* Wine glass markers for bar drinks */
.bottle-row, .glass-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.35rem;
  margin: 1.35rem 0 1.1rem;
}
.wine-glass {
  width: 64px;
  height: 98px;
  display: grid;
  place-items: end center;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.28));
}
.wine-glass svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wine-glass .bowl-wine { opacity: 0; transition: opacity .25s ease; }
.wine-glass.filled .bowl-wine { opacity: 1; animation: fillUp .55s ease both; }
.wine-glass:not(.filled) .bowl-wine { opacity: 0; }
.wine-glass:not(.filled) text { fill: rgba(255,255,255,.55); }
.wine-glass.pop { animation: pop .55s ease both; }
.wine-glass.mini {
  width: 28px;
  height: 44px;
  margin-bottom: .45rem;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.12));
}
.wine-glass.mini text { display: none; }
.stat-card .wine-glass.mini .bowl-empty { stroke: rgba(15,28,46,.35); fill: rgba(15,28,46,.04); }
.stat-card .wine-glass.mini path[d^="M36"],
.stat-card .wine-glass.mini path[d^="M22"] { stroke: rgba(15,28,46,.35); }
.stat-card.drink-simple { display: grid; gap: .2rem; }
.hospitality .welcome-card { text-align: center; }
.hospitality h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: .35rem 0;
  color: #fff;
  line-height: 1.25;
}
.hospitality .welcome-en {
  color: rgba(255,255,255,.78);
  margin: 0 0 .5rem;
  font-weight: 500;
}
.hospitality .welcome-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #E8D7B0;
  margin: .75rem 0 1rem;
}
.hospitality .welcome-note {
  margin-top: 1.1rem;
  color: rgba(255,255,255,.72);
  line-height: 1.5;
}
.welcome-arch {
  width: 110px;
  height: 110px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: radial-gradient(circle at 30% 30%, #F3E2B8, #C4A46A 55%, #8C6B2F);
  color: #1a1408;
  animation: pop .6s ease both;
}
.welcome-arch i { width: 42px; height: 42px; }
.arch-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(232,215,176,.45);
  animation: pulseRing 2s ease infinite;
}
@keyframes pulseRing {
  0% { transform: scale(.92); opacity: .8; }
  70% { transform: scale(1.08); opacity: 0; }
  100% { transform: scale(1.08); opacity: 0; }
}
.mobile-illu.soft {
  background: radial-gradient(circle at 30% 30%, rgba(232,215,176,.35), rgba(196,164,106,.55));
  color: #fff;
}
.kv { display: grid; gap: .35rem; margin-top: 1rem; text-align: left; }
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem .7rem;
  border-radius: 10px;
  background: rgba(0,0,0,.18);
  font-size: .92rem;
}

@keyframes pop {
  from { transform: scale(.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes fillUp {
  from { background-position: 0 100%; filter: saturate(.5); }
  to { filter: saturate(1); }
}

.pager { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.help { font-size: .82rem; color: var(--muted); }

@media (max-width: 1100px) {
  .split-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-stats, .split-3[style*="repeat(4"] { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    grid-auto-flow: row;
  }
  .sidebar-nav { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .nav-link span { font-size: .78rem; }
  .qr-grid, .split-2, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .content, .topbar { padding-left: 1rem; padding-right: 1rem; }
  .page-header { flex-direction: column; }
  .sidebar-nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split-3 { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .btn, .flash, .event-switcher, .pill-filters { display: none !important; }
  .app-shell { display: block; }
  .content { max-width: none; padding: 0; }
  body { background: #fff; }
}
