/* Empire FOH Hub — shared styles. Group shell (Empire Ink + Brass), venue accent applied per location. */

:root {
  --ink: #14181F;
  --ink-2: #1F2530;
  --ink-3: #2B3340;
  --brass: #A9884F;
  --brass-2: #C4A566;
  --brass-soft: rgba(169, 136, 79, 0.16);
  --paper: #F4F1EA;
  --card: #FFFFFF;
  --text: #1B1F27;
  --text-2: #5B6270;
  --text-3: #8A909B;
  --line: #E4DFD4;
  --danger: #B3261E;
  --danger-soft: rgba(179, 38, 30, 0.10);
  --ok: #2F7D4A;
  --ok-soft: rgba(47, 125, 74, 0.12);
  --accent: var(--brass);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
  min-height: 100vh;
  min-height: 100dvh;
}
body.auth { background: var(--ink); color: var(--paper); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0 0 12px; }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Masthead / auth layout ---------- */
.mast {
  font-size: 11px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--brass); font-weight: 600;
}
.rule { width: 48px; height: 2px; background: var(--brass); margin: 14px 0 18px; }

.auth-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--ink-2);
  border: 1px solid rgba(169, 136, 79, 0.28);
  border-radius: 18px;
  padding: 28px 22px 24px;
}
.auth-card h1 { font-size: 26px; font-weight: 600; margin-top: 10px; }
.auth-card .lead { color: rgba(244, 241, 234, 0.72); margin: 6px 0 18px; }
.auth-card .field label { color: rgba(244, 241, 234, 0.85); }
.auth-card .field input, .auth-card .field select {
  background: var(--ink); color: var(--paper); border-color: var(--ink-3);
}
.auth-card .field input:focus, .auth-card .field select:focus { border-color: var(--brass); }
.auth-card .links { margin-top: 18px; text-align: center; font-size: 14px; color: rgba(244, 241, 234, 0.72); }
.auth-card .links a { color: var(--brass-2); text-decoration: none; }
.auth-card .links a:hover { text-decoration: underline; }
.auth-foot { text-align: center; font-size: 12px; color: rgba(244, 241, 234, 0.4); margin-top: 22px; letter-spacing: 0.04em; }

/* ---------- Fields ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 16px; /* prevents iOS zoom */
  outline: none;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }
.field input.upper { text-transform: uppercase; }
.field .row { display: flex; gap: 8px; align-items: center; }
.field .row input { flex: 1; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--brass); }
.status { font-size: 13px; margin-top: 6px; min-height: 18px; }
.status.ok { color: #7FC38E; }
.status.bad { color: #F0A19B; }
.page .status.ok { color: var(--ok); }
.page .status.bad { color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600; font-size: 16px;
  cursor: pointer; text-decoration: none;
  min-height: 46px;
  transition: background .15s, opacity .15s;
}
.btn.block { width: 100%; }
.btn.primary { background: var(--brass); color: var(--ink); }
.btn.primary:hover { background: var(--brass-2); }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; opacity: .9; }
.btn.ghost:hover { opacity: 1; background: rgba(0,0,0,0.04); }
.page .btn.ghost { border-color: var(--line); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.link { background: none; border: none; padding: 0; min-height: 0; color: var(--brass); font-weight: 600; }

/* ---------- Alerts / toasts ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 15px; margin-bottom: 14px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.auth-card .alert.error { background: rgba(240, 161, 155, 0.14); color: #F0A19B; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.auth-card .alert.ok { background: rgba(127, 195, 142, 0.14); color: #9BD6A8; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* ---------- App shell ---------- */
.topbar {
  background: var(--ink); color: var(--paper);
  padding: 14px 16px 12px;
  padding-top: calc(14px + env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 20;
  border-bottom: 2px solid var(--accent);
}
.topbar .inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .mast { font-size: 10px; }
.topbar .loc { font-size: 17px; font-weight: 600; margin-top: 2px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; text-decoration: none; letter-spacing: .02em;
}
.page { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.page h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.page h2 { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); font-weight: 700; margin: 22px 0 10px; }
.page h2:first-child { margin-top: 4px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--ink); color: rgba(244, 241, 234, 0.6);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center;
  border-top: 1px solid var(--ink-3);
}
.tabbar .inner { display: flex; width: 100%; max-width: 640px; }
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: inherit;
  position: relative;
}
.tabbar a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent); }
.tabbar a .soon { position: absolute; top: 9px; right: calc(50% - 20px); width: 7px; height: 7px; border-radius: 50%; background: var(--brass); opacity: .7; }

/* ---------- Cards / lists ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.card.pinned { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.card .title { font-size: 17px; font-weight: 600; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card .meta { font-size: 13px; color: var(--text-3); margin-bottom: 8px; }
.card .body { white-space: pre-wrap; font-size: 15.5px; }
.card .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.badge.new { background: var(--accent); color: var(--ink); }
.badge.pin { background: var(--brass-soft); color: var(--brass); }
.badge.off { background: var(--danger-soft); color: var(--danger); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--brass-soft); color: var(--brass); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.empty { text-align: center; color: var(--text-2); padding: 28px 12px; }

.greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.greet .sub { color: var(--text-2); font-size: 14px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 10px 12px; text-align: center; text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 96px; justify-content: center;
}
.tile svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile .t { font-weight: 600; font-size: 14px; }
.tile .s { font-size: 11px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.tile.soon { opacity: .75; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabs button { flex: 1; border: none; background: transparent; padding: 9px 6px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--text-2); cursor: pointer; }
.tabs button.active { background: var(--ink); color: var(--paper); }
.person { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.person .name { font-weight: 600; }
.person .email { font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.person .controls { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.person .controls select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 14px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .06em; font-size: 17px; }
.inline-form { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 40px 0; color: var(--text-2); }

/* ---------- Tips ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.result { background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 14px 16px; margin-top: 8px; }
.result-head { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); font-weight: 700; margin-bottom: 8px; }
.result-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 15px; color: rgba(244, 241, 234, 0.82); }
.result-row span:first-child { flex: 1; }
.result-row.total { border-top: 1px solid rgba(244, 241, 234, 0.18); margin-top: 4px; padding-top: 9px; color: var(--paper); }
.result-row.big { font-size: 18px; color: var(--paper); border-top: 1px solid var(--brass); margin-top: 6px; padding-top: 10px; }
.result-row.big strong { font-size: 24px; color: var(--brass-2); }
.result .small.muted { color: rgba(244, 241, 234, 0.55); margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 10px; text-align: center; }
.stat .v { font-size: 20px; font-weight: 700; }
.stat .l { font-size: 11px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }
.entry-line { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.entry-line .d { font-weight: 600; }
.entry-line .sub { font-size: 13px; color: var(--text-3); grid-column: 1; }
.entry-line .amt { font-weight: 700; text-align: right; grid-row: 1 / span 2; align-self: center; font-size: 17px; }
.datebar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.datebar input[type=date], .datebar select { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); font-size: 15px; }
.datebar .btn.small { min-height: 40px; }
table.sheet { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.sheet th, table.sheet td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.sheet th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); background: var(--paper); }
table.sheet td.num, table.sheet th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.sheet tr:last-child td { border-bottom: none; }
table.sheet tr.total td { font-weight: 700; background: var(--paper); }
table.sheet .who { font-weight: 600; }
table.sheet .who .sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 400; }
.scroll-x { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.mini { padding: 6px 10px; min-height: 32px; font-size: 13px; }
.mini.on { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.warn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-left: 6px; vertical-align: middle; }
.rules-line { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rules-line:last-child { border-bottom: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.chips input { accent-color: var(--brass); }

/* ---------- Quizzes ---------- */
.q-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.q-card .q-num { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 700; margin-bottom: 4px; display: flex; justify-content: space-between; }
.q-card .q-prompt { font-size: 16px; font-weight: 600; margin-bottom: 10px; white-space: pre-wrap; }
.q-input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 16px; resize: vertical; background: var(--card); color: var(--text); }
.q-input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; background: var(--card); cursor: pointer; }
.choice input { margin-top: 3px; accent-color: var(--brass); }
.choice .key { font-weight: 700; color: var(--text-3); min-width: 16px; }
.choice.right { border-color: var(--ok); background: var(--ok-soft); }
.choice.wrong { border-color: var(--danger); background: var(--danger-soft); }
.answer-box { background: var(--paper); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 15px; white-space: pre-wrap; margin-bottom: 8px; }
.answer-box .lbl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 700; display: block; margin-bottom: 3px; }
.answer-box.model { background: var(--ok-soft); }
.q-card.right { box-shadow: inset 4px 0 0 var(--ok); }
.q-card.wrong { box-shadow: inset 4px 0 0 var(--danger); }
.q-card.partial { box-shadow: inset 4px 0 0 var(--brass); }
.score-hero { background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 18px; text-align: center; margin-bottom: 14px; }
.score-hero .big { font-size: 40px; font-weight: 700; color: var(--brass-2); line-height: 1.1; }
.score-hero .sub { color: rgba(244, 241, 234, 0.7); font-size: 14px; margin-top: 4px; }
.save-state { font-size: 12px; color: var(--text-3); text-align: right; min-height: 16px; }
.grade-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.grade-row input { width: 70px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; text-align: center; }
.sticky-bar { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--paper); padding: 10px 0; margin-top: 6px; border-top: 1px solid var(--line); }
.import-help { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--paper); border-radius: var(--radius-sm); padding: 10px 12px; white-space: pre; overflow-x: auto; color: var(--text-2); }
.qe { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.qe .qe-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.qe .qe-head select { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: var(--card); }
.qe .opt { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.qe .opt input[type=text] { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.qe textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; resize: vertical; }
.qe .row-tools { display: flex; gap: 6px; flex-wrap: wrap; }

@media (min-width: 700px) {
  .page { padding-top: 26px; }
  .auth-card { padding: 34px 30px 28px; }
}
