:root {
  --ink: #211b18;
  --muted: #6f625a;
  --paper: #fbf7ef;
  --paper-deep: #efe2ce;
  --line: #d9cbb9;
  --sage: #547866;
  --sage-dark: #25483a;
  --rose: #b55e5a;
  --gold: #c0913f;
  --blue: #355b7a;
  --white: #fffdf8;
  --shadow: 0 24px 70px rgba(50, 35, 23, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Manrope", system-ui, sans-serif;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--white);
}

.login-card {
  width: min(620px, 100%);
  display: grid;
  gap: 26px;
  justify-items: stretch;
}

.login-card h1 {
  margin: 0 0 10px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.15;
  text-align: center;
}

.login-credit {
  margin: 34px 0 0;
  color: var(--ink);
  font-size: 0.95rem;
  text-align: center;
}

.method-menu-screen,
.admin-screen,
.northwest-app-shell,
.decision-app-shell {
  min-height: 100vh;
  padding: 18px clamp(18px, 5vw, 72px) 72px;
  background:
    linear-gradient(180deg, rgba(234, 243, 255, 0.82), var(--paper)),
    var(--paper);
}

.admin-toolbar {
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
}

.admin-content {
  display: grid;
  gap: 18px;
  margin-top: 16px;
}

.admin-heading {
  padding: 18px 20px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-left: 7px solid var(--sage-dark);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(50, 35, 23, 0.08);
}

.admin-heading h1 {
  margin: 4px 0 8px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.admin-heading p:last-child {
  margin: 0;
  color: var(--muted);
}

.admin-section {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(50, 35, 23, 0.08);
}

.admin-section__header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.admin-section h2 {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.35rem;
}

.admin-section-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-summary {
  color: var(--sage-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.admin-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-log-wrap {
  max-height: 540px;
}

.admin-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  background: var(--white);
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  color: var(--sage-dark);
  background: #edf1e8;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.admin-table tbody tr:nth-child(even) {
  background: rgba(53, 91, 122, 0.035);
}

.admin-active-control {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  font-weight: 800;
}

.admin-active-control input {
  width: 18px;
  height: 18px;
}

.admin-expiration-input {
  min-width: 190px;
}

.admin-row-actions {
  display: flex;
  min-width: 260px;
  gap: 8px;
}

.admin-row-actions button {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

.admin-user-agent {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-examples-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.admin-example-module {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(237, 241, 232, 0.7), rgba(255, 253, 248, 0.96));
}

.admin-example-module h3 {
  margin: 0 0 12px;
  color: var(--sage-dark);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.08rem;
}

.admin-empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-example-project {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(37, 72, 58, 0.18);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 10px 24px rgba(50, 35, 23, 0.06);
}

.admin-example-project + .admin-example-project {
  margin-top: 10px;
}

.admin-example-project.is-not-example {
  opacity: 0.72;
}

.admin-example-project__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.admin-example-project__header strong,
.admin-example-project__header span {
  display: block;
}

.admin-example-project__header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-example-project__header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-example-users {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-example-users__title {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-example-user {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid rgba(37, 72, 58, 0.16);
  border-radius: 999px;
  background: rgba(237, 241, 232, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-example-user input {
  width: 15px;
  height: 15px;
}

.admin-time-details {
  min-width: 360px;
  font-variant-numeric: tabular-nums;
  line-height: 1.55;
}

.admin-time-details div {
  white-space: nowrap;
}

.admin-time-details strong {
  color: var(--sage-dark);
}

.session-duration-value {
  display: block;
  min-width: 112px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.session-state {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  margin-top: 5px;
  font-size: 0.72rem;
  font-weight: 900;
}

.session-state::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.session-state.is-online {
  color: #176b45;
}

.session-state.is-online::before {
  background: #22a06b;
  box-shadow: 0 0 0 4px rgba(34, 160, 107, 0.14);
  animation: onlinePulse 1.8s ease-in-out infinite;
}

.session-state.is-offline {
  color: var(--muted);
}

.session-state.is-offline::before {
  background: #9b928b;
}

@keyframes onlinePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
}

.method-menu-shell {
  min-height: calc(100vh - 90px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
}

@media (max-width: 900px) {
  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-section__header {
    align-items: flex-start;
    flex-direction: column;
  }
}

.method-menu-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.method-menu-intro {
  align-self: end;
  max-width: 980px;
}

.method-menu-intro h1 {
  max-width: 980px;
  margin-bottom: 14px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(2.4rem, 5vw, 4.7rem);
  line-height: 1.04;
}

.method-menu-intro p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.method-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 18px;
  align-self: start;
}

.method-choice-card {
  min-height: 220px;
  display: grid;
  gap: 16px;
  place-items: center;
  padding: 28px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(239, 226, 206, 0.76));
  border: 1px solid rgba(33, 27, 24, 0.14);
  border-left: 8px solid var(--sage-dark);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(50, 35, 23, 0.12);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.16;
  text-align: center;
}

.method-choice-card:hover,
.method-choice-card:focus-visible {
  color: var(--white);
  background: var(--sage-dark);
  transform: translateY(-2px);
}

.method-choice-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: currentColor;
  background: rgba(53, 91, 122, 0.1);
  border: 1px solid rgba(53, 91, 122, 0.18);
  border-radius: 12px;
}

.method-choice-card:hover .method-choice-icon,
.method-choice-card:focus-visible .method-choice-icon {
  background: rgba(255, 253, 248, 0.14);
  border-color: rgba(255, 253, 248, 0.26);
}

.method-choice-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.northwest-toolbar {
  grid-template-columns: auto minmax(280px, 1fr) minmax(180px, 240px) auto auto auto;
}

.northwest-toolbar .file-actions {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.northwest-ai-panel {
  margin: 12px 0;
}

.northwest-ai-panel__header {
  align-items: flex-start;
}

.northwest-ai-panel .section-kicker {
  margin-bottom: 8px;
}

.northwest-ai-output {
  max-height: none;
  overflow: auto;
}

.decision-ai-panel {
  margin-top: 0;
}

.decision-ai-output {
  max-height: none;
  overflow: auto;
}

.northwest-frame {
  width: 100%;
  height: calc(100vh - 290px);
  min-height: 680px;
  display: block;
  background: var(--white);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(50, 35, 23, 0.1);
}

.decision-toolbar {
  grid-template-columns: auto minmax(280px, 1fr) minmax(180px, 240px) auto auto auto;
}

.decision-module {
  display: grid;
  gap: 18px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(50, 35, 23, 0.1);
}

.decision-heading {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1fr);
  gap: 16px;
  align-items: end;
}

.decision-heading h2 {
  margin-bottom: 0;
}

.decision-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
}

.decision-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.decision-controls select,
.decision-controls input {
  width: 100%;
  min-height: 38px;
}

.decision-table-wrap {
  overflow: auto;
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
}

.decision-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.decision-table th,
.decision-table td {
  min-width: 104px;
  padding: 8px;
  border: 1px solid var(--line);
  text-align: center;
}

.decision-table th {
  background: #edf1e8;
  color: var(--sage-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.decision-table input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  text-align: center;
}

.decision-table tbody tr:nth-child(even) {
  background: rgba(53, 91, 122, 0.04);
}

.decision-calculated {
  color: #17365d;
  background: rgba(32, 174, 228, 0.12);
  font-weight: 900;
}

.decision-foot td,
.decision-foot th {
  background: rgba(244, 213, 51, 0.18);
  font-weight: 900;
}

.decision-recommendation {
  padding: 14px 16px;
  color: var(--sage-dark);
  background: rgba(84, 120, 102, 0.12);
  border-left: 6px solid var(--sage-dark);
  border-radius: 8px;
  font-weight: 900;
}

.opportunity-section,
.decision-tree-section {
  display: grid;
  gap: 12px;
}

.opportunity-section h3,
.decision-tree-section h3 {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.5rem;
}

.opportunity-table td {
  background: rgba(181, 94, 90, 0.08);
}

.decision-tree-3d {
  position: relative;
  width: 100%;
  min-height: 620px;
  overflow: hidden;
  background:
    linear-gradient(rgba(84, 120, 102, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84, 120, 102, 0.08) 1px, transparent 1px),
    var(--white);
  background-size: 34px 34px;
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  cursor: grab;
}

.decision-tree-3d:active {
  cursor: grabbing;
}

.decision-tree-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.decision-tree-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.decision-tree-3d-label {
  position: absolute;
  max-width: 260px;
  padding: 5px 8px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(53, 91, 122, 0.18);
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(33, 27, 24, 0.08);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
  transform: translate(-50%, -50%);
}

.decision-tree-3d-label.is-decision {
  color: var(--sage-dark);
  background: rgba(234, 243, 255, 0.92);
}

.decision-tree-3d-label.is-state {
  min-width: 170px;
  text-align: left;
}

@media (max-width: 760px) {
  .decision-tree-3d {
    min-height: 540px;
  }

  .decision-tree-3d-label {
    max-width: 190px;
    font-size: 11px;
  }

  .decision-tree-3d-label.is-state {
    min-width: 140px;
  }
}

.decision-tree-fallback {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 24px;
  color: var(--sage-dark);
  text-align: center;
  font-weight: 900;
}

.decision-tree-fallback-svg {
  display: block;
  width: 100%;
  min-height: inherit;
}

.fallback-branch-shadow {
  stroke: rgba(33, 27, 24, 0.16);
  stroke-linecap: round;
  stroke-width: 6;
}

.fallback-branch {
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-width: 4;
}

.fallback-decision-node {
  fill: var(--sage-dark);
}

.fallback-chance-node {
  fill: var(--gold);
  stroke: var(--ink);
  stroke-width: 3;
}

.fallback-payoff-node {
  fill: #2a9d8f;
  stroke: var(--sage-dark);
  stroke-width: 2;
}

.fallback-cost-node {
  fill: var(--rose);
  stroke: #7a352c;
  stroke-width: 2;
}

.fallback-tree-label {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(255, 253, 248, 0.95);
  stroke-width: 5px;
  stroke-linejoin: round;
}

.fallback-decision-text {
  fill: var(--sage-dark);
}

.fallback-state-text {
  font-size: 17px;
}

.fallback-payoff-text {
  fill: #17365d;
  font-size: 16px;
}

.decision-tree-svg {
  width: 100%;
  min-height: 420px;
  background:
    linear-gradient(rgba(84, 120, 102, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84, 120, 102, 0.08) 1px, transparent 1px),
    var(--white);
  background-size: 34px 34px;
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
}

.decision-tree-line {
  stroke: var(--blue);
  stroke-width: 2.5;
}

.decision-node {
  fill: var(--sage-dark);
}

.chance-node {
  fill: var(--gold);
  stroke: var(--ink);
  stroke-width: 2;
}

.decision-tree-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.save-toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  min-width: 150px;
  padding: 12px 18px;
  color: var(--white);
  background: var(--sage-dark);
  border: 1px solid rgba(255, 253, 248, 0.35);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(33, 27, 24, 0.24);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

button,
input,
select {
  font: inherit;
}

.brand {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--white);
  text-decoration: none;
  background: var(--ink);
  border-radius: 50%;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
}

.hero__button,
button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: var(--white);
  text-decoration: none;
  background: var(--sage-dark);
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.hero__button:hover,
button:hover {
  background: var(--sage);
}

.hero {
  position: relative;
  min-height: 92vh;
  display: grid;
  align-items: center;
  padding: 112px clamp(20px, 6vw, 84px) 58px;
  overflow: hidden;
}

.hero__art {
  position: absolute;
  inset: 84px clamp(16px, 4vw, 48px) 24px;
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  background:
    radial-gradient(circle at 82% 22%, rgba(192, 145, 63, 0.32), transparent 24%),
    linear-gradient(135deg, rgba(181, 94, 90, 0.2), transparent 40%),
    var(--white);
  box-shadow: var(--shadow);
}

.grid-paper {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(84, 120, 102, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84, 120, 102, 0.18) 1px, transparent 1px);
  background-size: 42px 42px;
}

.ink-line {
  position: absolute;
  height: 3px;
  background: var(--ink);
  transform-origin: left center;
}

.ink-line--one {
  width: 42%;
  right: 9%;
  top: 31%;
  transform: rotate(-7deg);
}

.ink-line--two {
  width: 26%;
  right: 19%;
  top: 42%;
  background: var(--rose);
  transform: rotate(-7deg);
}

.ink-line--three {
  width: 34%;
  right: 13%;
  top: 55%;
  background: var(--blue);
  transform: rotate(-7deg);
}

.hero__content {
  position: relative;
  max-width: 900px;
}

.hero__eyebrow,
.section-kicker {
  margin: 0 0 18px;
  color: var(--rose);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 880px;
  margin: 0 0 24px;
  font-family: "Cinzel", "Libre Baskerville", Georgia, serif;
  font-size: clamp(3rem, 6.4vw, 5.8rem);
  line-height: 0.98;
  letter-spacing: 0;
  text-wrap: balance;
}

.hero__button {
  width: max-content;
  min-width: 170px;
}

.method {
  padding: 82px clamp(18px, 5vw, 72px) 92px;
  background:
    linear-gradient(180deg, var(--paper), var(--paper-deep));
}

.method__intro {
  width: 100%;
  max-width: none;
  margin-bottom: 28px;
  padding: 24px clamp(18px, 4vw, 44px);
  background:
    linear-gradient(90deg, rgba(255, 253, 248, 0.98), rgba(239, 226, 206, 0.74)),
    var(--white);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-left: 8px solid var(--sage-dark);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(50, 35, 23, 0.1);
}

.intro-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.intro-toolbar .section-kicker {
  margin: 0;
}

.language-toggle {
  min-height: 38px;
  padding-inline: 14px;
  white-space: nowrap;
}

.top-controls {
  display: flex;
  align-items: end;
  gap: 12px;
}

.project-name-control {
  display: grid;
  gap: 5px;
  min-width: min(320px, 44vw);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.project-name-control input {
  width: 100%;
  min-height: 38px;
}

.app-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(180px, 260px) auto auto auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 18px;
  padding: 12px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(50, 35, 23, 0.1);
  backdrop-filter: blur(8px);
}

.file-actions {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.file-button {
  min-width: 82px;
  min-height: 64px;
  display: grid;
  gap: 4px;
  place-items: center;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  border-color: rgba(33, 27, 24, 0.16);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.1;
}

.file-button:hover,
.file-button:focus-visible {
  color: var(--white);
  background: var(--sage-dark);
  border-color: var(--sage-dark);
}

.file-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.project-picker {
  width: 100%;
  min-height: 38px;
}

.logged-user {
  align-self: center;
  color: var(--sage-dark);
  font-weight: 900;
  white-space: nowrap;
}

.auth-fields {
  display: grid;
  gap: 22px;
}

.auth-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-fields input {
  width: 100%;
  min-height: 38px;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 32px;
  min-width: 32px;
  min-height: 30px;
  padding: 0;
  color: var(--sage-dark);
  background: transparent;
  border-color: transparent;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle.is-active {
  color: var(--white);
  background: var(--sage-dark);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.auth-actions button {
  min-height: 38px;
  padding-inline: 12px;
}

.auth-status {
  color: var(--sage-dark);
  font-size: 0.9rem;
  line-height: 1.35;
}

h2 {
  margin: 0 0 12px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: 0;
}

.method__intro .intro-line {
  max-width: none;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.65;
}

.method__intro .platform-credit {
  max-width: none;
  margin: 12px 0 0;
  color: var(--sage-dark);
  font-size: clamp(1.05rem, 1.55vw, 1.32rem);
  line-height: 1.55;
}

.method__intro .platform-credit strong {
  color: var(--ink);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.08em;
}

.method__intro .platform-credit span {
  font-weight: 900;
}

.method__intro p:last-child {
  margin: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin-bottom: 22px;
}

.controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input {
  width: 112px;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.button-secondary {
  color: var(--sage-dark);
  background: transparent;
  border-color: var(--sage);
}

.button-secondary:hover {
  color: var(--white);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.table-panel,
.results {
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(50, 35, 23, 0.1);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 0 0 12px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  min-width: 116px;
  height: 94px;
  border: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

th {
  height: 56px;
  color: var(--sage-dark);
  background: rgba(84, 120, 102, 0.12);
  font-weight: 800;
}

td.corner-cell,
td.supply-cell,
td.demand-cell {
  min-width: 104px;
  font-weight: 800;
  background: rgba(192, 145, 63, 0.12);
}

.total-corner {
  position: relative;
  min-width: 116px;
  height: 94px;
  padding: 0;
  overflow: hidden;
  background: rgba(192, 145, 63, 0.12);
}

.total-corner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 145%;
  height: 2px;
  background: var(--ink);
  transform: rotate(39deg);
  transform-origin: left top;
}

.total-corner__supply,
.total-corner__demand {
  position: absolute;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.total-corner__supply {
  top: 16px;
  right: 14px;
}

.total-corner__demand {
  left: 14px;
  bottom: 16px;
}

.cost-cell {
  position: relative;
  background:
    repeating-linear-gradient(135deg, rgba(84, 120, 102, 0.08) 0 7px, transparent 7px 16px),
    var(--white);
  transition: box-shadow 160ms ease, background-color 160ms ease;
}

.cost-cell input {
  width: 58px;
  min-height: 34px;
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 6px;
  border-color: transparent;
  background: rgba(255, 253, 248, 0.8);
  font-weight: 800;
}

.allocation {
  display: inline-grid;
  min-width: 62px;
  min-height: 40px;
  place-items: center;
  margin-top: 18px;
  color: var(--blue);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
}

.allocation.is-active {
  color: var(--ink);
  background: rgba(192, 145, 63, 0.22);
  border-radius: 8px;
}

.nw-marker {
  position: absolute;
  z-index: 3;
  top: 35px;
  left: -27px;
  width: 38px;
  height: 34px;
  background: #f4d533;
  border: 2px solid var(--ink);
  border-radius: 5px;
  box-shadow: 0 4px 0 var(--ink), 0 8px 16px rgba(33, 27, 24, 0.22);
  pointer-events: none;
}

.nw-marker::before,
.nw-marker::after {
  content: "";
  position: absolute;
  background: var(--ink);
}

.nw-marker::before {
  width: 16px;
  height: 8px;
  top: 12px;
  left: 9px;
  border-radius: 6px 2px 2px 6px;
}

.nw-marker::after {
  width: 14px;
  height: 14px;
  top: 9px;
  left: 18px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.is-drop-ready {
  box-shadow: inset 0 0 0 5px rgba(244, 213, 51, 0.75);
}

.is-cancelled-row,
.is-cancelled-col {
  position: relative;
}

.is-cancelled-row::after,
.is-cancelled-col::before {
  content: "";
  position: absolute;
  z-index: 2;
  background: rgba(33, 27, 24, 0.78);
  pointer-events: none;
}

.is-cancelled-row::after {
  left: 8px;
  right: 8px;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
}

.is-cancelled-col::before {
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
}

.supply-drag {
  cursor: grab;
  user-select: none;
}

.supply-drag:active {
  cursor: grabbing;
}

.remaining-trail {
  display: block;
  min-height: 22px;
  margin-top: 6px;
  color: var(--blue);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
}

.edge-input {
  width: 86px;
  text-align: center;
  font-weight: 800;
}

.results {
  padding: 22px;
}

.results h3 {
  margin: 0 0 18px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.5rem;
}

dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

dl div {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 5px 0 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 700;
}

.status {
  margin-top: 18px;
  padding: 14px;
  color: var(--sage-dark);
  background: rgba(84, 120, 102, 0.13);
  border-radius: 8px;
  line-height: 1.5;
}

.status.is-warning {
  color: #7a352c;
  background: rgba(181, 94, 90, 0.15);
}

.network-section {
  padding: 18px clamp(18px, 5vw, 72px) 96px;
  background: var(--paper);
}

.app-shell:not(.has-project) > .network-builder,
.app-shell:not(.has-project) > .network-workspace,
.app-shell:not(.has-project) > .critical-dialog,
.app-shell:not(.has-project) > .ai-interpretation-section,
.app-shell:not(.has-project) > .gantt-section,
.app-shell:not(.has-project) > .pert-probability-section {
  display: none;
}

.network-workspace {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.platform-credit {
  margin-top: 14px;
  color: var(--sage-dark);
  font-size: 0.92rem;
  font-weight: 800;
}

.network-builder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
  padding: 18px;
  align-items: stretch;
  background: #eaf3ff;
  border: 1px solid rgba(53, 91, 122, 0.16);
  border-radius: 8px;
}

.builder-step {
  position: relative;
  display: grid;
  grid-auto-rows: auto;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: stretch;
  gap: 14px;
  height: 430px;
  min-height: 430px;
  padding: 16px;
  overflow: hidden;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(53, 91, 122, 0.12);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(53, 91, 122, 0.08);
}

.builder-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -28px;
  z-index: 2;
  width: 38px;
  height: 2px;
  background: var(--blue);
}

.builder-step:not(:last-child)::before {
  content: "";
  position: absolute;
  top: calc(50% - 5px);
  right: -31px;
  z-index: 3;
  border: 6px solid transparent;
  border-left-color: var(--blue);
}

.builder-step--draw {
  display: none !important;
}

.builder-step__header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.builder-step__header--with-control {
  grid-template-columns: auto minmax(0, 1fr) minmax(180px, 220px);
}

.builder-scale-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.duration-controls {
  display: grid;
  gap: 8px;
}

.duration-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.duration-mode-toggle button {
  min-height: 36px;
  padding: 4px 8px;
  font-size: 0.7rem;
  line-height: 1.15;
  text-wrap: balance;
}

.duration-mode-toggle button.is-active {
  color: var(--white);
  background: var(--sage-dark);
  border-color: var(--sage-dark);
}

.builder-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--blue);
  background: rgba(53, 91, 122, 0.1);
  border: 1px solid rgba(53, 91, 122, 0.16);
  border-radius: 8px;
}

.builder-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.builder-step h3 {
  margin: 0 0 6px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.45rem;
}

.builder-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.activity-mode-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
}

.activity-mode-actions button {
  min-height: 74px;
  gap: 8px;
  width: 100%;
  align-content: center;
  flex-direction: column;
  justify-content: center;
  padding: 14px 12px;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1rem, 1.8vw, 1.32rem);
  line-height: 1.2;
  text-align: center;
}

.activity-mode-actions button.is-active {
  color: var(--white);
  background: var(--sage-dark);
  border-color: var(--sage-dark);
}

.activity-mode-actions .button-icon {
  width: 24px;
  height: 24px;
}

.activity-select-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.activity-select-list label,
.builder-duration-list label,
.custom-activity-list label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.activity-entry {
  position: relative;
  padding: 10px 10px 10px 14px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--activity-color), white 84%), rgba(255, 253, 248, 0.98));
  border: 1px solid color-mix(in srgb, var(--activity-color), white 46%);
  border-left: 7px solid var(--activity-color);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(33, 27, 24, 0.06);
}

.activity-entry__label {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  padding: 4px 9px;
  color: var(--white);
  background: var(--activity-color);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.activity-select-list select,
.builder-scale-control select {
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.custom-activity-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
  gap: 10px;
}

.custom-activity-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.custom-activity-list textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.activity-entry select,
.activity-entry textarea {
  margin-top: 6px;
  color: var(--ink);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.activity-entry textarea {
  min-height: 48px;
  padding-inline: 0;
  resize: vertical;
}

.activity-entry select:focus,
.activity-entry textarea:focus {
  background: rgba(255, 253, 248, 0.38);
  border-color: color-mix(in srgb, var(--activity-color), black 12%);
}

#addCustomActivity {
  gap: 8px;
  width: 100%;
}

.builder-duration-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.pert-row {
  display: grid;
  grid-template-columns: minmax(108px, 1fr) repeat(6, 34px);
  gap: 4px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(217, 203, 185, 0.8);
}

.pert-row:not(.pert-row--header) {
  padding: 7px 6px 7px 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--activity-color), white 88%), rgba(255, 253, 248, 0.96));
  border-left: 6px solid var(--activity-color);
  border-radius: 7px;
}

.pert-row:not(.pert-row--header) > span:first-child {
  color: color-mix(in srgb, var(--activity-color), black 42%);
  font-weight: 900;
}

.builder-duration-list.is-cpm .pert-row {
  grid-template-columns: minmax(0, 1.4fr) 56px;
}

.builder-duration-list.is-cpm .pert-row input {
  width: 52px;
  padding-inline: 6px;
}

.pert-row--header {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--sage-dark);
  background: var(--white);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.inline-tooltip,
.expected-time,
.pert-calculated {
  position: relative;
}

.inline-tooltip::after,
.expected-time::after,
.pert-calculated::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 12;
  width: max-content;
  max-width: min(260px, 70vw);
  padding: 8px 10px;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--rose);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(33, 27, 24, 0.2);
  content: attr(data-tooltip);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.inline-tooltip:hover::after,
.inline-tooltip:focus-visible::after,
.expected-time:hover::after,
.expected-time:focus-visible::after,
.pert-calculated:hover::after,
.pert-calculated:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pert-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pert-row input {
  width: 34px;
  min-width: 0;
  min-height: 34px;
  padding-inline: 4px;
  text-align: center;
}

.pert-row:not(.pert-row--header) input {
  background: color-mix(in srgb, var(--activity-color), white 92%);
  border-color: color-mix(in srgb, var(--activity-color), white 42%);
}

.expected-time {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  align-items: center;
  color: var(--blue);
  font-weight: 900;
  cursor: default;
  min-width: 0;
  overflow-wrap: anywhere;
  width: 34px;
  text-align: center;
}

.pert-calculated {
  color: var(--sage-dark);
  font-weight: 900;
  text-align: center;
  cursor: default;
  width: 34px;
}

.expected-time small {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.builder-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Legacy fallback for older duration markup. */
.builder-duration {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
  align-items: end;
}

.builder-duration label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.relation-wrap {
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.relation-table {
  min-width: 0;
  width: 100%;
  border-collapse: collapse;
}

.relation-table th,
.relation-table td {
  min-width: 0;
  height: auto;
  padding: 7px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
}

.relation-table th {
  height: auto;
  background: rgba(84, 120, 102, 0.12);
}

.relation-activity-row {
  background: linear-gradient(90deg, color-mix(in srgb, var(--activity-color), white 88%), rgba(255, 253, 248, 0.97));
}

.relation-activity-row td:first-child {
  color: color-mix(in srgb, var(--activity-color), black 42%);
  border-left: 6px solid var(--activity-color);
  font-weight: 900;
}

.relation-table select {
  min-height: 36px;
  font-size: 0.8rem;
}

.relation-activity-row select {
  background: color-mix(in srgb, var(--activity-color), white 93%);
  border-color: color-mix(in srgb, var(--activity-color), white 42%);
}

.relation-activity-row .add-predecessor-button {
  color: color-mix(in srgb, var(--activity-color), black 28%);
  background: color-mix(in srgb, var(--activity-color), white 86%);
  border-color: color-mix(in srgb, var(--activity-color), white 42%);
}

.relation-activity-row .add-predecessor-button:hover {
  color: var(--white);
  background: var(--activity-color);
}

.predecessor-picker-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: start;
}

.predecessor-picker-list {
  display: grid;
  gap: 7px;
}

.add-predecessor-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--sage-dark);
  background: rgba(84, 120, 102, 0.1);
  border-color: rgba(84, 120, 102, 0.34);
  border-radius: 8px;
  font-size: 1.1rem;
}

.add-predecessor-button:hover {
  color: var(--white);
  background: var(--sage-dark);
}

.builder-step--relations {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.draw-network-action {
  gap: 8px;
  justify-self: end;
  width: auto;
  min-width: 0;
  min-height: 34px;
  padding: 0 12px;
  color: var(--sage-dark);
  background: rgba(84, 120, 102, 0.08);
  border-color: rgba(84, 120, 102, 0.34);
  border-radius: 7px;
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 900;
  align-self: end;
  margin-top: 8px;
}

.draw-network-action:hover,
.draw-network-action:focus-visible {
  color: var(--white);
  background: var(--sage-dark);
  border-color: var(--sage-dark);
}

.draw-network-action .button-icon,
.draw-network-action .button-icon svg {
  width: 15px;
  height: 15px;
}

.activity-panel,
.network-canvas-panel {
  position: relative;
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(50, 35, 23, 0.1);
}

.activity-panel {
  padding: 20px;
}

.activity-panel__header,
.network-canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.activity-panel__header {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  justify-content: stretch;
  gap: 16px;
}

.activity-panel__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  width: 100%;
}

.activity-panel__actions label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.activity-panel h3,
.network-canvas-header h3 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.45rem;
}

.heading-icon,
.button-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.heading-icon {
  width: 30px;
  height: 30px;
  color: var(--sage-dark);
  background: rgba(84, 120, 102, 0.13);
  border: 1px solid rgba(84, 120, 102, 0.2);
  border-radius: 8px;
}

.button-icon {
  width: 18px;
  height: 18px;
}

.heading-icon svg,
.button-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.activity-panel__actions button {
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding-inline: 14px;
  white-space: nowrap;
}

#loadNetworkExample {
  grid-column: 1 / -1;
}

.network-canvas-header {
  padding: 20px 22px 0;
}

.network-canvas-header .section-kicker {
  margin-bottom: 6px;
}

.activity-table-wrap {
  overflow-x: auto;
}

.activity-table {
  min-width: 0;
  width: 100%;
  border-collapse: collapse;
}

.activity-table th,
.activity-table td {
  min-width: 0;
  height: auto;
  padding: 8px;
  border-color: var(--line);
}

.activity-capture-row {
  background: linear-gradient(90deg, color-mix(in srgb, var(--activity-color), white 86%), rgba(255, 253, 248, 0.98));
}

.activity-capture-row td:nth-child(2) {
  box-shadow: inset 6px 0 0 var(--activity-color);
}

.activity-table th:first-child,
.activity-table td:first-child {
  width: 44px;
  padding-inline: 6px;
}

.activity-table th {
  height: 50px;
  padding-inline: 10px;
  font-size: 0.68rem;
  line-height: 1.25;
  text-transform: uppercase;
}

.activity-table input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  font-weight: 800;
}

.activity-table input {
  text-transform: uppercase;
}

.activity-capture-row input {
  background: color-mix(in srgb, var(--activity-color), white 92%);
  border-color: color-mix(in srgb, var(--activity-color), white 42%);
}

.activity-capture-row .activity-input {
  color: var(--white);
  background: var(--activity-color);
  border-color: color-mix(in srgb, var(--activity-color), black 18%);
}

.activity-input {
  max-width: 88px;
}

.duration-input {
  max-width: 92px;
}

.row-delete-button {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  color: #7a352c;
  background: rgba(181, 94, 90, 0.12);
  border-color: rgba(181, 94, 90, 0.35);
  border-radius: 50%;
  line-height: 1;
}

.row-delete-button:hover {
  color: var(--white);
  background: var(--rose);
}

.network-status {
  margin-top: 14px;
  font-size: 0.9rem;
}

.network-canvas-wrap {
  position: relative;
  width: 100%;
  overflow: auto;
  padding: 8px 14px 86px;
}

#projectNetworkSvg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: 620px;
  border: 1px solid rgba(84, 120, 102, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(rgba(84, 120, 102, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84, 120, 102, 0.12) 1px, transparent 1px),
    var(--white);
  background-size: 34px 34px;
}

.network-edge {
  fill: none;
  stroke-width: 4;
  transition: opacity 160ms ease, stroke-width 160ms ease;
}

.network-edge.is-base {
  stroke: rgba(33, 27, 24, 0.18);
  stroke-width: 6;
}

.network-route-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
  opacity: 0.94;
  transition: opacity 160ms ease, stroke-width 160ms ease;
}

.network-route-line.is-route-active {
  opacity: 0.96;
}

.network-route-line.is-critical-route {
  stroke: #d62728;
  stroke-width: 9;
}

.network-route-line.is-route-xray {
  opacity: 0.14;
  stroke-width: 4;
}

.network-route-line.is-critical-route.is-route-xray {
  opacity: 0.2;
}

.network-node circle {
  fill: #f8e7bd;
  stroke: var(--ink);
  stroke-width: 3;
}

.network-node.is-terminal circle {
  fill: #fff0c9;
}

.network-node.is-critical-node circle {
  stroke: #b00020;
  stroke-width: 6;
}

.node-divider {
  stroke: var(--ink);
  stroke-width: 3;
}

.network-node text {
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
}

.node-title,
.node-duration {
  fill: var(--blue);
  font-size: 16px;
}

.node-time {
  fill: #a71d2a;
  font-size: 16px;
}

.node-title,
.node-time,
.node-duration {
  cursor: default;
}

.network-canvas-wrap.is-tooltip-visible,
.network-canvas-wrap.is-tooltip-visible * {
  cursor: none;
}

.node-tooltip {
  position: absolute;
  z-index: 6;
  max-width: 245px;
  padding: 10px 12px;
  color: #2a1717;
  background: #f3c8c8;
  border: 3px solid #b00020;
  border-radius: 8px;
  box-shadow: 0 4px 0 rgba(176, 0, 32, 0.28), 0 10px 20px rgba(33, 27, 24, 0.2);
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.node-tooltip::after {
  content: "";
  position: absolute;
  left: -13px;
  top: 18px;
  width: 18px;
  height: 18px;
  background: #f3c8c8;
  border-left: 3px solid #b00020;
  border-bottom: 3px solid #b00020;
  transform: rotate(45deg);
}

.node-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.route-analysis-panel {
  position: static;
  display: grid;
  gap: 4px;
  width: auto;
  min-height: 56px;
  margin: 10px 14px 0;
  padding: 12px 16px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.98);
  border: 3px solid var(--blue);
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(255, 253, 248, 0.72), 0 12px 26px rgba(33, 27, 24, 0.2);
  font-size: 0.92rem;
  line-height: 1.35;
}

.route-analysis-panel.is-critical {
  border-color: #d62728;
}

.route-analysis-panel.is-subcritical {
  border-color: #c07a18;
}

.route-analysis-panel strong {
  color: var(--sage-dark);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1rem;
}

.route-analysis-panel.is-critical strong {
  color: #b00020;
}

.route-analysis-panel.is-subcritical strong {
  color: #8a4f00;
}

.slack-label {
  fill: var(--blue);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 800;
  text-anchor: middle;
  cursor: default;
}

.slack-label.is-critical {
  fill: var(--sage-dark);
}

.project-duration-badge rect {
  fill: rgba(248, 252, 255, 0.96);
  stroke: var(--blue);
  stroke-width: 4;
}

.project-duration-badge text {
  fill: #17365d;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: middle;
}

.critical-dialog {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  padding: 16px 20px;
  color: #17365d;
  background: rgba(255, 253, 248, 0.92);
  border: 2px solid rgba(181, 94, 90, 0.45);
  border-left: 8px solid #b00020;
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(50, 35, 23, 0.1);
}

.critical-dialog__badge {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: var(--white);
  background: #b00020;
  border-radius: 8px;
  font-weight: 900;
  letter-spacing: 0;
}

.critical-dialog h3 {
  margin: 0 0 6px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.35rem;
}

.critical-dialog p {
  margin: 0;
  line-height: 1.5;
}

.ai-interpretation-section {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.72fr);
  grid-template-rows: auto minmax(220px, 1fr) auto;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-left: 6px solid var(--blue);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(50, 35, 23, 0.09);
}

.ai-interpretation-header {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.ai-interpretation-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.35rem;
}

.ai-interpretation-output {
  grid-column: 1;
  grid-row: 2;
  min-height: 360px;
  padding: 14px 16px;
  overflow: auto;
  color: var(--ink);
  background: rgba(234, 243, 255, 0.42);
  border: 1px solid rgba(53, 91, 122, 0.24);
  border-radius: 8px;
  line-height: 1.58;
  white-space: pre-wrap;
}

.ai-avatar-widget {
  display: contents;
}

.ai-avatar {
  grid-column: 2;
  grid-row: 1 / 4;
  position: relative;
  align-self: center;
  min-height: 360px;
  aspect-ratio: 1.58 / 1;
  overflow: hidden;
  background: var(--white);
  border: 1px solid rgba(33, 27, 24, 0.12);
  box-shadow: 0 14px 36px rgba(50, 35, 23, 0.09);
}

.ai-avatar-widget.is-loading .ai-avatar {
  animation: avatarPulse 0.9s ease-in-out infinite;
}

.ai-avatar-widget.is-speaking .ai-avatar {
  animation: avatarHeadTalk 1.4s ease-in-out infinite;
}

.ai-avatar__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  transition: opacity 120ms ease;
}

.ai-avatar__image--normal {
  opacity: 1;
}

.ai-avatar__image--blink {
  animation: avatarBlink 7s linear infinite;
}

.ai-avatar-widget.is-speaking .ai-avatar__image--blink {
  opacity: 0;
  animation: none;
}

.ai-avatar-widget.is-speaking .ai-avatar__image--normal {
  animation: avatarNormalTalk 0.42s steps(1, end) infinite;
}

.ai-avatar-widget.is-speaking .ai-avatar__image--speaking {
  animation: avatarSpeakingTalk 0.42s steps(1, end) infinite;
}

.ai-avatar-widget.is-speaking.is-mouth-open .ai-avatar__image--normal {
  opacity: 0;
}

.ai-avatar-widget.is-speaking.is-mouth-open .ai-avatar__image--speaking {
  opacity: 1;
}

.ai-avatar-controls {
  grid-column: 1;
  grid-row: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 80px;
  padding: 14px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(53, 91, 122, 0.16);
  border-radius: 8px;
}

.ai-avatar-controls small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

@keyframes avatarBlink {
  0%,
  92%,
  100% {
    opacity: 0;
  }
  94%,
  95% {
    opacity: 1;
  }
}

@keyframes avatarPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes avatarHeadTalk {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-2px) scale(1.012);
  }
}

@keyframes avatarNormalTalk {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes avatarSpeakingTalk {
  0%,
  49% {
    opacity: 0;
  }
  50%,
  100% {
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .admin-examples-grid {
    grid-template-columns: 1fr;
  }

  .ai-interpretation-section {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }

  .ai-interpretation-header,
  .ai-interpretation-output,
  .ai-avatar-controls,
  .ai-avatar {
    grid-column: 1;
  }

  .ai-avatar {
    grid-row: 3;
    min-height: 280px;
  }

  .ai-avatar-controls {
    grid-row: 4;
  }
}

.route-controls {
  position: absolute;
  z-index: 5;
  right: 30px;
  bottom: 22px;
  left: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(33, 27, 24, 0.12);
}

.route-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.92);
  border-color: color-mix(in srgb, var(--route-color), var(--ink) 12%);
  box-shadow: inset 5px 0 0 var(--route-color);
  font-size: 0.78rem;
}

.route-button:hover,
.route-button.is-active {
  color: var(--white);
  background: var(--route-color);
}

.gantt-section {
  margin-top: 22px;
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(50, 35, 23, 0.1);
}

.gantt-wrap {
  overflow: auto;
  padding: 8px 14px 22px;
}

.gantt-table {
  min-width: max-content;
  width: 100%;
  border-collapse: collapse;
}

.gantt-table th,
.gantt-table td {
  min-width: 56px;
  height: 36px;
  padding: 6px;
  border: 1px solid var(--line);
  text-align: center;
}

.gantt-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf1e8;
  font-size: 0.72rem;
  white-space: nowrap;
}

.gantt-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 104px;
  background: #f7ebd2;
  font-weight: 900;
}

.gantt-table th.gantt-activity-label {
  color: var(--white);
  background: var(--activity-color);
  box-shadow: inset 7px 0 0 color-mix(in srgb, var(--activity-color), black 28%);
}

.gantt-table .gantt-bar {
  background: linear-gradient(180deg, color-mix(in srgb, var(--activity-color), white 6%), color-mix(in srgb, var(--activity-color), black 12%));
  box-shadow: inset 0 0 0 1px rgba(255, 253, 248, 0.48);
}

.gantt-table .gantt-bar.is-critical {
  background: linear-gradient(180deg, color-mix(in srgb, var(--activity-color), white 6%), color-mix(in srgb, var(--activity-color), black 12%));
}

.pert-probability-section {
  margin-top: 22px;
  padding: 16px;
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(50, 35, 23, 0.1);
}

.delivery-target-control {
  display: grid;
  gap: 6px;
  min-width: 160px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.delivery-target-control input {
  min-height: 38px;
  text-align: center;
}

.pert-probability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.normal-card,
.probability-legend,
.z-table-card {
  background: var(--white);
  border: 1px solid rgba(33, 27, 24, 0.12);
  border-radius: 8px;
}

.normal-card {
  overflow: hidden;
}

.normal-curve-svg {
  display: block;
  width: 100%;
  min-height: 250px;
}

.normal-bg {
  fill: #dff3ff;
  stroke: #24a7d8;
  stroke-width: 4;
}

.normal-axis,
.normal-tick {
  stroke: #6d7478;
  stroke-width: 2;
}

.normal-curve {
  fill: none;
  stroke: #20aee4;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.normal-shade {
  fill: rgba(32, 174, 228, 0.22);
}

.normal-target-line {
  stroke: #20aee4;
  stroke-width: 3;
}

.normal-label,
.normal-axis-label {
  fill: #1e3f58;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
}

.normal-axis-label {
  fill: #211b18;
  font-size: 12px;
  font-weight: 900;
}

.pert-probability-details {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.probability-legend {
  padding: 16px;
  color: #20385a;
  font-size: 1rem;
  line-height: 1.55;
}

.probability-legend p {
  margin: 0 0 12px;
}

.z-equation {
  display: grid;
  gap: 6px;
  margin: 10px 0 14px;
  padding: 12px;
  background: rgba(53, 91, 122, 0.08);
  border-radius: 8px;
  font-weight: 900;
}

.probability-numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.probability-numbers div {
  padding: 10px;
  border: 1px solid rgba(53, 91, 122, 0.16);
  border-radius: 8px;
}

.probability-numbers dd {
  font-size: 1rem;
}

.probability-warning {
  color: #7a352c;
  font-weight: 900;
}

.z-table-card {
  overflow: hidden;
}

.z-table-title {
  display: inline-block;
  margin: 14px 16px 8px;
  padding: 10px 18px;
  color: #211b18;
  background: #f58b9b;
  border: 5px solid #b00020;
  border-radius: 10px;
  font-weight: 900;
}

.z-table-wrap {
  max-height: 430px;
  overflow: auto;
  padding: 0 14px 16px;
}

.z-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.95rem;
}

.z-table th,
.z-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(33, 27, 24, 0.2);
  text-align: center;
}

.z-table thead th {
  position: sticky;
  top: 0;
  background: var(--white);
  border-top: 3px solid #211b18;
  border-bottom: 3px solid #211b18;
}

.z-table tbody th {
  color: var(--muted);
  font-weight: 900;
}

.z-table .is-z-row-guide,
.z-table .is-z-column-guide {
  background: rgba(32, 174, 228, 0.1);
}

.z-table thead .is-z-column-guide,
.z-table tbody th.is-z-row-guide {
  color: #17365d;
  background: rgba(32, 174, 228, 0.16);
}

.z-table thead .is-z-column-target,
.z-table tbody th.is-z-row-target {
  color: var(--white);
  background: #355b7a;
}

.z-table .is-z-selected {
  color: #17365d;
  background: #bfe9ff;
  box-shadow: inset 0 0 0 3px #20aee4;
  font-weight: 900;
}

@media (max-width: 860px) {
  .hero {
    min-height: 88vh;
  }

  .hero__art {
    inset: 86px 10px 22px;
  }

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

  .network-workspace {
    grid-template-columns: 1fr;
  }

  .network-builder {
    grid-template-columns: 1fr;
  }

  .intro-toolbar,
  .top-controls,
  .app-toolbar,
  .auth-fields {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .file-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .method-choice-grid {
    grid-template-columns: 1fr;
  }

  .method-menu-topbar,
  .northwest-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .builder-step {
    height: 430px;
  }

  .builder-step:not(:last-child)::before,
  .builder-step:not(:last-child)::after {
    display: none;
  }

  .builder-step__header--with-control {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .duration-controls {
    grid-column: 1 / -1;
  }

  .builder-scale-control {
    grid-column: 1 / -1;
  }

  .activity-panel__header {
    align-items: stretch;
    flex-direction: column;
  }

  .activity-panel__actions {
    width: 100%;
  }

  .results {
    order: -1;
  }
}

@media (max-width: 560px) {
  .brand {
    width: 42px;
    height: 42px;
  }

  .hero {
    padding-inline: 18px;
  }

  h1 {
    font-size: clamp(2.28rem, 12vw, 4.2rem);
  }

  .controls {
    align-items: stretch;
  }

  .controls label,
  .controls button {
    flex: 1 1 150px;
  }

  input {
    width: 100%;
  }
}
