@import url('https://api.fontshare.com/v2/css?f[]=general-sans@400,500,600,700&display=swap');
/* MediaHaus Portal — "warm premium" theme (matches Mission Control). */

:root {
  --ink: #F2EBDE;          /* warm cream text */
  --muted: #A99C88;
  --line: #37301F;
  --bg: #171310;           /* warm near-black */
  --panel: #221D17;        /* cards / inputs / bins */
  --bg-soft: #2C261E;      /* softer panel / fills */
  --accent: #CE7E58;       /* terracotta */
  --accent-ink: #ffffff;   /* text on accent */
  --ok: #4ec99a;
  --warn: #e8b24d;
  --danger: #f08a7a;
  --radius: 12px;
  --maxw: 760px;
  --topbar-bg: rgba(14,16,20,.85);
  color-scheme: dark;
}

/* Light theme — override the palette; everything built on var(--…) flips automatically. */
html[data-theme="light"] {
  --ink: #2A2620;
  --muted: #736A5E;
  --line: #EAE1D3;
  --bg: #FAF6F0;
  --panel: #FFFFFF;
  --bg-soft: #F3ECE1;
  --accent: #B96A47;
  --accent-ink: #FFFFFF;
  --ok: #2f855a;
  --warn: #b45309;
  --danger: #dc2626;
  --topbar-bg: rgba(255,255,255,.85);
  color-scheme: light;
}

/* Theme toggle button (auto-added to .topbar-right by theme.js). */
.theme-toggle {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; width: 32px; height: 32px; font-size: 15px; line-height: 1; padding: 0;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
/* Shared line-icon (Lucide via /js/icons.js) — inherits text color, aligns with adjacent text. */
.ic { flex: 0 0 auto; vertical-align: -0.15em; display: inline-block; }

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: 'General Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }

/* Top bar with wordmark */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--topbar-bg); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); z-index: 10;
}
.wordmark {
  font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; font-size: 18px;
  text-decoration: none; color: var(--ink); display: inline-flex; align-items: center;
}
.wordmark img.logo { height: 90px; width: auto; display: block; filter: invert(1); }
html[data-theme="light"] .wordmark img.logo { filter: none; }
.topbar .topbar-right { font-size: 14px; color: var(--muted); display: flex; gap: 14px; align-items: center; }

/* Page container */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 64px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 28px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
p.lead { color: var(--muted); margin-top: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 12px 18px; font-size: 16px; font-weight: 700; cursor: pointer; text-decoration: none; width: 100%;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; }

/* Inputs */
label.field { display: block; margin: 16px 0 6px; font-weight: 600; font-size: 14px; }
input[type="email"], input[type="text"], textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; font-size: 16px; font-family: inherit; background: var(--panel); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }

/* Cards */
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  background: var(--panel); text-decoration: none; color: inherit; display: block; transition: border-color .15s, transform .12s;
}
.card:hover { border-color: var(--muted); }

/* Status badges — dark tinted */
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line);
}
.badge.scheduled { background: rgba(91,140,255,.14);  color: #8fb0ff; border-color: rgba(91,140,255,.32); }
.badge.uploaded  { background: rgba(52,211,153,.14);  color: #5ee0b0; border-color: rgba(52,211,153,.32); }
.badge.culling   { background: rgba(251,191,36,.14);  color: #fcd34d; border-color: rgba(251,191,36,.32); }
.badge.editing   { background: rgba(185,139,255,.14); color: #cbb0ff; border-color: rgba(185,139,255,.32); }
.badge.delivered { background: rgba(139,147,161,.16); color: #aeb6c4; border-color: rgba(139,147,161,.32); }

/* Helpers */
.muted { color: var(--muted); }
.notice { padding: 12px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.notice.error { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.35); color: #fca5a5; }
.notice.ok { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.35); color: #6ee7b7; }
.hidden { display: none !important; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { height: 12px; }

/* Shoot header */
.shoot-head { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; background: var(--panel); }
.shoot-head h1 { font-size: 20px; }
.shoot-head .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* Drop zones */
.bins { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 620px) { .bins { grid-template-columns: 1fr 1fr; } }

.bin {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 16px;
  transition: border-color .15s, background .15s; background: var(--panel);
}
.bin.dragover { border-color: var(--accent); background: var(--bg-soft); }
.bin.hasfiles { border-style: solid; border-color: rgba(52,211,153,.45); }
.bin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bin-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.bin-check { color: var(--ok); font-weight: 700; display: none; }
.bin.hasfiles .bin-check { display: inline; }
.bin-count { font-size: 13px; color: var(--muted); }
.bin-hint { font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.bin-warn { margin: 2px 0 10px; padding: 9px 11px; border-radius: 8px; background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.4); color: #fcd34d; font-size: 13px; line-height: 1.45; }
.bin label.browse {
  display: inline-block; cursor: pointer; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; background: var(--bg-soft); color: var(--ink);
}
.bin label.browse:hover { border-color: var(--accent); }
.bin input[type="file"] { display: none; }

/* Upload summary + (collapsible) file rows */
.files { margin-top: 12px; }
.upsummary { font-size: 14px; }
/* One combined upload status across all bins (count + total speed in Mbps + ETA) */
.upglobal { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600;
  color: var(--ink); background: var(--bg-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.upglobal::before { content: "↑"; color: var(--accent); font-weight: 800; }
.uprow { display: flex; align-items: center; gap: 10px; }
.upsummary .uptext { color: var(--ink); font-weight: 600; }
.upsummary.hasfail .uptext { color: var(--danger); }
.uptoggle { margin-left: auto; background: none; border: none; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0; }
.upfiles { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.file { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 13px; }
.file .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .state { font-size: 12px; color: var(--muted); justify-self: end; }
.file .state.done { color: var(--ok); }
.file .state.error { color: var(--danger); }
.file .bar { grid-column: 1 / -1; height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.file .bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.file .bar > i.done { background: var(--ok); }
.file .bar > i.error { background: var(--danger); }
.file .retry { grid-column: 1 / -1; justify-self: start; font-size: 12px; padding: 4px 10px; }

/* Admin status tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 20px; }
.tab {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Admin intake block + done chips */
.intake { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }
.intake .notes { font-size: 16px; white-space: pre-wrap; }
.intake .issues { color: var(--warn); font-size: 14px; margin-top: 8px; white-space: pre-wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); }
.chip.on { background: rgba(52,211,153,.14); color: #5ee0b0; border-color: rgba(52,211,153,.3); }

.admin-card .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.statusset { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.statusset select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; background: var(--panel); color: var(--ink); }

/* Bin file gallery (view / delete actual Dropbox files) */
.viewfiles { margin-top: 10px; }
/* Inline culling gallery on the admin card */
.cull-host { margin-top: 12px; width: 100%; }
.cull-host .cull-tabs { margin: 0 0 10px; }

.gallery { margin-top: 10px; }
.gallery.fs { position: fixed; inset: 0; z-index: 1000; margin: 0; background: var(--bg); overflow: auto; padding: 12px 16px; }
.gallery.fs .gallery-bar { position: sticky; top: 0; background: var(--bg); padding: 10px 0; z-index: 1; margin-bottom: 12px; }
.gallery.fs .tiles, .gallery.fs .bgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.gallery.fs .bracket-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gallery.fs .tile .thumb { height: auto; aspect-ratio: 3 / 2; }
.gallery.fs .tile .fname { font-size: 12px; }
.gallery .note { font-size: 13px; color: var(--muted); padding: 4px 0; }
.gallery .tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bcard { position: relative; }
.bcard.expanded { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.bbadge { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.bexpand { position: absolute; bottom: 22px; right: 3px; width: 22px; height: 22px; border: none; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 22px; padding: 0; }
.bexpand:hover { background: var(--accent); }
.bracket-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.bracket-head label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.bracket-head input { width: 16px; height: 16px; accent-color: var(--accent); }
.bcollapse { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.bracket-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.tile { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg-soft); cursor: pointer; }
.tile .thumb { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; background: var(--bg-soft); }
.tile .thumb.placeholder { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.tile .fname { font-size: 10px; padding: 3px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.tile.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.tile .check {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; line-height: 20px; text-align: center; display: none;
}
.tile.selected .check { display: block; }
.gallery-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.gallery-bar .count { font-size: 13px; color: var(--muted); margin-left: auto; }
.stacklbl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.stacklbl select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: var(--panel); color: var(--ink); }

/* Intake checkboxes */
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Per-bin notes — shown only once the bin has files */
.bin-notes { display: none; margin-top: 12px; }
.bin.hasfiles .bin-notes { display: block; }
.bin-notes label.field { margin: 0 0 6px; }
.bin-notes textarea { min-height: 60px; }

/* Per-bin upload bar + ETA */
.upbar { height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.upbar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.upmeta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Phone: the bar's eight controls flex-wrap into a ragged block where the buttons land in
   different places depending on how long the file-count sentence is. Lay them on a 3-column
   grid instead, so every row is deliberate: the summary on its own line, the three selection
   actions sharing a row, then bracket stacking beside Expand all. Fullscreen takes a full
   row rather than leaving a stray two-thirds gap.
   Placement is by auto-flow, not fixed columns, so annotate mode — which omits the select and
   delete buttons and the "n selected" counter — collapses to a tidy two rows on its own. */
@media (max-width: 760px) {
  .gallery-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
  .gallery-bar .btn { font-size: 12px; padding: 9px 6px; white-space: normal; line-height: 1.2; }
  .gallery-bar .filecount { order: -1; grid-column: 1 / -1; line-height: 1.35; align-self: center; }
  .gallery-bar .stacklbl { grid-column: span 2; }
  .gallery-bar .stacklbl select { flex: 1; min-width: 0; }
  .gallery-bar .fsbtn { grid-column: 1 / -1; }
  .gallery-bar .count { grid-column: 1 / -1; margin-left: 0; align-self: center; }
  /* Fullscreen is still reachable here, and five tiles across a phone is unusable — match
     the inline grid so the button stays worth pressing. */
  .gallery.fs { padding: 10px 12px; }
  .gallery.fs .tiles, .gallery.fs .bgrid, .gallery.fs .bracket-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
