/* —— themes —— */
html[data-theme="dark"] {
  --bg: #0c0f12;
  --bg-soft: #12161b;
  --ink: #ece8e2;
  --mute: #8a939c;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --fill: rgba(255, 255, 255, 0.04);
  --fill-hover: rgba(255, 255, 255, 0.07);
  --input: #161b21;
  --rose: #ff6545;
  --rose-deep: #e8472c;
  --foam: #3ecf9e;
  --gold: #d4b07a;
  --wash: radial-gradient(ellipse 70% 45% at 0% 0%, rgba(255, 101, 69, 0.12), transparent 55%),
          radial-gradient(ellipse 50% 40% at 100% 0%, rgba(62, 207, 158, 0.06), transparent 50%),
          var(--bg);
  --card-grad: linear-gradient(160deg, #2a3340 0%, #1a222c 45%, #2e2424 100%);
}

html[data-theme="light"] {
  --bg: #f3f1ed;
  --bg-soft: #ffffff;
  --ink: #1a1d21;
  --mute: #6b737c;
  --line: rgba(20, 24, 30, 0.1);
  --line-strong: rgba(20, 24, 30, 0.16);
  --fill: rgba(20, 24, 30, 0.03);
  --fill-hover: rgba(20, 24, 30, 0.06);
  --input: #ffffff;
  --rose: #e84a2e;
  --rose-deep: #d03a20;
  --foam: #1a9f72;
  --gold: #9a6f2e;
  --wash: radial-gradient(ellipse 70% 45% at 0% 0%, rgba(232, 74, 46, 0.08), transparent 55%),
          radial-gradient(ellipse 50% 40% at 100% 0%, rgba(26, 159, 114, 0.05), transparent 50%),
          var(--bg);
  --card-grad: linear-gradient(160deg, #c8d0da 0%, #a8b2be 40%, #c9b0a8 100%);
}

:root {
  --sans: "Instrument Sans", system-ui, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--wash);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--rose); }
::selection { background: rgba(255, 101, 69, 0.28); }

#app { min-height: 100vh; }

/* —— gate —— */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.gate-card {
  width: min(420px, 100%);
  padding: 8px 0;
}
.mark {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 12px;
}
.gate h1 {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.gate p {
  margin: 0 0 24px;
  color: var(--mute);
  font-size: 15px;
  line-height: 1.55;
}

/* —— shell —— */
.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    position: static;
    height: auto;
    padding: 14px 16px;
  }
  .rail .logo { width: 100%; padding-bottom: 8px; }
  .rail .spacer { display: none; }
  .rail .nav-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: none;
    overflow: visible;
    width: 100%;
  }
  .nav-group { width: 100%; }
  .nav-group-items { padding-left: 4px; }
}

.rail {
  padding: 24px 14px 20px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: start;
  overflow: hidden;
}
.rail .logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  padding: 0 10px 18px;
  flex-shrink: 0;
}
.rail .logo em {
  font-style: normal;
  color: var(--rose);
  font-weight: 600;
}
.rail .nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail .nav-scroll::-webkit-scrollbar { width: 4px; }
.rail .nav-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
}

.nav-group {
  margin-bottom: 4px;
}
.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  color: var(--mute);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-group-toggle:hover {
  color: var(--ink);
  background: var(--fill-hover);
}
.nav-group-toggle .chev {
  font-size: 10px;
  opacity: 0.7;
}
.nav-group-items {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 6px 6px;
}
.nav-group.open .nav-group-items {
  display: flex;
}
.rail button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  color: var(--mute);
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
.rail .nav-group-items button:hover {
  color: var(--ink);
  background: var(--fill-hover);
}
.rail .nav-group-items button.on {
  color: var(--ink);
  background: var(--fill);
  box-shadow: inset 3px 0 0 var(--rose);
}
.rail .spacer { flex: 0.15; min-height: 8px; }
.rail .theme-btn,
.rail #out {
  color: var(--mute);
  font-weight: 500;
  font-size: 13px;
  flex-shrink: 0;
}
.rail .theme-btn:hover,
.rail #out:hover {
  color: var(--ink);
  background: var(--fill-hover);
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--mute);
  font-weight: 500;
  margin: 8px 0;
}

.stage {
  padding: 28px 32px 56px;
  max-width: 1100px;
  position: relative;
}

/* —— language switch —— */
.lang-switch {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 5;
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
}
.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--mute);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  min-width: 40px;
}
.lang-switch button + button {
  border-left: 1px solid var(--line);
}
.lang-switch button:hover {
  color: var(--ink);
  background: var(--fill-hover);
}
.lang-switch button.on {
  color: var(--ink);
  background: var(--fill);
}
.lang-switch--gate {
  position: static;
  top: auto;
  right: auto;
  display: inline-flex;
  margin: 0 0 20px;
}

/* —— actor —— */
.actor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  padding-right: 100px;
  border-bottom: 1px solid var(--line);
}
.actor .tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
}
.actor select {
  background: var(--input);
  border: 1px solid var(--line);
  padding: 10px 12px;
  min-width: 220px;
  border-radius: 10px;
  outline: none;
}
.actor select:focus {
  border-color: var(--rose);
}
.actor .who { font-weight: 500; font-size: 14px; }
.actor .who span {
  color: var(--rose);
  font-weight: 600;
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.head .sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
}

/* —— metrics: flat on bg —— */
.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px 20px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.metric {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 72px;
  padding: 4px 0;
  background: none;
  border: 0;
  box-shadow: none;
}
.metric b {
  display: block;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}
.metric i {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
  line-height: 1.3;
  min-height: 2.4em;
}

/* —— sections: no boxes —— */
.block {
  padding: 0;
  margin-bottom: 28px;
  background: none;
  border: 0;
  box-shadow: none;
}
.block h2 {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--mute);
  font-weight: 600;
}
.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: start;
}
.cols > .block {
  margin-bottom: 0;
  min-height: 0;
  padding-right: 8px;
}
.cols > .block:first-child {
  border-right: 1px solid var(--line);
  padding-right: 28px;
}
@media (max-width: 720px) {
  .cols { grid-template-columns: 1fr; gap: 28px; }
  .cols > .block:first-child {
    border-right: 0;
    padding-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 24px;
  }
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea,
.composer input {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--line);
  padding: 11px 12px;
  border-radius: 10px;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus,
.composer input:focus {
  border-color: var(--rose);
}
.field textarea { min-height: 80px; resize: vertical; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
}
.chip:hover { border-color: var(--line-strong); background: var(--fill); }
.chip.on {
  border-color: var(--rose);
  color: var(--rose);
  background: transparent;
}

.btn {
  border: 0;
  background: var(--rose);
  color: #fff;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 12px;
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.98); }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.btn.dark {
  background: var(--fill);
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn.mint {
  background: var(--foam);
  color: #042016;
}
.btn.danger {
  background: transparent;
  border: 1px solid rgba(220, 80, 80, 0.45);
  color: #e07070;
}
html[data-theme="light"] .btn.danger { color: #c04040; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.sm { padding: 7px 11px; font-size: 12px; border-radius: 9px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  font-size: 12px;
  color: var(--mute);
  font-weight: 600;
}
tr:hover td { background: var(--fill); }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid var(--line);
  color: var(--mute);
  border-radius: 999px;
}
.pill.live {
  border-color: color-mix(in srgb, var(--foam) 50%, transparent);
  color: var(--foam);
}
.pill.ops {
  border-color: color-mix(in srgb, var(--rose) 45%, transparent);
  color: var(--rose);
}

/* —— deck card: only elevated surface —— */
.deck-wrap {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 920px) { .deck-wrap { grid-template-columns: 1fr; } }

.card {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 20px;
  border: 1px solid var(--line);
}
.card .photo {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(8, 12, 16, 0.92) 0%, rgba(8, 12, 16, 0.25) 40%, transparent 65%),
    var(--card-grad);
  z-index: 0;
}
.card .rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
  pointer-events: none;
  z-index: 2;
}
.card .body { position: relative; z-index: 1; padding: 20px; color: #f4f0ea; }
.card h3 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.card .meta { color: rgba(244, 240, 234, 0.65); font-size: 13px; margin-bottom: 8px; }
.card .bio { font-size: 14px; line-height: 1.45; color: rgba(244, 240, 234, 0.9); }
.card .flags { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.actions .btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
}

.queue {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 560px;
  overflow: auto;
}
.queue-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 10px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  width: 100%;
  border-radius: 0;
}
.queue-item:hover { background: var(--fill); }
.queue-item.on {
  background: var(--fill);
  box-shadow: inset 3px 0 0 var(--rose);
}
.queue-item b { display: block; font-size: 14px; font-weight: 600; }
.queue-item span { color: var(--mute); font-size: 12px; }

.inbox {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 28px;
  min-height: 420px;
}
@media (max-width: 820px) { .inbox { grid-template-columns: 1fr; } }

.thread {
  height: 360px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.bubble {
  max-width: 76%;
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.45;
  border-radius: 14px;
}
.bubble.me {
  align-self: flex-end;
  background: var(--rose);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble.them {
  align-self: flex-start;
  background: var(--fill);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.composer {
  display: flex;
  gap: 10px;
  align-items: center;
}
.composer input { flex: 1; }

.flash {
  font-size: 13px;
  margin-bottom: 14px;
  padding: 0;
  font-weight: 600;
  background: none;
  border: 0;
}
.flash.ok { color: var(--foam); }
.flash.err { color: #e07070; }

.empty {
  padding: 32px 8px;
  text-align: left;
  color: var(--mute);
  border: 0;
  background: none;
}
.empty strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 600;
}

.bar {
  height: 4px;
  background: var(--fill);
  margin-top: 8px;
  border-radius: 99px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--rose);
  border-radius: inherit;
}

.checks { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 16px; }
.checks label {
  font-size: 13px;
  color: var(--mute);
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 500;
}
.checks input { accent-color: var(--rose); }

.like-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  background: none;
  border-radius: 0;
}

.form-panel {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.queue::-webkit-scrollbar,
.thread::-webkit-scrollbar { width: 6px; }
.queue::-webkit-scrollbar-thumb,
.thread::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
}
