:root {
  --blue: #004aad;
  --blue-dark: #00317a;
  --blue-light: #eaf2ff;
  --cyan: #00aee8;
  --ink: #101a27;
  --muted: #64748b;
  --line: #dfe7f1;
  --surface: #ffffff;
  --background: #f4f7fb;
  --green: #16a36a;
  --shadow: 0 14px 38px rgba(31, 57, 90, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--background);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #071b37;
  color: white;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 11px; margin: 0 7px 27px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(135deg, var(--cyan), var(--blue)); font: 800 1.2rem "Open Sans"; }
.brand strong, .brand small { display: block; }
.brand strong { font: 800 1rem "Open Sans"; }
.brand small { color: #9eb4d1; margin-top: 2px; }
.eyebrow { color: var(--blue); text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; font-weight: 700; }
.project-summary { border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); border-radius: 14px; padding: 15px; margin-bottom: 18px; }
.project-summary .eyebrow { color: #8eb8ec; }
.project-summary strong { display: block; font-size: .92rem; margin: 6px 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-summary small { color: #9eb4d1; }
.progress-track { height: 6px; border-radius: 20px; background: rgba(255,255,255,.12); overflow: hidden; margin-bottom: 8px; }
.progress-track span { height: 100%; display: block; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), #63e6be); transition: width .35s ease; }
.module-nav { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: #aabbd2; border-radius: 10px; padding: 10px; text-align: left; display: grid; grid-template-columns: 28px 1fr 18px; align-items: center; gap: 8px; font-size: .82rem; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: #0d356a; color: white; }
.nav-number { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.09); font-size: .73rem; font-weight: 700; }
.nav-item.active .nav-number { background: var(--cyan); color: #05213e; }
.nav-check { color: #54d6a0; font-weight: 700; }
.sidebar-action { margin-top: auto; border: 1px solid rgba(255,255,255,.17); color: white; background: rgba(255,255,255,.06); border-radius: 11px; padding: 12px; font-weight: 600; }
.sidebar-action:hover { background: rgba(255,255,255,.12); }

.main-content { padding: 0 42px 30px; min-width: 0; }
.topbar { height: 88px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); margin-bottom: 27px; }
.topbar h1 { font: 800 clamp(1.25rem, 2vw, 1.65rem) "Open Sans"; margin: 3px 0 0; }
.save-state { margin-left: auto; color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: 7px; }
.save-state span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.save-state.saving span { background: #f59e0b; }
.account-box { margin-left: auto; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .78rem; }
.account-box button { border: 1px solid var(--line); background: white; color: var(--blue); padding: 6px 9px; border-radius: 8px; font-weight: 700; }
.account-box + .save-state { margin-left: 0; }
.menu-button { display: none; background: white; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.welcome-card { max-width: 1050px; margin: 0 auto 22px; padding: 24px 28px; color: white; border-radius: 18px; background: linear-gradient(125deg, #07336c, #0057bd 67%, #00aee8); box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center; gap: 30px; overflow: hidden; position: relative; }
.welcome-card::after { content: ""; position: absolute; width: 180px; height: 180px; right: -65px; top: -95px; border: 28px solid rgba(255,255,255,.08); border-radius: 50%; }
.badge { display: inline-block; padding: 4px 9px; border-radius: 30px; background: rgba(255,255,255,.15); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.welcome-card h2 { font: 800 clamp(1.25rem, 2.6vw, 1.85rem) "Open Sans"; margin: 9px 0 6px; }
.welcome-card p { max-width: 680px; color: #dceaff; margin: 0; font-size: .9rem; }
.welcome-stat { min-width: 112px; text-align: center; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.12); z-index: 1; }
.welcome-stat strong, .welcome-stat span { display: block; }
.welcome-stat strong { font: 800 1.65rem "Open Sans"; }
.welcome-stat span { color: #dceaff; font-size: .72rem; }

.workspace { max-width: 1050px; margin: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.module-header { padding: 28px 30px 23px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 52px 1fr; gap: 16px; align-items: start; }
.module-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.45rem; background: var(--blue-light); }
.module-header h2 { font: 800 1.35rem "Open Sans"; margin: 1px 0 7px; }
.module-header p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; padding: 28px 30px 32px; }
.field { display: grid; align-content: start; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: .86rem; }
.field-hint { color: var(--muted); font-size: .77rem; line-height: 1.45; }
.field input, .field textarea, .field select { width: 100%; color: var(--ink); background: #fbfcfe; border: 1px solid #cfd9e6; border-radius: 10px; padding: 12px 13px; outline: none; transition: .2s; }
.field textarea { min-height: 105px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { background: white; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,74,173,.09); }
.required { color: #d83939; }
.tip { grid-column: 1 / -1; border-left: 4px solid var(--cyan); background: #eefaff; padding: 13px 15px; border-radius: 0 10px 10px 0; color: #345269; font-size: .82rem; line-height: 1.5; }
.tip strong { color: #123a5a; }
.ai-coach { grid-column: 1 / -1; border: 1px solid #b8d7ff; background: linear-gradient(135deg, #f3f8ff, #f1fcff); border-radius: 14px; padding: 17px; }
.ai-coach-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ai-coach h3 { font: 800 .95rem "Open Sans"; margin: 0 0 4px; color: #073d7e; }
.ai-coach p { margin: 0; color: #55708e; font-size: .8rem; }
.ai-response { display: none; white-space: pre-wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid #cce0f7; color: #173b5e; font-size: .84rem; line-height: 1.6; }
.ai-response.visible { display: block; }
.workspace-footer { max-width: 1050px; margin: 18px auto 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.workspace-footer > span { color: var(--muted); font-size: .8rem; }
.button { border-radius: 10px; padding: 11px 17px; font-weight: 700; font-size: .86rem; border: 1px solid transparent; }
.button.primary { background: var(--blue); color: white; }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { color: var(--blue); background: white; border-color: #bfd0e6; }
.button:disabled { opacity: .45; cursor: not-allowed; }

.summary-view { padding: 30px; }
.summary-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 20px; }
.summary-heading h2 { font: 800 1.45rem "Open Sans"; margin: 4px 0; }
.summary-heading p { color: var(--muted); margin: 0; }
.summary-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.summary-section { break-inside: avoid; border: 1px solid var(--line); border-radius: 13px; padding: 18px; margin-bottom: 12px; }
.summary-section h3 { font: 800 1rem "Open Sans"; color: var(--blue); margin: 0 0 13px; }
.answer { margin-bottom: 12px; }
.answer:last-child { margin-bottom: 0; }
.answer strong { display: block; font-size: .76rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; margin-bottom: 3px; }
.answer p { margin: 0; line-height: 1.55; white-space: pre-wrap; }
.empty-answer { color: #94a3b8; font-style: italic; }
.toast { position: fixed; right: 22px; bottom: 22px; background: #10243e; color: white; border-radius: 10px; padding: 11px 16px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s; box-shadow: var(--shadow); font-size: .84rem; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; width: 290px; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 10px 0 35px rgba(0,0,0,.25); }
  .main-content { padding: 0 18px 25px; }
  .menu-button { display: block; }
  .topbar { height: 76px; }
  .account-box span, .save-state { display: none; }
}
@media (max-width: 620px) {
  .main-content { padding: 0 12px 22px; }
  .welcome-card { padding: 20px; align-items: flex-start; }
  .welcome-stat { display: none; }
  .module-header { padding: 22px 18px; grid-template-columns: 44px 1fr; gap: 12px; }
  .module-icon { width: 44px; height: 44px; }
  .form-grid { grid-template-columns: 1fr; padding: 22px 18px 25px; }
  .field.full { grid-column: auto; }
  .tip { grid-column: auto; }
  .ai-coach { grid-column: auto; }
  .ai-coach-head { align-items: flex-start; flex-direction: column; }
  .workspace-footer > span { display: none; }
  .summary-heading { display: block; }
  .summary-actions { margin-top: 15px; }
}
@media print {
  .sidebar, .topbar, .welcome-card, .workspace-footer, .summary-actions { display: none !important; }
  .app-shell { display: block; }
  .main-content { padding: 0; }
  .workspace { border: 0; box-shadow: none; }
  .summary-view { padding: 0; }
}
