.template-page {
  --template-panel-muted: #f4f8fd;
}

.template-workspace {
  grid-template-columns: minmax(0, 0.86fr) minmax(560px, 1.14fr);
}

.template-tool {
  min-height: 700px;
}

.template-state {
  padding-bottom: 34px;
}

.template-step-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 5px;
  color: var(--orange-deep);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.template-mode-field {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.template-mode-field legend {
  margin-bottom: 9px;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

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

.template-mode-option {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 66px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease,
    transform 150ms ease;
}

.template-mode-option:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.template-mode-option.selected {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.06);
}

.template-mode-option:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

.template-mode-option > svg {
  width: 21px;
  height: 21px;
  color: var(--blue);
}

.template-mode-option span:nth-child(2) {
  min-width: 0;
}

.template-mode-option strong,
.template-mode-option small {
  display: block;
}

.template-mode-option strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.template-mode-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.template-radio {
  width: 15px;
  height: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.template-mode-option.selected .template-radio {
  background: var(--blue);
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--blue);
}

.school-template-panel {
  margin-bottom: 18px;
}

.template-select-field {
  display: block;
}

.template-select-field > span {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.template-select-field > span svg {
  width: 16px;
  height: 16px;
  color: var(--orange);
}

.template-select-wrap {
  position: relative;
}

.template-select-wrap select {
  width: 100%;
  min-height: 48px;
  padding: 9px 42px 9px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.template-select-wrap select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.template-select-wrap > svg {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.template-select-field > small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.template-file-section + .template-file-section {
  margin-top: 17px;
}

.template-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.template-section-heading > span {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.template-section-heading > small {
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
}

.template-dropzone {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 96px;
  padding: 17px 18px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.035), transparent 56%),
    var(--surface);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease,
    box-shadow 180ms ease;
}

.template-dropzone:hover,
.template-dropzone:focus-visible,
.template-dropzone.dragging {
  outline: none;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 58%),
    var(--surface);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 3px rgba(37, 99, 235, 0.04);
}

.template-upload-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 50%;
}

.template-upload-icon svg {
  width: 21px;
  height: 21px;
}

.template-dropzone > div {
  min-width: 0;
}

.template-dropzone h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.template-dropzone p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.template-upload-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 12px;
  color: #ffffff;
  background: var(--orange);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.secondary-upload-action {
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid rgba(37, 99, 235, 0.18);
}

.template-upload-action svg {
  width: 15px;
  height: 15px;
}

.template-dropzone-compact {
  min-height: 84px;
  padding-block: 13px;
}

.template-selected-file {
  margin-top: 9px;
}

.template-file-error {
  padding: 8px 10px;
  background: var(--danger-soft);
  border: 1px solid rgba(196, 61, 61, 0.18);
  border-radius: 6px;
}

.template-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 17px;
  padding: 12px 14px;
  background: rgba(37, 99, 235, 0.04);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.template-price-copy span,
.template-price-copy small {
  display: block;
}

.template-price-copy span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.template-price-copy small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}

.template-price-row > strong {
  color: var(--orange-deep);
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.template-price-row > strong small {
  margin-left: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.template-payment-field {
  margin-top: 15px;
}

.template-submit-button {
  margin-top: 14px;
}

.template-retention-note {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
  text-align: center;
}

.template-retention-note svg {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: var(--blue);
  flex: none;
}

.template-price-summary strong {
  color: var(--orange-deep);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.template-order-panel {
  border-top-color: var(--orange);
}

.template-order-progress [data-order-step="process"] svg {
  padding: 8px;
}

.template-payment-stage {
  margin-bottom: 12px;
}

.template-evidence-block {
  margin-bottom: 12px;
}

.template-order-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 15px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.template-order-action strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.template-order-action p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.template-result-stage {
  margin-top: 12px;
}

.template-order-summary .secondary-button {
  min-height: 42px;
}

.template-lookup-panel {
  border-top-color: var(--orange);
}

.template-lookup-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.template-lookup-meta span {
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--line-subtle);
  border-radius: 6px;
}

.template-lookup-meta strong {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-lookup-result .lookup-file-card {
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

.template-notes,
.template-faq {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.template-notes {
  padding: clamp(42px, 6vw, 62px) 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.template-notes-heading {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(380px, 1.22fr);
  gap: 5px 46px;
  align-items: end;
  margin-bottom: 25px;
}

.template-notes-heading .section-kicker {
  grid-column: 1 / -1;
}

.template-notes-heading h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display-cn);
  font-size: clamp(25px, 3vw, 33px);
  font-weight: 650;
  line-height: 1.32;
}

.template-notes-heading p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.75;
}

.template-notes-heading.compact {
  display: block;
  margin-bottom: 16px;
}

.template-notes-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.template-notes-grid article {
  position: relative;
  min-height: 185px;
  padding: 22px 19px 18px 0;
  border-right: 1px solid var(--line);
}

.template-notes-grid article:not(:first-child) {
  padding-left: 19px;
}

.template-notes-grid article:last-child {
  border-right: 0;
}

.template-notes-grid article > span {
  position: absolute;
  top: 20px;
  right: 15px;
  color: #c2cee0;
  font-family: Georgia, serif;
  font-size: 22px;
}

.template-notes-grid article > svg {
  width: 26px;
  height: 26px;
  margin-bottom: 23px;
  color: var(--blue);
}

.template-notes-grid h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.template-notes-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.template-faq {
  padding: clamp(38px, 5vw, 56px) 0 clamp(54px, 7vw, 76px);
}

@media (max-width: 980px) {
  .template-workspace {
    display: flex;
    width: min(760px, calc(100% - 40px));
  }

  .template-intro {
    order: 2;
  }

  .template-tool {
    order: 1;
  }

  .template-order-panel,
  .template-lookup-panel,
  .template-notes,
  .template-faq {
    width: min(760px, calc(100% - 40px));
  }

  .template-lookup-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .template-notes-grid article:nth-child(2) {
    border-right: 0;
  }

  .template-notes-grid article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 700px) {
  .template-header .site-nav {
    gap: 3px;
  }

  .template-workspace {
    width: calc(100% - 24px);
  }

  .template-order-panel,
  .template-lookup-panel,
  .template-notes,
  .template-faq {
    width: calc(100% - 24px);
  }

  .template-mode-option {
    grid-template-columns: 30px minmax(0, 1fr) 15px;
    min-height: 64px;
    padding-inline: 9px;
  }

  .template-dropzone {
    grid-template-columns: 43px minmax(0, 1fr);
    gap: 12px;
    padding: 15px 13px;
  }

  .template-upload-icon {
    width: 43px;
    height: 43px;
  }

  .template-upload-action {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 42px;
  }

  .template-section-heading {
    align-items: flex-start;
  }

  .template-section-heading > small {
    max-width: 16ch;
  }

  .template-price-row {
    padding-inline: 12px;
  }

  .template-order-action {
    align-items: stretch;
    flex-direction: column;
  }

  .template-order-action .secondary-button {
    width: 100%;
  }

  .template-evidence-block {
    grid-template-columns: 1fr;
  }

  .template-lookup-meta {
    grid-template-columns: 1fr;
  }

  .template-notes-heading {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .template-notes-heading .section-kicker {
    grid-column: auto;
  }

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

  .template-notes-grid article,
  .template-notes-grid article:not(:first-child) {
    min-height: 0;
    padding: 19px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .template-notes-grid article:last-child {
    border-bottom: 0;
  }

  .template-notes-grid article > svg {
    margin-bottom: 13px;
  }

  .template-notes-grid article > span {
    top: 17px;
  }
}

@media (max-width: 440px) {
  .template-mode-switch {
    grid-template-columns: 1fr;
  }

  .template-mode-option {
    min-height: 58px;
  }

  .template-dropzone {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .template-upload-icon {
    width: 40px;
    height: 40px;
  }

  .template-dropzone h3 {
    font-size: 13px;
  }

  .template-price-row {
    align-items: flex-start;
  }

  .template-price-row > strong {
    font-size: 18px;
  }

  .template-lookup-result .lookup-file-card {
    grid-template-columns: 40px minmax(0, 1fr);
  }
}

@media (min-width: 1200px) {
  .template-workspace {
    max-width: 1500px;
    grid-template-columns: minmax(260px, 0.55fr) minmax(0, 1fr);
    gap: 32px;
    padding-top: 28px;
  }

  .template-file-grid:has(#customTemplateSection:not([hidden])) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .template-file-grid .template-file-section + .template-file-section {
    margin-top: 0;
  }

  .template-dropzone {
    min-height: 120px;
  }
}
