:root {
  --bg: #0d0f0c;
  --panel: #14170f;
  --panel-border: #3a3320;
  --amber: #ffb000;
  --amber-dim: #9c7328;
  --green-ok: #7ee787;
  --red-err: #ff5f56;
  --text: #e8dfc8;
  --text-dim: #8a8370;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 14px;
}

.hidden { display: none !important; }

/* ── CRT shell ─────────────────────────────────────────────── */

.crt {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at center, rgba(255,176,0,0.04), transparent 70%),
    var(--bg);
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.12) 3px
  );
  mix-blend-mode: multiply;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #1a1c14;
  border-bottom: 1px solid var(--panel-border);
  font-family: "Space Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--amber-dim);
}

.titlebar-dots { display: inline-flex; gap: 6px; }
.titlebar-dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber-dim);
  display: inline-block;
  opacity: 0.5;
}

/* ── Panels (box-drawn) ───────────────────────────────────── */

.panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  margin: 0 0 16px 0;
}

.panel-title,
.panel-title-bottom {
  font-family: "Space Mono", monospace;
  font-size: 12px;
  color: var(--amber);
  padding: 6px 12px;
  letter-spacing: 0.03em;
  white-space: pre;
  overflow-x: auto;
}

.panel-title-bottom { color: var(--panel-border); }

.panel-body { padding: 4px 18px 18px; }

.panel-center {
  max-width: 460px;
  margin: 12vh auto 0;
}

/* ── Screens / layout ─────────────────────────────────────── */

.screen { flex: 1; padding: 24px; }

.dashboard {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 0;
  padding: 0;
}

.sidebar {
  width: 190px;
  flex-shrink: 0;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  padding: 10px 18px;
  cursor: pointer;
}
.nav-item:hover { color: var(--text); background: #1a1d14; }
.nav-item.active { color: var(--amber); border-left: 2px solid var(--amber); background: #1a1d14; }
.nav-logout { margin-top: auto; color: var(--red-err); opacity: 0.75; }
.nav-logout:hover { opacity: 1; }

.content { flex: 1; padding: 24px; max-width: 720px; }

/* ── Form elements ────────────────────────────────────────── */

.field { display: block; margin: 14px 0; }
.field span {
  display: block;
  color: var(--amber-dim);
  font-size: 12px;
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  background: #0a0c08;
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 10px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--amber);
}

.btn {
  background: #201b0c;
  border: 1px solid var(--amber-dim);
  color: var(--amber);
  font-family: "Space Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.05em;
  padding: 9px 16px;
  cursor: pointer;
  margin-top: 4px;
}
.btn:hover { border-color: var(--amber); background: #2a2410; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost { background: none; }
.btn-danger { color: var(--red-err); border-color: var(--red-err); }

.hint { color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.error-text { color: var(--red-err); font-size: 12.5px; min-height: 1em; }

/* ── Table ────────────────────────────────────────────────── */

.table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.table th {
  text-align: left; color: var(--amber-dim); font-weight: 500;
  border-bottom: 1px solid var(--panel-border); padding: 6px 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
}
.table td { padding: 8px; border-bottom: 1px solid #1f2216; vertical-align: top; }
.table a.delete-link { color: var(--red-err); cursor: pointer; text-decoration: underline; }

/* ── Inbox / OTP list ─────────────────────────────────────── */

.inbox-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.inbox-item {
  border: 1px solid var(--panel-border);
  padding: 10px 12px;
  background: #0f120b;
}
.inbox-item .meta { color: var(--text-dim); font-size: 11.5px; margin-bottom: 6px; }
.inbox-item .subject { color: var(--text); font-size: 13px; margin-bottom: 4px; }
.inbox-item .otp {
  font-family: "Space Mono", monospace;
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--green-ok);
}
.inbox-item .body-preview { color: var(--text-dim); font-size: 12px; margin-top: 6px; white-space: pre-wrap; }

/* ── Mode line ────────────────────────────────────────────── */

.modeline {
  border-top: 1px solid var(--panel-border);
  background: #1a1c14;
  color: var(--text-dim);
  font-size: 11.5px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Space Mono", monospace;
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-off { background: var(--red-err); }
.dot-on { background: var(--green-ok); box-shadow: 0 0 6px var(--green-ok); }

.modeline-sep { opacity: 0.4; }

.cursor {
  margin-left: auto;
  color: var(--amber);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 640px) {
  .dashboard { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--panel-border); padding: 0; }
  .nav-item { padding: 12px 14px; white-space: nowrap; }
  .nav-logout { margin-top: 0; margin-left: auto; }
  .content { padding: 16px; }
}
