:root {
  --burgundy: #660066;
  --ocean: #262262;
  --blue: #006FFA;
  --orange: #F37021;
  --forest: #005129;
  --candy: #EF4D41;
  --ink: #22252b;
  --paper: #fbfaf8;
  --line: #d9d5cf;
  --muted: #6b6f76;
  --now: #2f9e44;
  --next: #d9a300;
  --later: #9aa0a6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Calibri, sans-serif;
}

#app { max-width: 920px; margin: 0 auto; padding: 28px 20px 60px; }

.app-header .brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--burgundy);
  font-size: 13px;
}
.app-header h1 {
  margin: 4px 0 8px;
  font-size: 26px;
  color: var(--ocean);
  font-weight: 700;
}
.app-header .sub {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  max-width: 640px;
  line-height: 1.5;
}
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--later);
  display: inline-block;
}
.status-dot.ok { background: var(--now); }
.status-dot.warn { background: var(--candy); }
.ghost-btn {
  margin-left: auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.ghost-btn:hover { border-color: var(--ocean); color: var(--ocean); }

.map-section { margin-bottom: 30px; }
.section-title {
  font-size: 17px;
  color: var(--ocean);
  margin: 0 0 4px;
  font-weight: 700;
}
.section-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
  max-width: 640px;
  line-height: 1.45;
}
.timeline-section { margin-bottom: 30px; }
.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.timeline-legend .swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.today-swatch {
  background: transparent;
  border-left: 2px dashed #22252b;
  width: 0 !important;
  height: 10px !important;
}
.timeline-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.link-btn {
  background: var(--ocean);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.link-btn.active { background: var(--candy); }
.link-hint { font-size: 13px; color: var(--muted); }

.map-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 6px;
}
#mapSvg { width: 100%; height: auto; display: block; }

.link-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
}
.link-row .remove {
  margin-left: auto;
  cursor: pointer;
  color: var(--candy);
  font-weight: 700;
  border: none;
  background: transparent;
  font-size: 14px;
}

.cards-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 700px) {
  .cards-section { grid-template-columns: 1fr; }
}

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  overflow: hidden;
}
.card-head {
  padding: 10px 14px;
  color: white;
  font-weight: 700;
  font-size: 15px;
}
.card-recs {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 14px 0;
  font-style: italic;
}
.card-body { padding: 6px 14px 14px; }
.field { margin-top: 10px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  color: var(--muted);
  margin-bottom: 3px;
}
.field input[type=text], .field select, .field input[type=date] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fdfdfc;
}
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
}
.checks input { margin: 0; }
.horizon-row { display: flex; gap: 14px; }
.horizon-row label { font-size: 12px; display: flex; align-items: center; gap: 4px; }

.deps-wrap { margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.dep-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px 10px;
  background: #fbfaf8;
}
.dep-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--ocean);
  margin-bottom: 4px;
}
.dep-remove {
  border: none;
  background: transparent;
  color: var(--candy);
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
}
.add-dep-btn {
  margin-top: 10px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--ocean);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}
.add-dep-btn:hover { border-color: var(--ocean); background: #f2f1ee; }

.node-circle { cursor: pointer; }
.node-circle:focus-visible, .tl-marker:focus-visible {
  outline: 3px solid var(--candy);
  outline-offset: 3px;
  border-radius: 50%;
}
.node-label { font-size: 13px; font-weight: 700; fill: white; pointer-events: none; }
.node-sub { font-size: 10px; fill: white; opacity: 0.85; pointer-events: none; }
.center-label { font-size: 14px; font-weight: 700; fill: white; text-anchor: middle; pointer-events: none; }
.link-label { font-size: 11px; fill: var(--ink); }
.selected-ring { fill: none; stroke: var(--candy); stroke-width: 3; }
