/* MajiKa staff-surface M3-expressive tokens — Arcane DNA from the kiosk.
   Shared by the cashier + admin dashboards. Dark is the brand default; light is the
   daylight-venue variant (decision 0, 2026-09-30 plan). Toggle via
   `document.documentElement.dataset.theme` ("dark" | "light"); see the inline boot
   script in each index.html (localStorage `majika-theme`, first visit follows the OS).
   Fonts: Playfair Display (display), Literata (body), Poppins (chrome), Kalam (accent). */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Literata:opsz,wght@7..72,600;7..72,700&family=Poppins:wght@400;500;600&family=Kalam:wght@400&display=swap');

:root {
  color-scheme: dark;

  --md-sys-color-primary: #ffd740;
  --md-sys-color-primary-hover: #ffdf66;
  --md-sys-color-on-primary: #0d0015;
  --md-sys-color-primary-container: #3a2d1a;
  --md-sys-color-on-primary-container: #ffe97d;
  --md-sys-color-secondary: #7c4dff;
  --md-sys-color-secondary-container: #4527a0;
  --md-sys-color-on-secondary-container: #d5c6ff;
  --md-sys-color-tertiary: #448aff;
  --md-sys-color-surface-container: #2a0f4a;
  --md-sys-color-surface-container-high: #32205a;
  --md-sys-color-surface-container-highest: #3a2d6a;
  --md-sys-color-surface-variant: #1e0b38;
  --md-sys-color-surface: #14001f;
  --md-sys-color-background-top: #1a0033;
  --md-sys-color-background: #0d0015;
  --md-sys-color-on-surface: #e0d0ff;
  --md-sys-color-on-surface-variant: #9b7fca;
  --md-sys-color-outline: #453566;
  --md-sys-color-outline-variant: #2f2450;
  --md-sys-color-error: #ef5350;
  --md-sys-color-success: #66bb6a;
  --md-sys-color-paper: #efe4cf;
  --md-sys-color-on-paper: #1e1a10;
  --md-sys-color-amber: #fbbf24;
  --md-sys-color-info: #60a5fa;

  /* interaction tints (rgba over surfaces) */
  --hover-tint: rgba(124, 77, 255, 0.14);
  --row-tint: rgba(124, 77, 255, 0.07);
  --focus-ring: rgba(255, 215, 64, 0.25);
  --glow: 0 0 24px rgba(255, 215, 64, 0.28);

  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 24px;
  --md-sys-shape-corner-full: 999px;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Literata', Georgia, serif;
  --font-chrome: 'Poppins', system-ui, sans-serif;
  --font-accent: 'Kalam', cursive;

  --md-sys-elevation-1: 0 1px 3px rgba(0, 0, 0, 0.45);
  --md-sys-elevation-2: 0 2px 8px rgba(0, 0, 0, 0.45);
  --md-sys-elevation-3: 0 6px 20px rgba(0, 0, 0, 0.5);

  --md-sys-motion-entrance: 300ms cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-breathe: 3s ease-in-out infinite;
}

/* Light variant — same DNA, daylight-toned: warm white surfaces, lavender tints,
   darkened gold for text/CTA contrast on light. */
:root[data-theme='light'] {
  color-scheme: light;

  --md-sys-color-primary: #7a5c00;
  --md-sys-color-primary-hover: #8f6e00;
  --md-sys-color-on-primary: #fffdf5;
  --md-sys-color-primary-container: #ffe97d;
  --md-sys-color-on-primary-container: #241a00;
  --md-sys-color-secondary: #6438c8;
  --md-sys-color-secondary-container: #e7deff;
  --md-sys-color-on-secondary-container: #21005d;
  --md-sys-color-tertiary: #1a55c0;
  --md-sys-color-surface-container: #f1eaf7;
  --md-sys-color-surface-container-high: #eae2f2;
  --md-sys-color-surface-container-highest: #e4dbec;
  --md-sys-color-surface-variant: #e6dcf2;
  --md-sys-color-surface: #faf7ff;
  --md-sys-color-background-top: #ece2fb;
  --md-sys-color-background: #faf7ff;
  --md-sys-color-on-surface: #1d1a24;
  --md-sys-color-on-surface-variant: #57496e;
  --md-sys-color-outline: #80749a;
  --md-sys-color-outline-variant: #d4cbe4;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-success: #2e7d32;

  --hover-tint: rgba(100, 56, 200, 0.10);
  --row-tint: rgba(100, 56, 200, 0.06);
  --focus-ring: rgba(122, 92, 0, 0.25);
  --glow: 0 0 24px rgba(122, 92, 0, 0.18);

  --md-sys-elevation-1: 0 1px 3px rgba(29, 26, 36, 0.14);
  --md-sys-elevation-2: 0 2px 8px rgba(29, 26, 36, 0.14);
  --md-sys-elevation-3: 0 6px 20px rgba(29, 26, 36, 0.18);
}

* { box-sizing: border-box; }

/* Kill Android/Chrome font boosting — without this, phones inflate text to "giants". */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--md-sys-color-background-top), var(--md-sys-color-background));
  background-attachment: fixed;
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }

/* ✦ brand punctuation */
.spark::before { content: '✦ '; color: var(--md-sys-color-primary); }

/* ---------- chrome: buttons, chips, pills, inputs ---------- */

.btn {
  font-family: var(--font-chrome);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 10px 18px;
  border-radius: var(--md-sys-shape-corner-full);
  border: 1px solid var(--md-sys-color-outline);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: background var(--md-sys-motion-entrance), border-color var(--md-sys-motion-entrance), box-shadow var(--md-sys-motion-entrance), transform var(--md-sys-motion-entrance);
}

.btn:hover { background: var(--hover-tint); border-color: var(--md-sys-color-secondary); }

.btn-primary {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-weight: 600;
  box-shadow: var(--md-sys-elevation-1);
}

.btn-primary:hover {
  background: var(--md-sys-color-primary-hover);
  border-color: var(--md-sys-color-primary-hover);
  box-shadow: var(--md-sys-elevation-2), var(--glow);
  transform: translateY(-1px);
}

.btn-tonal {
  background: var(--md-sys-color-primary-container);
  border-color: transparent;
  color: var(--md-sys-color-on-primary-container);
}

.btn-danger { color: var(--md-sys-color-error); border-color: rgba(239, 83, 80, 0.45); }
.btn-danger:hover { background: rgba(239, 83, 80, 0.12); border-color: var(--md-sys-color-error); }

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

.chip {
  font-family: var(--font-chrome);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--md-sys-color-on-surface-variant));
}

.chip-ok { --dot: var(--md-sys-color-success); background: rgba(102, 187, 106, 0.14); color: var(--md-sys-color-success); }
.chip-warn { --dot: var(--md-sys-color-amber); background: rgba(251, 191, 36, 0.14); color: var(--md-sys-color-amber); }
.chip-err { --dot: var(--md-sys-color-error); background: rgba(239, 83, 80, 0.14); color: var(--md-sys-color-error); }
.chip-idle { --dot: var(--md-sys-color-on-surface-variant); }
.chip-info { --dot: var(--md-sys-color-info); background: rgba(96, 165, 250, 0.14); color: var(--md-sys-color-info); }

.pill {
  font-family: var(--font-chrome);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: var(--md-sys-shape-corner-full);
  display: inline-block;
}

.pill-active   { background: rgba(102, 187, 106, 0.16); color: var(--md-sys-color-success); }
.pill-pending  { background: rgba(251, 191, 36, 0.16); color: var(--md-sys-color-amber); }
.pill-processing { background: rgba(96, 165, 250, 0.16); color: var(--md-sys-color-info); }
.pill-expired  { background: rgba(155, 127, 202, 0.16); color: var(--md-sys-color-on-surface-variant); }
.pill-failed   { background: rgba(239, 83, 80, 0.16); color: var(--md-sys-color-error); }
.pill-redeemed { background: rgba(96, 165, 250, 0.16); color: var(--md-sys-color-info); }

.card {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 18px;
}

.card-elevated { box-shadow: var(--md-sys-elevation-2); }

/* breathing status orb — the kiosk's "everything breathes" move, tamed for staff density */
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 64, 0.0); }
  50% { box-shadow: 0 0 10px 2px rgba(255, 215, 64, 0.35); }
}

.orb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  animation: breathe var(--md-sys-motion-breathe);
}

.orb-green { background: var(--md-sys-color-success); }
.orb-amber { background: var(--md-sys-color-amber); animation-name: breathe-amber; }
@keyframes breathe-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
  50% { box-shadow: 0 0 10px 2px rgba(251, 191, 36, 0.35); }
}
.orb-red { background: var(--md-sys-color-error); animation: none; }
.orb-gray { background: var(--md-sys-color-on-surface-variant); animation: none; }

/* ---------- form fields ---------- */

.field { display: flex; flex-direction: column; gap: 4px; font-family: var(--font-chrome); }
.field > label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

input, select, textarea {
  font-family: var(--font-chrome);
  font-size: 0.88rem;
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--md-sys-motion-entrance), box-shadow var(--md-sys-motion-entrance);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

::placeholder { color: var(--md-sys-color-on-surface-variant); opacity: 0.7; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-large); background: var(--md-sys-color-surface-container); }

table { width: 100%; border-collapse: collapse; font-family: var(--font-chrome); font-size: 0.82rem; }

thead th {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--md-sys-color-outline);
}

tbody td { padding: 11px 14px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row-tint); }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.code { font-family: ui-monospace, monospace; color: var(--md-sys-color-primary); }
td .muted, .muted { color: var(--md-sys-color-on-surface-variant); }

/* ---------- summary stat cards ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }

.stat {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 3px;
  background: var(--accent, var(--md-sys-color-primary));
}

.stat-label {
  font-family: var(--font-chrome);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--md-sys-color-accent-label, var(--md-sys-color-on-surface-variant));
  margin-bottom: 4px;
}

.stat-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; line-height: 1.1; }

/* ---------- page scaffolding ---------- */

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 26px 0 16px; }
.page-head p { margin: 4px 0 0; color: var(--md-sys-color-on-surface-variant); font-size: 0.85rem; }

.section-title {
  font-family: var(--font-chrome);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  margin: 26px 0 10px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.filter-bar .field { min-width: 130px; }

.footer-note { font-family: var(--font-chrome); font-size: 0.72rem; color: var(--md-sys-color-on-surface-variant); margin-top: 14px; }

/* ---------- theme toggle ---------- */

.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  border-radius: var(--md-sys-shape-corner-full);
}

/* kiosk-card "tarot card" treatment: gold corner brackets on select */
.tarot-frame { position: relative; }
.tarot-frame::before, .tarot-frame::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--md-sys-color-primary);
  border-style: solid;
}
.tarot-frame::before { top: -6px; left: -6px; border-width: 2px 0 0 2px; }
.tarot-frame::after { bottom: -6px; right: -6px; border-width: 0 2px 2px 0; }
