@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0f0f;
  --surface: #131616;
  --border: #1f2424;
  --border-hi: #2e3636;
  --rail: #00c896;
  --rail-dim: #00c89622;
  --amber: #f5a623;
  --amber-dim: #f5a62318;
  --text: #c8d0d0;
  --text-dim: #5a6666;
  --text-hi: #eef2f2;
  --red: #e05555;
  --mono: "IBM Plex Mono", monospace;
  --sans: "IBM Plex Sans", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--rail);
  letter-spacing: 0.08em;
}
.logo span {
  color: var(--text-dim);
}
.status-bar {
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.status-bar .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-right: 5px;
  vertical-align: middle;
}
.status-bar .dot.active {
  background: var(--rail);
  box-shadow: 0 0 6px var(--rail);
}

/* ── Grid ── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  flex: 1;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.panel.span2 {
  grid-column: span 2;
}
.panel.full {
  grid-column: span 3;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.panel-title .accent {
  color: var(--rail);
}
.panel-index {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--border-hi);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
}

/* ── Email view ── */
.email-field {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 12px;
}
.email-field .label {
  color: var(--text-dim);
  min-width: 60px;
}
.email-field .value {
  color: var(--text-hi);
}
.email-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.email-body {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}
.email-body a {
  color: var(--rail);
  text-decoration: none;
}

/* ── Run button ── */
.run-wrap {
  padding: 12px 14px;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.btn-run {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--rail);
  color: var(--rail);
  padding: 7px 32px;
  cursor: pointer;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
.btn-run:hover {
  background: var(--rail-dim);
  box-shadow: 0 0 14px var(--rail-dim);
}
.btn-run.running {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-dim);
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ── Processing log ── */
.log-line {
  font-family: var(--mono);
  font-size: 12px;
  padding: 3px 0;
  display: flex;
  gap: 10px;
  opacity: 0;
  transform: translateX(-6px);
  transition:
    opacity 0.3s,
    transform 0.3s;
}
.log-line.visible {
  opacity: 1;
  transform: none;
}
.log-line .ts {
  color: var(--text-dim);
  min-width: 56px;
}
.log-line .msg {
  color: var(--text);
}
.log-line .msg.done {
  color: var(--rail);
}
.log-line .msg.warn {
  color: var(--amber);
}

/* ── Metadata ── */
.meta-block {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 2px;
  line-height: 1.8;
}
.meta-key {
  color: var(--text-dim);
}
.meta-value {
  color: var(--text-hi);
}
.meta-string {
  color: #7ec8a0;
}
.meta-url {
  color: var(--rail);
}
.meta-arr {
  color: var(--amber);
}

/* ── Key facts ── */
.fact-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.fact-row:last-child {
  border-bottom: none;
}
.fact-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}
.fact-tag.hi {
  border-color: var(--rail);
  color: var(--rail);
}
.fact-val {
  font-size: 13px;
  color: var(--text-hi);
  line-height: 1.5;
}

/* ── Analysis ── */
.analysis-section {
  margin-bottom: 16px;
}
.analysis-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rail);
  margin-bottom: 6px;
}
.analysis-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}
.action-item {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text);
}
.action-item::before {
  content: "→";
  color: var(--rail);
  flex-shrink: 0;
  font-family: var(--mono);
}
.score-bar {
  height: 3px;
  background: var(--border);
  margin-top: 8px;
  position: relative;
}
.score-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--rail);
  width: 0;
  transition: width 1s ease 0.5s;
}
.score-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Idle overlay ── */
.idle-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  z-index: 2;
  transition: opacity 0.4s;
}
.idle-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.idle-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--border-hi);
  letter-spacing: 0.1em;
}

/* ── Preset buttons ── */
.preset-btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  padding: 4px 12px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.preset-btn:hover {
  border-color: var(--text-dim);
  color: var(--text);
}
.preset-btn.active {
  border-color: var(--rail);
  color: var(--rail);
}
