:root {
  color-scheme: dark;
  --bg: #0c0c0e;
  --panel: #141416;
  --panel-2: #1c1c20;
  --line: #2c2c32;
  --text: #f6f4f1;
  --muted: #a39e96;
  --red: #e23b2f;
  --red-2: #ff5a4d;
  --ok: #1f8f55;
  --ok-bg: #163224;
  --warn: #c9862a;
  --warn-bg: #3a2c14;
  --bad-bg: #3a1816;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--red-2);
  outline-offset: 2px;
}
.hidden { display: none !important; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(226, 59, 47, 0.18), transparent 60%),
    var(--bg);
}
.card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.brand { color: var(--red-2); font-weight: 800; letter-spacing: 0.04em; font-size: 13px; text-transform: uppercase; white-space: nowrap; }
h1 { margin: 8px 0 8px; font-size: 32px; letter-spacing: -0.03em; }
h2, h3 { letter-spacing: -0.02em; }
.lead, .hint, .meta, .pane-note { color: var(--muted); line-height: 1.45; }
.pane-note { margin: 0; padding: 0 14px 8px; font-size: 13px; }
.script-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 8px; }
.script-tab {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 7px 8px;
  color: var(--muted);
  font-weight: 700;
}
.script-tab.active { color: var(--text); background: var(--panel-2); }
.script-tab[data-tab="blue"].active { box-shadow: inset 0 -2px 0 #6aa7ff; }
.script-tab[data-tab="turbo"].active { box-shadow: inset 0 -2px 0 #e2a23b; }
.script-tab[data-tab="sniper"].active { box-shadow: inset 0 -2px 0 #e23b2f; }
label { display: grid; gap: 6px; margin: 12px 0; font-size: 13px; color: var(--muted); }
input, textarea, select {
  width: 100%;
  background: #101012;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--text);
}
button[type="submit"], #manual-button {
  background: var(--red);
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
}
button[type="submit"]:hover, #manual-button:hover { background: #c83228; }
.ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}
.ghost:hover { background: var(--panel-2); }
.danger {
  background: #8d1d16;
  border: 0;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
}
.danger:hover { background: #a3221a; }
.error { color: #ffb0aa; min-height: 1.2em; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--text); }

.desk { height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #111113;
}
.spacer { flex: 1; }
.account { color: var(--muted); font-size: 14px; }
.share {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 16px;
  background: #1a1212;
  border-bottom: 1px solid #4a2a28;
}
.share .blurb { grid-column: 1 / -1; }
.share p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.share label { margin: 0; display: flex; align-items: center; gap: 8px; }
.share label input { min-width: 0; }
.columns { flex: 1; display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; min-height: 0; }
.pane { min-height: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--panel); }
.scripts { border-right: 0; background: #111113; }
.pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px 8px;
  font-weight: 700;
}
.count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.list-tools { padding: 0 12px 10px; display: grid; gap: 8px; }
.filters { display: flex; gap: 6px; }
.filter {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
}
.filter.active { background: var(--panel-2); color: var(--text); }
.order-list, .notes { overflow: auto; flex: 1; min-height: 0; }
.order-body { overflow: visible; }
.order-item {
  width: calc(100% - 16px);
  margin: 0 8px 8px;
  text-align: left;
  background: #101012;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 4px;
}
.order-item.active { border-color: #8a3a34; background: #221614; }
.order-item strong { font-size: 15px; }
.order-item .sub, .order-item .when { color: var(--muted); font-size: 12px; }
.order-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.thread { background: #101012; }
.empty {
  margin: auto;
  max-width: 340px;
  color: var(--muted);
}
.empty strong { display: block; color: var(--text); font-size: 22px; margin-bottom: 10px; }
.empty ol { margin: 0; padding-left: 18px; line-height: 1.6; }
.order-view { display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: auto; }
.thread-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.title-block { min-width: 0; }
.thread-head h2 { margin: 0; font-size: 20px; }
.thread-head .meta { margin: 4px 0 0; font-size: 13px; word-break: break-all; }
.badge {
  margin-left: auto;
  border-radius: 999px;
  padding: 5px 10px;
  background: #2a2a2e;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: #8ee0b0; }
.badge.warn { background: var(--warn-bg); color: #ffd18a; }
.badge.bad { background: var(--bad-bg); color: #ffb0aa; }
.order-body { padding: 16px; display: grid; gap: 12px; align-content: start; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat, .field {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.stat span, .field span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.stat strong { font-size: 18px; }
.buyer-card {
  background: #1a1212;
  border: 1px solid #4a2a28;
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.buyer-card h3 { margin: 0; font-size: 14px; }
.field { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.field b { font-size: 16px; word-break: break-all; }
.copy {
  border: 1px solid var(--line);
  background: #101012;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
}
.composer { border-top: 1px solid var(--line); padding: 12px 16px 16px; display: grid; gap: 12px; background: var(--panel); }
.action { border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: #101012; }
.action.emphasis { border-color: #8a3a34; box-shadow: inset 3px 0 0 var(--red); }
.action-head h3 { margin: 0; font-size: 15px; }
.action-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.row, .manual { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.text-link {
  display: block;
  margin: 14px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.manual label, .row .error { margin: 0; }
.manual label { min-width: 160px; flex: 1; }
.note {
  width: calc(100% - 16px);
  margin: 0 8px 8px;
  text-align: left;
  background: #101012;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
}
.note:hover, .note.copied { border-color: #8a3a34; }
.note strong { display: block; margin-bottom: 4px; }
.note span { color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.note-status { display: block; min-height: 1.2em; margin-top: 6px; color: #8ee0b0; font-size: 12px; font-style: normal; }
.note-actions { display: flex; gap: 6px; margin-top: 8px; }
.note-actions button { padding: 4px 8px; font-size: 12px; }
.note-actions button:last-child { margin-left: auto; }
.note-form { padding: 0 12px 12px; }
.confirm {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
}
.confirm-card {
  width: min(480px, 100%);
  background: #161618;
  border: 1px solid #5a3030;
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.confirm-card h2 { margin: 0 0 8px; font-size: 24px; }
.confirm-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.confirm-card ul { margin: 14px 0; padding-left: 18px; line-height: 1.5; }
#confirm-preview {
  max-height: 160px;
  overflow: auto;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #101012;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-all;
}
#confirm-yes.danger { background: #8d1d16; }
.mobile-only { display: none; }
.list-empty { margin: 12px; color: var(--muted); line-height: 1.45; }

@media (max-width: 980px) {
  .account { display: none; }
  .top { flex-wrap: wrap; }
  .share { grid-template-columns: 1fr; }
  .share button { width: 100%; }
  .columns { grid-template-columns: 1fr; }
  .scripts, .list-pane.hide-mobile, .thread.hide-mobile { display: none; }
  .scripts.show, .thread.show { display: flex; }
  .mobile-only { display: flex; gap: 6px; }
  .desk { height: 100dvh; }
}
@media (min-width: 981px) {
  #back-button, #alerts-button, #scripts-button { display: none; }
}
