:root {
  color-scheme: dark;
  --bg: #06110f;
  --panel: rgba(14, 31, 27, 0.88);
  --panel-strong: #102923;
  --line: rgba(154, 255, 210, 0.16);
  --text: #effff8;
  --muted: #94aaa1;
  --acid: #9affd2;
  --cyan: #54d8ff;
  --warning: #ffd36a;
  --danger: #ff8a80;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 78% 4%, rgba(84, 216, 255, 0.12), transparent 28rem),
    radial-gradient(circle at 8% 40%, rgba(154, 255, 210, 0.08), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(154, 255, 210, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(154, 255, 210, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.app-shell {
  position: relative;
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
}

.topbar, .status-row, .section-heading, .profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar { margin-bottom: 24px; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(154, 255, 210, 0.4);
  border-radius: 14px 5px 14px 5px;
  background: linear-gradient(145deg, rgba(154, 255, 210, 0.16), rgba(84, 216, 255, 0.04));
  color: var(--acid);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 22px rgba(154, 255, 210, 0.08);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.02rem; letter-spacing: 0.02em; }
.brand small { color: var(--muted); font-size: 0.75rem; }

.icon-button, .dialog-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.view { display: none; animation: reveal 260ms ease-out; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

.status-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(154, 255, 210, 0.2);
  border-radius: 28px 10px 28px 10px;
  background: linear-gradient(145deg, rgba(21, 53, 44, 0.96), rgba(8, 22, 19, 0.96));
  box-shadow: var(--shadow);
}
.status-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -80px;
  bottom: -95px;
  border: 28px solid rgba(154, 255, 210, 0.045);
  border-radius: 50%;
}
.eyebrow { color: var(--acid); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; color: #cde4da; font-size: 0.78rem; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 12px var(--warning); }
h1, h2, p { margin-top: 0; }
.status-card h1 { max-width: 12ch; margin: 26px 0 12px; font-size: clamp(2rem, 9vw, 3.5rem); line-height: 0.98; letter-spacing: -0.055em; }
.status-card p { max-width: 48ch; color: #b6cbc2; }
.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 24px 0; }
.progress span { height: 4px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); }
.progress .done { background: linear-gradient(90deg, var(--acid), var(--cyan)); box-shadow: 0 0 12px rgba(154, 255, 210, 0.35); }
.primary-action, .secondary-action {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 16px 6px 16px 6px;
  cursor: pointer;
  font-weight: 800;
}
.primary-action { display: flex; align-items: center; justify-content: space-between; border: 0; background: var(--acid); color: #04130d; }
.primary-action:disabled { opacity: 0.38; cursor: not-allowed; }
.secondary-action { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }

.section-heading { margin: 30px 2px 14px; }
.section-heading h1, .section-heading h2 { margin: 4px 0 0; font-size: 1.42rem; letter-spacing: -0.025em; }
.page-heading { margin-top: 8px; }
.page-heading h1 { font-size: 2.2rem; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick-card {
  min-height: 144px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px 7px 20px 7px;
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}
.quick-card:hover, .quick-card:focus-visible { transform: translateY(-2px); border-color: rgba(154, 255, 210, 0.44); }
.quick-card strong, .quick-card small { display: block; }
.quick-card strong { margin-top: 18px; font-size: 1rem; }
.quick-card small { color: var(--muted); font-size: 0.78rem; }
.quick-icon { color: var(--acid); font-size: 1.5rem; }
.signal-icon { color: var(--cyan); }

.risk-note { display: flex; gap: 12px; margin-top: 18px; padding: 15px 16px; border: 1px solid rgba(255, 211, 106, 0.16); border-radius: 16px 5px 16px 5px; background: rgba(255, 211, 106, 0.05); }
.risk-note > span { color: var(--warning); font-weight: 900; }
.risk-note p { margin: 0; color: #bbc9c3; font-size: 0.82rem; }

.empty-state { margin-top: 48px; padding: 34px 22px; text-align: center; border: 1px solid var(--line); border-radius: 28px 8px; background: var(--panel); }
.empty-state h2 { font-size: 1.4rem; }
.empty-state p { color: var(--muted); }
.radar { position: relative; width: 126px; height: 126px; margin: 0 auto 26px; border: 1px solid rgba(84, 216, 255, 0.25); border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 19px, rgba(84, 216, 255, 0.1) 20px); }
.radar::after { content: ""; position: absolute; inset: 50% 50% 0 50%; transform-origin: top; border-left: 1px solid var(--cyan); animation: sweep 3s linear infinite; }
.radar span { position: absolute; width: 7px; height: 7px; left: 68%; top: 31%; border-radius: 50%; background: var(--acid); box-shadow: 0 0 12px var(--acid); }
@keyframes sweep { to { transform: rotate(360deg); } }

.material-list { display: grid; gap: 12px; }
.material-list article { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 18px 6px; background: var(--panel); }
.material-list article.locked { opacity: 0.58; }
.material-list h2 { margin: 0 0 3px; font-size: 1rem; }
.material-list p { margin: 0; color: var(--muted); font-size: 0.8rem; }
.material-list button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--acid); color: #05130e; cursor: pointer; }
.file-type { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid var(--line); border-radius: 14px 5px; color: var(--acid); font-size: 0.72rem; font-weight: 900; }

.profile-card { justify-content: flex-start; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 22px 7px; background: var(--panel); }
.profile-card h2, .profile-card p { margin: 0; }
.profile-card p { color: var(--muted); font-size: 0.84rem; }
.avatar { display: grid; width: 56px; height: 56px; place-items: center; border-radius: 18px 7px; background: linear-gradient(145deg, var(--acid), var(--cyan)); color: #04130d; font-size: 1.3rem; font-weight: 900; }
.detail-list { margin: 16px 0; border: 1px solid var(--line); border-radius: 22px 7px; background: var(--panel); overflow: hidden; }
.detail-list div { display: flex; justify-content: space-between; gap: 20px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.detail-list div:last-child { border: 0; }
.detail-list dt, .detail-list dd { margin: 0; }
.detail-list dd { text-align: right; color: var(--acid); }
.detail-list .pending { color: var(--warning); }
.detail-list .muted { color: var(--muted); }
.detail-list .safe { color: var(--cyan); }

.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  width: min(calc(100% - 24px), 720px);
  grid-template-columns: repeat(4, 1fr);
  transform: translateX(-50%);
  border: 1px solid rgba(154, 255, 210, 0.18);
  border-radius: 22px 8px 22px 8px;
  background: rgba(7, 20, 17, 0.92);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
}
.bottom-nav button { min-height: 68px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.68rem; }
.bottom-nav button span { display: block; margin-bottom: 4px; font-size: 1.2rem; }
.bottom-nav button.active { color: var(--acid); }

dialog { width: min(calc(100% - 28px), 520px); padding: 0; border: 1px solid rgba(154, 255, 210, 0.3); border-radius: 28px 9px; background: #0d211c; color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 8, 7, 0.72); backdrop-filter: blur(7px); }
dialog form { position: relative; padding: 28px; }
dialog h2 { margin: 12px 0; font-size: 1.8rem; }
dialog p { color: var(--muted); }
dialog label { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; }
dialog input { width: 20px; height: 20px; accent-color: var(--acid); }
.dialog-close { position: absolute; right: 18px; top: 18px; font-size: 1.4rem; }
dialog .primary-action { margin-top: 22px; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 98px; max-width: calc(100% - 36px); padding: 12px 16px; transform: translate(-50%, 20px); border: 1px solid var(--line); border-radius: 14px 5px; background: #142a24; opacity: 0; pointer-events: none; transition: 180ms ease; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

body.light {
  color-scheme: light;
  --bg: #ecf8f2;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --line: rgba(2, 61, 42, 0.13);
  --text: #092219;
  --muted: #5e756b;
  --acid: #087a52;
  --cyan: #08789a;
  --shadow: 0 24px 70px rgba(16, 64, 48, 0.12);
}
body.light .status-card { background: linear-gradient(145deg, #ffffff, #dff7eb); }
body.light .status-card p { color: #4d6a5e; }
body.light .primary-action { background: #0b7d55; color: #fff; }
body.light .bottom-nav { background: rgba(250, 255, 252, 0.92); }
body.light dialog { background: #fff; }

@media (min-width: 680px) {
  .app-shell { padding-inline: 28px; }
  .status-card { padding: 34px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-card { min-height: 164px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

