:root {
  --navy-950: #0b1f33;
  --navy-900: #102a43;
  --navy-800: #173f62;
  --navy-700: #24577e;
  --orange: #e18b31;
  --orange-dark: #bf6d1f;
  --sand: #f2e7d8;
  --ink: #192c3d;
  --muted: #697b8b;
  --line: #dce3e8;
  --surface: #ffffff;
  --background: #f4f6f7;
  --danger: #b74242;
  --radius: 16px;
  --shadow: 0 18px 55px rgba(18, 42, 64, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--orange); color: #fff; font-size: 1.25rem; font-weight: 850; letter-spacing: -.06em; box-shadow: inset 0 -3px 0 rgba(0,0,0,.1); }
.brand > span:last-child, .mobile-brand > span:last-child { display: flex; flex-direction: column; line-height: 1; }
.brand strong, .mobile-brand strong { font-size: 1.12rem; letter-spacing: .16em; }
.brand small, .mobile-brand small { margin-top: 5px; font-size: .68rem; font-weight: 650; letter-spacing: .13em; text-transform: uppercase; opacity: .72; }
.brand--light { color: #fff; }

.eyebrow { display: inline-block; color: #d5e0e9; font-size: .7rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow--dark { color: var(--orange-dark); }

/* Login */
.auth-body { background: var(--background); }
.login-page { display: grid; grid-template-columns: minmax(440px, 1.04fr) minmax(480px, .96fr); min-height: 100vh; }
.login-intro { position: relative; overflow: hidden; min-height: 100vh; padding: clamp(34px, 5vw, 76px); color: #fff; background: linear-gradient(145deg, var(--navy-950), var(--navy-800)); }
.login-intro::before { content: ""; position: absolute; right: -160px; bottom: -180px; width: 560px; height: 560px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.022), 0 0 0 140px rgba(255,255,255,.018); }
.intro-content { position: relative; z-index: 2; display: flex; flex-direction: column; min-height: calc(100vh - clamp(68px, 10vw, 152px)); }
.intro-copy { margin: auto 0; max-width: 590px; }
.intro-copy h1 { margin: 22px 0 25px; font-size: clamp(3.2rem, 5vw, 5.8rem); font-weight: 720; line-height: .96; letter-spacing: -.065em; }
.intro-copy h1 span { color: #f2b871; }
.intro-copy p { max-width: 500px; margin: 0; color: #c2d0db; font-size: clamp(1.05rem, 1.5vw, 1.28rem); line-height: 1.65; }
.intro-status { display: flex; align-items: center; gap: 10px; color: #c2d0db; font-size: .82rem; font-weight: 600; letter-spacing: .04em; }
.intro-status i { width: 8px; height: 8px; border-radius: 50%; background: #65c18c; box-shadow: 0 0 0 5px rgba(101,193,140,.13); }
.blueprint { position: absolute; right: 5%; bottom: 7%; width: 250px; height: 210px; opacity: .08; transform: rotate(-6deg); }
.blueprint::before, .blueprint::after, .blueprint span { content: ""; position: absolute; border: 2px solid #fff; }
.blueprint::before { inset: 60px 0 0; }
.blueprint::after { left: 30px; right: 30px; top: 0; height: 130px; transform: rotate(45deg); }
.blueprint span:nth-child(1) { left: 40px; bottom: 0; width: 60px; height: 100px; }
.blueprint span:nth-child(2) { right: 35px; bottom: 50px; width: 55px; height: 55px; }

.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px clamp(30px, 7vw, 110px) 28px; background: #fbfcfc; }
.login-card { width: min(100%, 490px); }
.mobile-brand { display: none; }
.login-card h2 { margin: 11px 0 12px; color: var(--navy-950); font-size: clamp(2rem, 3vw, 2.7rem); line-height: 1.1; letter-spacing: -.045em; }
.login-lead { margin: 0 0 34px; color: var(--muted); line-height: 1.6; }
.alert { margin-bottom: 20px; padding: 13px 15px; border: 1px solid #b9d1e3; border-radius: 10px; color: #24577e; background: #ecf5fb; font-size: .9rem; line-height: 1.45; }
.alert--error { border-color: #e5bebe; color: #8e3030; background: #fff1f1; }
.login-form { display: grid; }
.login-form > label { margin: 0 0 9px; color: var(--ink); font-size: .82rem; font-weight: 750; }
.login-form > label:not(:first-of-type) { margin-top: 20px; }
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; top: 50%; left: 16px; width: 19px; height: 19px; color: #8796a2; transform: translateY(-50%); pointer-events: none; }
.input-wrap input { width: 100%; height: 54px; padding: 0 48px 0 48px; border: 1px solid #cfd9df; border-radius: 10px; outline: 0; color: var(--ink); background: #fff; transition: border .2s, box-shadow .2s; }
.input-wrap input::placeholder { color: #9aa7b0; }
.input-wrap input:focus { border-color: var(--navy-700); box-shadow: 0 0 0 4px rgba(36,87,126,.11); }
.password-toggle { position: absolute; top: 50%; right: 8px; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; color: #84929d; background: transparent; transform: translateY(-50%); cursor: pointer; }
.password-toggle:hover { background: #f1f4f6; }
.password-toggle svg { width: 20px; height: 20px; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 54px; margin-top: 28px; padding: 0 22px; border: 0; border-radius: 10px; color: #fff; background: var(--navy-900); box-shadow: 0 10px 24px rgba(16,42,67,.18); font-weight: 750; cursor: pointer; transition: transform .2s, background .2s; }
.primary-button:hover:not(:disabled) { background: var(--navy-800); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .72; }
.primary-button span { font-size: 1.3rem; }
.login-help { margin-top: 28px; padding-top: 25px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .82rem; }
.login-help a { color: var(--navy-700); font-weight: 700; text-decoration: none; }
.login-panel footer { width: 100%; margin-top: auto; padding-top: 50px; color: #98a4ac; text-align: center; font-size: .72rem; }

/* Application shell */
.app-body { background: var(--background); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 258px; padding: 28px 19px 20px; color: #d6e0e8; background: var(--navy-950); }
.brand--sidebar { margin: 0 12px 43px; color: #fff; }
.workspace-label { margin: 0 13px 12px; color: #73899b; font-size: .62rem; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.main-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { display: flex; align-items: center; min-height: 48px; padding: 0 13px; border-radius: 9px; color: #abc0d0; font-size: .87rem; font-weight: 620; text-decoration: none; transition: background .2s, color .2s; }
.nav-item svg { width: 20px; height: 20px; margin-right: 13px; }
.nav-item em { margin-left: auto; padding: 4px 7px; border-radius: 999px; color: #71899c; background: rgba(255,255,255,.045); font-size: .56rem; font-style: normal; letter-spacing: .06em; text-transform: uppercase; }
.nav-item.is-active { color: #fff; background: rgba(255,255,255,.09); box-shadow: inset 3px 0 var(--orange); }
.nav-item.is-disabled { cursor: default; }
.nav-item.is-disabled:hover { color: #cfdae3; background: rgba(255,255,255,.045); }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 18px 7px 0; border-top: 1px solid rgba(255,255,255,.09); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.user-chip > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.user-chip strong { overflow: hidden; color: #fff; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { margin-top: 3px; color: #8198aa; font-size: .67rem; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 37px; height: 37px; border-radius: 10px; color: #fff; background: var(--orange); font-weight: 800; }
.avatar--small { width: 35px; height: 35px; border-radius: 50%; }
.logout-button, .icon-button, .menu-button { display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.logout-button { width: 36px; height: 36px; border-radius: 8px; color: #8ea2b2; }
.logout-button:hover { color: #fff; background: rgba(255,255,255,.07); }
.logout-button svg, .icon-button svg { width: 19px; height: 19px; }
.main-area { min-width: 0; width: calc(100% - 258px); margin-left: 258px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; height: 72px; padding: 0 clamp(22px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(16px); }
.topbar-title { display: flex; flex-direction: column; }
.topbar-title span { color: var(--navy-950); font-weight: 800; letter-spacing: -.02em; }
.topbar-title small { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.topbar-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.icon-button { width: 38px; height: 38px; border-radius: 9px; color: #71818e; }
.icon-button:disabled { opacity: .65; }
.menu-button { display: none; width: 40px; height: 40px; margin-right: 10px; border-radius: 8px; }
.menu-button span { display: block; width: 20px; height: 2px; margin: 2px 0; background: var(--navy-900); }
.main-content { max-width: 1580px; margin: 0 auto; padding: clamp(30px, 4vw, 58px); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 33px; }
.page-heading h1 { margin: 9px 0 7px; color: var(--navy-950); font-size: clamp(2rem, 3vw, 3.15rem); line-height: 1.08; letter-spacing: -.05em; }
.page-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.primary-button--compact { min-height: 46px; margin: 0; white-space: nowrap; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { position: relative; overflow: hidden; min-height: 155px; padding: 21px 22px 18px; border: 1px solid #e0e6ea; border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 30px rgba(18,42,64,.045); }
.stat-card::after { content: ""; position: absolute; right: -30px; bottom: -55px; width: 115px; height: 115px; border-radius: 50%; background: var(--card-color); opacity: .08; }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .77rem; font-weight: 680; }
.stat-card__top i { width: 8px; height: 8px; border-radius: 50%; background: var(--card-color); box-shadow: 0 0 0 5px color-mix(in srgb, var(--card-color) 14%, transparent); }
.stat-card > strong { display: block; margin: 12px 0 6px; color: var(--navy-950); font-size: 2.25rem; letter-spacing: -.05em; }
.stat-card > small { color: #8a98a3; font-size: .68rem; }
.stat-card--blue { --card-color: #3979a9; }
.stat-card--amber { --card-color: #d99135; }
.stat-card--red { --card-color: #c85d5d; }
.stat-card--green { --card-color: #479775; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .8fr); gap: 20px; margin-top: 20px; }
.panel, .quick-panel { border: 1px solid #e0e6ea; border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 30px rgba(18,42,64,.045); }
.panel { min-height: 390px; }
.panel > header { display: flex; align-items: center; justify-content: space-between; min-height: 88px; padding: 20px 24px; border-bottom: 1px solid #e6ebee; }
.panel h2, .quick-panel h2 { margin: 5px 0 0; color: var(--navy-950); font-size: 1.08rem; letter-spacing: -.02em; }
.panel header button { border: 0; color: #789; background: transparent; font-size: .75rem; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; padding: 30px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; color: var(--navy-700); background: #edf3f7; }
.empty-icon svg { width: 30px; height: 30px; }
.empty-state h3 { margin: 18px 0 7px; color: var(--navy-950); font-size: 1rem; }
.empty-state p { max-width: 390px; margin: 0; color: var(--muted); font-size: .79rem; line-height: 1.55; }
.phase-badge { margin-top: 18px; padding: 6px 10px; border-radius: 999px; color: #916020; background: #fbf1e2; font-size: .62rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.date-chip { display: flex; flex-direction: column; align-items: center; min-width: 44px; padding: 7px 8px; border: 1px solid #d8e0e5; border-radius: 9px; color: var(--navy-900); font-size: 1rem; font-weight: 800; line-height: 1; }
.date-chip small { margin-top: 4px; color: var(--orange-dark); font-size: .52rem; letter-spacing: .07em; }
.timeline-placeholder { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 300px; padding: 35px 36px 35px 68px; }
.timeline-placeholder::before { content: ""; position: absolute; left: 37px; top: 52px; bottom: 64px; width: 1px; background: #dbe3e8; }
.timeline-placeholder i { position: absolute; left: 32px; width: 11px; height: 11px; border: 2px solid #b8c6d0; border-radius: 50%; background: #fff; }
.timeline-placeholder i:nth-child(1) { top: 60px; }
.timeline-placeholder i:nth-child(2) { top: 125px; }
.timeline-placeholder i:nth-child(3) { top: 190px; }
.timeline-placeholder p { margin: 0 0 6px; color: var(--ink); font-size: .87rem; font-weight: 700; }
.timeline-placeholder small { color: var(--muted); font-size: .72rem; line-height: 1.45; }
.quick-panel { display: flex; align-items: center; justify-content: space-between; gap: 25px; margin-top: 20px; padding: 23px 25px; }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 10px; }
.quick-actions button { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; min-width: 175px; padding: 12px; border: 1px solid #dce4e9; border-radius: 10px; color: var(--ink); background: #fbfcfc; text-align: left; opacity: .72; }
.quick-actions button > span { grid-row: 1 / span 2; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; color: var(--navy-700); background: #eaf1f5; font-weight: 800; }
.quick-actions strong { font-size: .72rem; }
.quick-actions small { margin-top: 2px; color: var(--muted); font-size: .6rem; }
.overlay { display: none; }

.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 40px; text-align: center; }
.error-page > strong { color: var(--orange); font-size: 5rem; line-height: 1; }
.error-page h1 { margin: 15px 0 8px; color: var(--navy-950); font-size: 2rem; }
.error-page p { color: var(--muted); }
.error-page a { margin-top: 20px; padding: 12px 18px; border-radius: 9px; color: #fff; background: var(--navy-900); font-weight: 700; text-decoration: none; }

@media (max-width: 1120px) {
  .login-page { grid-template-columns: .9fr 1.1fr; }
  .intro-copy h1 { font-size: clamp(3rem, 5.4vw, 4.5rem); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .quick-panel { align-items: flex-start; flex-direction: column; }
  .quick-actions { width: 100%; }
}

@media (max-width: 820px) {
  .login-page { display: block; min-height: 100vh; }
  .login-intro { display: none; }
  .login-panel { min-height: 100vh; padding: 35px 24px 22px; }
  .mobile-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 58px; color: var(--navy-950); }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .overlay { position: fixed; z-index: 25; inset: 0; border: 0; background: rgba(4,19,31,.48); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .overlay.is-visible { display: block; opacity: 1; pointer-events: auto; }
  .main-area { width: 100%; margin-left: 0; }
  .menu-button { display: grid; }
  .main-content { padding: 30px 22px; }
}

@media (max-width: 620px) {
  .topbar { height: 64px; padding: 0 15px; }
  .topbar-title span { font-size: .86rem; }
  .topbar-actions .icon-button { display: none; }
  .main-content { padding: 26px 16px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h1 { font-size: 2.15rem; }
  .primary-button--compact { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 138px; padding: 17px 16px; }
  .stat-card > strong { font-size: 1.9rem; }
  .stat-card__top { align-items: flex-start; min-height: 34px; font-size: .68rem; }
  .stat-card > small { display: none; }
  .panel > header { padding: 18px; }
  .panel { min-height: 350px; }
  .empty-state { min-height: 260px; padding: 24px 18px; }
  .quick-actions { grid-template-columns: 1fr; }
  .quick-actions button { width: 100%; }
  .login-card h2 { font-size: 2rem; }
  .login-panel footer { padding-top: 35px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.setup-page { max-width: 720px; margin: 32px auto; padding: 28px; background: white; border-radius: 16px; }
.setup-page input { display: block; width: 100%; padding: 12px; margin: 8px 0 16px; border: 1px solid #cbd5e1; border-radius: 8px; }
.setup-page fieldset { margin: 20px 0; padding: 16px; border: 1px solid #cbd5e1; }
