:root {
  color-scheme: dark;
  --bg: #07090b;
  --panel: #101417;
  --panel-2: #151a1e;
  --line: #293138;
  --text: #f2f5f7;
  --muted: #9aa7b0;
  --accent: #38d39f;
  --accent-2: #1e9f7b;
  --warning: #f5b942;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top left, #10251f 0, var(--bg) 32rem); color: var(--text); min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.site-header {
  height: 72px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 11, .85);
  backdrop-filter: blur(16px);
}
.brand { font-weight: 800; letter-spacing: -.03em; }
.brand span { color: var(--accent); }
.secure { color: var(--muted); font-size: .9rem; }

.hero { width: min(1050px, 90vw); margin: 8vh auto; display: grid; grid-template-columns: 1.1fr .9fr; gap: 5rem; align-items: center; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 5.5rem); line-height: .95; letter-spacing: -.055em; margin: .6rem 0 1.4rem; }
.hero > p { color: var(--muted); font-size: 1.1rem; line-height: 1.7; max-width: 48rem; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 800; }

.card { background: linear-gradient(180deg, rgba(22,28,32,.96), rgba(13,17,20,.96)); border: 1px solid var(--line); border-radius: 18px; padding: 1.5rem; box-shadow: 0 20px 70px rgba(0,0,0,.24); }
.card h2, .card h3 { margin-top: 0; }
label { display: grid; gap: .55rem; color: #cbd3d8; font-size: .9rem; margin-bottom: 1rem; }
input, textarea { width: 100%; border-radius: 10px; border: 1px solid #344048; background: #090c0e; color: var(--text); padding: .8rem .9rem; outline: none; }
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,211,159,.1); }
button { border: 0; border-radius: 10px; background: var(--accent); color: #03110c; padding: .78rem 1rem; font-weight: 800; }
button:hover:not(:disabled) { background: #58e4b5; }
button:disabled { opacity: .38; cursor: not-allowed; }
.secondary { background: #222a30; color: var(--text); }
.message { min-height: 1.2rem; color: var(--warning); }

.portal { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 320px 1fr; }
.portal aside { border-right: 1px solid var(--line); padding: 2rem 1.4rem; background: #0b0e10; }
.portal aside h2 { margin: .4rem 0; }
.status { color: var(--muted); margin-top: 0; }
.progress { height: 7px; background: #1b2226; border-radius: 999px; overflow: hidden; margin: 1.4rem 0 1.6rem; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
#stage-nav { display: grid; gap: .4rem; }
.stage-link { text-align: left; background: transparent; color: #c2ccd2; padding: .7rem .8rem; font-weight: 600; border: 1px solid transparent; }
.stage-link.available, .stage-link.in_progress { border-color: #33413f; background: #121a18; }
.stage-link.complete { color: var(--accent); }
.stage-link.locked { color: #5f6970; }

.workspace { width: min(900px, 90%); margin: 0 auto; padding: 3rem 0 5rem; }
.workspace-head { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 1.5rem; }
.workspace-head h1 { margin: .2rem 0 0; font-size: clamp(2rem, 4vw, 3.3rem); letter-spacing: -.04em; }
.save-state { color: var(--muted); font-size: .9rem; }
.form-grid #stage-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.actions { display: flex; gap: .7rem; margin-top: .7rem; }
.muted-card { margin-top: 1rem; color: var(--muted); box-shadow: none; }
.muted-card h3 { color: var(--text); }
.hold { margin: 0 0 1rem; border: 1px solid #70551c; background: #271f0e; color: #ffd77e; border-radius: 12px; padding: 1rem; }

.admin-shell { width: min(1400px, 92vw); margin: 3rem auto 6rem; }
.admin-auth { width: min(560px, 100%); margin: 8vh auto; }
.admin-auth h1, .admin-heading h1 { margin: .25rem 0 1rem; font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.04em; }
.admin-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.2rem 0; }
.metric { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 1rem; display: grid; gap: .35rem; }
.metric span { color: var(--muted); font-size: .82rem; }
.metric strong { font-size: 1.8rem; }
.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.table-list { display: grid; gap: .55rem; max-height: 420px; overflow: auto; }
.table-list article { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; display: grid; gap: .25rem; background: #0b0e10; }
.table-list article span { color: var(--accent); font-size: .82rem; }
.table-list article small, .muted { color: var(--muted); }
.check-row { display: flex; align-items: center; gap: .6rem; }
.check-row input { width: auto; }
.result-box { margin-top: 1rem; border: 1px solid #2f6553; background: #0d211b; color: #a8f5d8; border-radius: 10px; padding: .8rem; overflow-wrap: anywhere; }
.message.error { color: #ff8a8a; }
@media (max-width: 1000px) { .metric-grid, .admin-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; margin-top: 4vh; }
  .portal { grid-template-columns: 1fr; }
  .portal aside { border-right: 0; border-bottom: 1px solid var(--line); }
  #stage-nav { grid-template-columns: repeat(2, 1fr); }
  .workspace { width: min(92%, 760px); }
}

@media (max-width: 640px) { .metric-grid, .admin-grid { grid-template-columns: 1fr; } .admin-heading { align-items: flex-start; flex-direction: column; } }

@media (max-width: 560px) {
  .site-header { padding: 0 1rem; }
  .secure { display: none; }
  .hero { width: 92vw; }
  .portal aside { padding: 1.3rem 1rem; }
  #stage-nav { grid-template-columns: 1fr; }
  .form-grid #stage-fields { grid-template-columns: 1fr; }
  .workspace { padding-top: 2rem; }
  .workspace-head { align-items: start; flex-direction: column; gap: .5rem; }
  .actions { flex-direction: column; }
}
