/* Broadway Passport Kiosk - Partner Portal
   Same palette, type and shapes as the kiosk (resources/kiosk/css/10-base.css):
   theatre red, cream, gold, ink; Playfair Display + Inter; pill buttons.
   The crest is gold on transparent: it only ever sits on red or ink. */

:root {
  --red-1: #B81C20;
  --red-2: #D02329;
  --red-3: #E63037;
  --red-deep: #7A1014;
  --cream-1: #FBF6EC;
  --cream-2: #F4ECDA;
  --cream-3: #E8DDC5;
  --gold-1: #E8B547;
  --gold-2: #C99030;
  --gold-3: #F4E2B0;
  --ink-1: #1B0608;
  --ink-2: #3D1417;
  --ink-soft: #6E4F52;
  --success: #1B7A3A;

  --bg: var(--cream-1);
  --surface: #FFFFFF;
  --surface-2: var(--cream-2);
  --text: var(--ink-1);
  --text-soft: var(--ink-soft);
  --border: rgba(27, 6, 8, 0.10);
  --gold-text: var(--gold-2);
  --sh-1: 0 2px 6px rgba(26, 6, 8, 0.06);
  --sh-2: 0 8px 22px rgba(26, 6, 8, 0.10);
  --sh-red: 0 14px 32px rgba(208, 35, 41, 0.28);
  --sh-red-sm: 0 4px 12px rgba(208, 35, 41, 0.30);
  --focus: 0 0 0 3px rgba(208, 35, 41, 0.35);

  --r-card: 16px;
  --r-card-lg: 24px;
  --r-input: 14px;
  --r-pill: 100px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --font-head: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #140406;
  --surface: #220A0D;
  --surface-2: #2D0F13;
  --text: var(--cream-2);
  --text-soft: #C4A4A7;
  --border: rgba(244, 236, 218, 0.12);
  --gold-text: var(--gold-1);
  --sh-1: 0 2px 6px rgba(0, 0, 0, 0.3);
  --sh-2: 0 10px 28px rgba(0, 0, 0, 0.45);
  --focus: 0 0 0 3px rgba(232, 181, 71, 0.5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #140406;
    --surface: #220A0D;
    --surface-2: #2D0F13;
    --text: var(--cream-2);
    --text-soft: #C4A4A7;
    --border: rgba(244, 236, 218, 0.12);
    --gold-text: var(--gold-1);
    --sh-1: 0 2px 6px rgba(0, 0, 0, 0.3);
    --sh-2: 0 10px 28px rgba(0, 0, 0, 0.45);
    --focus: 0 0 0 3px rgba(232, 181, 71, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
p { margin: 0; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; font-weight: 700; }
a { color: var(--red-2); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
:root[data-theme="dark"] a { color: var(--gold-1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: var(--gold-1); } }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- crest ---------- */
.crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #3A0E12 0%, var(--ink-1) 70%);
  box-shadow: inset 0 0 0 1px rgba(232, 181, 71, 0.45);
}
.crest img { width: 78%; height: 78%; object-fit: contain; display: block; }
.crest-sm { width: 40px; height: 40px; background: rgba(27, 6, 8, 0.28); }
.crest-md { width: 56px; height: 56px; }
.crest-lg {
  width: 112px; height: 112px;
  box-shadow: inset 0 0 0 1px rgba(232, 181, 71, 0.55), 0 0 0 8px rgba(232, 181, 71, 0.06), 0 18px 48px rgba(208, 35, 41, 0.45);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(120deg, var(--red-2) 0%, var(--red-1) 45%, var(--red-deep) 100%);
  color: var(--cream-1);
  box-shadow: 0 6px 20px rgba(122, 16, 20, 0.25);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name { font-family: var(--font-head); font-weight: 800; font-size: 19px; letter-spacing: 0.01em; white-space: nowrap; }
.brand-eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold-3); margin-top: 3px;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.partner-pill {
  max-width: 280px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: rgba(27, 6, 8, 0.22);
  box-shadow: inset 0 0 0 1px rgba(244, 226, 176, 0.35);
}
.partner-logo-img { height: 22px; width: auto; vertical-align: middle; display: inline-block; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 0;
  background: rgba(27, 6, 8, 0.22);
  box-shadow: inset 0 0 0 1px rgba(244, 226, 176, 0.3);
  color: var(--gold-3);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.icon-btn:hover { background: rgba(27, 6, 8, 0.36); }
/* Sun in dark mode, crescent moon in light mode (what a click switches to). */
.theme-icon { width: 16px; height: 16px; border-radius: 50%; display: block; }
.theme-icon[data-mode="light"] { box-shadow: inset 6px -4px 0 0 var(--gold-3); transform: rotate(-20deg); }
.theme-icon[data-mode="dark"] { background: var(--gold-3); width: 12px; height: 12px; box-shadow: 0 0 0 3px rgba(244, 226, 176, 0.3), 0 0 0 6px rgba(244, 226, 176, 0.12); }

/* Sign-in: the stage carries the brand, so the bar turns transparent. */
body[data-view="signInView"] .topbar,
body[data-view="errorView"] .topbar { position: absolute; left: 0; right: 0; background: transparent; box-shadow: none; }
body[data-view="signInView"] .brand,
body[data-view="errorView"] .brand { visibility: hidden; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  border-radius: var(--r-pill);
  border: 0;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn-block { width: 100%; display: block; margin-top: 16px; padding: 14px 20px; font-size: 15px; }
.btn-primary {
  background: linear-gradient(180deg, var(--red-3), var(--red-1));
  color: #fff;
  box-shadow: var(--sh-red-sm);
}
.btn-primary:hover { box-shadow: var(--sh-red); }
.btn-secondary { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.btn-secondary:hover { box-shadow: inset 0 0 0 1px var(--gold-2); }
.btn-on-red {
  background: var(--cream-1);
  color: var(--red-1);
  padding: 9px 16px;
  font-size: 13px;
}
.btn-on-red:hover { background: #fff; }
.link-btn {
  background: none; border: 0; padding: 12px 0 0; margin: 0 auto;
  display: block; cursor: pointer;
  font: 600 13px var(--font-body);
  color: var(--text-soft);
}
.link-btn:hover { color: var(--text); text-decoration: underline; }

/* ---------- layout ---------- */
#app { max-width: 1120px; margin: 0 auto; padding: 24px 16px 56px; }
body[data-view="signInView"],
body[data-view="errorView"] { background: var(--ink-1); }
body[data-view="signInView"] #app,
body[data-view="errorView"] #app { max-width: none; padding: 0; }

/* ---------- stage (sign-in / error) ---------- */
.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 88px 16px 40px;
  color: var(--cream-1);
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(208, 35, 41, 0.55) 0%, rgba(208, 35, 41, 0) 70%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(232, 181, 71, 0.10) 0%, rgba(232, 181, 71, 0) 70%),
    var(--ink-1);
}
.stage-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; }
.stage-brand { text-align: center; margin-bottom: 26px; }
.stage-brand .crest-lg { margin-bottom: 18px; }
.stage-eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold-1);
}
.stage-title { font-size: 40px; line-height: 1.1; margin-top: 8px; color: #fff; }
.stage-sub { margin-top: 10px; color: rgba(251, 246, 236, 0.75); font-size: 15px; }
.stage-footer { margin-top: 22px; font-size: 13px; color: rgba(251, 246, 236, 0.65); text-align: center; }
.stage-footer a { color: var(--gold-1); }

.card {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-card-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 28px 26px 22px;
}
.auth-title { font-size: 24px; }
.auth-note { color: var(--text-soft); font-size: 14px; margin: 6px 0 18px; }
.field-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 8px; }
.field-input {
  width: 100%;
  font: 500 16px var(--font-body);
  padding: 14px 16px;
  border-radius: var(--r-input);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field-input::placeholder { color: var(--text-soft); opacity: 0.6; }
.field-input:focus { outline: none; border-color: var(--red-2); box-shadow: var(--focus); }
.field-code { letter-spacing: 0.5em; font-size: 24px; text-align: center; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; padding-left: calc(16px + 0.5em); }
.auth-error {
  color: var(--red-1);
  background: rgba(208, 35, 41, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 14px;
}
:root[data-theme="dark"] .auth-error { color: #FF9A9E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-error { color: #FF9A9E; } }
.auth-safety {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-soft); text-align: center;
}

.demo-badge {
  display: inline-block;
  background: var(--gold-1);
  color: var(--ink-1);
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: var(--r-pill);
  padding: 5px 12px;
  margin-bottom: 14px;
}

/* ---------- dashboard ---------- */
.dash-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.dash-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-text); }
.dash-title { font-size: 32px; line-height: 1.15; margin-top: 4px; }
.dash-controls { display: flex; align-items: center; gap: 10px; }
.dash-controls .demo-badge { margin: 0; }
.month-picker {
  font: 600 14px var(--font-body);
  padding: 10px 38px 10px 16px;
  border-radius: var(--r-pill);
  border: 0;
  box-shadow: inset 0 0 0 1.5px var(--border);
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--red-2) 50%), linear-gradient(135deg, var(--red-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.kiosk-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.kiosk-strip:empty { display: none; }
.kiosk-chip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface);
  box-shadow: var(--sh-1), inset 0 0 0 1px var(--border);
  border-radius: var(--r-pill);
  padding: 8px 16px;
  font-size: 13px;
}
.kiosk-chip-name { font-weight: 700; }
.kiosk-chip-loc, .kiosk-chip-status { color: var(--text-soft); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ink-soft); }
.status-dot.online { background: #22A04E; box-shadow: 0 0 0 3px rgba(34, 160, 78, 0.18); }
.status-dot.offline { background: var(--red-2); box-shadow: 0 0 0 3px rgba(208, 35, 41, 0.15); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-card-lg);
  padding: 26px 26px 22px;
  color: var(--cream-1);
  background:
    radial-gradient(ellipse 80% 90% at 100% 0%, rgba(230, 48, 55, 0.55) 0%, rgba(230, 48, 55, 0) 60%),
    linear-gradient(150deg, var(--red-deep) 0%, var(--red-1) 70%, var(--red-2) 100%);
  box-shadow: var(--sh-red);
  display: flex; flex-direction: column; justify-content: center;
  min-height: 190px;
}
.hero-crest { position: absolute; right: -18px; bottom: -26px; width: 170px; height: 170px; opacity: 0.16; pointer-events: none; }
.hero-crest img { width: 100%; height: 100%; }
.hero-label { font-size: 12px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-3); }
.hero-value {
  font-family: var(--font-head); font-weight: 800;
  font-size: 52px; line-height: 1.05; margin-top: 8px;
  color: var(--gold-1);
  font-variant-numeric: lining-nums tabular-nums;
  text-shadow: 0 2px 18px rgba(27, 6, 8, 0.35);
}
.hero-sub { margin-top: 6px; font-size: 14px; color: rgba(251, 246, 236, 0.85); }
.hero-today {
  margin-top: 16px; align-self: flex-start;
  font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: rgba(27, 6, 8, 0.25);
  box-shadow: inset 0 0 0 1px rgba(244, 226, 176, 0.25);
}

.kpi-stack { display: grid; grid-template-rows: repeat(3, 1fr); gap: 10px; }
.kpi-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--sh-1), inset 0 0 0 1px var(--border);
  padding: 14px 20px;
}
.kpi-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-soft); }
.kpi-value { font-family: var(--font-head); font-weight: 700; font-size: 26px; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }

.panel {
  background: var(--surface);
  border-radius: var(--r-card-lg);
  box-shadow: var(--sh-1), inset 0 0 0 1px var(--border);
  padding: 20px;
  margin-bottom: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-title { font-size: 20px; }

.chart-wrap { width: 100%; overflow-x: auto; }
.daily-chart { width: 100%; height: 220px; display: block; min-width: 460px; }
.chart-bar { fill: var(--red-2); transition: fill 0.15s ease; }
.chart-bar:hover { fill: var(--gold-1); }
.chart-axis-label { fill: var(--text-soft); font-size: 10px; font-family: var(--font-body); }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sales-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.sales-table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-soft); padding: 10px 12px; white-space: nowrap;
  border-bottom: 1.5px solid var(--border);
}
.sales-table td { padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sales-table tbody tr:hover { background: var(--surface-2); }
.sales-table td:nth-child(2) { font-weight: 600; }
.sales-table .unit { display: none; }
.sales-table .num { text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.sales-table .commission-cell { color: var(--gold-text); font-weight: 700; }
.sales-table tfoot td { font-weight: 800; border-top: 2px solid var(--border); border-bottom: 0; padding-top: 14px; }

.empty-note { text-align: center; padding: 22px 12px 8px; color: var(--text-soft); font-size: 14px; }
.empty-note .crest { margin-bottom: 10px; }

.updated-line { color: var(--text-soft); font-size: 12px; text-align: right; }
.dash-footer { margin-top: 18px; text-align: center; font-size: 12.5px; color: var(--text-soft); }

/* ---------- loading / error ---------- */
.skeleton-block {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shine 1.4s ease infinite;
  border-radius: var(--r-card);
  margin-bottom: 14px;
}
.sk-56 { height: 56px; } .sk-180 { height: 180px; } .sk-220 { height: 220px; } .sk-280 { height: 280px; }
.skeleton-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; }
@keyframes shine { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.error-card { text-align: center; }
.error-text { margin-bottom: 16px; font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-stack { grid-template-rows: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-card { flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; }
  .kpi-value { font-size: 22px; }
  .partner-pill { max-width: 200px; }
}
@media (max-width: 560px) {
  .brand-name { font-size: 16px; }
  .brand-eyebrow { font-size: 9.5px; letter-spacing: 0.18em; }
  .partner-pill { display: none; }
  .dash-title { font-size: 26px; }
  .hero-card { padding: 22px 20px 18px; min-height: 0; }
  .hero-value { font-size: 42px; }
  .kpi-stack { grid-template-columns: minmax(0, 1fr); }
  .kpi-card { flex-direction: row; align-items: center; padding: 12px 18px; }
  .kpi-value { font-size: 20px; }
  .panel { padding: 16px; border-radius: var(--r-card); }
  .stage-title { font-size: 32px; }
  .crest-lg { width: 92px; height: 92px; }
  .card { padding: 24px 20px 18px; }
  .skeleton-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .btn-on-red { padding: 8px 12px; }
  .brand { gap: 8px; }
}

/* Phone: each sale becomes a two-column card so the money columns never hide
   behind a sideways scroll. Show + commission on top, details underneath. */
@media (max-width: 640px) {
  .sales-table { min-width: 0; font-size: 13px; }
  .sales-table thead { display: none; }
  .sales-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--border);
  }
  .sales-table td { padding: 0; border: 0; white-space: normal; }
  .sales-table td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 15px; }
  .sales-table td:nth-child(6) { grid-column: 2; grid-row: 1; font-size: 15px; }
  .sales-table td:nth-child(1) { grid-column: 1; grid-row: 2; color: var(--text-soft); }
  .sales-table td:nth-child(3) { grid-column: 1; grid-row: 3; color: var(--text-soft); }
  .sales-table td:nth-child(4) { grid-column: 2; grid-row: 2; color: var(--text-soft); }
  .sales-table td:nth-child(5) { grid-column: 2; grid-row: 3; color: var(--text-soft); }
  .sales-table tbody td:nth-child(1)::before { content: "Sold "; }
  .sales-table tbody td:nth-child(3)::before { content: "Show "; }
  .sales-table .unit { display: inline; }
  .sales-table tbody tr:hover { background: none; }
  .sales-table tfoot tr { border-bottom: 0; border-top: 2px solid var(--border); margin-top: 4px; }
  .sales-table tfoot td { padding: 0; border: 0; }
  .sales-table tfoot td:nth-child(2), .sales-table tfoot td:nth-child(3) { display: none; }
  .sales-table tfoot td:nth-child(1) { grid-column: 1; grid-row: 1; font-size: 15px; }
}
