:root {
  --bg: #0a0a0b;
  --panel: #121214;
  --panel-2: #17171a;
  --line: #232327;
  --line-soft: #1b1b1f;
  --txt: #f4f4f5;
  --mut: #a1a1aa;
  --dim: #63636b;
  --red: #f87171;
  --amber: #fbbf24;
  --green: #4ade80;
  --radius: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 20%, transparent 75%);
  opacity: 0.5;
}

/* ---------- entrance motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: var(--d, 0ms); }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.pop { animation: pop-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ---------- top bar ---------- */
.topbar {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark {
  width: 14px; height: 14px; border-radius: 4px;
  background: linear-gradient(135deg, #fff, #71717a);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
}
.wordmark { font-weight: 700; letter-spacing: -0.02em; font-size: 18px; }
.divider, .sub { color: var(--dim); font-size: 14px; }
.status { display: flex; align-items: center; gap: 12px; }
.pill {
  font-family: var(--mono); font-size: 11.5px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; color: var(--mut); background: var(--panel);
}
.pill.ghost { background: transparent; }
.live { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--mut); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); transition: background 0.3s, box-shadow 0.3s; }
.dot.on { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dot.mock { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.dot.pulse { animation: pulse 1s ease-in-out infinite; background: var(--mut); }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.8); } }

/* ---------- layout ---------- */
.layout {
  position: relative; z-index: 1;
  display: grid; gap: 20px;
  grid-template-columns: 1fr 1fr;
  max-width: 1180px; margin: 0 auto; padding: 28px 32px 12px;
}
.inbox { grid-column: 1 / -1; }
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); font-weight: 600; }

/* ---------- composer ---------- */
select, input[type="text"], textarea {
  width: 100%;
  background: var(--bg); color: var(--txt);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 14px;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus, input:focus, textarea:focus { border-color: #52525b; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06); }
select { width: auto; font-size: 12.5px; color: var(--mut); cursor: pointer; }
textarea { resize: vertical; line-height: 1.55; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; letter-spacing: 0.04em; }
.row2 { display: grid; grid-template-columns: 1fr 130px; gap: 12px; }
.latency {
  font-family: var(--mono); font-size: 14px; color: var(--txt);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: var(--bg); white-space: nowrap;
}
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 16px; }
.slider span { display: block; font-size: 12px; color: var(--mut); margin-bottom: 8px; }
.slider b { font-family: var(--mono); color: var(--txt); font-weight: 600; }
input[type="range"] { width: 100%; accent-color: #e4e4e7; cursor: pointer; }
.go {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: #fafafa; color: #09090b; border: none; border-radius: 10px;
  font: inherit; font-weight: 650; font-size: 15px; padding: 13px 18px;
  cursor: pointer; transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
}
.go:hover { box-shadow: 0 0 28px rgba(255, 255, 255, 0.18); }
.go:active { transform: scale(0.985); }
.go:disabled { opacity: 0.55; cursor: wait; }
.go-key {
  font-family: var(--mono); font-size: 12px; opacity: 0.5;
  border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 6px; padding: 2px 8px;
}
.go.loading .go-label::after { content: "…"; animation: dots 0.9s steps(3) infinite; }
@keyframes dots { 0% { content: ""; } 33% { content: "·"; } 66% { content: "··"; } 100% { content: "···"; } }

/* ---------- result ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--dim); font-size: 14px; line-height: 1.7; }
.empty-ring {
  width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 50%;
  border: 1px dashed #3f3f46;
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-left: 3px solid var(--mut);
  background: var(--bg); border-radius: 10px; padding: 13px 15px; margin-bottom: 18px;
}
.banner .traffic { display: flex; gap: 6px; }
.traffic i { width: 11px; height: 11px; border-radius: 50%; background: #3f3f46; transition: all 0.3s; }
.banner.red { border-left-color: var(--red); }
.banner.red .traffic i:nth-child(1) { background: var(--red); box-shadow: 0 0 12px var(--red); }
.banner.amber { border-left-color: var(--amber); }
.banner.amber .traffic i:nth-child(2) { background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.banner.green { border-left-color: var(--green); }
.banner.green .traffic i:nth-child(3) { background: var(--green); box-shadow: 0 0 12px var(--green); }
.banner .action { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.banner .route { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--mut); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; margin-bottom: 6px; font-size: 13.5px; }
.kv .k { color: var(--dim); }
.kv .v { font-family: var(--mono); display: flex; align-items: center; gap: 8px; }
.sdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sdot.g { background: var(--green); box-shadow: 0 0 8px var(--green); }
.sdot.a { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.sdot.r { background: var(--red); box-shadow: 0 0 8px var(--red); }

.bars { margin: 14px 0 4px; display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 46px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-row .name { color: var(--mut); font-family: var(--mono); font-size: 11.5px; text-transform: lowercase; }
.bar-row .num { font-family: var(--mono); text-align: right; color: var(--txt); }
.track { height: 6px; background: #1f1f23; border-radius: 99px; overflow: hidden; }
.fill {
  height: 100%; width: 0; border-radius: 99px; background: #e4e4e7;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.fill.hot { background: var(--red); }
.fill.warm { background: var(--amber); }

.gauge-wrap { margin: 16px 0 6px; }
.gauge-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.gauge-top b { font-family: var(--mono); font-size: 14px; }
.gauge { height: 10px; background: #1f1f23; border-radius: 99px; overflow: hidden; position: relative; }
.gauge .fill { transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s; }
.gauge .marker {
  position: absolute; top: -2px; bottom: -2px; width: 2px; background: rgba(255, 255, 255, 0.45);
  transition: left 0.3s;
}
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); margin: 18px 0 8px; }

/* ---------- inbox ---------- */
.inbox-list { display: flex; flex-direction: column; }
.inbox-row {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 10px; border-top: 1px solid var(--line-soft);
  cursor: pointer; border-radius: 8px;
  transition: background 0.18s;
  animation: pop-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--d, 0ms);
}
.inbox-row:hover { background: rgba(255, 255, 255, 0.03); }
.inbox-row .subj { font-size: 13.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row .from { font-size: 12px; color: var(--dim); font-family: var(--mono); }
.inbox-row .tags { display: flex; gap: 8px; align-items: center; font-family: var(--mono); font-size: 11px; color: var(--mut); }
.inbox-loading { padding: 22px; color: var(--dim); font-size: 13px; display: flex; gap: 10px; align-items: center; }

/* ---------- footer ---------- */
.foot {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1180px; margin: 0 auto; padding: 18px 32px 34px;
  font-family: var(--mono); font-size: 11.5px; color: var(--dim);
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 20px 16px 8px; }
  .topbar { padding: 16px; }
  .foot { padding: 14px 16px 28px; }
  .row2 { grid-template-columns: 1fr; }
}
