:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #eef4f8;
    --text: #17212b;
    --muted: #64707d;
    --border: #dce4ea;
    --accent: #0b7a75;
    --accent-dark: #075f5b;
    --danger-bg: #fff1f0;
    --danger: #b42318;
    --shadow: 0 16px 40px rgba(25, 42, 62, .08);
    --radius: 8px;
    --value-font-size: 24px;
    --value-font-weight: 800;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

h1 {
    margin: 0 0 12px;
    width: 100%;
    max-width: none;
    font-size: clamp(19px, 2.8vw, 33px);
    line-height: 1.08;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header-wrap,
.site-footer-wrap {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header-wrap,
.site-footer-wrap {
    margin-top: 6px;
    margin-bottom: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.site-header {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 10px 13px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent);
    color: white;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.header-route-search {
    position: relative;
    flex: 1 1 420px;
    max-width: 560px;
}

.header-route-search label {
    display: block;
}

.header-route-search input {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 7px;
}

.header-route-suggestions {
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 18px 36px rgba(25, 42, 62, .16);
}

.header-route-suggestion,
.header-route-empty {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid #edf2f5;
    background: transparent;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    text-align: left;
}

.header-route-suggestion:hover,
.header-route-suggestion:focus {
    background: #f4f8fa;
    outline: none;
}

.header-route-suggestion strong,
.header-route-empty strong {
    font-weight: 650;
}

.header-route-suggestion span,
.header-route-empty span {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.header-route-empty {
    display: grid;
    gap: 2px;
}

.header-route-empty a {
    color: var(--accent-dark);
    font-weight: 650;
}

.top-nav {
    display: flex;
    gap: 18px;
    color: var(--muted);
    font-size: 14px;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto 7px;
}

.hero-band,
.content-band,
.message-page,
.admin-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-band {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 16px;
}

.hero-copy p {
    width: 100%;
    max-width: none;
    color: var(--muted);
    font-size: 18px;
}

.hero-form-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.hero-form-panel .hero-copy {
    margin-bottom: 16px;
}

.hero-form-panel .hero-copy p {
    margin-bottom: 0;
    font-size: 16px;
}

.route-form,
.fuel-form {
    display: grid;
    gap: 14px;
}

.hero-form-panel .route-form {
    grid-template-columns: minmax(170px, 1.25fr) minmax(170px, 1.25fr) minmax(118px, .72fr) minmax(118px, .72fr) 46px minmax(180px, .9fr);
    align-items: end;
}

.hero-form-panel .route-form .advanced-options {
    grid-column: 1 / -1;
}

.hero-form-panel .route-form .primary-button {
    width: 100%;
    align-self: end;
}

.hero-form-panel .route-form .route-clear-button {
    align-self: end;
}

.route-form label,
.fuel-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

input {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cfd9e0;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}

input::placeholder {
    color: rgba(100, 112, 125, .32);
    opacity: 1;
}

select {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cfd9e0;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}

textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid #cfd9e0;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    resize: vertical;
}

input:focus {
    outline: 3px solid rgba(11, 122, 117, .16);
    border-color: var(--accent);
}

.city-field {
    position: relative;
}

.city-suggestions {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: grid;
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    padding: 0;
    box-shadow: 0 14px 34px rgba(23, 33, 43, .16);
}

.city-suggestions[hidden] {
    display: none;
}

.city-suggestion {
    display: block;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #edf2f5;
    border-radius: 0;
    background: transparent;
    padding: 12px 14px;
    color: var(--text);
    text-align: left;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.35;
    cursor: pointer;
}

.city-suggestion:last-child {
    border-bottom: 0;
}

.city-suggestion:hover,
.city-suggestion:focus {
    outline: none;
    background: #f8fafb;
}

.city-suggestion__line {
    color: var(--text);
}

.city-suggestion-empty {
    padding: 12px;
    color: var(--muted);
    font-size: 14px;
}

.via-city-field {
    position: relative;
}

.via-city-picker {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 8px;
    border: 1px solid #cfd9e0;
    border-radius: 7px;
    background: #fff;
    padding: 6px 10px;
}

.via-city-picker:focus-within {
    outline: 3px solid rgba(11, 122, 117, .16);
    border-color: var(--accent);
}

.via-city-picker input {
    min-height: 32px;
    flex: 1 1 180px;
    border: 0;
    border-radius: 0;
    padding: 0;
    outline: 0;
}

.via-city-picker input:focus {
    outline: 0;
}

.via-city-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.via-city-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    border: 1px solid rgba(11, 122, 117, .22);
    border-radius: 7px;
    background: #eef7f6;
    color: var(--accent-dark);
    padding: 0 7px 0 10px;
    font-size: 13px;
    font-weight: 750;
}

.via-city-tag button {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--accent-dark);
    cursor: pointer;
    font: inherit;
    line-height: 1;
}


textarea:focus,
select:focus {
    outline: 3px solid rgba(11, 122, 117, .16);
    border-color: var(--accent);
}

.primary-button,
.secondary-button,
.danger-button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    padding: 0 18px;
    font-weight: 750;
    cursor: pointer;
}

.primary-button {
    background: var(--accent);
    color: #fff;
}

.primary-button:hover {
    background: var(--accent-dark);
}

.secondary-button {
    background: #e4efef;
    color: var(--accent-dark);
}

.secondary-button.active {
    background: var(--accent);
    color: #fff;
}

.danger-button {
    min-height: 36px;
    background: var(--danger-bg);
    color: var(--danger);
}

.inline {
    width: fit-content;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
}

.advanced-options {
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    padding: 10px 12px;
}

.advanced-options summary {
    cursor: pointer;
    color: var(--accent-dark);
    font-weight: 750;
}

.advanced-options[open] {
    display: grid;
    gap: 12px;
}

.advanced-options[open] summary {
    margin-bottom: 2px;
}

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

.checkbox-grid label {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 500;
}

.checkbox-grid input {
    width: 18px;
    min-height: 18px;
}

.route-variant-note {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.route-variant-note span {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    padding: 5px 10px;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 750;
}

.notice {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #7fbfba;
    border-radius: 7px;
    background: #e4f5f2;
    color: var(--accent-dark);
    font-weight: 650;
}

.notice.error {
    background: var(--danger-bg);
    color: var(--danger);
}

.route-form-notice {
    grid-column: 1 / -1;
    margin: 0;
}

.admin-toast {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1000;
    width: min(420px, calc(100vw - 36px));
    border: 1px solid rgba(7, 95, 91, .28);
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(25, 42, 62, .18);
    padding: 13px 16px;
    background: #e4f5f2;
    color: var(--accent-dark);
    font-weight: 650;
    line-height: 1.35;
    opacity: 1;
    transform: translateY(0);
    transition: opacity .22s ease, transform .22s ease;
}

.admin-toast-error {
    border-color: rgba(180, 35, 24, .24);
    background: var(--danger-bg);
    color: var(--danger);
}

.admin-toast.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

.content-band,
.message-page {
    margin-top: 12px;
    padding: 16px;
}

.route-description-band {
    position: relative;
}

.route-description-preview {
    position: relative;
    max-height: 196px;
    overflow: hidden;
}

.route-description-preview::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 42px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff);
    pointer-events: none;
}

.route-description-band.is-expanded .route-description-preview {
    max-height: none;
}

.route-description-band.is-expanded .route-description-preview::after {
    display: none;
}

.route-description-preview.is-not-clipped::after {
    display: none;
}

.text-expand-button {
    margin-top: 10px;
    margin-inline: auto;
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    display: block;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.section-heading h2,
.content-band h2,
.route-side h2,
.admin-panel h2 {
    margin: 0 0 12px;
    font-size: 24px;
}

.heading-page-label {
    display: inline-block;
    margin-left: 8px;
    color: var(--muted);
    font-size: 16px;
    font-weight: 500;
}

.section-heading p,
.content-band p,
.message-page p,
.side-block p {
    color: var(--muted);
}

.route-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 9px;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 9px;
}

.directory-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.directory-facts-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 9px;
    align-items: stretch;
}

.directory-card {
    display: grid;
    gap: 4px;
    min-height: 64px;
    align-content: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    padding: 12px 14px;
}

a.directory-card:hover {
    border-color: var(--accent);
}

.directory-card strong {
    font-weight: 750;
}

.directory-card span {
    color: var(--muted);
    font-size: 13px;
}

.directory-facts-grid .directory-card.wide {
    grid-column: span 2;
    align-content: start;
}

.route-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 54px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
}

.route-row:hover {
    border-color: var(--accent);
}

.empty-state {
    margin-top: 9px;
    border: 1px dashed #bdc8d1;
    border-radius: 7px;
    padding: 16px;
    color: var(--muted);
}

.info-grid,
.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin-top: 12px;
}

.info-grid article {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.info-grid h2 {
    margin: 0 0 10px;
    font-size: 20px;
}

.info-grid p {
    margin: 0;
    color: var(--muted);
}

.breadcrumbs {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.route-breadcrumbs {
    margin-bottom: 8px;
}

.breadcrumbs > * + *::before {
    content: "/";
    margin-right: 8px;
    color: #9aa6b2;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 26px;
}

.route-summary {
    padding: 12px 8px 0;
}

.metric-inline-label {
    white-space: nowrap;
}

.route-layout > .route-main:only-child {
    grid-column: 1 / -1;
}

.route-tools {
    padding: 14px 8px 18px;
}

.route-tool-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.route-tool-actions .secondary-button,
.route-tool-actions .danger-button {
    min-height: 36px;
    padding: 0 18px;
    text-decoration: none;
}

.route-tool-panel {
    margin-top: 12px;
    margin-bottom: 0;
}

.route-tool-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.route-report-form {
    display: grid;
    gap: 12px;
}

.route-report-form textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
}

.metrics-grid.compact {
    gap: 10px;
    margin-top: 0;
}

.metric {
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 16px;
    display: grid;
    align-content: start;
}

.metrics-grid.compact .metric {
    padding: 10px 12px;
    min-height: 74px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: var(--value-font-size);
    font-weight: var(--value-font-weight);
    line-height: 1.15;
    color: var(--text);
}

.metrics-grid.compact .metric strong {
    margin-top: 3px;
    font-size: var(--value-font-size);
    font-weight: var(--value-font-weight);
}

.metric strong.price-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    width: max-content;
    max-width: 100%;
}

.metric strong.price-line span {
    display: inline;
    flex: 0 0 auto;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.metric-price {
    min-width: 130px;
}

.route-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 12px;
    margin-top: 12px;
}

.route-main,
.route-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.route-main {
    padding: 12px;
}

.route-side {
    padding: 16px;
}

.map {
    min-height: 520px;
    border-radius: 7px;
    overflow: hidden;
    background: #dfe8ed;
}

.map-error {
    min-height: 520px;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--danger);
    background: var(--danger-bg);
    text-align: center;
    font-weight: 650;
}

.print-link-row {
    margin-top: 14px;
}

.print-link-row .secondary-button {
    width: fit-content;
}

.pdf-download-button.is-preparing {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0f8f52;
    border-color: #0f8f52;
    color: #fff;
    pointer-events: none;
}

.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.loading-dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: .35;
    animation: loading-dot 1s infinite ease-in-out;
}

.loading-dots i:nth-child(2) {
    animation-delay: .15s;
}

.loading-dots i:nth-child(3) {
    animation-delay: .3s;
}

@keyframes loading-dot {
    0%, 80%, 100% {
        opacity: .35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.pdf-document-meta {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
    color: #111;
    font-size: 13px;
    line-height: 1.3;
}

.pdf-document-meta strong {
    font-weight: 750;
}

.print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 18px;
}

.print-head p {
    margin: 0;
    color: var(--muted);
}

.print-metrics {
    margin-bottom: 18px;
}

.print-map {
    min-height: 420px;
    margin-bottom: 18px;
}

.static-print-map {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 7px;
    margin-bottom: 18px;
}

.print-roadmap {
    width: 100%;
    border-collapse: collapse;
}

.print-roadmap th,
.print-roadmap td {
    border-bottom: 1px solid var(--border);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.print-roadmap th {
    color: var(--muted);
    font-size: 13px;
}

.print-roadmap span {
    color: var(--muted);
}

.pdf-document-source {
    margin-top: 24px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--text);
    font-size: 17px;
    line-height: 1.35;
    break-inside: avoid;
    page-break-inside: avoid;
}

.pdf-document-source strong,
.pdf-document-source span {
    display: block;
}

.pdf-document-source span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.route-place-marker {
    width: 28px;
    height: 38px;
    border: 0;
    background: transparent;
}

.route-place-marker i {
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: #e85d4f;
    box-shadow: 0 3px 10px rgba(23, 33, 43, .24);
    color: #fff;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    line-height: 1;
    transform: rotate(-45deg);
}

.route-place-marker i span {
    position: relative;
    z-index: 1;
    display: block;
    transform: rotate(45deg);
}

.route-place-tooltip {
    border: 1px solid var(--border);
    border-radius: 7px;
    box-shadow: 0 8px 20px rgba(23, 33, 43, .16);
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
}

.route-place-tooltip span {
    color: var(--muted);
}

.side-block {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.route-points {
    padding: 9px 8px 4px;
}

.section-heading.compact {
    display: block;
}

.section-heading.compact h2 {
    margin: 0 0 4px;
    white-space: nowrap;
}

.section-heading.compact p {
    margin: 0 0 6px;
    font-size: 14px;
    white-space: nowrap;
}

.route-instructions .section-heading.compact {
    display: block;
}

.route-instructions .section-heading.compact h2,
.route-instructions .section-heading.compact p {
    display: block;
    white-space: nowrap;
}

.route-roadmap,
.instruction-list {
    display: grid;
    gap: 4px;
}

.roadmap-row {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(170px, 1fr) repeat(4, minmax(92px, .55fr));
    column-gap: 12px;
    row-gap: 4px;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
}

.roadmap-row::before {
    content: "";
    position: absolute;
    left: 25px;
    top: 0;
    bottom: -11px;
    width: 2px;
    background: #e85d4f;
    transform: translateX(-50%);
}

.roadmap-row:first-child::before {
    top: 26px;
}

.roadmap-row:last-child::before {
    bottom: calc(100% - 26px);
}

.roadmap-marker {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e85d4f;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.roadmap-place strong,
.roadmap-place span,
.roadmap-data span,
.roadmap-data strong,
.roadmap-note span {
    display: block;
}

.roadmap-place span,
.roadmap-data span,
.roadmap-note {
    color: var(--muted);
    font-size: 13px;
}

.roadmap-data strong {
    font-size: 15px;
}

.roadmap-note {
    grid-column: 2 / -1;
    padding-top: 0;
}

.roadmap-note span {
    display: inline-flex;
    margin-left: 8px;
    color: var(--accent-dark);
    font-weight: 650;
}

.instruction-row {
    display: grid;
    grid-template-columns: 30px minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
}

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

.extra-card {
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    padding: 12px;
}

.extra-card h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.extra-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 76px 48px;
    gap: 10px;
    align-items: baseline;
    padding: 7px 0;
    border-top: 1px solid #eef3f5;
}

.extra-row:first-of-type {
    border-top: 0;
}

.extra-row span {
    color: var(--muted);
}

.extra-row strong,
.extra-row em {
    text-align: right;
    font-style: normal;
    font-weight: 750;
}

.instruction-step {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e4efef;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
}

.instruction-main strong {
    display: block;
}

.instruction-row small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.instruction-meta {
    display: flex;
    gap: 14px;
    align-items: baseline;
    justify-content: flex-end;
    white-space: nowrap;
}

.instruction-meta em {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    color: var(--muted);
    font-style: normal;
    font-weight: 650;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 13px;
    color: var(--muted);
    font-size: 13px;
}

.footer-nav {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.static-page-content :first-child {
    margin-top: 0;
}

.static-page-content :last-child {
    margin-bottom: 0;
}

.ad-block {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
}

.ad-block > *:first-child {
    margin-top: 0;
}

.ad-block > *:last-child {
    margin-bottom: 0;
}

.ad-global-top {
    margin-bottom: 12px;
}

.ad-after-map,
.ad-after-pdf,
.ad-content-bottom {
    margin-top: 10px;
}

.ad-floating {
    position: sticky;
    top: 12px;
    overflow: hidden;
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.ad-floating-content {
    overflow: hidden;
    max-height: inherit;
}

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

.admin-panel {
    padding: 16px;
    margin-top: 12px;
    overflow-x: auto;
}

.content-band.admin-top-band {
    margin-top: 8px;
}

.admin-panel td,
.admin-panel p,
.admin-panel span,
.admin-panel a {
    font-weight: 400;
}

.admin-panel h1,
.admin-panel h2,
.admin-panel h3,
.admin-panel th,
.admin-panel label {
    font-weight: 650;
}

.admin-panel.wide {
    display: block;
}

.admin-budget-panel {
    display: block;
    margin: 14px 0 18px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #f7fbfb;
}

.admin-budget-panel > summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 800;
    line-height: 1.25;
}

.admin-budget-panel[open] > summary {
    margin-bottom: 10px;
}

.admin-budget-panel.is-blocked {
    border-color: #efb2aa;
    background: #fff3f1;
}

.admin-budget-panel strong {
    display: block;
    margin-bottom: 4px;
}

.admin-budget-panel > div {
    margin-top: 10px;
}

.admin-budget-panel p {
    margin: 0;
    color: var(--danger);
    font-weight: 700;
}

.admin-budget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.admin-budget-grid span {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #ffffff;
}

.admin-budget-help {
    color: var(--muted);
}

.admin-budget-help summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 700;
}

.admin-budget-help p {
    margin: 0;
    padding-top: 6px;
    color: var(--muted);
    font-weight: 500;
}

.admin-login {
    max-width: 520px;
    margin-inline: auto;
}

.admin-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.admin-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0 12px;
    color: var(--muted);
    font-weight: 500;
}

.admin-tabs a.active {
    border-color: var(--accent);
    background: #e4efef;
    color: var(--accent-dark);
}

.tab-badge {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    padding: 0 6px;
    background: #fce8e6;
    color: #b42318;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.admin-tabs a.active .tab-badge {
    background: var(--accent);
    color: #fff;
}

.admin-create-form,
.admin-filter-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin: 8px 0 18px;
}

.admin-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
}

.admin-top-band {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
}

.admin-top-band .admin-title-row {
    min-height: 40px;
}

.admin-top-band .admin-tabs {
    margin-top: 0;
}

.admin-top-band + .admin-panel {
    margin-top: 6px;
}

.admin-routes-heading {
    align-items: flex-start;
}

.heading-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
}

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

.heading-inline span {
    color: var(--muted);
    font-weight: 400;
}

.slide-panel {
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.slide-panel .admin-create-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px auto;
    margin: 0;
}

.icon-button {
    width: 46px;
    min-height: 46px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--accent-dark);
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
}

.icon-button span {
    line-height: 1;
}

.icon-button:hover {
    border-color: var(--accent);
    background: #f3faf9;
}

.icon-button svg {
    display: block;
}

.admin-create-form label,
.admin-filter-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.admin-create-form input,
.admin-filter-form input,
.admin-filter-form select,
.settings-form input,
.settings-form textarea,
.settings-form select,
.ad-settings-card input,
.ad-settings-card textarea,
.ad-settings-card select,
.seo-settings-card input,
.seo-settings-card textarea,
.seo-settings-card select {
    font-weight: 400;
}

.settings-form {
    display: grid;
    gap: 16px;
}

.settings-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.settings-form h3 {
    margin: 4px 0 -4px;
}

.settings-form small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    font-weight: 500;
}

.ads-settings-form {
    gap: 12px;
}

.ad-settings-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 14px;
    background: #fff;
}

.seo-settings-form {
    gap: 12px;
}

.seo-settings-card {
    display: grid;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0;
    background: #fff;
    overflow: hidden;
}

.seo-settings-card h3 {
    margin: 0;
    font-size: 18px;
}

.seo-spoiler-toggle {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 0 14px;
    font: inherit;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.seo-spoiler-toggle:hover {
    background: #f8fafb;
}

.seo-spoiler-icon::before {
    content: "▾";
    display: block;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    font-weight: 400;
    transform: rotate(-90deg);
    transition: transform .16s ease;
}

.seo-spoiler-toggle.active .seo-spoiler-icon::before {
    transform: rotate(0deg);
}

.seo-spoiler-panel {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--border);
    padding: 14px;
}

.seo-spoiler-panel[hidden] {
    display: none;
}

.ad-settings-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.ad-settings-head h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.ad-settings-head p {
    margin: 0;
    color: var(--muted);
}

.toggle-row {
    width: max-content;
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 8px !important;
    color: var(--text) !important;
    white-space: nowrap;
}

.toggle-row input {
    width: 18px;
    height: 18px;
}

.admin-faq {
    display: grid;
    gap: 16px;
}

.faq-card {
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 14px;
}

.faq-card h3 {
    margin: 0 0 10px;
}

.faq-card p {
    margin: 0 0 8px;
    color: var(--muted);
}

.faq-card pre {
    margin: 8px 0 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #f8fafb;
    padding: 10px 12px;
}

.faq-table code {
    font-weight: 500;
}

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

.custom-html-band > :first-child {
    margin-top: 0;
}

.custom-html-band > :last-child {
    margin-bottom: 0;
}

.admin-actions {
    vertical-align: middle;
}

.admin-actions-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    max-width: 100%;
}

.admin-actions-inner form,
td form {
    margin: 0;
}

.admin-actions-inner button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
}

.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    margin: 6px 0 14px;
}

.bulk-actions .secondary-button,
.bulk-actions .danger-button {
    min-height: 36px;
    padding: 0 16px;
}

.row-check {
    width: 18px;
    min-height: 18px;
    display: block;
    margin: 0 auto;
    padding: 0;
    cursor: pointer;
}

.routes-table,
.pending-table,
.staging-table {
    table-layout: fixed;
}

.routes-table,
.pending-table,
.staging-table {
    width: 100%;
    min-width: 0;
}

.review-routes-table,
.route-issues-table {
    min-width: 920px;
}

.admin-panel.wide {
    overflow-x: auto;
}

.check-col {
    width: 36px;
}

.routes-route-col {
    width: 26%;
}

.routes-status-col {
    width: 10%;
}

.routes-distance-col {
    width: 10%;
}

.routes-issue-col {
    width: auto;
}

.routes-views-col {
    width: 8%;
}

.routes-date-col {
    width: 15%;
}

.routes-actions-col {
    width: 16%;
}

.pending-route-col {
    width: 27%;
}

.pending-status-col {
    width: 8%;
}

.pending-attempts-col {
    width: 6%;
}

.pending-date-col {
    width: 15%;
}

.pending-error-col {
    width: 22%;
}

.pending-actions-col {
    width: 18%;
}

.staging-route-col {
    width: 15%;
}

.staging-status-col {
    width: 8%;
}

.staging-type-col {
    width: 9%;
}

.staging-source-col {
    width: 9%;
}

.staging-attempts-col {
    width: 6%;
}

.staging-error-col {
    width: 19%;
}

.staging-date-col {
    width: 10%;
}

.staging-actions-col {
    width: 20%;
}

.routes-table th,
.routes-table td,
.pending-table th,
.pending-table td,
.staging-table th,
.staging-table td {
    padding: 10px 8px;
}

.routes-table td,
.pending-table td,
.staging-table td {
    vertical-align: middle;
}

.routes-table th,
.review-routes-table th,
.route-issues-table th,
.pending-table th,
.staging-table th {
    white-space: nowrap;
}

.routes-table th {
    font-size: 11px;
}

.routes-table td,
.review-routes-table td,
.route-issues-table td,
.pending-table td,
.staging-table td {
    overflow-wrap: anywhere;
}

.routes-table .admin-actions-inner,
.review-routes-table .admin-actions-inner,
.route-issues-table .admin-actions-inner,
.pending-table .admin-actions-inner,
.staging-table .admin-actions-inner {
    align-items: flex-start;
    gap: 6px;
}

.routes-table .admin-actions-inner,
.pending-table .admin-actions-inner,
.staging-table .admin-actions-inner {
    flex-direction: row;
    flex-wrap: wrap;
}

.routes-table .admin-actions-inner form,
.review-routes-table .admin-actions-inner form,
.route-issues-table .admin-actions-inner form,
.pending-table .admin-actions-inner form,
.staging-table .admin-actions-inner form {
    flex: 0 0 auto;
}

.routes-table .admin-actions-inner button,
.review-routes-table .admin-actions-inner button,
.route-issues-table .admin-actions-inner button,
.pending-table .admin-actions-inner button,
.staging-table .admin-actions-inner button {
    min-height: 32px;
    padding: 0 8px;
}

.routes-table .admin-actions-inner button,
.pending-table .admin-actions-inner button,
.staging-table .admin-actions-inner button {
    width: auto;
}

.routes-table td:nth-child(6),
.routes-table th:nth-child(6) {
    text-align: right;
}

.status-note {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
}

.staging-edit-row td {
    background: #f8fafb;
}

.staging-edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
    margin: 0;
}

.staging-edit-form .via-city-field,
.staging-edit-form label:nth-last-child(2) {
    grid-column: 1 / -1;
}

.staging-edit-form .secondary-button {
    justify-self: start;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    color: var(--muted);
}

.pagination a {
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 12px;
    color: var(--accent-dark);
    font-weight: 500;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

@media (max-width: 860px) {
    .hero-band,
    .route-layout,
    .info-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .hero-band,
    .content-band {
        padding: 16px;
    }

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

    .hero-form-panel .route-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-form-panel .route-form .advanced-options,
    .hero-form-panel .route-form .primary-button {
        grid-column: 1 / -1;
    }

    .metrics-grid.compact .metric {
        min-height: 68px;
    }

    .map {
        min-height: 360px;
    }

    .site-footer,
    .section-heading,
    .admin-title-row {
        display: block;
    }

    .site-header {
        flex-wrap: wrap;
        gap: 10px 16px;
    }

    .header-route-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    .checkbox-grid,
    .hgv-grid {
        grid-template-columns: 1fr;
    }

    .route-list,
    .directory-grid,
    .directory-grid.compact,
    .directory-facts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-create-form,
    .admin-filter-form,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .admin-routes-heading {
        display: grid;
        gap: 12px;
    }

    .slide-panel .admin-create-form {
        grid-template-columns: 1fr;
    }

    .admin-title-row form {
        margin-top: 16px;
    }
}

@media (max-width: 720px) {
    .route-summary {
        padding-inline: 0;
    }

    .roadmap-row {
        grid-template-columns: 1fr 1fr;
        padding-left: 54px;
    }

    .roadmap-marker {
        position: absolute;
        left: 16px;
        top: 14px;
    }

    .roadmap-row::before {
        left: 29px;
    }

    .roadmap-place,
    .roadmap-note {
        grid-column: 1 / -1;
    }

    .section-heading.compact h2,
    .section-heading.compact p,
    .route-instructions .section-heading.compact h2,
    .route-instructions .section-heading.compact p {
        white-space: normal;
    }

    .instruction-row {
        grid-template-columns: 28px 1fr;
        gap: 6px 10px;
        padding: 6px 9px;
    }

    .instruction-main {
        min-width: 0;
    }

    .instruction-main strong {
        line-height: 1.22;
    }

    .instruction-row small {
        margin-top: 1px;
        line-height: 1.25;
    }

    .instruction-meta {
        grid-column: 2;
        gap: 12px;
        justify-content: flex-start;
        line-height: 1.2;
    }

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

    .route-tool-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    main,
    .site-header-wrap,
    .site-footer-wrap {
        width: min(100% - 20px, 1180px);
    }

    .site-header {
        min-height: 64px;
    }

    .top-nav {
        gap: 10px;
        font-size: 13px;
    }

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

    .metrics-grid.compact {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-form-panel .route-form {
        grid-template-columns: 68px 1fr;
    }

    .hero-form-panel .route-form label,
    .hero-form-panel .route-form .advanced-options,
    .hero-form-panel .route-form .route-form-notice {
        grid-column: 1 / -1;
    }

    .hero-form-panel .route-form .route-clear-button {
        grid-column: 1;
    }

    .hero-form-panel .route-form .primary-button {
        grid-column: 2;
    }

    .metrics-grid.compact .metric strong {
        font-size: 18px;
    }

    .metric-price {
        min-width: 0;
    }

    .route-row {
        display: grid;
    }

    .route-list,
    .directory-grid,
    .directory-grid.compact,
    .directory-facts-grid,
    .admin-create-form,
    .admin-filter-form {
        grid-template-columns: 1fr;
    }

    .directory-facts-grid .directory-card.wide {
        grid-column: span 1;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    .site-header-wrap,
    .site-footer,
    .ad-block,
    .ad-floating,
    .print-button {
        display: none;
    }

    body {
        background: #fff;
    }

    main {
        width: 100%;
        margin: 0;
    }

    .content-band {
        box-shadow: none;
        border: 0;
        padding: 0;
    }

    .print-map {
        width: 100% !important;
        height: 360px;
        min-height: 360px;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-map .leaflet-map-pane,
    .print-map .leaflet-tile-pane,
    .print-map .leaflet-overlay-pane,
    .print-map .leaflet-marker-pane {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .route-place-marker i,
    .route-place-marker span,
    .leaflet-tile {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

}
