:root {
  --bg: #0b0d0e;
  --panel: #121516;
  --line: #23282a;
  --txt: #e8e6e1;
  --dim: #8a8f8c;
  --amber: #ffb000;
  --green: #33d17a;
  --red: #e5484d;
  --mono: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #0e1112;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--amber); font-size: 18px; letter-spacing: 2px; }
.brand-name { font-weight: 800; letter-spacing: 3px; font-size: 15px; }

.btn-buy {
  background: var(--amber); color: #111;
  border: 0; border-radius: 6px;
  padding: 10px 18px; font-weight: 700; font-size: 14px;
  cursor: pointer;
}
.btn-buy:hover { filter: brightness(1.1); }
.btn-buy.big { font-size: 16px; padding: 14px 28px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 32px 20px 60px; }

.hero h1 {
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.05; font-weight: 800; letter-spacing: -1px;
}
.hero .sub { color: var(--dim); margin-top: 10px; font-size: 17px; max-width: 560px; }

.panel {
  margin-top: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.ch-label {
  font-family: var(--mono); font-size: 12px; letter-spacing: 2px;
  color: var(--green);
  border: 1px solid var(--green); border-radius: 4px; padding: 3px 8px;
}
.btn-ghost {
  background: transparent; color: var(--dim);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { color: var(--txt); border-color: var(--dim); }

textarea {
  width: 100%;
  background: #0a0c0d; color: var(--txt);
  border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--mono); font-size: 14px; line-height: 1.7;
  padding: 14px; resize: vertical; min-height: 150px;
}
textarea:focus { outline: none; border-color: var(--amber); }

.hint { color: var(--dim); font-size: 13px; margin-top: 10px; }
.hint code { color: var(--amber); font-family: var(--mono); font-size: 12px; }

.btn-go {
  margin-top: 16px;
  background: var(--green); color: #06110a;
  border: 0; border-radius: 8px;
  padding: 14px 30px; font-weight: 800; font-size: 16px; letter-spacing: 1px;
  cursor: pointer; width: 100%;
}
.btn-go:hover { filter: brightness(1.08); }

.output { margin-top: 36px; }
.output.hidden { display: none; }
.output-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.output-head h2 { font-size: 22px; letter-spacing: 1px; }
.output-head .btn-go { width: auto; margin-top: 0; padding: 10px 22px; font-size: 14px; }

.plot-frame {
  background: #0e1112;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px;
}
#stageSvg { width: 100%; height: auto; display: block; }

.legend { display: flex; gap: 18px; padding: 10px 6px 4px; color: var(--dim); font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot.mic { background: var(--amber); }
.dot.di { background: var(--green); border-radius: 2px; }
.dot.wedge { background: var(--red); border-radius: 0; clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%); }

.table-title { margin: 28px 0 12px; font-size: 22px; letter-spacing: 1px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--panel); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th {
  font-family: var(--mono); font-size: 11px; letter-spacing: 2px;
  color: var(--dim); background: #0e1112;
}
tbody tr:last-child td { border-bottom: 0; }
td.ch { font-family: var(--mono); color: var(--amber); font-weight: 700; }
td.mic-cell { font-family: var(--mono); font-size: 13px; }

.buy-cta {
  margin-top: 34px; text-align: center;
  border: 1px dashed var(--line); border-radius: 10px; padding: 28px 20px;
}
.buy-cta p { color: var(--dim); margin-bottom: 14px; }

footer { text-align: center; color: var(--dim); font-size: 13px; padding: 26px; border-top: 1px solid var(--line); }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 28px; max-width: 420px; width: 100%; text-align: center;
}
.modal-box h3 { margin-bottom: 8px; }
.modal-box p { color: var(--dim); font-size: 14px; margin-bottom: 16px; }
.modal-box form { display: flex; gap: 8px; margin-bottom: 12px; }
.modal-box input {
  flex: 1; background: #0a0c0d; border: 1px solid var(--line); border-radius: 6px;
  color: var(--txt); padding: 10px 12px; font-size: 14px;
}
.modal-box .btn-go { width: auto; margin-top: 0; padding: 10px 18px; font-size: 14px; }
.wait-msg { color: var(--green); font-weight: 700; }

@media (max-width: 640px) {
  .output-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .output-head .btn-go { width: 100%; }
  .modal-box form { flex-direction: column; }
}

/* ---------- SVG stage plot ---------- */
#stageSvg .grid-line { stroke: #1c2123; }
#stageSvg .stage-rect { }
#stageSvg .aud-label {
  fill: #8a8f8c; font-family: var(--mono); font-size: 13px; letter-spacing: 4px;
}
#stageSvg .node-label {
  fill: #e8e6e1; font-size: 13px; font-weight: 700; font-family: var(--mono);
}
#stageSvg .node-mic {
  fill: #8a8f8c; font-size: 10.5px; font-family: var(--mono);
}
#stageSvg .di-text {
  fill: #06110a; font-size: 9px; font-weight: 800; font-family: var(--mono);
}

/* ---------- PRINT → PRODUCTION PDF ---------- */
.print-legend, .print-footer { display: none; }

@media print {
  @page { size: landscape; margin: 10mm; }
  .no-print { display: none !important; }
  body { background: #fff !important; color: #111; }
  .wrap { max-width: 100%; padding: 0; }
  .output.hidden, #sharedView.hidden { display: block !important; }
  .output, #sharedView { margin-top: 0; }
  .gig-header { margin-bottom: 8pt; }
  .gig-header h3 { color: #111; font-size: 22pt; letter-spacing: .5pt; }
  .gh-meta { color: #444; font-size: 10.5pt; }
  .plot-frame {
    border: 1.5pt solid #111; background: #fff; border-radius: 0;
    padding: 6pt; page-break-inside: avoid;
  }
  .table-title { color: #111; font-size: 15pt; margin: 14pt 0 6pt; page-break-after: avoid; }
  .table-wrap { border: 1pt solid #111; border-radius: 0; }
  table { background: #fff; font-size: 9.5pt; }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }
  th { background: #eee; color: #333; font-size: 8pt; }
  th, td { border-bottom: .75pt solid #ccc; color: #111; padding: 5pt 7pt; }
  td.ch { color: #8a4b00; }
  .notes-out { margin-top: 14pt; }
  .notes-out p { color: #111; font-size: 10.5pt; }
  #stageSvg text, #sharedSvg text { fill: #111 !important; }
  #stageSvg .di-text, #sharedSvg .di-text { fill: #06110a !important; }
  #stageSvg .node-mic, #sharedSvg .node-mic { fill: #555 !important; }
  #stageSvg .stage-rect, #sharedSvg .stage-rect { fill: #fff !important; stroke: #111 !important; }
  #stageSvg .grid-line, #sharedSvg .grid-line { stroke: #e6e6e6 !important; }
  #stageSvg .aud-label, #sharedSvg .aud-label { fill: #666 !important; }
  .print-legend {
    display: block; color: #333; font-size: 9pt; font-family: var(--mono);
    padding: 4pt 2pt 0; letter-spacing: 1pt;
  }
  .print-footer {
    display: block; margin-top: 12pt; padding-top: 6pt;
    border-top: 1pt solid #999; color: #666; font-size: 8.5pt;
    font-family: var(--mono); letter-spacing: .5pt;
  }
  footer, .topbar, #landingView { display: none !important; }
}

/* HEADROOM tie-in */
footer { text-align: center; color: var(--dim); font-size: 13px; padding: 26px; border-top: 1px solid var(--line); }
footer a { color: inherit; text-decoration: none; opacity: .8; }
footer a:hover { opacity: 1; }

/* Gig details + notes */
.gig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gig-grid input, .saved-actions input {
  background: #0a0c0d; border: 1px solid var(--line); border-radius: 6px;
  color: var(--txt); padding: 10px 12px; font-size: 14px; width: 100%;
  color-scheme: dark;
}
.gig-grid input:focus, .saved-actions input:focus { outline: none; border-color: var(--amber); }
.gig-grid input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}
.gig-grid input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
#stageNotes {
  min-height: 70px;
}
.gig-header { margin-bottom: 14px; }
.gig-header h3 { font-size: 26px; letter-spacing: .5px; }
.gh-meta { color: var(--dim); font-size: 14px; margin-top: 4px; }
.notes-out { margin-top: 28px; }
.notes-out p { white-space: pre-wrap; color: var(--txt); font-size: 15px; }
.notes-out.hidden { display: none; }

/* Saved plots */
.saved-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.saved-item {
  display: flex; align-items: center; gap: 8px;
  background: #0a0c0d; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 12px; font-size: 13px;
}
.saved-item button { background: none; border: none; cursor: pointer; font-size: 13px; }
.saved-item .load { color: var(--green); font-weight: 700; }
.saved-item .del { color: var(--red); }
.saved-actions { display: flex; gap: 8px; }
.saved-actions input { flex: 1; }

/* Editable table cells */
td.editable { cursor: text; }
td.editable:hover { background: #1a1e1f; }
td.editing { padding: 0; }
td.editing input {
  width: 100%; background: #0a0c0d; border: 1px solid var(--amber);
  color: var(--txt); padding: 10px 12px; font-size: 14px; border-radius: 4px;
}

@media (max-width: 640px) {
  .gig-grid { grid-template-columns: 1fr; }
  .saved-actions { flex-direction: column; }
}

/* HEADROOM CTA banner — standard component for all builds */
.hr-banner { margin-top: 36px; }
.hr-banner-inner {
  display: flex; align-items: center; gap: 16px;
  background: #0e1112;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 10px;
  padding: 18px 20px;
}
.hr-banner-mark { color: var(--txt); font-size: 20px; letter-spacing: 2px; flex-shrink: 0; }
.hr-banner-text { flex: 1; }
.hr-banner-text strong { display: block; font-size: 15px; letter-spacing: .5px; }
.hr-banner-text span { color: var(--dim); font-size: 13px; display: block; }
.hr-banner-text .banner-sub { margin-top: 6px; font-size: 12px; }
.hr-banner-text code {
  font-family: var(--mono); font-size: 12px;
  background: #1a1e1f; padding: 2px 6px; border-radius: 4px;
  color: var(--amber);
}
.btn-hr {
  flex-shrink: 0;
  background: transparent; color: var(--txt);
  border: 1px solid var(--dim); border-radius: 6px;
  padding: 10px 18px; font-size: 14px; font-weight: 700;
  text-decoration: none; white-space: nowrap;
}
.btn-hr:hover { border-color: var(--txt); }
@media (max-width: 640px) {
  .hr-banner-inner { flex-direction: column; align-items: flex-start; }
}

.error-bar {
  background: #3d1414;
  border: 1px solid #e5484d;
  color: #ffb4b4;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
}
.error-bar.hidden { display: none; }
.saved-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.saved-row .btn-ghost:first-child { flex: 1; text-align: left; }

/* ---------- Landing (logged out) ---------- */
.landing { max-width: 980px; margin: 0 auto; padding: 48px 20px 60px; }
.landing-hero { text-align: left; padding: 30px 0 10px; }
.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: 3px;
  color: var(--green); margin-bottom: 16px;
}
.landing-hero h1 {
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1.02; font-weight: 800; letter-spacing: -1.5px;
}
.landing-hero .sub { color: var(--dim); margin-top: 14px; font-size: 18px; max-width: 620px; }
.landing-ctas { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.landing-ctas.center { justify-content: center; margin: 34px 0 10px; }
.btn-go.big.try-free, .btn-ghost.big { width: auto; margin-top: 0; padding: 14px 30px; font-size: 16px; }
.micro { color: var(--dim); font-size: 13px; margin-top: 12px; }
.landing-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin: 44px 0;
}
.l-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px;
}
.l-card h3 { font-size: 16px; margin-bottom: 8px; letter-spacing: .3px; }
.l-card p { color: var(--dim); font-size: 14px; }
.landing-next { margin: 10px 0 30px; }
.landing-next h2 { font-size: 22px; letter-spacing: 1px; margin-bottom: 12px; }
.landing-next ul { list-style: none; }
.landing-next li {
  padding: 10px 0 10px 26px; border-bottom: 1px solid var(--line);
  color: var(--txt); font-size: 15px; position: relative;
}
.landing-next li::before {
  content: "→"; position: absolute; left: 4px; color: var(--amber);
  font-family: var(--mono);
}
.landing .hr-banner { margin-top: 44px; }
@media (max-width: 720px) {
  .landing-grid { grid-template-columns: 1fr; }
  .landing-ctas .btn-go.big, .landing-ctas .btn-ghost.big { width: 100%; text-align: center; }
}

/* ---------- Topbar auth ---------- */
.topbar-auth { display: flex; align-items: center; gap: 10px; }
#userWrap { position: relative; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  min-width: 190px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.user-menu.hidden { display: none; }
.user-menu-email {
  font-size: 12px; color: var(--dim); padding: 8px 10px;
  border-bottom: 1px solid var(--line); margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; color: var(--txt);
  padding: 9px 10px; font-size: 14px; border-radius: 6px; cursor: pointer;
}
.user-menu-item:hover { background: #1a1e1f; }

/* ---------- Auth + settings modals ---------- */
.auth-box { text-align: left; }
.auth-box h3 { text-align: center; margin-bottom: 14px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.auth-tab {
  flex: 1; background: transparent; border: 1px solid var(--line);
  color: var(--dim); border-radius: 6px; padding: 9px; font-size: 14px;
  font-weight: 700; cursor: pointer;
}
.auth-tab.active { color: var(--txt); border-color: var(--amber); }
.auth-box form { display: flex; flex-direction: column; gap: 10px; }
.auth-box input {
  background: #0a0c0d; border: 1px solid var(--line); border-radius: 6px;
  color: var(--txt); padding: 11px 12px; font-size: 15px; width: 100%;
}
.auth-box input:focus { outline: none; border-color: var(--amber); }
.auth-box .btn-go { margin-top: 4px; }
.auth-divider {
  display: flex; align-items: center; gap: 10px; color: var(--dim);
  font-size: 12px; margin: 4px 0;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.btn-ghost.wide { width: 100%; }
.auth-msg {
  margin-top: 12px; font-size: 14px; color: #ffb4b4;
  background: #3d1414; border: 1px solid var(--red);
  border-radius: 8px; padding: 10px 12px;
}
.auth-msg.hidden { display: none; }
.auth-msg.ok { color: #b8f0cd; background: #0f2c1a; border-color: var(--green); }

.set-row { margin-bottom: 16px; text-align: left; }
.set-row label {
  display: block; font-size: 12px; letter-spacing: 1.5px;
  font-family: var(--mono); color: var(--dim); margin-bottom: 8px;
}
.set-inline { display: flex; gap: 8px; }
.set-inline input {
  flex: 1; background: #0a0c0d; border: 1px solid var(--line); border-radius: 6px;
  color: var(--txt); padding: 10px 12px; font-size: 14px; min-width: 0;
}
.set-inline input:focus { outline: none; border-color: var(--amber); }

/* ---------- Drag canvas ---------- */
#stageSvg .node.drag, #sharedSvg .node.drag { cursor: grab; touch-action: none; }
#stageSvg .node.dragging { cursor: grabbing; opacity: .88; }
#stageSvg .node.drag:hover .mic-dot { stroke: #fff; stroke-width: 1.5; }
.drag-hint { margin-bottom: 12px; }
.linklike {
  background: none; border: 0; color: var(--amber); cursor: pointer;
  font-size: inherit; text-decoration: underline; padding: 0;
}

/* ---------- Shared view ---------- */
.shared-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; gap: 10px; flex-wrap: wrap;
}
#sharedView .output-actions { display: flex; gap: 10px; }
#sharedView .btn-go { width: auto; margin-top: 0; padding: 12px 26px; font-size: 15px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1a1e1f; border: 1px solid var(--amber); color: var(--txt);
  border-radius: 8px; padding: 12px 20px; font-size: 14px; z-index: 100;
  max-width: calc(100vw - 40px); text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.toast.hidden { display: none; }

/* ---------- Output actions row ---------- */
.output-actions { display: flex; gap: 10px; align-items: center; }
@media (max-width: 640px) {
  .output-actions { width: 100%; flex-direction: column; }
  .output-actions .btn-go, .output-actions .btn-ghost { width: 100%; }
}
