:root {
  --bg: #07110f;
  --panel: #0d1a17;
  --panel-strong: #12231f;
  --panel-soft: rgba(18, 35, 31, 0.72);
  --line: rgba(184, 225, 210, 0.14);
  --line-strong: rgba(184, 225, 210, 0.25);
  --text: #f2f7f5;
  --muted: #91a9a0;
  --accent: #77e7b8;
  --accent-strong: #9af3cd;
  --accent-ink: #052117;
  --blue: #7ca8ff;
  --amber: #f5c768;
  --red: #f07f7f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 18px;
  --radius-sm: 11px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 20% 5%, #113129 0, transparent 32%), var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.ambient { position: fixed; border-radius: 50%; filter: blur(100px); pointer-events: none; opacity: .18; }
.ambient-one { width: 32rem; height: 32rem; background: #42d79b; top: -18rem; right: -10rem; }
.ambient-two { width: 28rem; height: 28rem; background: #2f6fff; bottom: -20rem; left: -14rem; opacity: .1; }

.brand-lockup { display: inline-flex; align-items: center; gap: 12px; text-align: left; }
.brand-lockup div { display: grid; gap: 1px; }
.brand-lockup strong { font-size: .94rem; letter-spacing: .01em; }
.brand-lockup span:not(.brand-mark) { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid rgba(119, 231, 184, .55); border-radius: 12px; color: var(--accent-strong); background: rgba(119, 231, 184, .08); font-weight: 750; font-family: Georgia, serif; font-size: 1.25rem; }
.brand-button { border: 0; background: transparent; padding: 0; cursor: pointer; }

.auth-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); min-height: 100vh; }
.auth-story { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 6vw, 86px); border-right: 1px solid var(--line); }
.story-copy { max-width: 780px; padding: 10vh 0; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: .7rem; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 22px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 7vw, 6.7rem); font-weight: 500; letter-spacing: -.055em; line-height: .94; max-width: 900px; }
.story-copy > p:last-child { max-width: 620px; color: #b6c7c1; font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.65; }
.feature-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; list-style: none; margin: 0; padding: 0; }
.feature-list li { display: grid; gap: 8px; color: #b6c7c1; font-size: .84rem; line-height: 1.4; }
.feature-list span { color: var(--accent); font-family: ui-monospace, monospace; font-size: .7rem; }
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(100%, 430px); padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, rgba(18, 35, 31, .92), rgba(10, 23, 20, .92)); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.auth-card h2 { margin-bottom: 8px; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.muted { color: var(--muted); }

.stack-form { display: grid; gap: 17px; margin-top: 28px; }
.stack-form label, .field { display: grid; gap: 8px; color: #c7d5d0; font-size: .78rem; font-weight: 650; letter-spacing: .02em; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 12px 13px; color: var(--text); background: rgba(4, 13, 11, .72); transition: border-color .18s, background .18s; }
input:hover, select:hover, textarea:hover { border-color: rgba(119, 231, 184, .42); }
textarea { min-height: 108px; resize: vertical; line-height: 1.45; }
select { appearance: auto; }
.form-hint { margin: -6px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.form-error { min-height: 1.2em; margin: 16px 0 0; color: #ff9999; font-size: .82rem; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid transparent; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 700; font-size: .8rem; transition: transform .15s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.primary { color: var(--accent-ink); background: var(--accent); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { border-color: var(--line-strong); background: var(--panel-strong); }
.button.ghost { border-color: var(--line); background: transparent; color: #c6d5d0; }
.button.danger { color: #ffdede; border-color: rgba(240, 127, 127, .35); background: rgba(240, 127, 127, .1); }
.button.small { min-height: 33px; padding: 6px 10px; font-size: .72rem; }
.wide { width: 100%; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 254px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 28px 20px 20px; border-right: 1px solid var(--line); background: rgba(7, 17, 15, .86); backdrop-filter: blur(24px); z-index: 10; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mobile-menu-close, .sidebar-scrim { display: none; }
.nav-list { display: grid; gap: 7px; margin-top: 48px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; border: 1px solid transparent; border-radius: 11px; padding: 0 13px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; font-size: .82rem; font-weight: 650; }
.nav-item span { width: 18px; color: #76958a; text-align: center; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.025); }
.nav-item.active { color: var(--text); border-color: var(--line); background: var(--panel-strong); }
.nav-item.active span { color: var(--accent); }
.sidebar-footer { display: grid; gap: 14px; margin-top: auto; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(18, 35, 31, .55); }
.user-chip > div { min-width: 0; display: grid; gap: 2px; }
.user-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.user-chip span:not(.avatar) { color: var(--muted); font-size: .65rem; letter-spacing: .09em; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent-ink); background: var(--accent); font-size: .74rem; font-weight: 800; }
.workspace { min-width: 0; }
.mobile-header { display: none; }
.content { width: min(100%, 1480px); margin: 0 auto; padding: 48px clamp(28px, 5vw, 74px) 80px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.page-header h1 { margin: 0; font-size: clamp(2.25rem, 5vw, 4.1rem); }
.page-header p:last-child { margin: 8px 0 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 32px; }
.metric { min-height: 126px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(18,35,31,.82), rgba(10,23,20,.7)); }
.metric span { color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.metric strong { display: block; margin-top: 20px; font-family: Georgia, serif; font-size: 2.25rem; font-weight: 500; }
.metric small { color: #779087; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 30px 0 14px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 500; }

.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project-card { position: relative; display: grid; gap: 18px; min-height: 228px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(13, 26, 23, .82); cursor: pointer; transition: transform .18s, border-color .18s, background .18s; }
.project-card:hover { transform: translateY(-2px); border-color: rgba(119, 231, 184, .34); background: rgba(18, 35, 31, .9); }
.project-card:focus-visible { outline: 2px solid var(--accent); }
.card-top, .card-bottom { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.project-code { color: var(--accent); font: 700 .68rem/1 ui-monospace, monospace; letter-spacing: .06em; }
.project-card h3 { margin: 0 0 7px; font-size: 1rem; }
.project-card p { margin: 0; color: var(--muted); font-size: .79rem; line-height: 1.5; }
.owner-line { display: flex; align-items: center; gap: 8px; color: #b5c6c0; font-size: .73rem; }
.mini-avatar { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: rgba(119, 231, 184, .12); color: var(--accent); font-size: .65rem; font-weight: 800; }
.progress-bar { display: block; width: 100%; height: 5px; border: 0; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; appearance: none; }
.progress-bar::-webkit-progress-bar { border-radius: inherit; background: rgba(255,255,255,.06); }
.progress-bar::-webkit-progress-value { border-radius: inherit; background: var(--accent); }
.progress-bar::-moz-progress-bar { border-radius: inherit; background: var(--accent); }
.progress-copy { margin-top: 7px; color: var(--muted); font-size: .68rem; }

.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 25px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; color: #b8c9c3; background: rgba(255,255,255,.025); font: 700 .62rem/1 ui-monospace, monospace; letter-spacing: .05em; }
.badge.green { color: var(--accent); border-color: rgba(119,231,184,.25); background: rgba(119,231,184,.07); }
.badge.amber { color: var(--amber); border-color: rgba(245,199,104,.25); background: rgba(245,199,104,.07); }
.badge.red { color: #ffaaaa; border-color: rgba(240,127,127,.25); background: rgba(240,127,127,.07); }
.badge.blue { color: #a9c4ff; border-color: rgba(124,168,255,.25); background: rgba(124,168,255,.07); }

.detail-hero { display: grid; grid-template-columns: 1fr auto; gap: 28px; padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(135deg, rgba(18,35,31,.92), rgba(10,23,20,.7)); }
.detail-hero h1 { margin: 8px 0 14px; font-size: clamp(2.25rem, 5vw, 4.8rem); }
.detail-hero .lead { max-width: 850px; color: #bdccc7; line-height: 1.65; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; color: var(--muted); font-size: .75rem; }
.detail-rail { min-width: 210px; display: grid; align-content: start; gap: 12px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; background: rgba(13,26,23,.78); }
.panel h2, .panel h3 { margin: 0; font-family: Georgia, serif; font-weight: 500; }
.panel-copy { margin: 10px 0 0; color: var(--muted); line-height: 1.6; white-space: pre-wrap; }
.panel + .panel { margin-top: 14px; }

.task-list, .approval-list, .audit-list { display: grid; gap: 10px; margin-top: 16px; }
.task-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4,13,11,.34); }
.task-index { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--muted); background: var(--panel-strong); font: 700 .67rem ui-monospace, monospace; }
.task-row.done .task-index { color: var(--accent-ink); background: var(--accent); }
.task-copy strong { font-size: .82rem; }
.task-copy p { margin: 5px 0 0; color: var(--muted); font-size: .7rem; }
.task-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.evidence-list { display: grid; gap: 5px; margin-top: 9px; }
.evidence-item { color: #9fb6ae; font-size: .69rem; overflow-wrap: anywhere; }
.evidence-item::before { content: "↳ "; color: var(--accent); }
.approval-card { display: grid; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4,13,11,.34); }
.approval-card h3 { font-family: inherit; font-size: .85rem; font-weight: 700; }
.approval-card p { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.approval-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: #789088; font-size: .67rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: rgba(13,26,23,.75); }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: .76rem; }
th { color: var(--muted); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.cell-main { display: grid; gap: 3px; }
.cell-main span { color: var(--muted); font-size: .68rem; }
.audit-item { display: grid; grid-template-columns: 145px minmax(0, 1fr) auto; gap: 18px; align-items: start; padding: 16px; border-bottom: 1px solid var(--line); }
.audit-item:last-child { border-bottom: 0; }
.audit-time { color: var(--muted); font: .67rem ui-monospace, monospace; }
.audit-main strong { display: block; margin-bottom: 5px; font-size: .8rem; }
.audit-main p { margin: 0; color: var(--muted); font-size: .71rem; line-height: 1.5; overflow-wrap: anywhere; }

.empty-state { display: grid; place-items: center; min-height: 280px; padding: 40px; border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; }
.empty-state .empty-mark { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 18px; color: var(--accent); background: var(--panel-strong); font-size: 1.4rem; }
.empty-state h2 { margin-bottom: 8px; font-family: Georgia, serif; font-weight: 500; }
.empty-state p { max-width: 460px; color: var(--muted); line-height: 1.55; }

.dialog { width: min(640px, calc(100vw - 28px)); max-height: calc(100vh - 34px); overflow-y: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 22px; color: var(--text); background: #0b1714; box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(1, 7, 5, .78); backdrop-filter: blur(7px); }
.dialog-frame { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.dialog-heading h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; font-size: 1.65rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .span-two { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(390px, calc(100vw - 48px)); padding: 13px 16px; border: 1px solid rgba(119,231,184,.28); border-radius: 12px; color: #dcf8ed; background: #123127; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .18s, transform .18s; font-size: .78rem; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(240,127,127,.35); background: #351b1b; color: #ffdede; }
.skeleton { min-height: 160px; border-radius: var(--radius); background: linear-gradient(90deg, rgba(255,255,255,.025), rgba(255,255,255,.06), rgba(255,255,255,.025)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1050px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-story { min-height: 56vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .story-copy { padding: 9vh 0 6vh; }
  .auth-panel { min-height: 44vh; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .feature-list { grid-template-columns: 1fr; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: min(290px, 88vw); transition: transform .2s; box-shadow: var(--shadow); z-index: 30; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-close { display: grid; flex: 0 0 auto; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; display: block; width: 100%; height: 100%; border: 0; padding: 0; background: rgba(1, 7, 5, .72); cursor: pointer; }
  .sidebar-scrim[hidden] { display: none; }
  .mobile-header { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(7,17,15,.88); backdrop-filter: blur(18px); }
  .content { padding: 30px 18px 60px; }
  .page-header, .detail-hero { display: grid; grid-template-columns: 1fr; align-items: start; }
  .page-header h1 { font-size: 2.5rem; }
  .project-grid, .metric-grid { grid-template-columns: 1fr; }
  .detail-rail { min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-two { grid-column: auto; }
  .task-row { grid-template-columns: auto 1fr; }
  .task-actions { grid-column: 2; justify-content: flex-start; }
  .audit-item { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 480px) {
  .auth-story, .auth-panel { padding: 22px; }
  .auth-card { padding: 25px 21px; }
  h1 { font-size: 2.85rem; }
  .page-actions, .page-actions .button { width: 100%; }
  .form-actions { display: grid; }
}
