@import url("../css/typography.css");
:root {
  --bg: #f5f7fa;
  --card: #fff;
  --text: #102a43;
  --muted: #486581;
  --weak: #6f8399;
  --line: #d9e2ec;
  --cyan: #0a5382;
  --ready: #1565c0;
  --done: #2e7d32;
  --blocked: #90a4ae;
}

* { box-sizing: border-box; }

body {
  min-width: 960px;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(147, 197, 216, 0.26), transparent 28%),
    linear-gradient(150deg, rgba(232, 200, 156, 0.08), transparent 34%),
    linear-gradient(180deg, #fbfdff 0%, #f3f7fa 100%);
  color: var(--text);
  font-family:var(--font-app);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: min(1540px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 22px 0 52px;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  padding: 24px 28px;
  box-shadow: 0 20px 46px rgba(16, 42, 67, 0.08);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -6% 0 12%;
  height: 70px;
  border-top: 1px solid rgba(10, 83, 130, 0.10);
  transform: rotate(-3deg);
  pointer-events: none;
}

.back {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
  border: 1px solid #c9d9e8;
  border-radius: 999px;
  background: #fff;
  color: var(--cyan);
  text-decoration: none;
  font-weight: 700;
  padding: 7px 12px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.25;
  text-wrap: balance;
}

.hero p {
  margin: 0;
  max-width: 920px;
  color: var(--muted);
  line-height: 1.65;
  text-wrap: pretty;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid #c9d9e8;
  border-radius: 10px;
  background: #fff;
  color: #274866;
  padding: 9px 14px;
  box-shadow: 0 8px 18px rgba(16, 42, 67, 0.05);
}

.mono,
.pid {
  font-family:var(--font-app);
  font-variant-numeric: tabular-nums;
}

.section {
  margin-top: 24px;
}

.cad-import-entrance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #c7ddeb;
  border-left: 6px solid #6a1b9a;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.86), rgba(255, 255, 255, 0.98) 58%),
    #fff;
  padding: 18px 20px;
  box-shadow: 0 16px 34px rgba(16, 42, 67, 0.06);
}

.cad-import-entrance h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.35;
}

.cad-import-entrance p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.cad-import-link {
  flex: 0 0 auto;
  border: 1px solid var(--cyan);
  border-radius: 10px;
  background: var(--cyan);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  padding: 9px 14px;
}

.region-panel {
  border: 1px solid #c7ddeb;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.78), rgba(255, 255, 255, 0.98) 48%),
    #fff;
  padding: 18px;
  box-shadow: 0 16px 34px rgba(16, 42, 67, 0.06);
}

.region-picker {
  display: grid;
  grid-template-columns: auto minmax(260px, 420px) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.region-picker label {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.region-picker select {
  min-height: 38px;
  border: 1px solid #c7ddeb;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 7px 12px;
  font: 700 14px var(--font-app);
}

.region-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.region-status::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}

.region-status.is-configured {
  color: var(--done);
  background: rgba(46, 125, 50, 0.10);
}

.region-status.is-pending {
  color: #b45309;
  background: #fffbeb;
}

.region-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(16, 42, 67, 0.08);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.region-summary b,
.region-summary span,
.region-summary em {
  display: block;
}

.region-summary b {
  font-size: 18px;
  line-height: 1.35;
}

.region-summary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.region-summary em {
  flex: 0 0 auto;
  border: 1px solid #c7ddeb;
  border-radius: 999px;
  background: #fff;
  color: var(--cyan);
  padding: 7px 11px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.region-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr;
  gap: 12px;
}

.region-grid section,
.region-method {
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.region-grid h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.region-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.region-methods {
  display: grid;
  gap: 8px;
}

.region-method strong {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 13px;
}

.region-method span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.region-notices {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  border-left: 6px solid #f59e0b;
  border-radius: 12px;
  background: #fffbeb;
  padding: 10px 12px;
}

.region-notices p {
  margin: 0;
  color: #78350f;
  font-size: 12px;
  line-height: 1.65;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(16, 42, 67, 0.08);
  padding-bottom: 10px;
}

.section h2 {
  margin: 0;
  font-size: 18px;
}

.section-title p {
  margin: 0;
  color: var(--weak);
  font-size: 13px;
}

.flow {
  display: grid;
  gap: 20px;
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.30fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.stage:not(:last-child)::after {
  content: "↓";
  position: absolute;
  left: 128px;
  bottom: -20px;
  color: var(--cyan);
  opacity: 0.55;
  font: 700 18px var(--font-app);
}

.stage-head {
  border: 1px solid var(--line);
  border-left: 6px solid var(--module-color, #0a5382);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.72), rgba(255, 255, 255, 0.98) 58%),
    #fff;
  padding: 18px;
  box-shadow: 0 12px 26px rgba(16, 42, 67, 0.05);
}

.stage-head h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.35;
}

.stage-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

/* The catalog intentionally has one independent calculation per row. */
.program-grid.program-catalog {
  grid-template-columns: minmax(0, 1fr);
}

.program-catalog .program {
  min-height: 82px;
}

.program {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  padding: 14px;
  box-shadow: 0 12px 26px rgba(16, 42, 67, 0.055);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.program:hover {
  border-color: var(--cyan);
  box-shadow: 0 16px 34px rgba(16, 42, 67, 0.09);
  transform: translateY(-2px);
}

.program.is-blocked {
  background: #f7f9fb;
  color: #64748b;
  pointer-events: none;
}

.program.is-done {
  border-color: rgba(46, 125, 50, 0.35);
}

.program.is-ready {
  border-color: rgba(21, 101, 192, 0.30);
}

.pid {
  color: var(--cyan);
  font-weight: 700;
}

.program strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.program .brief {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.program .need {
  display: block;
  margin-top: 5px;
  color: #6f8399;
  font-size: 12px;
  line-height: 1.45;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 66px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.is-done .status {
  color: var(--done);
  background: rgba(46, 125, 50, 0.10);
}

.is-ready .status {
  color: var(--ready);
  background: rgba(21, 101, 192, 0.10);
}

.is-blocked .status {
  color: #78909c;
  background: #edf2f7;
}

.chain {
  border: 1px dashed #9bb6cd;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.70), rgba(255, 255, 255, 0.92)),
    #fff;
  color: var(--cyan);
  padding: 18px 20px;
  font-family:var(--font-app);
  line-height: 1.7;
}

.empty {
  border: 1px dashed #9bb6cd;
  border-radius: 16px;
  background: #fff;
  color: var(--muted);
  padding: 24px;
}

@media (max-width: 1280px) {
  .program-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1040px) {
  .stage { grid-template-columns: 1fr; }
  .stage:not(:last-child)::after { left: 24px; }
  .program-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-grid { grid-template-columns: 1fr; }
  .region-picker { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  body { min-width: 0; }
  .program-grid { grid-template-columns: 1fr; }
  .page { max-width: calc(100vw - 28px); padding: 18px 0 44px; }
}

@media (max-width: 720px) {
  .page { max-width: calc(100vw - 24px); padding: 14px 0 36px; }
  .hero { padding: 18px; }
}
