:root {
  --brand: #08705c;
  --brand-dark: #064f42;
  --brand-soft: #e5f6f1;
  --ink: #14231f;
  --muted: #5d6d68;
  --line: #d7e2de;
  --paper: #ffffff;
  --surface: #f3f7f5;
  --red: #c63f3f;
  --red-soft: #fff0f0;
  --violet: #6549b8;
  --shadow: 0 20px 60px rgba(12, 52, 43, .12);
}

html { background: var(--surface); }
body { min-height: 100dvh; background: linear-gradient(180deg, #edf6f3 0, #f7f9f8 420px); }
a { color: inherit; }
.app-header { position: sticky; top: 0; z-index: 50; height: auto; min-height: 66px; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.header-inner { width: min(1040px, calc(100% - 32px)); min-height: 66px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; font-size: 18px; font-weight: 900; transform: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.brand div { gap: 2px; }
.brand strong { font-size: 1rem; }
.brand span:last-child { display: block; color: var(--muted); font-size: .78rem; }
.privacy { background: var(--brand-soft); border: 1px solid #bfe2d7; color: var(--brand-dark); border-radius: 999px; padding: 7px 11px; font-weight: 750; }
.privacy i { width: 8px; height: 8px; box-shadow: none; }

.shell { width: min(1040px, calc(100% - 32px)); padding: 30px 0 54px; }
.intro { align-items: center; margin: 0 2px 20px; }
.intro h1 { max-width: 690px; font-size: clamp(1.7rem, 4vw, 2.65rem); }
.intro > p { max-width: 360px; }

.workspace { display: block; min-height: 0; overflow: visible; border-radius: 24px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 0; background: #0c3f35; border-radius: 23px 23px 0 0; overflow: hidden; }
.step { min-width: 0; min-height: 84px; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; align-content: center; border-radius: 0; padding: 14px 20px; border-right: 1px solid rgba(255,255,255,.12); }
.step:last-child { border-right: 0; }
.step span { width: 34px; height: 34px; border-radius: 50%; }
.step.active { background: var(--brand); color: #fff; }
.step.active b, .step.active small { color: #fff; }
.step.active span { background: #fff; color: var(--brand-dark); border-color: #fff; }
.stage { padding: clamp(24px, 5vw, 46px); }
.panel-heading { margin-bottom: 24px; }
.panel-heading h2 { max-width: 720px; margin-bottom: 7px; }
.panel-heading p:last-child { font-size: .95rem; }

.drop-zone { min-height: 230px; border-width: 2px; border-color: #8eb9ad; background: linear-gradient(145deg, #f8fcfb, #edf8f4); }
.drop-zone strong { font-size: 1.15rem; }
.drop-zone small { font-size: .9rem; }
.drop-zone.reading { opacity: .7; pointer-events: none; }
.drop-zone.reading .upload-icon { animation: pulse 1s infinite alternate; }
.upload-icon { border-radius: 50%; font-size: 30px; }
.file-card { background: #f9fbfa; padding: 15px; }
.file-summary { margin: 10px 0 0; padding: 11px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 750; }
.single-action { justify-content: flex-end; }
.button-large { min-height: 50px; padding-inline: 22px; }

.form-section { border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-top: 14px; background: #fbfcfc; }
.form-section h3 { margin: 0 0 14px; font-size: .92rem; color: var(--brand-dark); }
.form-grid { gap: 14px; }
.form-grid input { font-size: 16px; }
.address-grid { grid-template-columns: 2fr 1fr 1fr 2fr; }
.check-card { justify-content: flex-start; }
.check-card .check-mark { order: -1; }
.conversion-progress { margin-top: 16px; padding: 14px; border-radius: 12px; background: #eef7f4; display: flex; align-items: center; gap: 11px; color: var(--brand-dark); }
.conversion-progress span { width: 22px; height: 22px; flex: none; border: 3px solid #b7d8cf; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { to { transform: scale(1.08); } }

.result-hero { display: flex; align-items: center; gap: 18px; padding: 18px; margin-bottom: 16px; border: 1px solid #bee3d8; border-radius: 16px; background: linear-gradient(135deg, #eefaf6, #fff); }
.result-hero h2 { margin: 3px 0; font-size: 1.55rem; }
.result-hero p:last-child { margin: 0; color: var(--muted); }
.result-badge { flex: none; }
.metric-grid { margin-bottom: 16px; }
.metric { background: #fff; }
.primary-result-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; margin-top: 18px; }
.plan-button, .xml-save-button { min-height: 86px; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 14px 16px; text-align: left; text-decoration: none; border-radius: 15px; }
.plan-button { background: var(--brand); color: #fff; }
.xml-save-button { background: #0f2f28; color: #fff; }
.plan-button > span, .xml-save-button > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.16); font-size: 1rem; font-weight: 900; }
.plan-button div, .xml-save-button div { min-width: 0; }
.plan-button strong, .plan-button small, .xml-save-button strong, .xml-save-button small { display: block; }
.plan-button strong, .xml-save-button strong { font-size: .96rem; }
.plan-button small, .xml-save-button small { margin-top: 4px; color: #d9eee8; line-height: 1.35; }
.plan-button b, .xml-save-button b { font-size: 1.3rem; }
.more-files { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.more-files summary { cursor: pointer; padding: 14px 16px; color: var(--brand-dark); font-weight: 800; }
.more-files .downloads { margin: 0; padding: 0 14px 14px; }
.download-card { text-decoration: none; }

.save-dialog { border: 0; padding: 0; width: min(650px, calc(100% - 24px)); border-radius: 20px; max-height: 90dvh; }
.save-dialog::backdrop { background: rgba(7, 25, 21, .72); }
.save-sheet { padding: 22px; overflow: auto; max-height: 90dvh; }
.save-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.save-head h2 { margin: 4px 0 8px; }
.save-hint { margin: 6px 0 16px; color: var(--muted); line-height: 1.5; }
.save-links { display: grid; gap: 9px; }
.save-file-link { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 70px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); text-decoration: none; background: #f9fbfa; }
.save-file-link:hover, .save-file-link:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.save-file-link > span { display: grid; place-items: center; height: 42px; border-radius: 10px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 900; }
.save-file-link strong, .save-file-link small { display: block; overflow: hidden; text-overflow: ellipsis; }
.save-file-link strong { white-space: nowrap; }
.save-file-link small { margin-top: 3px; color: var(--muted); }
.save-file-link b { font-size: 1.2rem; color: var(--brand); }
.save-footer { display: flex; justify-content: flex-end; margin-top: 16px; }

.map-header a.button { display: inline-flex; align-items: center; text-decoration: none; }
.map-manhole-hit, .map-hit { touch-action: manipulation; }
.line-row { min-height: 56px; }
.line-row input { width: 24px; height: 24px; }
.dn-chip { min-height: 40px; font-weight: 750; }
.selection-card { position: sticky; top: 0; z-index: 2; }

.startup-version-card small { color: var(--muted); }

@media (max-width: 850px) {
  .header-inner { width: min(100% - 22px, 720px); }
  .shell { width: min(100% - 20px, 720px); padding-top: 20px; }
  .intro { margin-bottom: 16px; }
  .workspace { border-radius: 18px; }
  .steps { border-radius: 17px 17px 0 0; }
  .step { min-width: 0; padding: 11px 10px; grid-template-columns: 36px 1fr; }
  .address-grid { grid-template-columns: 1fr 1fr; }
  .street-field { grid-column: 1 / -1; }
  .primary-result-actions { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .app-header { min-height: 62px; }
  .header-inner { min-height: 62px; width: calc(100% - 20px); }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: .94rem; }
  .brand span:last-child { display: block; font-size: .72rem; }
  .privacy { display: none; }
  .header-actions .button { min-height: 40px; padding: 7px 9px; font-size: .76rem; }
  .shell { width: 100%; padding: 14px 8px 28px; }
  .intro { padding: 0 7px; }
  .intro h1 { font-size: 1.55rem; letter-spacing: -.035em; }
  .intro > p { margin-top: 9px; font-size: .9rem; }
  .workspace { border-radius: 16px; }
  .steps { position: sticky; top: 62px; z-index: 20; border-radius: 15px 15px 0 0; }
  .step { min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 7px 3px; text-align: center; }
  .step span { width: 28px; height: 28px; font-size: .75rem; }
  .step b { font-size: .75rem; }
  .step small { display: none; }
  .stage { padding: 20px 13px; }
  .panel-heading { margin-bottom: 18px; }
  .panel-heading h2 { font-size: 1.35rem; }
  .panel-heading p:last-child { font-size: .88rem; }
  .format-pill { margin-top: 9px; }
  .drop-zone { min-height: 190px; padding: 22px 16px; }
  .drop-zone small { font-size: .82rem; }
  .file-card { padding: 11px; }
  .file-card strong { font-size: .9rem; }
  .file-summary { font-size: .86rem; }
  .footer-actions { position: static; margin-top: 20px; }
  .footer-actions .button { flex: 1; }
  .single-action .button { width: 100%; }
  .form-section { padding: 14px; }
  .form-grid, .address-grid { grid-template-columns: 1fr; }
  .street-field { grid-column: auto; }
  .check-card { align-items: flex-start; padding: 13px; }
  .result-hero { align-items: flex-start; padding: 14px; }
  .result-badge { width: 52px; height: 52px; font-size: 1.4rem; }
  .result-hero h2 { font-size: 1.3rem; }
  .metric-grid { gap: 8px; }
  .metric { padding: 11px; }
  .metric strong { font-size: 1.08rem; }
  .plan-button, .xml-save-button { min-height: 82px; padding: 12px; grid-template-columns: 42px minmax(0,1fr) auto; }
  .plan-button > span, .xml-save-button > span { width: 40px; height: 40px; }
  .plan-button small, .xml-save-button small { font-size: .76rem; }
  .downloads { grid-template-columns: 1fr; }
  .compatibility { padding: 0 8px; }
  .save-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 88dvh; }
  .save-sheet { padding: 18px 14px max(18px, env(safe-area-inset-bottom)); max-height: 88dvh; }
  .save-file-link { grid-template-columns: 42px minmax(0,1fr) auto; min-height: 68px; }
  .save-file-link > span { height: 40px; }
  .save-file-link small { font-size: .73rem; }
  .save-footer .button { width: 100%; }
  .map-header { align-items: flex-start; flex-wrap: wrap; }
  .map-header > div:last-child { width: 100%; display: grid; grid-template-columns: 1fr 1fr auto; }
  .map-header .button { justify-content: center; text-align: center; min-height: 44px; }
  .map-header .icon-button { width: 44px; height: 44px; }
  .map-layout { grid-template-rows: 48dvh auto; }
  .map-sidebar { max-height: 46dvh; }
  .map-canvas { min-width: 560px; }
}

@media (prefers-reduced-motion: reduce) {
  .conversion-progress span, .drop-zone.reading .upload-icon { animation: none; }
}
