:root {
  --bg: #03070b;
  --panel: rgba(8, 18, 24, 0.88);
  --panel2: rgba(13, 27, 35, 0.92);
  --line: rgba(46, 233, 255, 0.28);
  --line2: rgba(255, 138, 30, 0.48);
  --cyan: #2ee9ff;
  --orange: #ff8a1e;
  --green: #37f5a0;
  --red: #ff3f5f;
  --yellow: #ffe66d;
  --ink: #d9f7ff;
  --muted: #7da3ad;
  --deep: #061017;
  --shadow: 0 0 26px rgba(46, 233, 255, 0.14);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background:
    repeating-linear-gradient(0deg, transparent 0 42px, rgba(46, 233, 255, 0.035) 42px 43px),
    repeating-linear-gradient(90deg, transparent 0 42px, rgba(46, 233, 255, 0.035) 42px 43px),
    radial-gradient(90% 55% at 50% 0%, rgba(46, 233, 255, 0.12), transparent 62%),
    linear-gradient(180deg, #03070b, #061019 58%, #03070b);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 7, 11, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sigil {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 2px solid var(--orange);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 138, 30, 0.35) 0 15%, transparent 16% 35%, rgba(255, 138, 30, 0.18) 36% 49%, transparent 50%);
  box-shadow: 0 0 20px rgba(255, 138, 30, 0.55), inset 0 0 14px rgba(255, 138, 30, 0.35);
}

.eyebrow,
.mini,
.nav,
.status-pill,
.metric-card span,
.tab,
button,
label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1;
  color: #f0fdff;
  text-shadow: 0 0 18px rgba(46, 233, 255, 0.72);
}

h2 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
}

h3 {
  font-size: 15px;
  color: #f0fdff;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  border: 1px solid var(--line);
  background: rgba(46, 233, 255, 0.09);
  color: var(--cyan);
  padding: 8px 11px;
  font-size: 11px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.status-pill.warn,
.notice.warn {
  border-color: var(--line2);
  background: rgba(255, 138, 30, 0.1);
  color: var(--orange);
}

.status-pill.bad,
.global-error {
  border-color: rgba(255, 63, 95, 0.65);
  background: rgba(255, 63, 95, 0.1);
  color: #ffd1d9;
}

.status-note {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 75px;
  height: calc(100vh - 75px);
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(3, 7, 11, 0.78);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav {
  border: 1px solid rgba(46, 233, 255, 0.18);
  background: rgba(46, 233, 255, 0.045);
  color: var(--muted);
  padding: 13px 12px;
  text-align: left;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.nav:hover,
.nav.active {
  color: var(--cyan);
  border-color: var(--line);
  background: rgba(46, 233, 255, 0.11);
  box-shadow: inset 0 0 18px rgba(46, 233, 255, 0.06);
}

.nav.link {
  margin-top: auto;
  color: var(--orange);
  border-color: var(--line2);
}

.workspace {
  padding: 24px;
  min-width: 0;
}

.screen,
.mobile-view {
  display: none;
}

.screen.active,
.mobile-view.active {
  display: block;
}

.screen-head,
.panel-head,
.mobile-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel,
.metric-card,
.kill-panel,
.notice,
.global-error {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: inset 0 0 26px rgba(46, 233, 255, 0.04), var(--shadow);
}

.panel,
.notice,
.global-error {
  padding: 16px;
}

.notice,
.global-error {
  margin-bottom: 16px;
  line-height: 1.45;
}

.inline-note {
  border: 1px solid rgba(255, 138, 30, 0.4);
  background: rgba(255, 138, 30, 0.08);
  color: #ffd9af;
  padding: 10px;
  line-height: 1.45;
  font-size: 13px;
}

.inline-note.caution {
  border-color: rgba(255, 230, 109, 0.44);
  background: rgba(255, 230, 109, 0.07);
  color: var(--yellow);
}

.hidden {
  display: none !important;
}

.grid.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 18px;
  min-height: 132px;
}

.metric-card span,
.mini {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin: 12px 0 5px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(46, 233, 255, 0.58);
  word-break: break-word;
}

.metric-card small {
  color: var(--muted);
}

.two-col,
.contact-shell,
.inbox-layout,
.campaign-layout,
.template-layout,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.traffic-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.traffic-lane {
  border: 1px solid rgba(46, 233, 255, 0.22);
  background: rgba(6, 15, 20, 0.66);
  min-width: 0;
}

.traffic-lane header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  min-height: 94px;
  padding: 12px;
  border-bottom: 1px solid rgba(46, 233, 255, 0.16);
}

.traffic-lane header span,
.traffic-lane header b,
.traffic-lane header small,
.traffic-item small,
.traffic-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.traffic-lane header strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.traffic-lane header b {
  color: var(--cyan);
  font-size: 24px;
  line-height: 1;
}

.traffic-items {
  display: grid;
  gap: 8px;
  padding: 10px;
  max-height: 680px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.traffic-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
  min-height: 118px;
  display: grid;
  gap: 7px;
  align-content: start;
}

.traffic-item strong,
.traffic-item p,
.traffic-item small {
  overflow-wrap: anywhere;
}

.traffic-item div > strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.traffic-item p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.traffic-item .priority {
  margin-top: 4px;
}

.traffic-red {
  border-color: rgba(255, 88, 88, 0.4);
}

.traffic-red header b {
  color: #ff7a7a;
}

.traffic-yellow {
  border-color: rgba(255, 230, 109, 0.38);
}

.traffic-yellow header b {
  color: var(--yellow);
}

.traffic-green {
  border-color: rgba(77, 255, 181, 0.34);
}

.traffic-green header b {
  color: #69ffc5;
}

.traffic-blue {
  border-color: rgba(46, 233, 255, 0.38);
}

.traffic-gray {
  opacity: 0.78;
}

/* Brand hero on the dashboard. Transparent PNG so the body grid runs
   continuously behind it and the gridlines stay unbroken. */
.brand-hero {
  margin-top: 16px;
  padding: 28px 0 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background: transparent;
}

.brand-portal-wrap {
  position: relative;
  width: 100%;
  max-width: 900px;
}

.brand-hero img {
  width: 100%;
  height: auto;
  opacity: 0.97;
  filter: drop-shadow(0 0 34px rgba(46, 233, 255, 0.14));
  pointer-events: none;
  user-select: none;
  display: block;
}

/* SODA identity disc: half Sophie cyan, half Loda gold, glowing. Opens the split screen. */
.soda-disc {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.soda-disc img {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  animation: soda-pulse 3.4s ease-in-out infinite;
  transition: transform 0.18s ease, filter 0.18s ease;
}
.soda-disc span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  background: linear-gradient(90deg, var(--cyan) 0 50%, var(--yellow) 50% 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.soda-disc:hover img,
.soda-disc:focus-visible img {
  transform: scale(1.09);
  filter: drop-shadow(0 0 20px rgba(46, 233, 255, 0.6)) drop-shadow(0 0 20px rgba(255, 230, 109, 0.55));
}
@keyframes soda-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(46, 233, 255, 0.35)) drop-shadow(0 0 8px rgba(255, 230, 109, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(46, 233, 255, 0.55)) drop-shadow(0 0 16px rgba(255, 230, 109, 0.5));
  }
}

.portal-hotspot {
  position: absolute;
  width: clamp(32px, 6.8%, 64px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04) 58%, transparent 70%);
  cursor: pointer;
  opacity: 0.48;
  transform: translate(-50%, -50%);
  transition: opacity 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.portal-hotspot::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--portal-glow), transparent 68%);
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}

.portal-hotspot:hover,
.portal-hotspot:focus-visible {
  opacity: 1;
  outline: 0;
  border-color: var(--portal-core);
  background: radial-gradient(circle, var(--portal-core), rgba(255, 255, 255, 0.08) 54%, transparent 72%);
  box-shadow: 0 0 18px var(--portal-glow), 0 0 42px var(--portal-glow);
}

.portal-hotspot:hover::before,
.portal-hotspot:focus-visible::before {
  opacity: 1;
}

.portal-hotspot-sophie {
  left: 12%;
  top: 20%;
  --portal-core: rgba(46, 233, 255, 0.82);
  --portal-glow: rgba(46, 233, 255, 0.38);
}

.portal-hotspot-loda {
  left: 86%;
  top: 20%;
  --portal-core: rgba(255, 209, 102, 0.88);
  --portal-glow: rgba(255, 209, 102, 0.42);
}

.portal-hotspot-soda {
  left: 50%;
  top: 44%;
  width: 36%;
  aspect-ratio: 4.7 / 1;
  border-radius: 999px;
  --portal-core: rgba(109, 244, 255, 0.78);
  --portal-glow: rgba(255, 209, 102, 0.34);
}

.portal-hotspot-soda::before {
  inset: -18px;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(46, 233, 255, 0.42), rgba(255, 209, 102, 0.46), rgba(255, 138, 30, 0.24));
  filter: blur(8px);
}

.portal-hotspot-soda:hover,
.portal-hotspot-soda:focus-visible {
  background: linear-gradient(90deg, rgba(46, 233, 255, 0.2), rgba(255, 209, 102, 0.26));
  box-shadow: 0 0 22px rgba(46, 233, 255, 0.34), 0 0 48px rgba(255, 209, 102, 0.28);
}

.portal-screen.active {
  display: flex;
  min-height: calc(100vh - 123px);
  flex-direction: column;
}

.screen-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.portal-frame {
  flex: 1;
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--line);
  background: #03070b;
}

.soda-split {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 70vh;
  border: 1px solid var(--line);
  background: #03070b;
}

.soda-frame {
  min-height: 70vh;
  border: 0;
}

.soda-frame + .soda-frame {
  border-left: 1px solid rgba(46, 233, 255, 0.35);
}

.settings-grid {
  grid-template-columns: 1fr 1fr 1fr;
}

.stack {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid rgba(46, 233, 255, 0.22);
  background: rgba(2, 10, 14, 0.58);
  padding: 12px;
  min-width: 0;
}

.item strong {
  display: block;
  color: #f2fdff;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.item p {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.selectable .item {
  cursor: pointer;
}

.selectable .item.active {
  border-color: var(--line2);
  background: rgba(255, 138, 30, 0.08);
}

.empty {
  border: 1px dashed rgba(46, 233, 255, 0.26);
  color: var(--muted);
  padding: 16px;
  line-height: 1.45;
  background: rgba(46, 233, 255, 0.035);
}

.coming {
  border-color: var(--line2);
  color: #ffd9af;
  background: rgba(255, 138, 30, 0.07);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.health {
  border: 1px solid rgba(46, 233, 255, 0.22);
  background: rgba(46, 233, 255, 0.055);
  padding: 12px;
}

.health b {
  display: block;
}

.health span {
  color: var(--muted);
  font-size: 13px;
}

.health small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  opacity: 0.8;
}

.health.ok {
  border-color: rgba(60, 235, 160, 0.35);
  background: rgba(60, 235, 160, 0.06);
}

.health.bad {
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.07);
}

/* Runestones panel: carve on the right, the carved stones on the left. */
.wide-panel { grid-column: 1 / -1; }

.runestone-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.runestone-report {
  margin-top: 12px;
  max-height: 260px;
  overflow-y: auto;
}

.runestone-report .lint-note,
.runestone-report .ok,
.runestone-report .bad {
  font-size: 12px;
  padding: 2px 0;
}

@media (max-width: 900px) {
  .runestone-layout { grid-template-columns: 1fr; }
}

/* Record modal: create a lead from any board, edit a lead where it sits. */
.record-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  overflow-y: auto;
  background: rgba(3, 7, 11, 0.82);
  backdrop-filter: blur(3px);
}

.record-modal[hidden] { display: none; }

.record-card {
  width: min(720px, 100%);
  border: 1px solid rgba(46, 233, 255, 0.3);
  background: var(--panel, #0a1119);
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.record-card .form-grid { margin-top: 12px; }

.record-card textarea,
.record-card input,
.record-card select { width: 100%; }

.priority {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid currentColor;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.priority.jack {
  color: #ff365c;
  background: rgba(255, 54, 92, 0.12);
}

.priority.black {
  color: #b779ff;
  background: rgba(183, 121, 255, 0.13);
}

.priority.grid {
  color: var(--cyan);
  background: rgba(46, 233, 255, 0.11);
}

.priority.cold {
  color: #8aa5ff;
  background: rgba(138, 165, 255, 0.12);
}

.priority.flat {
  color: #8b98a0;
  background: rgba(139, 152, 160, 0.12);
}

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.stage {
  min-height: 520px;
  border: 1px solid var(--line);
  background: rgba(8, 18, 24, 0.72);
  padding: 12px;
}

.stage h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.opp-card {
  border: 1px solid rgba(46, 233, 255, 0.25);
  background: rgba(2, 10, 14, 0.82);
  padding: 12px;
  margin-bottom: 10px;
  cursor: grab;
}

.opp-card:active {
  cursor: grabbing;
}

.opp-card .value {
  color: var(--green);
  font-weight: 800;
  margin-top: 8px;
}

.stage.drag-over {
  border-color: var(--orange);
  box-shadow: inset 0 0 30px rgba(255, 138, 30, 0.08);
}

.contact-profile .name {
  font-size: 32px;
  line-height: 1.05;
  color: #f2fdff;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.contact-profile .meta {
  color: var(--muted);
  line-height: 1.5;
}

.kv {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(46, 233, 255, 0.12);
  padding-bottom: 8px;
}

.kv span:first-child {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 800;
}

.kv span:last-child {
  text-align: right;
  overflow-wrap: anywhere;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px;
  font-size: 12px;
  font-weight: 900;
}

.segmented button.active {
  color: var(--cyan);
  background: rgba(46, 233, 255, 0.11);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  border-left: 3px solid var(--cyan);
  background: rgba(2, 10, 14, 0.58);
  padding: 12px;
}

.timeline-item.out {
  border-color: var(--orange);
}

.timeline-item small {
  color: var(--muted);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.primary,
.ghost,
.kill {
  border: 1px solid var(--line);
  background: rgba(46, 233, 255, 0.08);
  color: var(--cyan);
  min-height: 42px;
  padding: 10px 14px;
  font-weight: 900;
}

.primary {
  background: rgba(46, 233, 255, 0.14);
}

.ghost {
  color: var(--muted);
}

.primary:hover,
.ghost:hover {
  border-color: var(--cyan);
  color: #f2fdff;
}

.select,
input,
textarea {
  border: 1px solid rgba(46, 233, 255, 0.28);
  background: rgba(2, 10, 14, 0.82);
  color: var(--ink);
  padding: 10px;
  min-height: 42px;
  outline: none;
}

.select {
  min-width: 220px;
}

.select.slim {
  min-width: 155px;
}

.contact-tools {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(220px, 360px) auto;
  align-items: center;
  gap: 8px;
  max-width: 820px;
}

.contact-tools .mini {
  grid-column: 1 / -1;
  text-align: right;
}

.contact-tools .ghost {
  min-height: 42px;
  white-space: nowrap;
}

textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}

.form-grid,
.template-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.template-form {
  grid-template-columns: 1fr 180px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

label input,
label select,
label textarea {
  width: 100%;
}

.wide {
  grid-column: 1 / -1;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkline input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--cyan);
}

.steps {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.subhead {
  margin-top: 18px;
}

.step-row {
  display: grid;
  grid-template-columns: 58px 1fr 110px 110px;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(46, 233, 255, 0.22);
  background: rgba(2, 10, 14, 0.58);
  padding: 10px;
}

.step-card {
  border: 1px solid rgba(46, 233, 255, 0.24);
  background: rgba(2, 10, 14, 0.62);
  padding: 12px;
}

.step-top,
.stats-row,
.approval-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.step-top {
  justify-content: space-between;
  margin-bottom: 10px;
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.step-grid span,
.stats-row b,
.lint-note,
.approval-meta span,
.approval-meta p {
  border: 1px solid rgba(46, 233, 255, 0.18);
  background: rgba(46, 233, 255, 0.045);
  color: var(--muted);
  padding: 8px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.stats-row {
  margin-top: 10px;
}

.stats-row b {
  color: var(--green);
  font-weight: 900;
}

.step-form {
  border-top: 1px solid rgba(46, 233, 255, 0.16);
  padding-top: 14px;
}

.merge-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.merge-palette button {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: rgba(46, 233, 255, 0.07);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.lint {
  display: grid;
  gap: 8px;
}

.lint .ok,
.lint .bad {
  border: 1px solid currentColor;
  padding: 10px;
}

.lint .ok {
  color: var(--green);
  background: rgba(55, 245, 160, 0.08);
}

.lint .bad {
  color: #ffc4ce;
  background: rgba(255, 63, 95, 0.09);
}

.scripts-list {
  display: grid;
  gap: 16px;
}

.script-group {
  display: grid;
  gap: 14px;
}

.script-stack {
  display: grid;
  gap: 12px;
}

.script-card {
  border: 1px solid rgba(46, 233, 255, 0.24);
  background: rgba(2, 10, 14, 0.66);
  padding: 16px;
  min-width: 0;
}

.script-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.script-top strong {
  display: block;
  color: #f2fdff;
  margin-bottom: 5px;
}

.script-top p {
  color: var(--orange);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.recording-status {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid rgba(125, 163, 173, 0.46);
  border-radius: 50%;
  background: rgba(125, 163, 173, 0.14);
  color: var(--green);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
}

.recording-status.recorded {
  border-color: rgba(55, 245, 160, 0.7);
  background: rgba(55, 245, 160, 0.14);
  box-shadow: 0 0 18px rgba(55, 245, 160, 0.18);
}

.script-text {
  color: #f2fdff;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.approve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.approval-card {
  border: 1px solid var(--line);
  background: var(--panel2);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.approval-card textarea {
  min-height: 160px;
}

.approval-meta {
  align-items: flex-start;
}

.approval-meta strong {
  flex-basis: 100%;
  color: #f2fdff;
}

.approval-meta p {
  flex-basis: 100%;
  color: var(--ink);
}

.queue-badge {
  border-color: rgba(255, 230, 109, 0.5) !important;
  background: rgba(255, 230, 109, 0.09) !important;
  color: var(--yellow) !important;
}

.approval-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.approval-actions button:last-child {
  border-color: var(--line2);
  color: var(--orange);
}

.kill-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 16px;
  border-color: rgba(255, 63, 95, 0.65);
}

.kill-panel.compact,
.mobile-kill {
  margin-bottom: 14px;
}

.kill-panel p {
  color: var(--muted);
  margin-top: 6px;
}

.kill {
  min-width: 180px;
  background: rgba(255, 63, 95, 0.16);
  border-color: rgba(255, 63, 95, 0.75);
  color: #ffd1d9;
  font-size: 13px;
}

.kill.on {
  background: rgba(55, 245, 160, 0.13);
  border-color: rgba(55, 245, 160, 0.65);
  color: var(--green);
}

.toggle-list {
  display: grid;
  gap: 10px;
}

.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(46, 233, 255, 0.22);
  padding: 12px;
}

.toggle button {
  min-width: 88px;
}

.mobile-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(var(--safe-t) + 12px) 14px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 7, 11, 0.96);
}

.mobile-head .sigil {
  width: 32px;
  height: 32px;
}

.mobile-head h1 {
  font-size: 24px;
}

.mobile-main {
  padding: 14px 14px calc(var(--safe-b) + 86px);
}

.mobile-title h2 {
  font-size: 34px;
}

.mobile-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}

.mobile-metrics article {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 8px;
  text-align: center;
}

.mobile-metrics span {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 900;
}

.mobile-metrics strong {
  display: block;
  color: var(--cyan);
  font-size: 30px;
  line-height: 1;
  margin-top: 5px;
}

.mobile-kanban {
  display: grid;
  gap: 12px;
}

.mobile-kanban .stage {
  min-height: auto;
}

.mobile-reply {
  margin-top: 12px;
}

.one-hand {
  display: grid;
  gap: 14px;
}

.one-hand .approval-card {
  min-height: calc(100vh - 190px);
}

.one-hand .approval-actions {
  position: sticky;
  bottom: calc(var(--safe-b) + 70px);
  background: rgba(3, 7, 11, 0.94);
  padding-top: 8px;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: var(--safe-b);
  border-top: 1px solid var(--line);
  background: rgba(3, 7, 11, 0.98);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 58px;
  font-size: 10px;
  font-weight: 900;
}

.tab.active {
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(46, 233, 255, 0.72);
}

@media (max-width: 1050px) {
  .grid.metrics,
  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .two-col,
  .contact-shell,
  .inbox-layout,
  .campaign-layout,
  .template-layout,
  .soda-split {
    grid-template-columns: 1fr;
  }

  .traffic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .soda-frame + .soda-frame {
    border-left: 0;
    border-top: 1px solid rgba(46, 233, 255, 0.35);
  }
}

@media (max-width: 780px) {
  body[data-mode="desktop"] .layout {
    grid-template-columns: 1fr;
  }

  body[data-mode="desktop"] .rail {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    padding: 16px;
  }

  .grid.metrics,
  .settings-grid,
  .form-grid,
  .template-form,
  .traffic-grid {
    grid-template-columns: 1fr;
  }

  .contact-tools {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: none;
  }

  .contact-tools .mini {
    text-align: left;
  }

  .step-row {
    grid-template-columns: 1fr;
  }

  .step-grid {
    grid-template-columns: 1fr;
  }

  .kill-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ---- Login gate ------------------------------------------------------- */
/* Full-screen lock shown on any 401. Replaces the ?k= bootstrap URL, which put
   the access key in the address bar and had to be re-pasted per browser. */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(8, 18, 24, 0.96), var(--bg) 70%);
  backdrop-filter: blur(14px);
}
.login-gate[hidden] { display: none; }
.login-card {
  width: min(380px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 26px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 0 42px rgba(46, 233, 255, 0.14);
}
.login-card h2 { margin: 0; }
.login-card .sigil { margin-bottom: 4px; }
.login-card input {
  width: 100%;
  letter-spacing: 0.08em;
}
.login-card .button-row { margin-top: 4px; }
.login-card .login-hint {
  margin: 0;
  opacity: 0.62;
}
.login-card code {
  color: var(--ink);
  font-size: 0.92em;
}
.login-error { color: #ff8a6b; }
