:root {
  --bg: #14171a;
  --bg-raised: #1b1f23;
  --bg-inset: #0f1113;
  --hairline: #2a2f34;
  --text: #e8e6e1;
  --text-dim: #9aa0a6;
  --amber: #f2a93b;
  --blue: #6f93b3;
  --red: #c1443b;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

.hidden { display: none !important; }

/* ---------- Gate ---------- */
.gate {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at top, rgba(242,169,59,0.06), transparent 60%),
    var(--bg);
}

.gate-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.gate-mark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--amber);
  border: 1px solid var(--amber);
  display: inline-block;
  padding: 6px 12px;
  margin-bottom: 20px;
}

.gate-card h1 {
  font-size: 28px;
  margin: 0 0 8px;
  font-weight: 700;
}

.gate-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.5;
}

.gate-card input {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 12px 14px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.gate-card input:focus { outline: none; border-color: var(--amber); }

.gate-card button {
  width: 100%;
  background: var(--amber);
  color: #1b1300;
  border: none;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 14px;
  border-radius: 4px;
  cursor: pointer;
}

.gate-card button:hover { filter: brightness(1.08); }

.gate-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin-top: 12px;
}

/* ---------- App shell ---------- */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-raised);
  flex-shrink: 0;
}

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

.brand-mark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.25em;
  color: var(--amber);
  border: 1px solid var(--amber);
  padding: 4px 8px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 14px; }
.brand-text span { font-size: 11px; color: var(--text-dim); }

.status {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4caf6f;
  box-shadow: 0 0 6px #4caf6f;
}

/* ---------- Log ---------- */
.log {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.log-entry {
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 14px 16px;
}

.log-entry.officer { border-left: 3px solid var(--blue); }
.log-entry.system { border-left: 3px solid var(--text-dim); }
.log-entry.assistant { border-left: 3px solid var(--amber); }
.log-entry.error { border-left: 3px solid var(--red); }

.entry-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.tag-officer { background: rgba(111,147,179,0.15); color: var(--blue); }
.tag-system { background: rgba(154,160,166,0.15); color: var(--text-dim); }
.tag-assistant { background: rgba(242,169,59,0.15); color: var(--amber); }
.tag-error { background: rgba(193,68,59,0.15); color: var(--red); }

.ts { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }

.log-entry p { margin: 6px 0; font-size: 14px; line-height: 1.55; }
.log-entry .hint { color: var(--text-dim); font-size: 12.5px; font-style: italic; }

.log-entry ul { margin: 6px 0; padding-left: 20px; }
.log-entry li { font-size: 14px; line-height: 1.55; margin-bottom: 4px; }

.log-entry strong { color: #fff; }

/* Statute chips — the signature element */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}

.chip {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--hairline);
  background: var(--bg-inset);
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 3px;
}

.chip b { color: var(--amber); font-weight: 600; }

.disclaimer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--hairline);
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

.thinking {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}

/* ---------- Composer ---------- */
.composer {
  flex-shrink: 0;
  border-top: 1px solid var(--hairline);
  background: var(--bg-raised);
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.composer textarea {
  flex: 1;
  resize: none;
  background: var(--bg-inset);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 12px 14px;
  border-radius: 6px;
  max-height: 140px;
}

.composer textarea:focus { outline: none; border-color: var(--amber); }

.composer button {
  background: var(--amber);
  color: #1b1300;
  border: none;
  font-weight: 600;
  font-size: 14px;
  padding: 0 20px;
  border-radius: 6px;
  cursor: pointer;
}

.composer button:disabled { opacity: 0.5; cursor: default; }
.composer button:hover:not(:disabled) { filter: brightness(1.08); }

@media (max-width: 600px) {
  .topbar { padding: 12px 14px; }
  .log { padding: 14px; }
  .composer { padding: 10px 14px; }
}
