:root {
  color-scheme: light;
  --ink: #1c1915;
  --muted: #6d645b;
  --line: #e4dcd2;
  --paper: #f6f1ea;
  --card: #fffdf9;
  --sidebar: #24211d;
  --sidebar-soft: #312c27;
  --cream: #f3eadf;
  --accent: #c6532a;
  --accent-dark: #9d3e1d;
  --good: #1f7a4d;
  --bad: #9d2c2c;
  --shadow: 0 16px 40px rgba(48, 32, 18, 0.08);
  font-family: "Segoe UI", "PT Sans", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
}

button, input, textarea { font: inherit; }

button { cursor: pointer; }

#app {
  height: 100%;
  min-height: 100%;
}

.boot, .install {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  text-align: center;
}

.install, .gate {
  width: min(560px, 100%);
  margin: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  text-align: left;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2 { font-weight: 650; letter-spacing: -0.03em; }

h1 { margin: 0 0 12px; font-size: 32px; }

h2 { margin: 0; font-size: 22px; }

p { line-height: 1.5; }

.shell {
  height: 100%;
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
}

.sidebar {
  background: var(--sidebar);
  color: #f7f1e8;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand, .me, .pane-head, .composer, .settings-form {
  padding: 18px 18px 14px;
}

.brand strong, .me strong { display: block; }

.brand span, .me span, .hint, .meta {
  color: #cbbbaa;
  font-size: 13px;
}

.brand { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }

.toolbar, .stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 0;
}

.sidebar .stack {
  overflow: auto;
  min-height: 0;
  padding-bottom: 14px;
}

.me {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.primary, .ghost, .danger, .tiny {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:hover { background: var(--accent-dark); }

.ghost, .tiny {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.pane .ghost, .pane .tiny, .gate .ghost {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.danger {
  background: transparent;
  color: #ffd0d0;
  border: 1px solid rgba(255, 180, 180, 0.25);
}

.pane .danger { color: var(--bad); border-color: #efc7c7; background: white; }

.tiny { padding: 6px 10px; border-radius: 999px; }

.card, .row {
  width: 100%;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--sidebar-soft);
  color: inherit;
  padding: 12px;
}

.row { display: flex; flex-direction: column; gap: 4px; }

.row.active { outline: 1px solid #e7b39a; }

.row b, .card b { font-weight: 650; }

.section-label {
  margin: 8px 4px 0;
  color: #b5a494;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.actions { display: flex; gap: 8px; margin-top: 10px; }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 12px;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at top right, rgba(198, 83, 42, 0.08), transparent 28%),
    var(--paper);
}

.pane-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.9);
}

.pane-body {
  flex: 1;
  overflow: auto;
  padding: 22px;
  min-height: 0;
}

.back { display: none; }

.form, .settings-form {
  width: min(560px, 100%);
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 6px; }

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 12px 13px;
  color: var(--ink);
}

textarea { min-height: 74px; resize: vertical; }

input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid #e7b39a;
  outline-offset: 1px;
}

.hint { display: block; margin-top: 8px; }

.flash {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #e7f6ee;
  color: var(--good);
}

.flash.bad { background: #fdecec; color: var(--bad); }

.messages { display: flex; flex-direction: column; gap: 10px; }

.bubble {
  max-width: min(68%, 560px);
  padding: 10px 12px;
  border-radius: 16px;
  background: white;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.45;
}

.bubble.mine {
  margin-left: auto;
  background: var(--ink);
  color: #f7f1e8;
  border-color: var(--ink);
}

.bubble time, .empty {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  margin: 48px auto;
  max-width: 420px;
  text-align: center;
  font-size: 15px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.94);
}

.composer textarea { min-height: 52px; }

code {
  font-family: Consolas, monospace;
  font-size: 0.92em;
}

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .shell.pane-open .sidebar { display: none; }
  .shell:not(.pane-open) .pane { display: none; }
  .back { display: inline-flex; }
}
