/* ShowFlow layout & components. Colours come only from theme.css variables. */

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
body > main { flex: 1; }
a { color: var(--accent); }
button { font-family: inherit; }
.mono { font-family: var(--mono); }

/* ── Suite header (identical across all apps; always dark + warm) ────────── */
.topbar {
  background: var(--headbar); color: #fff; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  font-family: var(--head); font-weight: 700; font-size: 14px; letter-spacing: .5px;
  background: #EDE7DB; color: #1A1712;            /* warm cream box, gold-free */
}
.brand .names { display: flex; flex-direction: column; line-height: 1.1; }
.brand .wordmark { font-family: var(--head); font-weight: 600; font-size: 17px; letter-spacing: 1.5px; text-transform: uppercase; color: #fff; }
.brand .subtitle { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #9C9C94; margin-top: 2px; }
.who { display: flex; align-items: center; gap: 8px; }
.topbar .btn { color: #C9C0B2; border-color: rgba(255,255,255,.18); background: transparent; }
.topbar .btn:hover { color: #fff; border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.07); }
.topbar #save-state { color: #9A9180 !important; }
@media (max-width: 600px) { .topbar { padding: 12px 14px; } }

/* ── Footer (corporate mark, subtle, dark in both modes) ────────────────── */
.app-footer {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px; margin-top: 28px; background: var(--headbar);
  color: #8B8474; font-size: 12px; letter-spacing: .3px;
}
.app-footer .nicoby-logo { height: 22px; width: auto; opacity: .85; }

/* ── Buttons (flat) ─────────────────────────────────────────────────────── */
.btn {
  appearance: none; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--btn-2-border); border-radius: var(--r-ctrl);
  padding: 7px 13px; font-size: 13px; box-shadow: none;
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.btn.primary {                       /* one graphite primary per screen */
  color: var(--accent-ink); background: var(--accent);
  border-color: var(--accent); font-weight: 600;
}
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { color: #fff; border-color: var(--danger-btn); background: var(--danger-btn); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.icon { padding: 4px 8px; line-height: 1; }

/* ── Layout shell ───────────────────────────────────────────────────────── */
main { max-width: 1080px; margin: 0 auto; padding: 26px 22px 80px; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
h1 { font-family: var(--head); font-weight: 500; font-size: 22px; margin: 0 0 4px; }
h2 { font-weight: 500; font-size: 15px; color: var(--ink-soft); margin: 0; }
.uplabel { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; color: var(--ink-faint); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 16px;
}
.list-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--brand, var(--line));
  border-radius: var(--r-card); padding: 14px 16px; margin-bottom: 10px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.list-card:hover { background: var(--surface-2); border-color: var(--brass-deep); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand, var(--ink-faint)); flex: none; }
.chip {
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--brand, var(--line)); color: var(--brand, var(--ink-soft));
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
label.field { display: block; margin-bottom: 12px; }
label.field .lab { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-ctrl);
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brass); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* ── Fit-to-window budget bar (the soul) ────────────────────────────────── */
.budget {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 14px 16px; margin-bottom: 18px;
}
.budget .top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.budget .verdict { font-size: 18px; font-weight: 500; }
.budget.over  .verdict { color: var(--danger); }
.budget.under .verdict { color: var(--warn); }
.budget.exact .verdict { color: var(--ok); }
.budget .times { color: var(--ink-soft); font-size: 13px; }
.bar {
  position: relative; height: 12px; border-radius: 999px;
  background: var(--surface-2); margin-top: 12px; overflow: hidden;
  border: 1px solid var(--line);
}
.bar .fill { height: 100%; background: var(--ok); transition: width .18s ease, background .18s; }
.budget.under .bar .fill { background: var(--warn); }
.budget.over  .bar .fill { background: var(--danger); }
.bar .target {                  /* the window-end marker */
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--brass);
}

/* ── Running order rows (colour-coded by segment type) ──────────────────── */
.seg {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--type, var(--line-soft));
  border-radius: var(--r-card); margin-bottom: 9px;
}
.seg.dragging { opacity: .45; }
/* clear line showing where the row will land */
.seg.drop-above { box-shadow: inset 0 3px 0 var(--brass); }
.seg.drop-below { box-shadow: inset 0 -3px 0 var(--brass); }
.seg-main { display: grid; grid-template-columns: 16px 96px 1fr auto auto; align-items: center; gap: 12px; padding: 11px 14px; }
.seg .drag-handle { cursor: grab; color: var(--ink-faint); font-size: 15px; line-height: 1; text-align: center;
  letter-spacing: -2px; user-select: none; align-self: center; }
.seg .drag-handle:hover { color: var(--ink); }
.seg.dragging .drag-handle { cursor: grabbing; }
.seg .id-col { display: flex; flex-direction: column; gap: 6px; align-items: start; }
.seg input.start {
  font-family: var(--mono); font-size: 16px; color: var(--ink);
  width: 70px; padding: 2px 5px; border: 1px solid transparent; border-radius: var(--r-ctrl);
  background: transparent;
}
.seg input.start:hover { border-color: var(--line); }
.seg input.start:focus { border-color: var(--brass); background: var(--bg); outline: none; }
.seg .typechip {
  align-self: start; font-size: 8.5px; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 7px; border-radius: 999px; color: var(--type, var(--ink-faint));
  background: color-mix(in srgb, var(--type, var(--ink-faint)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--type, var(--ink-faint)) 34%, transparent);
  cursor: pointer; appearance: none; -webkit-appearance: none; text-align: center;
  width: auto; max-width: 100%; white-space: nowrap;
}
select.sfx-add { appearance: none; -webkit-appearance: none; }
.seg .title-cell input {
  border: 1px solid transparent; background: transparent; padding: 5px 7px;
  font-size: 15px; border-radius: var(--r-ctrl); width: 100%;
}
.seg .title-cell input:hover { border-color: var(--line); }
.seg .title-cell input:focus { border-color: var(--brass); background: var(--bg); outline: none; }
.seg .dur { display: flex; align-items: center; gap: 5px; }
.seg .dur input { width: 50px; text-align: right; font-family: var(--mono); font-size: 15px; color: var(--ink);
  border: 1px solid transparent; background: transparent; padding: 4px 6px; border-radius: var(--r-ctrl); }
.seg .dur input:hover { border-color: var(--line); }
.seg .dur input:focus { border-color: var(--brass); background: var(--bg); outline: none; }
.seg .dur input::-webkit-inner-spin-button, .seg .dur input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.seg .dur input { -moz-appearance: textfield; }
.seg .dur .unit { font-size: 11px; color: var(--ink-faint); }
.seg .tools { display: flex; gap: 3px; align-items: center; }
.seg .type-edit { display: none; }   /* type chip toggles a select when clicked */

.seg-type-act        { --type: var(--type-act); }
.seg-type-changeover { --type: var(--type-changeover); }
.seg-type-interval   { --type: var(--type-interval); }
.seg-type-mc         { --type: var(--type-mc); }
.seg-type-doors      { --type: var(--type-doors); }
.seg-type-countdown  { --type: var(--type-countdown); }
.seg-type-custom     { --type: var(--type-custom); }

/* ── Segment detail (expanded) ──────────────────────────────────────────── */
.seg-detail { padding: 2px 14px 14px; border-top: 1px solid var(--line-soft); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 12px 0 6px; }
.detail-grid.one { grid-template-columns: 1fr; }
.field-mini .lab { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); display: block; margin-bottom: 3px; }
.field-mini input { font-size: 13px; }

/* ── Song / SFX list ────────────────────────────────────────────────────── */
.expander {
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-ctrl);
  color: var(--ink-soft); cursor: pointer; padding: 5px 10px; font-size: 11px;
  display: flex; align-items: center; gap: 6px;
}
.expander:hover { border-color: var(--brass-deep); color: var(--ink); }
.expander .count { color: var(--ink-faint); }
.songs { margin-top: 12px; }
.songs .songs-title { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-faint); margin: 4px 2px 8px; }
.song { display: grid; grid-template-columns: 24px minmax(140px, 1fr) 1.5fr 30px; gap: 12px; align-items: center; padding: 4px 0; }
.song .ord { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); text-align: right; }
.song .title input { background: transparent; border: 1px solid transparent; padding: 5px 7px; font-size: 14px; border-radius: var(--r-ctrl); width: 100%; }
.song .title input:hover { border-color: var(--line); }
.song .title input:focus { border-color: var(--brass); background: var(--bg); outline: none; }
.sfx-cell { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sfx-chip {
  font-size: 11px; padding: 2px 4px 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--warn)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--warn)) 40%, transparent);
  color: var(--c, var(--warn)); display: inline-flex; gap: 5px; align-items: center;
}
.sfx-chip .x { cursor: pointer; opacity: .7; font-size: 12px; line-height: 1; }
.sfx-chip .x:hover { opacity: 1; color: var(--danger); }
.sfx-add { font-size: 11px; padding: 3px 7px; border: 1px dashed var(--line); border-radius: 999px;
  background: transparent; color: var(--ink-faint); cursor: pointer; }
.sfx-add:hover { border-color: var(--brass-deep); color: var(--ink-soft); }
.songs .add-song { margin-top: 10px; }

/* ── Available-SFX master bar ────────────────────────────────────────────── */
.sfx-master { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 14px; margin-bottom: 14px; }
.sfx-master .lab { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-faint); margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.sfx-master .lab .hint { text-transform: none; letter-spacing: 0; color: var(--ink-faint); font-size: 11px; }
.sfx-master .pool { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sfx-master input.add-sfx { width: 150px; font-size: 12px; padding: 4px 8px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.handle { cursor: grab; color: var(--ink-faint); user-select: none; }
.handle:active { cursor: grabbing; }

/* ── Crew & talent panel ────────────────────────────────────────────────── */
.crew { margin-top: 26px; }
.crew .crew-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.crew .crew-head h2 { color: var(--ink); font-size: 15px; }
.crew-row {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--lipstick);
  border-radius: var(--r-ctrl); padding: 10px 12px; margin-bottom: 8px;
  display: grid; grid-template-columns: 1.4fr 1fr 205px 1fr 30px; gap: 10px; align-items: center;
}
.crew-row input, .crew-row select { font-size: 13px; padding: 6px 8px; }
.crew-row .times { display: flex; gap: 5px; align-items: center; }
.crew-row .times input { flex: 1; min-width: 0; font-family: var(--mono); text-align: center; padding: 6px 4px; }
.crew-row .times .dash { color: var(--ink-faint); }
.crew-empty { color: var(--ink-soft); font-size: 13px; padding: 4px 2px 10px; }

/* fill-in status line inside a segment */
.fill-line { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; flex-wrap: wrap; }
.fill-line .status-await { color: var(--ink-faint); }
.fill-line .status-done { color: var(--ok); }

/* segment may carry pinned crew chips */
.seg .crew-pins { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px 72px; }
.crew-pin { font-size: 11px; padding: 2px 9px; border-radius: 999px; color: var(--lipstick);
  border: 1px solid color-mix(in srgb, var(--lipstick) 45%, transparent);
  background: color-mix(in srgb, var(--lipstick) 14%, transparent); }

/* ── Output sheets (MC / SFX / AV visuals / contact) ────────────────────── */
.sheet-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 18px; }
.sheet-nav .btn.active { color: var(--brass); border-color: var(--brass); }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px 24px; }
.sheet h2.sheet-title { color: var(--ink); font-size: 18px; margin: 0 0 2px; }
.sheet .sheet-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet th { text-align: left; font-weight: 400; font-size: 10px; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-faint); padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
.sheet td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: top; }
.sheet td.t { font-family: var(--mono); color: var(--brass); white-space: nowrap; width: 58px; }
.sheet .seg-head td { color: var(--ink-soft); font-weight: 500; padding-top: 16px; border-bottom: 1px solid var(--line); }
.sheet .seg-head .mono { color: var(--brass); }
.sheet .muted-cell { color: var(--ink-soft); }
.sheet .empty { color: var(--ink-faint); font-style: italic; padding: 14px 10px; }
.sheet a { word-break: break-all; }
/* All sheets are in the DOM; on screen only the active one shows. Print outputs them all. */
.sheet-page + .sheet-page { margin-top: 18px; }
.sheet-page.screen-off { display: none; }

/* ── Artist library cards ───────────────────────────────────────────────── */
.artist-card { border: 1px solid var(--line); border-radius: var(--r-ctrl); padding: 10px 12px; margin-bottom: 10px; background: var(--bg); }
.artist-top { display: grid; grid-template-columns: 1.1fr 1.5fr 1.5fr 30px; gap: 8px; align-items: center; }
.artist-top .a-name { font-weight: 500; }
.artist-card input { font-size: 13px; padding: 6px 8px; }
.perf-wrap { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.perf-wrap > .lab { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); display: block; margin-bottom: 6px; }
.perf-row { display: grid; grid-template-columns: 1.4fr 1fr 30px; gap: 8px; align-items: center; margin-bottom: 6px; }
.perf-wrap .btn.small { margin-top: 2px; }

/* ── Library / picker ───────────────────────────────────────────────────── */
.lib-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctrl); margin-bottom: 8px; }
.lib-item .grow { flex: 1; }
.lib-item .meta { color: var(--ink-faint); font-size: 12px; }

/* ── Show picker (master calendar) ──────────────────────────────────────── */
.show-list { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-ctrl); margin-top: 6px; }
.show-pick {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border-left: 3px solid var(--brand, transparent); border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.show-pick:last-child { border-bottom: none; }
.show-pick:hover { background: var(--surface-2); }
.show-pick.sel { background: color-mix(in srgb, var(--brass) 14%, transparent); border-left-color: var(--brass); }
.show-pick .dot { background: var(--brand, var(--ink-faint)); }
.show-pick .chip { border-color: var(--brand, var(--line)); color: var(--brand, var(--ink-soft)); flex: none; }

.np-session { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.np-session:empty { display: none; }
.np-session .lab { font-size: 12px; color: var(--ink-soft); width: 100%; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal { width: 460px; max-width: 100%; max-height: 90vh; overflow: auto; }
.modal h1 { margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.hidden { display: none !important; }

/* ── Print: clean role sheets ───────────────────────────────────────────── */
@media print {
  .topbar, .app-footer, .toolbar, .budget .bar, .seg .actions, .seg select.type,
  .sheet-nav, .no-print, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: 100%; padding: 0; }
  .seg { border: none; border-bottom: 1px solid #ccc; border-radius: 0; }
  .seg .start { color: #000; }
  .seg .title-cell input { color: #000; }
  /* output sheets */
  .sheet { border: none; padding: 0; background: #fff; }
  .sheet h2.sheet-title, .sheet td, .sheet td.t, .sheet .seg-head .mono { color: #000 !important; }
  .sheet th { color: #444; }
  .sheet td, .sheet th { border-color: #ccc !important; }
  /* Print every sheet, each starting on a fresh page. */
  .sheet-page.screen-off { display: block !important; }
  .sheet-page + .sheet-page { break-before: page; margin-top: 0; }
}

/* ── Mobile run sheet ───────────────────────────────────────────────────── */
@media (max-width: 620px) {
  .seg { grid-template-columns: 56px 1fr auto; }
  .seg .typetag, .seg select.type { display: none; }
  main { padding: 16px 12px 80px; }
}
