:root {
  --bg: #02040b;
  --bg-soft: #07111f;
  --panel: rgba(7, 17, 31, 0.92);
  --panel-strong: rgba(10, 28, 52, 0.95);
  --line: rgba(76, 177, 255, 0.24);
  --line-strong: rgba(76, 177, 255, 0.46);
  --text: #f4fbff;
  --muted: #9eb3ce;
  --dim: #667b9d;
  --blue: #2d7dff;
  --cyan: #35d6ff;
  --gold: #ffcf5a;
  --green: #58ffbd;
  --red: #ff5f7e;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(45, 125, 255, 0.34), transparent 30%),
    radial-gradient(circle at 92% 12%, rgba(255, 207, 90, 0.11), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(53, 214, 255, 0.18), transparent 34%),
    #02040b;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(5, 10, 22, 0.22), rgba(2, 4, 11, 0.7)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 48px);
}

.screen { animation: rise 180ms ease-out; padding-bottom: 4px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.top-card, .card, .project-card, .decision-card, .placeholder, .outbox-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(7, 17, 31, 0.96), rgba(4, 8, 18, 0.92));
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.top-card { padding: 18px; position: relative; overflow: hidden; }
.command-cta.small { min-height: 52px; margin-top: 14px; font-size: 15px; }
.top-card::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -38px;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(53,214,255,0.26), transparent 68%);
  pointer-events: none;
}

.kicker, .mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #8fdcff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(88,255,189,0.72);
}

h1 {
  margin: 20px 0 0;
  font-size: clamp(29px, 9vw, 38px);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

h2 { margin: 0; font-size: 16px; letter-spacing: -0.02em; }
h3 { margin: 0; font-size: 15px; }
p { margin: 0; }

.command-cta {
  width: 100%;
  min-height: 62px;
  margin-top: 18px;
  border: 0;
  border-radius: 20px;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(135deg, #eafaff, #77e6ff 58%, #ffcf5a);
  color: #03111d;
  font-size: 17px;
  font-weight: 900;
  text-align: left;
  box-shadow: 0 0 34px rgba(53,214,255,0.32);
}

.command-cta span, .arrow { font-size: 22px; }

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin: 13px 0 18px;
}

.metric {
  min-height: 88px;
  padding: 14px;
  border: 1px solid rgba(53,214,255,0.22);
  border-radius: 21px;
  background: linear-gradient(145deg, rgba(10,28,52,0.9), rgba(5,10,22,0.9));
}
.metric button { all: unset; display: block; width: 100%; cursor: pointer; }
.metric big { display: block; font-size: 27px; font-weight: 900; }
.metric span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.25; }
.metric.hot { border-color: rgba(255,207,90,0.42); }
.metric.hot big { color: var(--gold); }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 18px 4px 10px;
}
.section-title span { color: var(--muted); font-size: 12px; }

.project-card {
  width: 100%;
  min-height: 86px;
  border-radius: 22px;
  padding: 13px;
  margin: 10px 0;
  color: var(--text);
  text-align: left;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}
.project-card:active, .command-cta:active, .nav button:active, .button:active { transform: scale(0.985); }
.project-card:hover { border-color: var(--line-strong); }

.icon {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #123d76, #0d2143);
  color: #8ff0ff;
  font-size: 12px;
  font-weight: 900;
}
.project-meta { min-width: 0; }
.project-meta b { display: block; font-size: 15px; }
.project-meta p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.25; }
.gold { color: var(--gold) !important; }
.green { color: var(--green) !important; }
.red { color: var(--red) !important; }
.muted { color: var(--muted); }

.progress {
  height: 7px;
  border-radius: 99px;
  background: #10213b;
  overflow: hidden;
  margin-top: 10px;
}
.progress i {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--gold));
  border-radius: inherit;
}

.card, .decision-card, .placeholder, .queue-item, .file-item, .outbox-panel { padding: 16px; margin-top: 12px; }
.card p, .decision-card p, .placeholder p, .queue-item p, .file-item p, .outbox-panel p { color: var(--muted); font-size: 14px; line-height: 1.38; margin-top: 7px; }
.queue-item, .file-item {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(7, 17, 31, 0.92), rgba(4, 8, 18, 0.88));
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.queue-item small { display: block; margin-top: 10px; color: var(--dim); font-size: 12px; font-weight: 800; }
.queue-item.is-done { opacity: 0.72; }
.outbox-panel { border-color: rgba(255,207,90,0.34); background: linear-gradient(145deg, rgba(25, 26, 26, 0.92), rgba(7,17,31,0.92)); }
.outbox-panel h2 { color: var(--gold); }
.helper-copy { font-size: 12px !important; }
.message-preview {
  margin-top: 12px;
  border: 1px dashed rgba(53,214,255,0.28);
  border-radius: 16px;
  background: rgba(2,4,11,0.46);
  padding: 11px;
}
.message-preview pre {
  margin: 0;
  white-space: pre-wrap;
  color: #d7f7ff;
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copy-box { min-height: 190px; margin-top: 12px; font-size: 14px; }
.export-box { min-height: 260px; }
.queue-actions { grid-template-columns: 1fr; }
.file-item b { color: #bcecff; }
.compact-list { margin: 10px 0 0; padding: 0; list-style: none; }
.compact-list li { padding: 9px 0; border-bottom: 1px solid rgba(53,214,255,0.1); color: var(--muted); font-size: 13px; line-height: 1.35; }
.compact-list li:last-child { border-bottom: 0; }
.utility-link { display: block; margin: 16px auto 0; border: 0; background: transparent; color: var(--dim); font-size: 12px; font-weight: 800; text-decoration: underline; }

.detail-head {
  padding: 18px;
  border-radius: 26px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(145deg, rgba(10,28,52,0.96), rgba(4,8,18,0.94));
}
.detail-head h1 { margin-top: 12px; }

.back-link {
  border: 0;
  background: transparent;
  color: var(--cyan);
  min-height: 40px;
  padding: 0;
  font-size: 14px;
  font-weight: 800;
}

.button-row { display: grid; gap: 10px; margin-top: 14px; }
.button-row.two { grid-template-columns: 1fr 1fr; }

.button {
  min-height: 50px;
  border: 1px solid rgba(53,214,255,0.32);
  border-radius: 17px;
  padding: 12px 14px;
  background: rgba(53,214,255,0.1);
  color: var(--text);
  font-weight: 850;
}
.button.primary {
  border: 0;
  background: linear-gradient(135deg, #eafaff, #77e6ff 62%, #ffcf5a);
  color: #03111d;
}
.button.ghost { background: rgba(255,255,255,0.035); color: #bcecff; }
.button.gold { border-color: rgba(255,207,90,0.48); background: rgba(255,207,90,0.12); color: var(--gold) !important; }

.timeline { margin: 10px 0 0; padding: 0; list-style: none; }
.timeline li {
  position: relative;
  padding: 10px 0 10px 24px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid rgba(53,214,255,0.09);
}
.timeline li:last-child { border-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 16px rgba(53,214,255,0.55);
}

textarea {
  width: 100%;
  min-height: 172px;
  resize: vertical;
  border: 1px solid rgba(53,214,255,0.36);
  outline: none;
  background: linear-gradient(145deg, #07111f, #040812);
  border-radius: 24px;
  padding: 17px;
  color: #e6f8ff;
  font-size: 18px;
  line-height: 1.36;
}
textarea:focus { border-color: rgba(255,207,90,0.62); box-shadow: 0 0 0 3px rgba(255,207,90,0.08); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  min-height: 40px;
  border: 1px solid rgba(53,214,255,0.3);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(53,214,255,0.07);
  color: #b9f4ff;
  font-size: 13px;
  font-weight: 800;
}
.chip.active { border-color: rgba(255,207,90,0.66); background: rgba(255,207,90,0.14); color: var(--gold); }

.confirmation {
  margin-top: 12px;
  border: 1px solid rgba(88,255,189,0.38);
  border-radius: 20px;
  padding: 14px;
  background: rgba(88,255,189,0.08);
  color: var(--green);
  font-weight: 850;
}

.decision-card.approved { border-color: rgba(88,255,189,0.42); }
.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255,207,90,0.12);
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}
.state-pill.done { background: rgba(88,255,189,0.1); color: var(--green); }

.nav {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(calc(100vw - 28px), 402px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(53,214,255,0.22);
  border-radius: 24px;
  background: rgba(4,8,18,0.94);
  backdrop-filter: blur(16px);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.28);
}
.nav button {
  min-height: 46px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: #7890b5;
  font-size: 11px;
  font-weight: 900;
}
.nav button.active { background: rgba(53,214,255,0.11); color: #7de7ff; }

.empty-orbit {
  height: 120px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(53,214,255,0.24);
  color: var(--dim);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

@media (min-width: 431px) {
  body { padding: 18px 0; }
  .shell { min-height: calc(100vh - 36px); border: 1px solid rgba(53,214,255,0.12); border-radius: 34px; }
}
