/* ============================================================
   SCE Admin
   Deliberately NOT the guest app. Staff should never have to
   wonder which one they're looking at, especially at 11pm when
   they're cancelling a show. Dense, tabular, desk-first.
   ============================================================ */

:root {
  --bg:     #14161A;
  --panel:  #1D2026;
  --panel-2:#252932;
  --rule:   #333944;
  --text:   #E8EAED;
  --dim:    #98A0AD;
  --accent: #F3895B;
  --ok:     #07DA00;
  --warn:   #F3B85B;
  --danger: #FF3E3E;
  --blue:   #6E8BFF;

  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
}
body.centered {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 20px;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 26px 0 8px; text-transform: uppercase;
     letter-spacing: 0.09em; color: var(--dim); }

header.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 22px; flex-wrap: wrap; min-height: 52px;
  background: var(--panel); border-bottom: 1px solid var(--rule);
}
header.bar .brand { font-weight: 700; letter-spacing: 0.02em; }
header.bar nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 14px; color: var(--dim); }

main { max-width: 1080px; margin: 0 auto; padding: 26px 22px 70px; }

.head { display: flex; justify-content: space-between; align-items: flex-start;
        gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.flash {
  margin: 0; padding: 11px 22px;
  background: rgba(7,218,0,.12); border-bottom: 1px solid rgba(7,218,0,.3);
  font-size: 14px; line-height: 1.5;
}
/* Two flashes used to run together into one wall of text — the artist
   import emits both a "skipped" and a "no bio" message. */
.flash p { margin: 0; }
.flash p + p { margin-top: 6px; padding-top: 6px;
               border-top: 1px solid rgba(7,218,0,.22); }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--dim); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--rule);
}
td { padding: 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:hover td { background: var(--panel); }

.dim { color: var(--dim); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13.5px; white-space: nowrap; }
.strong { font-weight: 600; }
.right { text-align: right; }
.struck td:nth-child(2) .strong { text-decoration: line-through; color: var(--dim); }

code {
  font-family: var(--mono); font-size: 13px;
  background: var(--panel-2); padding: 1px 6px; border-radius: 4px;
}

/* ---------- Pills and category chips ---------- */

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  border: 1px solid var(--rule); color: var(--dim);
}
.pill.on   { background: var(--ok); border-color: var(--ok); color: #04240A; font-weight: 700; }
.pill.red  { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 700; }
.pill.blue { background: #2900F3; border-color: #2900F3; color: #fff; font-weight: 700; }
.pill.warn { background: rgba(243,184,91,.15); border-color: var(--warn); color: var(--warn); }

.cat {
  display: inline-block; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.07em; padding-left: 9px; border-left: 3px solid var(--rule);
}
.cat[data-cat="in_concert"]  { border-left-color: #FFFFFF; }
.cat[data-cat="enjoy"]       { border-left-color: #07DA00; }
.cat[data-cat="learn"]       { border-left-color: #F3895B; }
.cat[data-cat="information"] { border-left-color: #6B7280; }

/* ---------- Day tabs ---------- */

.daytabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.daytabs a {
  padding: 6px 12px; border: 1px solid var(--rule); border-radius: 7px;
  font-size: 14px; background: var(--panel);
}
.daytabs a.on { background: var(--accent); border-color: var(--accent); color: #241004; font-weight: 650; }
.daytabs a.on .dim { color: rgba(36,16,4,.7); }

/* ---------- Panels and forms ---------- */

.panel {
  background: var(--panel); border: 1px solid var(--rule);
  border-radius: 10px; padding: 18px; margin-bottom: 16px;
}
.panel.narrow { width: 100%; max-width: 340px; }
.panel.muted { background: transparent; }
.panel.warnbox { border-color: var(--warn); background: rgba(243,184,91,.07); }
.panel ul { margin: 8px 0 0; padding-left: 18px; }
.panel li { margin-bottom: 5px; font-size: 14px; color: var(--dim); }

label {
  display: block; font-size: 12.5px; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--dim);
  margin: 14px 0 5px; font-weight: 600;
}
label:first-child { margin-top: 0; }
label .dim { text-transform: none; letter-spacing: 0; font-weight: 400; }
label.check {
  display: flex; align-items: center; gap: 9px;
  text-transform: none; letter-spacing: 0; font-size: 14.5px;
  color: var(--text); font-weight: 400;
}

input[type="text"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="file"], select, textarea,
input[type="date"], input[type="time"], input[type="email"],
input[type="url"], input[type="search"], input[type="tel"] {
  width: 100%; padding: 9px 11px;
  font-family: var(--sans); font-size: 15px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--rule); border-radius: 7px;
}
textarea { resize: vertical; line-height: 1.5; }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.row label { margin-top: 14px; }

.btn {
  display: inline-block; padding: 8px 14px;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--rule); border-radius: 7px; cursor: pointer;
}
.btn:hover { text-decoration: none; border-color: var(--dim); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #241004; }
.btn.danger  { background: transparent; border-color: var(--danger); color: var(--danger); }

button.link {
  background: none; border: none; color: var(--dim);
  font-family: var(--sans); font-size: 13.5px; cursor: pointer; padding: 0;
}
button.link:hover { color: var(--text); text-decoration: underline; }

.danger-zone {
  display: flex; align-items: center; gap: 12px;
  padding-top: 14px; border-top: 1px solid var(--rule);
}

.error {
  margin-top: 12px; padding: 9px 12px; border-radius: 7px; font-size: 14px;
  background: rgba(255,62,62,.12); border: 1px solid rgba(255,62,62,.4);
  color: #FF9C9C;
}

/* ---------- Import diff ---------- */

.counts { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 6px; }
.count {
  padding: 10px 16px; border-radius: 9px;
  border: 1px solid var(--rule); background: var(--panel);
  font-size: 13px; color: var(--dim);
}
.count b { display: block; font-size: 21px; color: var(--text); line-height: 1.2; }
.count.new b { color: var(--ok); }
.count.chg b { color: var(--warn); }
.count.rem b { color: var(--danger); }

.was { color: var(--danger); text-decoration: line-through; }
.now { color: var(--ok); }

details.panel summary {
  cursor: pointer; font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim);
}
details.panel[open] summary { margin-bottom: 14px; }

.quoted {
  margin-top: 6px; padding: 7px 10px;
  border-left: 3px solid var(--rule); background: var(--bg);
  border-radius: 0 6px 6px 0; color: var(--dim);
}

/* Renamed from .bar — it collided with the header .bar above, which
   made every admin page render its header as a 9px orange stripe with
   the brand and nav overlapping on top of each other. */
.meter {
  display: block; height: 9px; border-radius: 5px;
  background: var(--accent); min-width: 2px;
}


/* Hidden artists stay in the list -- you have to be able to find them to
   un-hide them -- but should read as inactive at a glance. */
tr.is-hidden-row td { opacity: .55; }
tr.is-hidden-row td .pill.warn { opacity: 1; }

/* ---------- Sailings: past list and at-sea marker ---------- */
.pill.sea { margin-left: 8px; background: rgba(110,139,255,.16);
            border-color: var(--blue); color: var(--blue); font-weight: 700; }
.past-sailings { opacity: .72; }
.past-sailings:hover { opacity: 1; }
.past-tabs { margin: -6px 0 16px; }
.past-tabs summary { cursor: pointer; margin-bottom: 8px; }

/* ---------- Programming watch: fill meter ---------- */
.fill { display: inline-flex; align-items: center; gap: 8px; }
.fill-bar { display: inline-block; width: 90px; height: 8px;
            background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.fill-bar i { display: block; height: 100%; background: var(--ok); }
.fill.tight .fill-bar i { background: var(--warn); }
.fill.tight .mono { color: var(--warn); }
.fill.over .fill-bar i { background: var(--danger); }
.fill.over .mono { color: var(--danger); font-weight: 700; }
.fill.light .fill-bar i { background: var(--blue); }

header.bar nav a.on { color: var(--text); font-weight: 650; }

/* ============================================================
   Phone layout
   ============================================================
   The desk layout squeezed six columns into 390px (dates broke over
   five lines, "AT SEA NOW" wrapped into a circle). On a phone:
     - the nav is one row that scrolls sideways, current page lit
     - every table becomes a stack of cards, each value labelled
       with its column heading (data-label, set by admin/base.html)
     - inputs are 16px so iOS doesn't zoom the page on focus
   ============================================================ */
@media (max-width: 720px) {
  header.bar {
    display: block; padding: calc(env(safe-area-inset-top) + 10px) 0 0;
    position: sticky; top: 0; z-index: 20;
  }
  header.bar .brand { display: block; padding: 0 16px 8px; font-size: 16px; }
  header.bar nav {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 6px; padding: 0 12px 10px; font-size: 15px; scrollbar-width: none;
  }
  header.bar nav::-webkit-scrollbar { display: none; }
  header.bar nav a {
    flex: 0 0 auto; padding: 7px 12px; border-radius: 999px;
    border: 1px solid var(--rule); white-space: nowrap;
  }
  header.bar nav a.on { background: var(--accent); border-color: var(--accent); color: #241004; }
  header.bar nav a:hover { text-decoration: none; }

  main { padding: 16px 14px calc(env(safe-area-inset-bottom) + 50px); }
  .flash { padding: 11px 16px; }

  .head { gap: 12px; }
  .head h1 { width: 100%; }
  .head .actions { width: 100%; }
  .head .actions > *, .head .actions form { flex: 1 1 0; }
  .head .actions .btn, .head .actions form .btn { width: 100%; text-align: center; }

  .btn { padding: 10px 14px; font-size: 15px; min-height: 42px; }
  input[type="text"], input[type="password"], input[type="number"],
  input[type="datetime-local"], input[type="file"], select, textarea,
  input[type="date"], input[type="time"], input[type="email"],
  input[type="url"], input[type="search"], input[type="tel"] {
    font-size: 16px; padding: 11px 12px; min-height: 44px;
  }

  .daytabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
             padding-bottom: 4px; scrollbar-width: none; }
  .daytabs::-webkit-scrollbar { display: none; }
  .daytabs a { flex: 0 0 auto; white-space: nowrap; }

  .counts { display: grid; grid-template-columns: 1fr 1fr; }
  .panel { padding: 14px; }
  .pill { white-space: nowrap; }

  /* ---- tables as cards ---- */
  table.stack { margin-bottom: 14px; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr {
    background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 10px;
  }
  table.stack tr:hover td { background: transparent; }
  table.stack td {
    border: none; padding: 4px 0;
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 12px; text-align: right; min-width: 0;
  }
  table.stack td::before {
    content: attr(data-label); flex: 0 0 auto; text-align: left;
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--dim); font-weight: 600;
  }
  /* First cell is the row's title: full width, no label. */
  table.stack td:first-child {
    display: block; text-align: left; font-size: 16px;
    padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--rule);
  }
  table.stack td:first-child::before,
  table.stack td[data-label=""]::before { display: none; }
  table.stack td[data-label=""] { justify-content: flex-start; text-align: left; }
  table.stack td:empty { display: none; }
  table.stack td .actions { justify-content: flex-end; }
  table.stack td input, table.stack td select { max-width: 60%; }
}

/* ---------- Suggestions ---------- */
.sugg-table td { padding: 14px 10px; }
.sugg-text { white-space: pre-wrap; font-size: 15.5px; line-height: 1.5; }
@media (max-width: 720px) {
  .sugg-table tr td { padding: 14px 4px; }
  .sugg-table .actions .btn { flex: 1 1 auto; }
}

/* ---------- Event list: search, postponed ---------- */
.event-search { display: flex; gap: 8px; margin: 0 0 14px; }
.event-search input { flex: 1 1 auto; }
.pill.danger-pill { background: rgba(255,90,80,.15); border-color: var(--danger); color: var(--danger); }
tr.dimmed td:nth-child(2) .strong, tr.dimmed td.mono { opacity: .65; }
@media (max-width: 720px) {
  .event-search { flex-wrap: wrap; }
  .event-search input { flex: 1 0 100%; }
  .event-search .btn { flex: 1 1 0; }
}

/* ---------- Database patches ---------- */
pre.sql {
  white-space: pre-wrap; font-family: var(--mono, ui-monospace, monospace);
  font-size: 12.5px; line-height: 1.5; color: var(--dim);
  background: var(--panel-2); border-radius: 8px; padding: 10px 12px;
  margin: 8px 0 0; max-height: 320px; overflow: auto;
}
.warn-text { color: var(--warn); }

/* ---- Admin -> Crew ---- */
.crew-form .row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 8px 0; }
.crew-form .row label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.crew-form .row label.check { flex-direction: row; align-items: center; gap: 6px; }
.crew-form .row input[type="text"], .crew-form .row input:not([type]),
.crew-form .row input[type="date"] { min-width: 0; }
input[type="color"] { width: 48px; height: 32px; padding: 0; border: 0; background: none; }

/* ---- Accounts, Team and the portal ---- */
.panel.narrow button[type="submit"]:not(.btn) {
  width: 100%; margin-top: 18px; padding: 10px 14px;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  background: var(--accent); color: #241004;
  border: 1px solid var(--accent); border-radius: 7px; cursor: pointer;
}
.panel.narrow .btn { margin-top: 14px; }
.setup-box { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--rule); }
.setup-box h2 { margin-top: 0; }
.secret {
  display: inline-block; font-family: var(--mono); font-size: 20px; letter-spacing: 0.06em;
  background: var(--bg); border: 1px dashed var(--warn); border-radius: 8px;
  padding: 8px 14px; margin: 6px 0 4px; user-select: all;
}
.charter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #0B2545; color: #E8EEF7; font-size: 13.5px; padding: 7px 20px;
}
.charter-bar form { margin: 0; }
.charter-bar button.link { color: #B9C7DD; }
.inline { display: inline; margin: 0; }
.inline select { width: auto; min-width: 7.5em; padding: 4px 8px; font-size: 13.5px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 0 0 16px; }
.stat { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 14px; }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2);
        border: 1px solid var(--rule); border-radius: 999px; padding: 3px 4px 3px 11px; font-size: 13.5px; }
.chip form { margin: 0; }
.chip button.link { padding: 0 6px; }
.chip .pill { margin: 0; }
@media (max-width: 720px) {
  table.stack td .chips { justify-content: flex-end; }
  table.stack td .chip { border-radius: 12px; text-align: left; }
  table.stack td form.inline select { min-width: 0; max-width: 42vw; }
}
/* ---- Branding ---- */
.brand-grid { align-items: start; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.brand-preview { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.brand-preview figure { margin: 0; text-align: center; }
.brand-preview figcaption { font-size: 12px; color: var(--dim); margin-top: 6px; }
.phone-home { width: 120px; height: 150px; border-radius: 18px; border: 1px solid var(--rule);
  background: linear-gradient(160deg, #3a4a6b, #1b2133); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; }
.phone-home img { width: 60px; height: 60px; border-radius: 14px; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.phone-home span { font-size: 11px; color: #fff; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-splash { width: 72px; height: 150px; border-radius: 12px; overflow: hidden; border: 1px solid var(--rule); }
.phone-splash img { width: 100%; height: 100%; object-fit: cover; display: block; }
#brand-meter { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 8px; }
#brand-meter i { display: block; height: 100%; background: var(--accent); transition: width .2s; }

.artist-photo-row { display: flex; gap: 14px; align-items: flex-start; }
.artist-photo-row > div { flex: 1; min-width: 0; }
.artist-photo-now { width: 96px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--bg);
  border: 1px solid var(--rule); flex: 0 0 auto; }
