:root {
  --bg: #f3f6fc;
  --surface: #ffffff;
  --surface-2: #edf1fa;
  --ink: #0f1b3d;
  --muted: #56617f;
  --line: #d9e1f0;
  --navy: #0f2557;
  --accent: #1d4fb8;
  --accent-hover: #163f94;
  --accent-soft: #e2eafb;
  --yellow: #f5c518;
  --yellow-hover: #e3b30a;
  --yellow-soft: #fff4c4;
  --yellow-ink: #7a5c00;
  --gold: var(--yellow-ink);
  --ok: #2f6b45;
  --danger: #b42318;
  --logo-ink: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 37, 87, .06), 0 4px 16px rgba(15, 37, 87, .06);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); font-size: .9rem; }

/* Brand */
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.2; color: #fff; min-width: 0; }
.logo { width: 40px; height: 40px; flex-shrink: 0; }
.brand-lg { font-size: 1.55rem; flex-direction: column; gap: .5rem; color: var(--navy); text-wrap: balance; }
.brand-lg .logo { width: 84px; height: 84px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at 50% 0%, #1d3f8f 0%, var(--navy) 60%); }
.login-card { width: 100%; max-width: 380px; border-top: 6px solid var(--yellow); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); text-align: center; display: grid; gap: 1.25rem; }
.login-card form { display: grid; gap: 1rem; text-align: left; }

/* Buttons & fields */
.btn { font: inherit; font-weight: 500; border: 1px solid transparent; border-radius: 9px; padding: .55rem 1rem; cursor: pointer; transition: background .15s, border-color .15s, color .15s; display: inline-flex; align-items: center; gap: .35rem; justify-content: center; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: #fde8e6; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.field { display: grid; gap: .3rem; font-size: .88rem; font-weight: 500; }
.field input, .field textarea, .field select {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: .6rem .75rem; width: 100%;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* Top bar & tabs */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .75rem clamp(1rem, 4vw, 2rem); background: var(--navy); border-bottom: 4px solid var(--yellow); }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.12); }
.topbar-right { display: flex; align-items: center; gap: .6rem; }
.tag { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: .25rem .6rem; border-radius: 99px; background: var(--yellow); color: var(--navy); }
.tabs { display: flex; gap: .25rem; padding: .5rem clamp(1rem, 4vw, 2rem); background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 0; z-index: 5; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: inherit; font-weight: 500; background: none; border: 0; padding: .5rem .85rem; border-radius: 8px; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; }
.tabs button:hover { color: var(--ink); background: var(--surface-2); }
.tabs button.active { color: var(--navy); background: var(--yellow-soft); box-shadow: inset 0 -3px 0 var(--yellow); }
.badge { background: var(--yellow); color: var(--navy); font-size: .72rem; font-weight: 600; min-width: 1.2rem; height: 1.2rem; padding: 0 .35rem; border-radius: 99px; display: inline-grid; place-items: center; }

/* Main */
.main { max-width: 1040px; margin: 0 auto; padding: 1.75rem clamp(1rem, 4vw, 2rem) 4rem; display: grid; gap: 1.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head p { margin-top: .25rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .9rem; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; align-items: start; }
.stack { display: grid; gap: .75rem; align-content: start; }
.empty { color: var(--muted); padding: 1.25rem; text-align: center; border: 1px dashed var(--line); border-radius: 10px; font-size: .92rem; }
.item { padding: .9rem 0; border-top: 1px solid var(--line); display: grid; gap: .3rem; }
.item:first-child { border-top: 0; padding-top: 0; }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.item-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.meta { font-size: .84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.pre { white-space: pre-wrap; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.stat .value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Tickets */
.shows { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.show-card { display: grid; gap: .7rem; }
.show-card .big { font-family: var(--font-display); font-size: 2.4rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.bar.full > div { background: var(--yellow); }
.split { display: flex; justify-content: space-between; font-size: .88rem; }
.split b { font-variant-numeric: tabular-nums; }
.sold-out { color: var(--gold); font-weight: 600; font-size: .85rem; }

/* Calendar */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; gap: .5rem; }
.cal-nav { display: flex; gap: .35rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: .75rem; font-weight: 600; color: var(--muted); text-align: center; padding: .25rem 0; text-transform: uppercase; letter-spacing: .04em; }
.cal-day { min-height: 78px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .35rem; font: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: var(--ink); overflow: hidden; }
.cal-day:hover { border-color: var(--accent); }
.cal-day.other { background: transparent; color: #a3adc4; border-color: transparent; }
.cal-day.today .num { background: var(--yellow); color: var(--navy); }
.cal-day.selected { outline: 2px solid var(--accent); outline-offset: -1px; }
.cal-day .num { font-size: .8rem; font-weight: 600; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 99px; }
.cal-chip { font-size: .72rem; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.date-pill { display: inline-grid; place-items: center; text-align: center; min-width: 52px; padding: .35rem .5rem; border-radius: 9px; background: var(--accent-soft); color: var(--accent); line-height: 1.1; }
.date-pill b { font-family: var(--font-display); font-size: 1.25rem; }
.date-pill small { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.event-row { display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: start; }

/* Cast */
.cast-table { width: 100%; border-collapse: collapse; }
.cast-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem .5rem; border-bottom: 1px solid var(--line); }
.cast-table td { padding: .7rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cast-table tr:last-child td { border-bottom: 0; }
.cast-table td.actions { text-align: right; white-space: nowrap; width: 1%; }
.cast-name { font-weight: 600; }

/* Signups */
.signups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; align-items: start; }
.names { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.names li { display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); padding: .35rem .6rem; border-radius: 7px; font-size: .9rem; }
.names li .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .2rem; }
.names li .x:hover { color: var(--danger); }
.join { display: flex; gap: .4rem; }
.join input { flex: 1; font: inherit; border: 1px solid var(--line); border-radius: 9px; padding: .45rem .65rem; min-width: 0; }
.closed-label { font-size: .72rem; text-transform: uppercase; font-weight: 600; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: .15rem .5rem; border-radius: 99px; }
.card.inactive { opacity: .7; }

/* Messages */
.msg { border-left: 3px solid transparent; padding-left: .8rem; }
.msg.unread { border-left-color: var(--accent); }
.new-pill { font-size: .7rem; font-weight: 600; color: var(--navy); background: var(--yellow); padding: .1rem .45rem; border-radius: 99px; margin-left: .4rem; vertical-align: middle; }

/* Notice */
.notice { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--navy); color: #fff; border-left: 6px solid var(--yellow); border-radius: var(--radius); padding: .9rem 1.1rem; }
.notice .btn { background: var(--yellow); color: var(--navy); }

/* Modal */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 2rem)); box-shadow: 0 20px 60px rgba(0,0,0,.25); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(15, 37, 87, .5); }
#modalForm { padding: 1.5rem; display: grid; gap: 1rem; }
#modalBody { display: grid; gap: .85rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* Toast */
.toast { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .65rem 1.1rem; border-radius: 10px; font-size: .9rem; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 2rem); }
.toast.err { background: var(--danger); }

/* Olio */
.setlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.number { display: grid; gap: 1rem; }
.number-title { display: flex; gap: .85rem; align-items: flex-start; }
.number-idx { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; width: 2.2rem; height: 2.2rem; border-radius: 99px; background: var(--yellow); color: var(--navy); display: grid; place-items: center; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.media-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; border-top: 1px solid var(--line); padding-top: 1rem; }
.media-section-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.media-section-head h3 { font-size: .95rem; }
.media { background: var(--surface-2); border-radius: 10px; padding: .6rem; display: grid; gap: .45rem; }
.media-head { display: flex; align-items: center; gap: .6rem; }
.media-label { font-weight: 600; font-size: .9rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media audio { width: 100%; height: 40px; }
.media video { width: 100%; max-height: 360px; border-radius: 8px; background: #000; }
.media-loading { font-size: .85rem; color: var(--muted); padding: .5rem 0; }
.progress { display: grid; gap: .35rem; }

@media (max-width: 760px) {
  .media-cols { grid-template-columns: 1fr; }
  .number > .item-head { flex-direction: column; }
  .grid-2 { grid-template-columns: 1fr; }
  .cal-day { min-height: 52px; padding: .2rem; }
  .cal-chip { font-size: 0; height: 6px; width: 6px; padding: 0; border-radius: 99px; background: var(--accent); }
  .cal-day .chips { display: flex; gap: 2px; flex-wrap: wrap; }
  .row { grid-template-columns: 1fr; }
  h1 { font-size: 1.45rem; }
  .topbar .brand { font-size: .98rem; }
  .topbar .logo { width: 34px; height: 34px; }
}

/* Masks badge on navy bar */
.topbar .logo { background: #fff; border-radius: 10px; padding: 3px; }
.topbar .btn { white-space: nowrap; }
.storage { display: grid; gap: .5rem; margin-bottom: 1rem; padding: .9rem 1.1rem; }
.storage-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .92rem; }
.storage .muted { margin: 0; }
.storage-warn { border-left: 4px solid var(--yellow); }
.storage-warn .bar > div { background: var(--yellow); }
