:root {
  --brand-navy: #1b3144;
  --brand-offwhite: #f7f7f2;
  --brand-teal: #82afbf;
  --brand-silver: #cddcdd;
  --brand-green: #9fc76b;
  --brand-darkgreen: #315b3b;
  --font-headline: 'Noto Serif', Georgia, serif;
  --font-body: 'Manrope', 'Segoe UI', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--brand-offwhite);
  color: var(--brand-navy);
  line-height: 1.6;
}

.container { max-width: 900px; margin: 0 auto; padding: 20px; }
.hidden { display: none !important; }

.app-header {
  background: var(--brand-navy);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
}
.header-divider {
  width: 1px;
  height: 32px;
  background: var(--brand-teal);
  opacity: 0.5;
}
.app-header h1 {
  font-family: var(--font-headline);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.header-right { display: flex; align-items: center; gap: 16px; }
.header-right .user-email { font-size: 13px; color: var(--brand-silver); }
.btn-logout {
  background: transparent;
  border: 1px solid var(--brand-teal);
  color: var(--brand-silver);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(130,175,191,0.15); color: #fff; border-color: #fff; }

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--brand-navy) 0%, #2a4d66 60%, var(--brand-teal) 100%);
}
.login-card {
  background: #fff;
  border-radius: 8px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(27,49,68,0.25);
}
.login-logo {
  display: block;
  max-width: 264px;
  height: auto;
  margin: 0 auto 20px;
}
.login-card h1 {
  font-family: var(--font-headline);
  color: var(--brand-navy);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}
.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 4px;
}
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--brand-silver);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-body);
  margin-bottom: 16px;
  color: var(--brand-navy);
}
.login-card input:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(130,175,191,0.25);
}
.btn-login {
  width: 100%;
  background: var(--brand-navy);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s;
}
.btn-login:hover { background: #243f54; }
.login-error { color: #c0392b; font-size: 13px; margin-top: 8px; min-height: 20px; }

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 16px;
}
.dashboard-header h2 {
  font-family: var(--font-headline);
  font-size: 22px;
  color: var(--brand-navy);
  font-weight: 700;
}
.btn-add {
  background: var(--brand-darkgreen);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}
.btn-add:hover { background: #264a2f; }
.client-list { display: flex; flex-direction: column; gap: 8px; }
.client-card {
  background: #fff;
  border: 1px solid var(--brand-silver);
  border-radius: 6px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.15s;
}
.client-card:hover { box-shadow: 0 2px 12px rgba(27,49,68,0.1); }
.client-info h3 {
  font-family: var(--font-headline);
  font-size: 16px;
  color: var(--brand-navy);
  margin-bottom: 4px;
  font-weight: 600;
}
.client-info .meta { font-size: 12px; color: var(--brand-teal); }
.client-actions { display: flex; gap: 8px; align-items: center; }
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-complete { background: rgba(159,199,107,0.2); color: var(--brand-darkgreen); }
.badge-progress { background: rgba(130,175,191,0.2); color: var(--brand-navy); }
.btn-edit, .btn-delete {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-edit { background: #fff; border-color: var(--brand-teal); color: var(--brand-navy); }
.btn-edit:hover { background: var(--brand-teal); color: #fff; }
.btn-delete { background: #fff; border-color: #c0392b; color: #c0392b; }
.btn-delete:hover { background: #c0392b; color: #fff; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--brand-teal);
}
.empty-state p { font-size: 15px; margin-bottom: 16px; }

.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(27,49,68,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(27,49,68,0.25);
}
.modal h3 {
  font-family: var(--font-headline);
  font-size: 18px;
  color: var(--brand-navy);
  margin-bottom: 16px;
  font-weight: 700;
}
.modal input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--brand-silver);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-body);
  margin-bottom: 16px;
  color: var(--brand-navy);
}
.modal input:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(130,175,191,0.25);
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-cancel {
  padding: 8px 20px;
  border: 1px solid var(--brand-silver);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--brand-navy);
  transition: all 0.2s;
}
.btn-cancel:hover { background: var(--brand-offwhite); }
.btn-confirm {
  padding: 8px 20px;
  border: none;
  background: var(--brand-navy);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  transition: background 0.2s;
}
.btn-confirm:hover { background: #243f54; }

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 8px;
}
.wizard-header h2 {
  font-family: var(--font-headline);
  font-size: 22px;
  color: var(--brand-navy);
  font-weight: 700;
}
.btn-back-dashboard {
  background: transparent;
  border: 1px solid var(--brand-silver);
  color: var(--brand-navy);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all 0.2s;
}
.btn-back-dashboard:hover { background: var(--brand-silver); }

.progress-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
}
.progress-step {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  background: var(--brand-silver);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-navy);
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.3;
}
.progress-step.active { background: var(--brand-navy); color: #fff; }
.progress-step.done { background: rgba(159,199,107,0.3); color: var(--brand-darkgreen); }

.section-card {
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  border: 1px solid var(--brand-silver);
  margin-bottom: 16px;
}
.section-card h3 {
  font-family: var(--font-headline);
  font-size: 17px;
  color: var(--brand-navy);
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand-silver);
  font-weight: 600;
}

.question-group {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--brand-offwhite);
}
.question-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.question-group label.q-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 8px;
}
.question-group .q-hint {
  font-size: 12px;
  color: var(--brand-teal);
  margin-bottom: 8px;
}

.form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--brand-silver);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--brand-navy);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(130,175,191,0.2);
}
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--brand-silver);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--brand-navy);
  resize: vertical;
  min-height: 80px;
}
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(130,175,191,0.2);
}

.dual-row { display: flex; gap: 12px; }
.dual-row > div { flex: 1; }
.dual-row label { font-size: 12px; color: var(--brand-navy); margin-bottom: 4px; display: block; font-weight: 500; }

.checkbox-group { display: flex; flex-direction: column; gap: 6px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 4px 0;
}
.checkbox-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand-navy); }

.radio-group { display: flex; flex-direction: column; gap: 6px; }
.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 4px 0;
}
.radio-item input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand-navy); }

.alloc-table { width: 100%; border-collapse: collapse; }
.alloc-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-navy);
  padding: 6px 8px;
  border-bottom: 1px solid var(--brand-silver);
}
.alloc-table td { padding: 4px 8px; }
.alloc-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand-navy); }
.alloc-table .pct-input {
  width: 70px;
  padding: 4px 8px;
  border: 1px solid var(--brand-silver);
  border-radius: 3px;
  text-align: right;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--brand-navy);
}
.alloc-table .pct-input:disabled { background: var(--brand-offwhite); color: #aaa; }
.alloc-total {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
}
.alloc-total.valid { color: var(--brand-darkgreen); }
.alloc-total.invalid { color: #c0392b; }

.toggle-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--brand-silver);
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-item:has(input:checked) {
  border-color: var(--brand-navy);
  background: rgba(130,175,191,0.1);
}
.toggle-item input { accent-color: var(--brand-navy); }

.investor-search {
  position: relative;
  margin-bottom: 12px;
}
.investor-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--brand-silver);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--brand-navy);
}
.investor-search input:focus { outline: none; border-color: var(--brand-teal); box-shadow: 0 0 0 3px rgba(130,175,191,0.2); }
.investor-category {
  margin-bottom: 12px;
}
.investor-category h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--brand-silver);
}
.other-investor-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.other-investor-row input[type="text"] {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--brand-silver);
  border-radius: 3px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--brand-navy);
}
.btn-add-other {
  padding: 6px 12px;
  background: var(--brand-navy);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-add-other:hover { background: #243f54; }

.conditional-field { margin-top: 8px; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
}
.btn-prev, .btn-next, .btn-submit {
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-prev {
  background: #fff;
  border: 1px solid var(--brand-silver);
  color: var(--brand-navy);
}
.btn-prev:hover { background: var(--brand-silver); }
.btn-next {
  background: var(--brand-navy);
  color: #fff;
  border: none;
}
.btn-next:hover:not(:disabled) { background: #243f54; }
.btn-next:disabled, .btn-submit:disabled {
  background: var(--brand-silver);
  color: #fff;
  cursor: not-allowed;
  opacity: 0.7;
}
.btn-submit {
  background: var(--brand-darkgreen);
  color: #fff;
  border: none;
}
.btn-submit:hover:not(:disabled) { background: #264a2f; }
.nav-spacer { flex: 1; }

.delete-msg {
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--brand-teal);
}
.btn-danger {
  background: #c0392b;
}
.btn-danger:hover { background: #a93226; }
.structured-field {
  margin-bottom: 12px;
}
.structured-field label {
  font-size: 12px;
  color: var(--brand-navy);
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}
.na-hint {
  font-style: italic;
  padding: 12px;
  background: var(--brand-offwhite);
  border-radius: 4px;
  color: var(--brand-teal);
}
.investor-scroll {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--brand-silver);
  border-radius: 4px;
  padding: 12px;
}
.other-investor-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.other-investor-item span {
  flex: 1;
  font-size: 13px;
}
.other-investor-remove {
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-size: 16px;
}
.currency-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.currency-prefix {
  position: absolute;
  left: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-navy);
  pointer-events: none;
}
.currency-input {
  padding-left: 24px !important;
}
.conditional-label {
  font-size: 12px;
  color: var(--brand-navy);
  font-weight: 500;
}
.state-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.state-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
}
.state-item:hover { background: rgba(130,175,191,0.1); }
.state-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand-navy); }

@media (max-width: 640px) {
  .container { padding: 10px; }
  .section-card { padding: 16px; }
  .toggle-group { grid-template-columns: 1fr; }
  .dual-row { flex-direction: column; }
  .state-grid { grid-template-columns: repeat(2, 1fr); }

  .app-header {
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    text-align: center;
  }
  .header-left {
    gap: 10px;
    justify-content: center;
  }
  .header-logo { height: 28px; }
  .header-divider { height: 24px; }
  .app-header h1 { font-size: 16px; }
  .header-right {
    gap: 10px;
    justify-content: center;
  }
  .header-right .user-email { font-size: 12px; }
  .btn-logout { padding: 4px 10px; font-size: 12px; }

  .login-wrapper { padding: 16px; }
  .login-card { padding: 32px 24px; max-width: calc(100% - 32px); }
  .login-logo { max-width: 200px; }
  .login-card h1 { font-size: 20px; }

  .client-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .client-actions {
    align-self: flex-end;
  }

  .wizard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 16px 0 8px;
  }
  .wizard-header h2 { font-size: 18px; }
  .btn-back-dashboard { align-self: flex-end; font-size: 12px; padding: 5px 10px; }

  .progress-bar {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .progress-bar::-webkit-scrollbar { display: none; }
  .progress-step {
    flex: 0 0 auto;
    min-width: 90px;
    max-width: 110px;
    font-size: 11px;
    padding: 8px 10px;
    border-radius: 4px;
    margin-right: 4px;
    white-space: normal;
    line-height: 1.25;
  }

  .section-card h3 { font-size: 18px; }
  .question-block h4 { font-size: 15px; }

  .wizard-nav { gap: 8px; }
  .btn-prev, .btn-next, .btn-submit {
    padding: 10px 16px;
    font-size: 13px;
  }
}
