/* =========================================================================
 * Omni Flash — Signal Bay
 * Design language: a media mastering console. Prompts are signal; jobs are
 * channels being processed; the gallery is a light table of finished prints,
 * masters and scores. Warm hardware-panel palette (not cold SaaS-dark),
 * phosphor-amber VU-meter accent, cathode-teal tally light, condensed
 * industrial display type + monospace readouts for timecodes/data.
 * ======================================================================= */

:root {
  --bg: #14120e;
  --bg-2: #0f0d0a;
  --panel: #1e1b15;
  --panel-2: #26221a;
  --panel-3: #2f2a1f;
  --line: #3a3426;
  --line-bright: #4d4530;
  --text: #f3ecda;
  --muted: #a79c82;
  --dim: #6b6252;
  --accent: #ffb93d;      /* phosphor amber — VU needle */
  --accent-ink: #17130a;  /* text-on-amber */
  --accent-2: #59d6c2;    /* cathode teal — tally light */
  --good: #59d6c2;
  --bad: #ff6a5c;
  --warn: #ffb93d;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  --font-display: "Oswald", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 560px at 85% -8%, rgba(255, 185, 61, 0.08), transparent 58%),
    radial-gradient(900px 500px at -5% 108%, rgba(89, 214, 194, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

a { color: inherit; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- Shared: wordmark badge ---------- */
.wordmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--line-bright);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 185, 61, 0.08);
}
.wordmark::after { content: "OF"; }

/* ---------- Auth gate ---------- */
.auth-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(760px 480px at 50% -6%, rgba(255, 185, 61, 0.10), transparent 60%),
    var(--bg);
  z-index: 100;
  padding: 20px;
}
.auth-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 30px 30px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
}
.auth-card::before, .auth-card::after {
  content: ""; position: absolute; top: 12px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--line-bright); box-shadow: inset 0 1px 1px rgba(0,0,0,0.6);
}
.auth-card::before { left: 12px; }
.auth-card::after { right: 12px; }
.auth-logo { margin: 0 auto 14px; }
.auth-card h1 {
  margin: 4px 0 3px; font-family: var(--font-display); font-weight: 600;
  font-size: 25px; letter-spacing: 0.5px; text-transform: uppercase;
}
.auth-eyebrow {
  display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--accent-2); margin-bottom: 4px;
}
.auth-sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.auth-card form { text-align: left; }
.auth-err { color: var(--bad); font-size: 12.5px; margin: 10px 0 0; min-height: 15px; text-align: center; }
.auth-foot { margin-top: 20px; color: var(--dim); font-size: 11px; font-family: var(--font-mono); letter-spacing: 0.4px; }

.google-btn {
  display: flex; align-items: center; justify-content: center; width: 100%; gap: 10px;
  padding: 12px; background: #fff; color: #1f2328; border: 1px solid #d0d7de;
  border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 600; cursor: pointer; transition: 0.15s;
}
.google-btn:hover { box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25); background: #f7f9fb; }
.g-icon {
  width: 18px; height: 18px; border-radius: 3px; flex: none;
  background: conic-gradient(from -45deg, #ea4335 110deg, #4285f4 90deg 180deg, #34a853 180deg 270deg, #fbbc05 270deg);
}
.divider { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 10.5px; margin: 16px 0; text-transform: uppercase; letter-spacing: 1.4px; font-family: var(--font-mono); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Topbar ---------- */
.app { min-height: 100%; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 30px; border-bottom: 1px solid var(--line);
  background: rgba(20, 18, 14, 0.82); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo { flex: none; }
.brand h1 {
  margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 19px;
  letter-spacing: 0.6px; text-transform: uppercase; line-height: 1.15;
}
.brand .sub {
  margin: 1px 0 0; color: var(--accent-2); font-size: 10px; font-family: var(--font-mono);
  letter-spacing: 2px; text-transform: uppercase;
}
.top-actions { display: flex; align-items: center; gap: 12px; }

.badge {
  padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.6px; border: 1px solid var(--line); background: var(--panel-2);
  font-family: var(--font-mono); display: inline-flex; align-items: center; gap: 6px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.badge.live { color: var(--good); border-color: rgba(89, 214, 194, 0.45); box-shadow: 0 0 14px rgba(89, 214, 194, 0.2); }
.badge.live::before { background: var(--good); box-shadow: 0 0 6px var(--good); }
.badge.mock { color: var(--warn); border-color: rgba(255, 185, 61, 0.4); }
.badge.mock::before { background: var(--warn); }
.user-chip { color: var(--muted); font-size: 12px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); font-family: var(--font-mono); }

.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
}
.ghost:hover { color: var(--text); border-color: var(--dim); }
.ghost.danger:hover { color: var(--bad); border-color: var(--bad); }

/* ---------- Stat strip ---------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
  padding: 18px 30px 0; max-width: 1480px; margin: 0 auto;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; text-align: center;
}
.stat b { display: block; font-size: 22px; font-family: var(--font-mono); font-weight: 600; }
.stat span { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: 372px 1fr; gap: 20px;
  padding: 20px 30px 60px; max-width: 1480px; margin: 0 auto;
}

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px; position: relative;
}
.panel h2 {
  margin: 0 0 14px; font-family: var(--font-display); font-weight: 500; font-size: 13px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 1.6px;
}
.header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.header-row h2 { margin: 0; }

/* ---------- Composer ---------- */
.kind-toggle { display: flex; gap: 6px; margin-bottom: 16px; }
.kind {
  flex: 1; padding: 10px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  letter-spacing: 0.3px; cursor: pointer; transition: 0.15s;
}
.kind.active {
  color: var(--accent-ink); background: var(--accent); border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(255, 185, 61, 0.28);
}

.field { display: block; margin-bottom: 12px; }
.field > span { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field > span em { font-style: normal; color: var(--dim); font-family: var(--font-mono); }
.field textarea, .field input, .field select {
  width: 100%; padding: 11px 13px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px;
  font-family: var(--font-body); transition: 0.15s;
}
.field textarea:focus, .field input:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 185, 61, 0.16);
}
.field textarea { resize: vertical; font-family: inherit; line-height: 1.5; }
.checkbox-field { display: flex; align-items: flex-start; gap: 8px; }
.checkbox-field input[type="checkbox"] { width: auto; margin: 2px 0 0; accent-color: var(--accent); }
.checkbox-field span { display: block; font-size: 12px; color: var(--muted); }
.checkbox-field span em { font-style: normal; color: var(--dim); }

.params { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.params .field:nth-child(3) { grid-column: 1 / -1; }

.cta {
  width: 100%; margin-top: 8px; padding: 13px; background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--radius-sm); color: var(--accent-ink);
  font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.8px;
  text-transform: uppercase; cursor: pointer; transition: 0.15s;
}
.cta:hover { filter: brightness(1.08); box-shadow: 0 6px 20px rgba(255, 185, 61, 0.28); }
.cta:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.notes { margin: 0; padding-left: 16px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.notes code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; color: var(--accent-2); font-family: var(--font-mono); }
.live-dot { color: var(--good); }

/* ---------- Jobs (processing rack) ---------- */
.jobs { display: flex; flex-direction: column; gap: 12px; }
.empty { color: var(--dim); text-align: center; padding: 40px 20px; font-size: 13.5px; line-height: 1.6; }

.job {
  background: var(--panel); border: 1px solid var(--line); border-left: 2px solid var(--line-bright);
  border-radius: var(--radius); padding: 15px 16px; animation: rise 0.3s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.job-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.kind-tag { padding: 3px 8px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.6px; font-family: var(--font-mono); }
.kind-tag.image { background: rgba(255, 185, 61, 0.16); color: var(--accent); }
.kind-tag.video { background: rgba(89, 214, 194, 0.16); color: var(--accent-2); }
.kind-tag.soundtrack { background: rgba(255, 106, 92, 0.14); color: #ff9689; }
.status-tag { padding: 3px 8px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px; font-family: var(--font-mono); text-transform: uppercase; }
.status-tag.succeeded { background: rgba(89, 214, 194, 0.14); color: var(--good); }
.status-tag.running { background: rgba(255, 185, 61, 0.14); color: var(--accent); }
.status-tag.running::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 5px; animation: blink 1s infinite; box-shadow: 0 0 6px var(--accent); }
.status-tag.queued { background: rgba(255, 185, 61, 0.08); color: var(--muted); }
.status-tag.queued::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); margin-right: 5px; animation: blink 1s infinite; }
.status-tag.failed { background: rgba(255, 106, 92, 0.14); color: var(--bad); }
@keyframes blink { 50% { opacity: 0.3; } }
.job .time { margin-left: auto; color: var(--dim); font-size: 11px; font-family: var(--font-mono); }
.job .prompt { color: var(--text); margin: 11px 0; font-size: 14px; line-height: 1.5; }
.job-actions { display: flex; gap: 8px; margin-top: 6px; }
.job .err { color: var(--bad); font-size: 12.5px; margin-top: 6px; font-family: var(--font-mono); }

/* Signature: segmented level-meter progress, styled after a hardware VU meter */
.progress {
  height: 9px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 3px; overflow: hidden; margin: 6px 0 12px; padding: 1px;
}
.progress > i {
  display: block; height: 100%; border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--accent) 0px, var(--accent) 5px, transparent 5px, transparent 8px);
  box-shadow: 0 0 8px rgba(255, 185, 61, 0.5);
  transition: width 0.4s ease;
  animation: meter-pulse 1.7s ease-in-out infinite;
}
@keyframes meter-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }

/* ---------- Gallery (light table) ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery-grid img, .gallery-grid video {
  width: 100%; height: 150px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  cursor: zoom-in; background: #000; transition: 0.15s;
}
.gallery-grid img:hover, .gallery-grid video:hover { border-color: var(--accent); transform: scale(1.01); }
.gallery-grid img { object-fit: cover; }
.gallery-grid video { object-fit: contain; }
.gallery-grid .audio-tile, .gallery-grid .file-chip {
  height: 150px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #000;
  display: flex; align-items: center; justify-content: center; padding: 10px; box-sizing: border-box;
}
.audio-tile audio { width: 100%; }
.file-chip { color: var(--muted); font-size: 13px; text-decoration: none; transition: 0.15s; font-family: var(--font-mono); }
.file-chip:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(8, 6, 3, 0.94); display: grid; place-items: center; z-index: 60; padding: 40px; }
.lb-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 92vw; }
.lb-stage img, .lb-stage video { max-width: 88vw; max-height: 76vh; border-radius: var(--radius-sm); box-shadow: var(--shadow); object-fit: contain; background: #000; }
.lb-caption { color: var(--muted); font-size: 13px; text-align: center; max-width: 82vw; overflow-wrap: anywhere; padding: 0 120px; font-family: var(--font-mono); }
.lb-close { position: absolute; top: 22px; right: 30px; font-size: 32px; background: none; border: none; color: var(--text); cursor: pointer; line-height: 1; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); font-size: 38px; line-height: 1; color: var(--text);
  cursor: pointer; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); border-radius: 50%;
  width: 56px; height: 56px; display: grid; place-items: center;
}
.lb-nav:hover { background: rgba(0, 0, 0, 0.65); color: var(--accent); border-color: var(--accent); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-download {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 999px; cursor: pointer; font-size: 13px; box-shadow: var(--shadow);
}
.lb-download:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  color: var(--text); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px;
  box-shadow: var(--shadow); animation: slide 0.3s ease; max-width: 320px;
}
.toast.ok { border-left-color: var(--good); }
.toast.err { border-left-color: var(--bad); }
@keyframes slide { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.btn-sm { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 5px 11px; font-size: 12px; cursor: pointer; }
.btn-sm:hover { color: var(--text); border-color: var(--dim); }
.btn-sm.danger:hover { color: var(--bad); border-color: var(--bad); }

/* ---------- Toolbar + filters ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; font-family: var(--font-body); }
.filter:focus { outline: none; border-color: var(--accent); }
.filter.search { min-width: 180px; }
.count-chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; color: var(--muted); vertical-align: middle; font-family: var(--font-mono); }

/* ---------- Presets ---------- */
.presets { margin-bottom: 12px; }
.preset-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.mini { background: none; border: none; color: var(--accent-2); cursor: pointer; font-size: 12px; }
.mini:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer; text-align: left; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--accent); background: rgba(255, 185, 61, 0.1); }

/* ---------- Card meta + shortcuts ---------- */
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.meta-tag { background: var(--panel-2); border: 1px solid var(--line); color: var(--dim); border-radius: 5px; padding: 2px 7px; font-size: 10.5px; letter-spacing: 0.3px; font-family: var(--font-mono); }
.prompt.clickable { cursor: pointer; }
.prompt.clickable:hover { color: var(--accent-2); }
.hint { color: var(--dim); font-size: 11px; margin: 10px 0 0; text-align: center; font-family: var(--font-mono); }
kbd { background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; font-size: 11px; font-family: var(--font-mono); }

/* ---------- Drawer ---------- */
.blurred { filter: blur(3px) brightness(0.8); pointer-events: none; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(480px, 100%);
  background: var(--bg-2); border-left: 1px solid var(--line); z-index: 55;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-family: var(--font-display); font-weight: 500; text-transform: uppercase; letter-spacing: 0.6px; font-size: 15px; }
.drawer-body { overflow: auto; padding: 18px 20px; }
.drawer-sec { margin-bottom: 18px; }
.drawer-sec h4 { margin: 0 0 8px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.4px; font-family: var(--font-display); font-weight: 500; }
.drawer-status { display: flex; gap: 8px; margin-bottom: 12px; }
.drawer-prompt { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.drawer-prompt p { margin: 0 0 10px; line-height: 1.5; font-size: 14px; }
.param-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.param-row > span { color: var(--muted); flex: none; }
.param-row > b { text-align: right; word-break: break-word; color: var(--text); font-family: var(--font-mono); font-weight: 500; }
.out-list { display: flex; flex-direction: column; gap: 12px; }
.out-item { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.media-row img, .media-row video { width: 100%; height: 170px; object-fit: contain; background: #000; display: block; }
.out-actions { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.drawer-actions { display: flex; gap: 10px; margin-top: 6px; }
.drawer-actions .cta { margin-top: 0; flex: 1; }
.drawer-actions .ghost { flex: 0 0 auto; }

/* ---------- Reference / source upload dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius-sm); padding: 14px;
  text-align: center; margin: 0 0 12px; transition: 0.15s; background: var(--panel-2);
}
.dropzone.dragover { border-color: var(--accent-2); background: rgba(89, 214, 194, 0.06); }
.drop-icon { font-size: 20px; display: block; margin-bottom: 4px; }
.dropzone p { margin: 0 0 2px; color: var(--muted); font-size: 13px; }
.drop-note { color: var(--dim); font-size: 11px; }
.ref-preview { text-align: left; }
.ref-preview img, .ref-preview video { width: 100%; max-height: 150px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #000; margin-bottom: 8px; }
.ref-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ref-name { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.mini.danger { color: var(--bad); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(3, 1fr); }
  .topbar { padding: 14px 18px; }
}
@media (max-width: 560px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }
