:root {
  --bg0: #0f1412;
  --bg1: #171e1b;
  --bg2: #1f2924;
  --line: #2d3b34;
  --text: #e8f0eb;
  --muted: #8fa398;
  --accent: #3ecf8e;
  --accent-dim: #1f6b4a;
  --danger: #e07070;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a3d2e 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243028 0%, transparent 50%),
    var(--bg0);
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.mark {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 0.4rem;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  font-family: var(--mono);
  font-weight: 500;
  color: #04140c;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tag {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.login-panel {
  display: block;
  max-width: 24rem;
}

.login-panel[hidden] {
  display: none;
}

.login-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.login-panel .hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
}

.session {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
}

.dev-key {
  font-size: 0.8rem;
  color: var(--muted);
}

.dev-key summary {
  cursor: pointer;
  margin-bottom: 0.35rem;
}

.dev-key[open] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}


label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  background: var(--bg1);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 0.35rem;
  padding: 0.55rem 0.7rem;
  min-width: 16rem;
}

textarea {
  min-width: 100%;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.btn {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 0.35rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent-dim);
}

.btn.primary {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #dff8ea;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  border-radius: 0.3rem;
}

.tab.active {
  color: var(--text);
  background: var(--bg2);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

#panel-inbox {
  display: none;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
}

#panel-inbox.active {
  display: grid;
}

.toolbar {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
}

.toolbar input {
  flex: 1;
}

.list {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  min-height: 28rem;
  max-height: 36rem;
  overflow: auto;
}

.msg {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: inherit;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
}

.msg:hover,
.msg.active {
  background: var(--bg2);
}

.msg .sub {
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.msg .meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.detail {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1rem;
  min-height: 28rem;
  overflow: auto;
}

.detail.empty {
  color: var(--muted);
  display: grid;
  place-items: center;
}

.detail h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.detail .meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.detail pre {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--bg0);
  padding: 0.85rem;
  border-radius: 0.35rem;
}

.form {
  display: grid;
  gap: 0.85rem;
  max-width: 36rem;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1rem;
}

.form.row {
  grid-template-columns: 1fr auto;
  align-items: end;
  max-width: 40rem;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.secret {
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: #1a2a20;
  border: 1px solid var(--accent-dim);
  border-radius: 0.35rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
}

.banner {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #2a1717;
  border: 1px solid var(--danger);
  border-radius: 0.35rem;
  color: #f0c0c0;
}

@media (max-width: 800px) {
  #panel-inbox.active {
    grid-template-columns: 1fr;
  }
  input {
    min-width: 0;
  }
}
