:root {
  --bg: #071018;
  --surface: #0b1621;
  --surface-2: #101d2a;
  --line: rgba(154, 190, 220, 0.16);
  --text: #edf5ff;
  --muted: #91a5b8;
  --accent: #72e5ff;
  --warm: #f2b880;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Instrument Sans", system-ui, sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.portal-shell { min-height: 100vh; }
.portal-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
}
.portal-brand {
  color: var(--text);
  text-decoration: none;
  font: 700 1.05rem "Space Grotesk", sans-serif;
}
.portal-brand span, .kicker, .status-label { color: var(--accent); }
.portal-user { display: none; align-items: center; gap: 18px; color: var(--muted); font-size: .9rem; }
.text-button, .close-button { border: 0; color: var(--text); background: transparent; }

.auth-view {
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 8vw, 120px);
  background:
    linear-gradient(90deg, rgba(7,16,24,.96) 0%, rgba(7,16,24,.74) 55%, rgba(7,16,24,.18) 100%),
    radial-gradient(circle at 78% 42%, rgba(114,229,255,.2), transparent 27%),
    repeating-linear-gradient(115deg, transparent 0 42px, rgba(114,229,255,.035) 43px 44px);
  animation: enter .7s ease both;
}
.kicker { margin: 0 0 12px; text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; }
.auth-view h1, .rail-heading h1, .project-detail h2, dialog h2, .empty-state h2 {
  font-family: "Space Grotesk", sans-serif;
}
.auth-view h1 { margin: 0; max-width: 720px; font-size: clamp(3.5rem, 8vw, 7.5rem); line-height: .9; }
.auth-view h1 span { color: var(--accent); }
.auth-view > p:not(.kicker):not(.auth-note) { max-width: 520px; color: var(--muted); font-size: 1.1rem; line-height: 1.7; }
.auth-note { margin-top: 16px; color: var(--muted); font-size: .82rem; }

.primary-button, .icon-button {
  border: 0;
  color: #031218;
  background: var(--accent);
  font-weight: 650;
}
.primary-button { align-self: flex-start; min-height: 48px; padding: 0 20px; border-radius: 999px; }
.primary-button:hover, .icon-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; }

.workspace { min-height: calc(100vh - 72px); display: none; grid-template-columns: 340px 1fr; animation: enter .45s ease both; }
body.is-authenticated .portal-user { display: flex; }
body.is-authenticated .workspace { display: grid; }
body.is-authenticated .auth-view { display: none; }
.project-rail { border-right: 1px solid var(--line); background: #09131d; }
.rail-heading { display: flex; justify-content: space-between; align-items: end; padding: 34px 26px 24px; }
.rail-heading h1 { margin: 0; font-size: 2rem; }
.icon-button { width: 42px; height: 42px; border-radius: 50%; font-size: 1.5rem; }
.project-list { border-top: 1px solid var(--line); }
.project-item {
  width: 100%;
  padding: 20px 26px;
  display: grid;
  gap: 8px;
  text-align: left;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background .2s ease, padding-left .2s ease;
}
.project-item:hover, .project-item.is-active { padding-left: 31px; background: var(--surface-2); }
.project-item strong { font: 600 1rem "Space Grotesk", sans-serif; }
.project-item span { color: var(--muted); font-size: .8rem; }

.project-main { min-width: 0; padding: clamp(30px, 5vw, 72px); }
.empty-state { max-width: 570px; margin-top: 12vh; }
.empty-state h2 { margin: 0; font-size: clamp(2.8rem, 6vw, 5.5rem); line-height: .95; }
.empty-state > p:not(.kicker) { color: var(--muted); line-height: 1.7; }
.project-detail { max-width: 980px; animation: detail-in .35s ease both; }
.detail-header { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 32px; padding-bottom: 42px; border-bottom: 1px solid var(--line); }
.status-label { margin: 0 0 12px; text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; }
.project-detail h2 { margin: 0; font-size: clamp(2.8rem, 5vw, 5.4rem); line-height: .95; }
.detail-header p:last-child { max-width: 680px; color: var(--muted); line-height: 1.65; }
.progress-orbit { width: 112px; height: 112px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) var(--progress), var(--surface-2) 0); position: relative; }
.progress-orbit::after { content: ""; position: absolute; inset: 8px; border-radius: inherit; background: var(--bg); }
.progress-orbit strong { position: relative; z-index: 1; font: 600 1.2rem "Space Grotesk", sans-serif; }
.project-facts { margin: 0; display: grid; grid-template-columns: .7fr .8fr 1.5fr .8fr; border-bottom: 1px solid var(--line); }
.project-facts div { padding: 28px 24px 28px 0; }
.project-facts dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .13em; }
.project-facts dd { margin: 9px 0 0; line-height: 1.55; }
.timeline-section { padding-top: 42px; }
.activity-list { margin-top: 24px; }
.activity-item { position: relative; padding: 0 0 32px 28px; border-left: 1px solid var(--line); }
.activity-item::before { content: ""; position: absolute; width: 9px; height: 9px; left: -5px; top: 4px; border-radius: 50%; background: var(--accent); }
.activity-item strong { display: block; font-family: "Space Grotesk", sans-serif; }
.activity-item time { color: var(--warm); font-size: .75rem; }
.activity-item p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }

dialog { width: min(640px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 24px; color: var(--text); background: var(--surface); box-shadow: 0 40px 120px #000b; }
dialog::backdrop { background: rgba(1, 5, 8, .78); backdrop-filter: blur(8px); }
.project-form, .admin-form { display: grid; gap: 18px; padding: 30px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; }
dialog h2 { margin: 0; font-size: 2.2rem; }
.close-button { font-size: 2rem; }
label { display: grid; gap: 8px; color: #cbd8e5; font-size: .88rem; }
input, textarea, select { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: #071018; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(114,229,255,.08); }
.form-status { min-height: 20px; margin: 0; color: var(--warm); }
.admin-form { margin-top: 26px; padding: 28px 0 0; border-top: 1px solid var(--line); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
@keyframes detail-in { from { opacity: 0; transform: translateX(12px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 780px) {
  .portal-header { padding: 0 18px; }
  .portal-user span { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .project-rail { border-right: 0; }
  .project-list { display: flex; overflow-x: auto; }
  .project-item { min-width: 230px; border-right: 1px solid var(--line); }
  .project-main { padding: 34px 20px; }
  .detail-header { grid-template-columns: 1fr; }
  .progress-orbit { width: 88px; height: 88px; }
  .project-facts { grid-template-columns: 1fr; }
  .project-facts div { border-bottom: 1px solid var(--line); }
  .admin-grid { grid-template-columns: 1fr; }
}
