:root {
  color-scheme: dark;
  --bg: #080b11;
  --bg-soft: #0c111a;
  --panel: #101620;
  --panel-raised: #141b27;
  --panel-hover: #182130;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f6fb;
  --text-soft: #b8c0cf;
  --muted: #758096;
  --accent: #8e79ff;
  --accent-strong: #a796ff;
  --accent-soft: rgba(142, 121, 255, 0.13);
  --blue: #65a8ff;
  --green: #43d39e;
  --amber: #f1b96a;
  --red: #ff7d86;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  --content: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -10%, rgba(113, 89, 247, 0.12), transparent 32rem),
    radial-gradient(circle at 8% 30%, rgba(67, 108, 211, 0.06), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.noscript {
  padding: 16px;
  background: var(--red);
  color: #22070a;
  text-align: center;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-accent {
  color: var(--accent-strong);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 750;
  letter-spacing: -0.01em;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent-strong), #7661ed);
  box-shadow: 0 8px 24px rgba(116, 91, 236, 0.22);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #b1a3ff, #816bf2);
}

.button-secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.button-secondary:hover:not(:disabled),
.button-ghost:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.075);
}

.button-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-soft);
}

.button-large {
  width: 100%;
  min-height: 52px;
  border-radius: 13px;
  font-size: 16px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 20px;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

/* Onboarding */

.onboarding-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 32px 20px;
}

.onboarding-shell::before {
  position: absolute;
  width: min(720px, 90vw);
  height: min(720px, 90vw);
  border: 1px solid rgba(142, 121, 255, 0.09);
  border-radius: 50%;
  box-shadow: 0 0 120px rgba(105, 83, 230, 0.1) inset;
  content: "";
}

.onboarding-card {
  position: relative;
  z-index: 2;
  width: min(520px, 100%);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(14, 19, 29, 0.9);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.45);
  text-align: center;
  backdrop-filter: blur(24px);
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px solid rgba(169, 151, 255, 0.35);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(159, 140, 255, 0.22), rgba(97, 74, 217, 0.08));
  box-shadow: 0 0 34px rgba(137, 111, 255, 0.16);
  color: #d7ceff;
  font-family: Georgia, serif;
  font-size: 28px;
  font-style: italic;
}

.onboarding-card h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.onboarding-copy {
  max-width: 420px;
  margin: 20px auto 24px;
  color: var(--text-soft);
}

.privacy-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0 0 24px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.flow-arrow {
  color: var(--muted);
}

.flow-vault {
  color: var(--text);
}

.flow-lock {
  color: var(--green);
}

.onboarding-help {
  margin: 16px 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.inline-alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  text-align: left;
  font-size: 13px;
}

.inline-alert-danger {
  border: 1px solid rgba(255, 125, 134, 0.24);
  background: rgba(255, 125, 134, 0.08);
  color: #ffc0c5;
}

.onboarding-orbit span {
  position: absolute;
  z-index: 1;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
  opacity: 0.55;
}

.onboarding-orbit span:nth-child(1) { top: 20%; left: 18%; }
.onboarding-orbit span:nth-child(2) { right: 16%; bottom: 24%; }
.onboarding-orbit span:nth-child(3) { top: 32%; right: 26%; opacity: 0.2; }

/* App shell */

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 17, 0.82);
  backdrop-filter: blur(22px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.header-brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid rgba(159, 140, 255, 0.28);
  border-radius: 10px;
  background: var(--accent-soft);
  color: #d3c9ff;
  font-family: Georgia, serif;
  font-size: 19px;
  font-style: italic;
}

.header-brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
}

.header-brand strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.header-brand small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-actions,
.connection-state {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 10px;
}

.connection-state {
  gap: 9px;
  margin-right: 5px;
  padding-right: 15px;
  border-right: 1px solid var(--line);
}

.connection-state > span:last-child {
  display: flex;
  flex-direction: column;
}

.connection-state strong {
  color: var(--text-soft);
  font-size: 11px;
}

.connection-state small {
  max-width: 150px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(67, 211, 158, 0.1);
}

.app-main {
  width: min(var(--content), calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 72px;
}

.welcome-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 38px;
}

.welcome-row h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 70px);
  font-weight: 720;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.welcome-row h1 span {
  color: var(--muted);
}

.welcome-principle {
  max-width: 320px;
  margin: 0 0 5px;
  padding-left: 18px;
  border-left: 1px solid var(--accent);
  color: var(--text-soft);
  font-size: 13px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 54px;
}

.metric-card {
  display: flex;
  min-height: 138px;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 22, 32, 0.72);
}

.metric-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.metric-value {
  margin: 9px 0 0;
  font-size: 40px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric-note {
  color: var(--muted);
  font-size: 11px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.035em;
}

.focus-section {
  margin-bottom: 56px;
}

.focus-heading {
  margin-bottom: 18px;
}

.focus-date-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.focus-date-block span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.focus-date-block strong {
  font-size: 14px;
}

.methodology-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(101, 168, 255, 0.13);
  border-radius: 12px;
  background: rgba(73, 130, 205, 0.055);
  color: #aab7cb;
  font-size: 12px;
}

.methodology-note p {
  margin: 0;
}

.methodology-note strong {
  color: #d9e5f8;
}

.methodology-icon {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(101, 168, 255, 0.32);
  border-radius: 50%;
  color: var(--blue);
  font-family: Georgia, serif;
  font-size: 12px;
  font-style: italic;
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.focus-card {
  position: relative;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(146, 124, 255, 0.07), transparent 42%),
    var(--panel);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.16);
}

.focus-card::after {
  position: absolute;
  top: -70px;
  right: -70px;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(142, 121, 255, 0.1);
  border-radius: 50%;
  content: "";
}

.interactive-card {
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.interactive-card:hover {
  transform: translateY(-2px);
  border-color: rgba(159, 140, 255, 0.32);
  background-color: var(--panel-raised);
}

.card-topline,
.progress-header,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entity-id {
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-planned { border-color: rgba(241, 185, 106, 0.19); background: rgba(241, 185, 106, 0.07); color: #e8b975; }
.status-running { border-color: rgba(101, 168, 255, 0.25); background: rgba(101, 168, 255, 0.08); color: #8bc0ff; }
.status-completed { border-color: rgba(67, 211, 158, 0.22); background: rgba(67, 211, 158, 0.07); color: #70dcb4; }
.status-cancelled { color: var(--muted); }

.focus-title {
  margin: 20px 0 5px;
  font-size: 26px;
  letter-spacing: -0.035em;
}

.architecture-line {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.account-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 21px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.13);
}

.account-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-value {
  color: var(--text-soft);
  font-size: 12px;
}

.progress-header {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.progress-header strong {
  color: var(--text-soft);
}

.progress-track {
  width: 100%;
  height: 3px;
  margin-bottom: 15px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
}

.progress-value {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 250ms ease;
}

.progress-0 { width: 0; }
.progress-1 { width: 14.2857%; }
.progress-2 { width: 28.5714%; }
.progress-3 { width: 42.8571%; }
.progress-4 { width: 57.1429%; }
.progress-5 { width: 71.4286%; }
.progress-6 { width: 85.7143%; }
.progress-7 { width: 100%; }

.setup-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-checklist li {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.setup-checklist li.is-complete {
  color: var(--text-soft);
}

.check-dot {
  display: grid;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 9px;
}

.is-complete .check-dot {
  border-color: rgba(67, 211, 158, 0.25);
  background: rgba(67, 211, 158, 0.08);
  color: var(--green);
}

.card-actions {
  justify-content: flex-start;
  margin-top: 22px;
}

.card-actions .button {
  flex: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(16, 22, 32, 0.66);
}

.panel-heading {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  font-size: 21px;
}

.section-note {
  color: var(--muted);
  font-size: 10px;
}

.compact-list,
.review-list,
.decision-list {
  display: flex;
  flex-direction: column;
}

.compact-entity-card,
.review-row,
.decision-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
}

.compact-entity-card:last-child,
.review-row:last-child,
.decision-row:last-child {
  border-bottom: 0;
}

.compact-entity-card:hover,
.review-row:hover,
.decision-row:hover {
  background: rgba(255, 255, 255, 0.028);
}

.compact-card-main,
.review-info,
.decision-info {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.compact-card-main strong,
.review-info strong,
.decision-info strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-card-main small,
.review-info small,
.decision-info small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-row {
  display: grid;
  grid-template-columns: 48px 35px 1fr 18px;
}

.review-date {
  color: var(--text-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  text-transform: uppercase;
}

.review-overdue {
  color: var(--red);
}

.review-due-today {
  color: var(--amber);
}

.review-horizon {
  display: grid;
  height: 25px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent-strong);
  font-size: 9px;
  font-weight: 850;
}

.row-arrow {
  color: var(--muted);
  transition: transform 140ms ease, color 140ms ease;
}

.review-row:hover .row-arrow,
.decision-row:hover .row-arrow {
  transform: translateX(2px);
  color: var(--text);
}

.decisions-panel {
  margin-bottom: 14px;
}

.decision-row {
  display: grid;
  grid-template-columns: 42px 1fr auto 18px;
  padding: 16px 24px;
}

.decision-id {
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
}

.confidence-badge {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.empty-state {
  margin: 0;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.knowledge-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) 1.25fr;
  align-items: center;
  gap: 40px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 80% 50%, rgba(142, 121, 255, 0.08), transparent 40%),
    rgba(16, 22, 32, 0.6);
}

.knowledge-panel h2 {
  margin: 0 0 8px;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.knowledge-panel p:not(.eyebrow) {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.knowledge-ladder {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.knowledge-stage {
  display: flex;
  min-width: 80px;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.knowledge-stage strong {
  font-size: 22px;
  letter-spacing: -0.04em;
}

.knowledge-stage span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.knowledge-arrow {
  color: rgba(142, 121, 255, 0.5);
  font-size: 13px;
}

.app-footer {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 max(24px, calc((100vw - var(--content)) / 2));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.footer-brand {
  color: var(--text-soft);
  font-weight: 800;
}

.footer-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.validation-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.validation-dot.is-clean { background: var(--green); box-shadow: 0 0 8px rgba(67, 211, 158, 0.5); }
.validation-dot.has-warnings { background: var(--amber); box-shadow: 0 0 8px rgba(241, 185, 106, 0.45); }

/* Drawer and forms */

.drawer-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(5px);
}

.drawer {
  display: flex;
  width: min(680px, 94vw);
  height: 100%;
  flex-direction: column;
  border-left: 1px solid var(--line-strong);
  background: #0c1119;
  box-shadow: -28px 0 80px rgba(0, 0, 0, 0.42);
  animation: drawer-in 190ms ease-out;
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.drawer-meta {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.drawer-close {
  flex: 0 0 auto;
}

.drawer-content {
  flex: 1;
  padding: 26px 30px 40px;
  overflow-y: auto;
}

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: rgba(8, 11, 17, 0.78);
  backdrop-filter: blur(16px);
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0 0 24px;
}

.metadata-item {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
}

.metadata-item dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metadata-item dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
}

.drawer-setup-block {
  margin-bottom: 25px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.drawer-setup-block h3 {
  margin: 0 0 12px;
  font-size: 12px;
}

.sections-view {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.content-section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.content-section h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.content-section p {
  margin: 0;
  color: var(--text-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px 14px;
}

.form-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.field-label {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
}

.required-mark {
  color: var(--accent-strong);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  transition: border-color 150ms ease, background 150ms ease;
}

.field-input:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.field-input:focus {
  border-color: rgba(159, 140, 255, 0.68);
  background: rgba(142, 121, 255, 0.045);
}

.field-input::placeholder {
  color: #596478;
}

.field-textarea {
  min-height: 90px;
  resize: vertical;
}

select.field-input {
  color-scheme: dark;
}

.field-help {
  color: var(--muted);
  font-size: 9px;
}

.confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #101620;
  box-shadow: var(--shadow);
  color: var(--text);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.confirm-dialog form {
  padding: 28px;
}

.confirm-mark {
  display: grid;
  width: 35px;
  height: 35px;
  margin-bottom: 17px;
  place-items: center;
  border: 1px solid rgba(241, 185, 106, 0.24);
  border-radius: 10px;
  background: rgba(241, 185, 106, 0.07);
  color: var(--amber);
  font-weight: 800;
}

.confirm-dialog h2 {
  margin: 0 0 9px;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.confirm-dialog p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(390px, calc(100vw - 40px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  transform: translateY(8px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #171e2a;
  box-shadow: var(--shadow);
  color: var(--text-soft);
  opacity: 0;
  font-size: 12px;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-success { border-color: rgba(67, 211, 158, 0.24); color: #a6e8d0; }
.toast-error { border-color: rgba(255, 125, 134, 0.28); color: #ffc0c5; }

.is-busy::after {
  position: fixed;
  z-index: 120;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--blue), transparent);
  background-size: 200% 100%;
  content: "";
  animation: busy 1s linear infinite;
}

@keyframes busy {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (max-width: 980px) {
  .connection-state { display: none; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .knowledge-panel { grid-template-columns: 1fr; }
  .knowledge-ladder { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .app-header {
    min-height: 64px;
    padding: 0 16px;
  }

  .header-actions {
    gap: 6px;
  }

  .button-icon-label {
    width: 40px;
    padding: 0;
    overflow: hidden;
    color: transparent;
  }

  .button-icon-label span {
    color: var(--text-soft);
  }

  #new-decision-button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 12px;
  }

  #disconnect-button { display: none; }

  .app-main {
    width: min(100% - 28px, var(--content));
    padding: 38px 0 50px;
  }

  .welcome-row {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 28px;
  }

  .welcome-row h1 {
    font-size: clamp(39px, 13vw, 58px);
  }

  .metrics-grid {
    gap: 9px;
    margin-bottom: 42px;
  }

  .metric-card {
    min-height: 120px;
    padding: 16px;
  }

  .metric-value { font-size: 34px; }
  .metric-note { font-size: 9px; }

  .focus-grid {
    grid-template-columns: 1fr;
  }

  .focus-card {
    padding: 20px;
  }

  .section-note,
  .focus-date-block {
    display: none;
  }

  .decision-row {
    grid-template-columns: 34px 1fr 18px;
    padding: 15px 17px;
  }

  .confidence-badge { display: none; }

  .knowledge-panel {
    padding: 22px;
  }

  .knowledge-ladder {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .knowledge-stage {
    min-width: 0;
    padding: 10px 4px;
  }

  .knowledge-stage strong { font-size: 18px; }
  .knowledge-stage span { font-size: 7px; }
  .knowledge-arrow { display: none; }

  .app-footer {
    padding: 14px 16px;
  }

  .footer-brand,
  #last-sync { display: none; }

  .drawer {
    width: 100%;
    max-width: none;
    border-left: 0;
  }

  .drawer-header {
    padding: 22px 18px 18px;
  }

  .drawer-header h2 { font-size: 23px; }

  .drawer-content {
    padding: 20px 18px 34px;
  }

  .drawer-footer {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .drawer-footer .button { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field-wide { grid-column: auto; }
  .metadata-grid { grid-template-columns: 1fr 1fr; }

  .onboarding-card {
    padding: 32px 22px;
  }

  .privacy-flow {
    gap: 6px;
    font-size: 10px;
  }
}

@media (max-width: 420px) {
  .header-brand > span:last-child { display: none; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 108px; }
  .metric-label { font-size: 10px; }
  .setup-checklist { grid-template-columns: 1fr; }
  .review-row { grid-template-columns: 44px 32px 1fr; }
  .review-row .row-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
