/* ==========================================================================
   XENVIA UI — shared design system
   Fine-dining, editorial-premium: brass & ink, Fraunces + Inter + Mono.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ---- Brand ---- */
  --brass: #ff7e33;
  /* Sunset Orange */
  --brass-strong: #ff4500;
  /* Deep Orange Red */
  --emerald: #38bdf8;
  /* Electric Cyan/Blue */
  --crimson: #f43f5e;
  /* Vibrant Rose Red */
  --amber: #fbbf24;
  /* Vibrant Amber */

  /* ---- Dark theme (default) ---- */
  --ink: #070d19;
  /* Midnight Navy */
  --surface: #0e1726;
  /* Slate Blue Navy */
  --surface-2: #152238;
  /* Lighter Navy Card */
  --surface-3: #1f2f4c;
  /* Elevated Slate Navy */
  --border: rgba(148, 163, 184, 0.08);
  --border-strong: rgba(148, 163, 184, 0.15);
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --glass-bg: rgba(14, 23, 38, 0.65);
  --glass-border: rgba(148, 163, 184, 0.12);
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.55);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme='light'] {
  --ink: #f0f4f8;
  /* Slate Blue Light */
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #e2ecf5;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #0f172a;
  --text-dim: #475569;
  --text-faint: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(148, 163, 184, 0.1);
  --shadow: 0 20px 60px -24px rgba(15, 23, 42, 0.15);
  --shadow-sm: 0 8px 24px -14px rgba(15, 23, 42, 0.1);
  --brass: #f97316;
  --brass-strong: #c2410c;
  --emerald: #0284c7;
  --crimson: #e11d48;
  --amber: #d97706;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

::selection {
  background: var(--brass);
  color: #14171c;
}

/* Ambient background texture — quiet grain + radial glow, not a full gradient wash */
.xv-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 15% -10%, rgba(255, 126, 51, 0.12), transparent 60%),
    radial-gradient(50% 40% at 100% 0%, rgba(56, 189, 248, 0.08), transparent 60%);
}

:root[data-theme='light'] .xv-ambient {
  background:
    radial-gradient(60% 50% at 15% -10%, rgba(249, 115, 22, 0.09), transparent 60%),
    radial-gradient(50% 40% at 100% 0%, rgba(14, 165, 233, 0.06), transparent 60%);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* -------------------------------- Type -------------------------------- */
.xv-h1,
.xv-h2,
.xv-h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0;
}

.xv-h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
}

.xv-h2 {
  font-size: 22px;
  font-weight: 600;
}

.xv-h3 {
  font-size: 17px;
  font-weight: 600;
}

.xv-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 500;
}

.xv-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.xv-muted {
  color: var(--text-dim);
}

.xv-faint {
  color: var(--text-faint);
}

/* ------------------------------- Buttons ------------------------------- */
.xv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), background 0.18s, border-color 0.18s, box-shadow 0.18s;
  user-select: none;
  white-space: nowrap;
}

.xv-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.xv-btn:active {
  transform: translateY(0) scale(0.98);
}

.xv-btn:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.xv-btn.primary {
  background: linear-gradient(180deg, var(--brass-strong), var(--brass));
  border-color: transparent;
  color: #1a1305;
  box-shadow: 0 8px 20px -8px rgba(201, 161, 93, 0.55);
}

.xv-btn.primary:hover {
  filter: brightness(1.05);
}

.xv-btn.ghost {
  background: transparent;
  border-color: var(--border);
}

.xv-btn.danger {
  background: transparent;
  border-color: rgba(229, 72, 77, 0.4);
  color: var(--crimson);
}

.xv-btn.danger:hover {
  background: rgba(229, 72, 77, 0.1);
}

.xv-btn.sm {
  padding: 7px 13px;
  font-size: 12.5px;
}

.xv-btn.icon {
  padding: 10px;
  border-radius: 50%;
}

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

/* -------------------------------- Cards -------------------------------- */
.xv-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.xv-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ------------------------------- Inputs --------------------------------- */
.xv-input,
.xv-select,
.xv-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.xv-input:focus,
.xv-select:focus,
.xv-textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(201, 161, 93, 0.16);
}

.xv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.xv-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}

/* -------------------------------- Badges -------------------------------- */
.xv-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
}

.xv-badge.b-pending {
  background: rgba(226, 163, 54, 0.16);
  color: var(--amber);
}

.xv-badge.b-accepted {
  background: rgba(90, 140, 230, 0.16);
  color: #7fa4ea;
}

.xv-badge.b-preparing {
  background: rgba(201, 161, 93, 0.16);
  color: var(--brass);
}

.xv-badge.b-ready {
  background: rgba(52, 163, 122, 0.18);
  color: var(--emerald);
}

.xv-badge.b-served {
  background: rgba(154, 160, 172, 0.16);
  color: var(--text-dim);
}

.xv-badge.b-completed {
  background: rgba(154, 160, 172, 0.12);
  color: var(--text-faint);
}

.xv-badge.b-cancelled {
  background: rgba(229, 72, 77, 0.16);
  color: var(--crimson);
}

/* --------------------------- Live sync beacon ---------------------------- */
.xv-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--emerald);
}

.xv-live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(52, 163, 122, 0.6);
  animation: xv-pulse 2s infinite;
}

@keyframes xv-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 163, 122, 0.55);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(52, 163, 122, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(52, 163, 122, 0);
  }
}

/* ------------------------- Signature: ticket perforation ------------------------- */
/* A punched paper-ticket edge used on order/KOT cards across the whole product —
   the one motif that ties customer, kitchen and owner surfaces together. */
.xv-ticket {
  position: relative;
  border-radius: var(--radius);
}

.xv-ticket::before {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 1px;
  background-image: radial-gradient(circle, var(--ink) 2.5px, transparent 2.6px);
  background-size: 14px 100%;
  background-position: 0 -1px;
  background-repeat: repeat-x;
  opacity: 0.9;
}

/* --------------------------------- Toast --------------------------------- */
.xv-toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.xv-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: xv-toast-in 0.35s var(--ease-out);
}

@keyframes xv-toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.xv-toast.ok {
  border: 1px solid rgba(52, 163, 122, 0.4);
}

.xv-toast.err {
  border: 1px solid rgba(229, 72, 77, 0.4);
}

.xv-toast.info {
  border: 1px solid var(--border-strong);
}

/* -------------------------------- Utility -------------------------------- */
.xv-row {
  display: flex;
  align-items: center;
}

.xv-between {
  justify-content: space-between;
}

.xv-gap-4 {
  gap: 4px;
}

.xv-gap-8 {
  gap: 8px;
}

.xv-gap-12 {
  gap: 12px;
}

.xv-gap-16 {
  gap: 16px;
}

.xv-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.xv-scrim.show {
  opacity: 1;
  pointer-events: auto;
}

.xv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  gap: 10px;
}

.xv-empty .glyph {
  font-size: 34px;
  opacity: 0.7;
  margin-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}