@font-face {
    font-family: "Myriad Pro";
    src: local("Myriad Pro Light"), local("MyriadPro-Light"), url("../fonts/MyriadPro-Light.woff2") format("woff2");
    font-style: normal;
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: "Myriad Pro";
    src: local("Myriad Pro"), local("MyriadPro-Regular"), url("../fonts/MyriadPro-Regular.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Myriad Pro";
    src: local("Myriad Pro Semibold"), local("MyriadPro-Semibold"), url("../fonts/MyriadPro-Semibold.woff2") format("woff2");
    font-style: normal;
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "Myriad Pro";
    src: local("Myriad Pro Bold"), local("MyriadPro-Bold"), url("../fonts/MyriadPro-Bold.woff2") format("woff2");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #f4f8fc;
    --surface: rgba(255,255,255,.88);
    --surface-solid: #fff;
    --ink: #102033;
    --muted: #66758a;
    --line: #dbe7f2;
    --primary: #087cf0;
    --primary-dark: #0464c6;
    --cyan: #19c8e8;
    --success: #13a66b;
    --warning: #f2a20c;
    --danger: #df3b52;
    --shadow: 0 18px 55px rgba(18, 58, 92, .12);
    --shadow-soft: 0 10px 30px rgba(18, 58, 92, .08);
    --radius: 22px;
    --radius-small: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Myriad Pro", "Myriad", "Helvetica Neue", Arial, system-ui, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 0%, rgba(25,200,232,.16), transparent 32rem),
        radial-gradient(circle at 88% 12%, rgba(8,124,240,.14), transparent 36rem),
        linear-gradient(180deg, #f9fcff 0%, var(--bg) 42%, #eef5fb 100%);
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .36;
    background-image: linear-gradient(rgba(36,93,135,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(36,93,135,.035) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

.ambient { position: fixed; pointer-events: none; filter: blur(18px); z-index: -1; border-radius: 999px; animation: drift 14s ease-in-out infinite alternate; }
.ambient-one { width: 280px; height: 280px; left: -120px; top: 34vh; background: rgba(24,199,232,.12); }
.ambient-two { width: 360px; height: 360px; right: -170px; top: 58vh; background: rgba(8,124,240,.10); animation-delay: -5s; }
@keyframes drift { to { transform: translate3d(40px,-34px,0) scale(1.08); } }

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px clamp(18px, 4vw, 64px);
    background: rgba(249,252,255,.78);
    border-bottom: 1px solid rgba(203,219,233,.72);
    backdrop-filter: blur(18px) saturate(150%);
}
.brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.brand-logo img { width: auto; height: 46px; max-width: min(260px, 42vw); object-fit: contain; transition: transform .25s ease, filter .25s ease; }
.brand-logo:hover img { transform: translateY(-1px) scale(1.02); filter: drop-shadow(0 8px 14px rgba(8,124,240,.16)); }
.top-nav { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.top-nav > a:not(.button), .user-pill { padding: 9px 11px; color: #405369; font-size: .88rem; font-weight: 700; border-radius: 10px; }
.top-nav > a:not(.button):hover { color: var(--primary); background: rgba(8,124,240,.07); }
.user-pill { background: #e9f4ff; color: #0b68be; }

.page-shell { width: min(1180px, calc(100% - 34px)); margin: 0 auto; padding: 50px 0 76px; position: relative; }
.page-shell-wide { width: min(1460px, calc(100% - 28px)); }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: .78rem; width: min(1180px, calc(100% - 34px)); margin: 0 auto; padding: 22px 0 34px; border-top: 1px solid rgba(205,220,232,.8); }
.footer-logo img { width: auto; height: 34px; max-width: 190px; object-fit: contain; transition: transform .2s ease, opacity .2s ease; }
.footer-logo:hover img { transform: translateY(-2px); opacity: .82; }

.hero { display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: 42px; padding: 26px 0 44px; }
.hero-copy { animation: rise .7s ease both; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 999px; background: rgba(8,124,240,.08); color: #086cce; font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px rgba(25,200,232,.13); }
.hero h1 { max-width: 800px; margin: 18px 0 16px; font-size: clamp(2.35rem, 6vw, 5.15rem); line-height: .96; letter-spacing: -.065em; }
.hero h1 span { color: transparent; background: linear-gradient(100deg, var(--primary), var(--cyan)); background-clip: text; -webkit-background-clip: text; }
.hero p { max-width: 690px; margin: 0; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.18rem); line-height: 1.72; }
.hero-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 25px; }
.hero-visual { min-height: 330px; display: grid; place-items: center; perspective: 900px; animation: rise .8s .1s ease both; }
.mini-board {
    width: min(100%, 360px);
    background: #fff;
    border: 10px solid #087cf0;
    border-radius: 22px;
    padding: 18px;
    box-shadow: 0 28px 70px rgba(17,72,121,.24);
    transform: rotateY(-8deg) rotateX(3deg) rotateZ(1.3deg);
    animation: floatBoard 5.5s ease-in-out infinite;
}
@keyframes floatBoard { 50% { transform: rotateY(-3deg) rotateX(1deg) rotateZ(-.8deg) translateY(-8px); } }
.mini-board-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.route-badge { display: inline-grid; place-items: center; min-width: 65px; min-height: 44px; padding: 7px 13px; border-radius: 13px; background: var(--route-color, var(--primary)); color: var(--route-contrast, #fff); font-size: 1.35rem; font-weight: 900; line-height: .9; letter-spacing: -.045em; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.mini-board-head strong { display: block; font-size: .82rem; }
.mini-board-head small { color: var(--muted); font-size: .66rem; }
.mini-line { position: relative; padding-left: 23px; display: grid; gap: 9px; }
.mini-line::before { content: ""; position: absolute; left: 7px; top: 5px; bottom: 5px; width: 4px; border-radius: 5px; background: #0b87ee; }
.mini-stop { position: relative; font-size: .65rem; color: #3f5268; }
.mini-stop::before { content: ""; position: absolute; left: -20px; top: .18rem; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 3px solid #0b87ee; }
.mini-stop.active { font-weight: 900; color: #0b68be; }

@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 22px; margin: 18px 0 22px; }
.section-head h1, .section-head h2 { margin: 0; letter-spacing: -.04em; }
.section-head h1 { font-size: clamp(2rem, 4vw, 3.35rem); }
.section-head h2 { font-size: clamp(1.45rem, 3vw, 2.2rem); }
.section-head p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.section-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.button { border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 13px; font-weight: 800; font-size: .9rem; transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0); }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--primary), #0a94ed); box-shadow: 0 10px 24px rgba(8,124,240,.23); }
.button-primary:hover { box-shadow: 0 14px 29px rgba(8,124,240,.30); }
.button-secondary { color: #0568c2; background: #e7f3ff; }
.button-ghost { color: #43566c; background: rgba(255,255,255,.62); border: 1px solid var(--line); }
.button-danger { color: #fff; background: var(--danger); }
.button-small { min-height: 36px; padding: 8px 12px; border-radius: 10px; font-size: .79rem; }
.button-icon { width: 39px; min-width: 39px; height: 39px; padding: 0; border-radius: 11px; }
.button[disabled] { opacity: .55; cursor: wait; transform: none; }

.panel { background: var(--surface); border: 1px solid rgba(209,224,237,.9); border-radius: var(--radius); box-shadow: var(--shadow-soft); backdrop-filter: blur(14px); }
.panel-pad { padding: clamp(18px, 3vw, 30px); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.panel-title h2, .panel-title h3 { margin: 0; letter-spacing: -.03em; }
.panel-title p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }

.route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.route-card { position: relative; display: flex; flex-direction: column; min-height: 235px; padding: 20px; overflow: hidden; background: rgba(255,255,255,.90); border: 1px solid rgba(204,221,235,.88); border-radius: 20px; box-shadow: var(--shadow-soft); transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; animation: rise .55s ease both; }
.route-card::after { content: ""; position: absolute; width: 170px; height: 170px; right: -75px; bottom: -85px; border-radius: 50%; background: color-mix(in srgb, var(--route-color, var(--primary)) 16%, transparent); }
.route-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--route-color, var(--primary)) 38%, #d5e3ef); }
.route-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.route-card h3 { margin: 18px 0 5px; font-size: 1.25rem; letter-spacing: -.035em; }
.route-card .direction { color: var(--muted); font-size: .86rem; line-height: 1.45; min-height: 2.5em; }
.route-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 20px; position: relative; z-index: 1; }
.route-card-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; position: relative; z-index: 1; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; background: #eff5fa; color: #53677d; font-size: .7rem; font-weight: 800; }
.tag-public { background: #e3f8ef; color: #0c8959; }
.tag-private { background: #f2f0fa; color: #665891; }
.tag-gtfs { background: #e8f4ff; color: #0870ce; }
.search-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; padding: 8px 10px 8px 16px; background: rgba(255,255,255,.84); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-soft); }
.search-bar input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; padding: 8px 0; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 58px 28px; border: 1px dashed #bdd2e4; border-radius: var(--radius); background: rgba(255,255,255,.58); }
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { margin: 0 0 20px; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: .75rem; font-weight: 800; color: #4e6278; }
.input, .select, .textarea { width: 100%; border: 1px solid #cfdeea; border-radius: 12px; background: rgba(255,255,255,.92); color: var(--ink); outline: none; padding: 11px 12px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.input:focus, .select:focus, .textarea:focus { border-color: #64afea; box-shadow: 0 0 0 4px rgba(8,124,240,.09); }
.textarea { min-height: 95px; resize: vertical; line-height: 1.5; }
.field-hint { color: var(--muted); font-size: .69rem; line-height: 1.45; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 48px; height: 44px; border: 0; padding: 0; border-radius: 12px; overflow: hidden; background: transparent; cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 20px; }

.auth-wrap { min-height: calc(100vh - 250px); display: grid; place-items: center; padding: 30px 0; }
.auth-card { width: min(100%, 470px); padding: 34px; }
.auth-card h1 { margin: 0 0 8px; font-size: 2rem; letter-spacing: -.045em; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); }
.auth-card .field { margin-bottom: 14px; }
.auth-card .button { width: 100%; margin-top: 8px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .82rem; color: var(--muted); }
.auth-error { margin-bottom: 16px; padding: 11px 13px; border-radius: 12px; background: #ffe9ed; color: #a51d34; font-size: .84rem; font-weight: 700; }

.editor-layout { display: grid; grid-template-columns: minmax(270px, .76fr) minmax(310px, .9fr) minmax(390px, 1.35fr); gap: 16px; align-items: start; }
.editor-panel { min-width: 0; }
.sticky-panel { position: sticky; top: 92px; }
.stop-list { display: grid; gap: 8px; max-height: 63vh; overflow: auto; padding-right: 4px; }
.stop-item { display: grid; grid-template-columns: 31px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid #d7e5ef; border-radius: 13px; background: #fff; transition: .2s ease; cursor: pointer; }
.stop-item:hover { border-color: #91c2e8; transform: translateX(2px); }
.stop-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8,124,240,.09); background: #f7fbff; }
.stop-handle { color: #90a4b7; cursor: grab; font-weight: 900; letter-spacing: -2px; user-select: none; }
.stop-handle:active { cursor: grabbing; }
.stop-fields { min-width: 0; }
.stop-item [data-stop-name] { width: 100%; min-width: 0; border: 0; padding: 3px 4px; outline: none; background: transparent; font-size: .82rem; font-weight: 700; }
.stop-item small { display: block; min-width: 0; overflow: hidden; color: var(--muted); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.stop-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.stop-meta-row label { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; color: #6a7e91; font-size: .58rem; font-weight: 700; }
.stop-meta-row [data-travel-minutes] { width: 42px; height: 25px; padding: 2px 3px; border: 1px solid #d4e1eb; border-radius: 7px; background: #f5f9fc; color: #18344d; text-align: center; font-size: .66rem; font-weight: 900; }
.stop-meta-row [data-travel-minutes]:disabled { border-color: transparent; background: transparent; color: #9aa9b7; }
.stop-dot { width: 16px; height: 16px; border-radius: 50%; border: 4px solid var(--route-color, var(--primary)); background: #fff; }
.add-stop-form { display: grid; grid-template-columns: minmax(0,1fr) 76px auto; gap: 8px; margin-top: 12px; }
.stop-minute-input { text-align: center; }
.day-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 7px; }
.day-tab { border: 0; cursor: pointer; min-width: 44px; padding: 9px 10px; border-radius: 10px; color: #5a6e82; background: #edf3f8; font-size: .75rem; font-weight: 900; }
.day-tab.active { color: #fff; background: var(--primary); box-shadow: 0 7px 16px rgba(8,124,240,.20); }
.schedule-heading { margin: 15px 0 13px; padding: 12px 13px; border-radius: 13px; background: linear-gradient(135deg, #eef8ff, #f5fbff); border: 1px solid #d8eaf7; }
.schedule-heading strong { display: block; }
.schedule-heading small { color: var(--muted); }
.time-toolbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.time-chips { display: flex; flex-wrap: wrap; gap: 7px; min-height: 50px; margin: 14px 0; }
.time-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 8px 7px 11px; border-radius: 999px; background: #e9f5ff; color: #0968bd; font-size: .78rem; font-weight: 900; animation: chipIn .22s ease both; }
.time-chip button { border: 0; background: rgba(9,104,189,.1); color: inherit; cursor: pointer; border-radius: 50%; width: 20px; height: 20px; padding: 0; line-height: 1; }
@keyframes chipIn { from { transform: scale(.85); opacity: 0; } }
.bulk-box { margin-top: 8px; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.save-indicator { min-height: 20px; color: var(--success); font-size: .76rem; font-weight: 800; }
.drag-ghost { opacity: .45; background: #dff1ff; }

.legend-manager { margin-top: 18px; }
.legend-manager-grid { display: grid; grid-template-columns: minmax(270px,.72fr) minmax(0,1.6fr); gap: 18px; align-items: start; }
.legend-create-card { padding: 18px; border: 1px solid #d8e6f0; border-radius: 17px; background: linear-gradient(145deg,#f8fcff,#eef7fd); }
.legend-create-card .textarea { min-height: 82px; }
.legend-auto-attach { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: #4e6377; font-size: .76rem; font-weight: 700; }
.legend-auto-attach input { width: 17px; height: 17px; accent-color: var(--primary); }
.legend-editor-list { display: grid; gap: 10px; }
.legend-editor-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid #d8e5ee; border-radius: 16px; background: #fff; transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.legend-editor-item:hover { border-color: #9bc7e8; box-shadow: 0 8px 24px rgba(18,58,92,.07); transform: translateY(-1px); }
.legend-edit-fields { display: grid; gap: 8px; min-width: 0; }
.legend-edit-head { display: grid; grid-template-columns: 84px minmax(0,1fr); gap: 8px; }
.legend-symbol-input { text-align: center; font-weight: 900; }
.legend-editor-item .textarea { min-height: 64px; }
.legend-item-actions { display: grid; gap: 7px; }
.legend-attach-switch { position: relative; width: 42px; height: 24px; cursor: pointer; }
.legend-attach-switch input { position: absolute; opacity: 0; pointer-events: none; }
.legend-attach-switch span { position: absolute; inset: 0; border-radius: 999px; background: #cdd9e3; transition: .2s ease; }
.legend-attach-switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.16); transition: .2s ease; }
.legend-attach-switch input:checked + span { background: var(--primary); }
.legend-attach-switch input:checked + span::after { transform: translateX(18px); }
.legend-attach-switch input:focus-visible + span { box-shadow: 0 0 0 4px rgba(8,124,240,.14); }
.empty-inline { padding: 22px; border: 1px dashed #b9cfdf; border-radius: 15px; color: var(--muted); text-align: center; font-size: .82rem; }


.gtfs-drop { position: relative; display: grid; place-items: center; min-height: 250px; padding: 35px; text-align: center; border: 2px dashed #a8cce7; border-radius: 24px; background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(232,246,255,.78)); transition: .25s ease; cursor: pointer; }
.gtfs-drop:hover, .gtfs-drop.dragover { border-color: var(--primary); transform: translateY(-2px); background: #f5fbff; }
.gtfs-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.gtfs-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: #e2f2ff; color: var(--primary); font-size: 1.8rem; margin-bottom: 13px; }
.gtfs-drop h3 { margin: 0 0 7px; }
.gtfs-drop p { margin: 0; color: var(--muted); }
.import-list { display: grid; gap: 9px; margin-top: 20px; max-height: 480px; overflow: auto; }
.import-option { display: grid; grid-template-columns: auto auto 1fr auto; gap: 12px; align-items: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.import-option input { width: 18px; height: 18px; accent-color: var(--primary); }
.import-option strong { display: block; }
.import-option small { color: var(--muted); }
.progress { height: 9px; overflow: hidden; border-radius: 99px; background: #dce9f3; margin-top: 14px; }
.progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan)); transition: width .3s ease; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; background: rgba(255,255,255,.84); }
.data-table th, .data-table td { padding: 13px 14px; border-bottom: 1px solid #e4edf4; text-align: left; font-size: .82rem; }
.data-table th { background: #f2f7fb; color: #53677c; font-size: .71rem; text-transform: uppercase; letter-spacing: .06em; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.actions { display: flex; gap: 7px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(10,27,43,.55); backdrop-filter: blur(9px); opacity: 0; visibility: hidden; transition: .22s ease; }
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal { width: min(100%, 620px); max-height: calc(100vh - 40px); overflow: auto; padding: 25px; background: #fff; border-radius: 22px; box-shadow: 0 30px 90px rgba(0,0,0,.25); transform: translateY(18px) scale(.98); transition: .22s ease; }
.modal-backdrop.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.modal-head h2 { margin: 0; }
.modal-close { border: 0; background: #edf3f8; width: 38px; height: 38px; border-radius: 11px; cursor: pointer; font-size: 1.2rem; }

.flash-stack { position: fixed; z-index: 120; right: 20px; top: 83px; display: grid; gap: 8px; width: min(390px, calc(100vw - 40px)); }
.flash { padding: 12px 14px; border-radius: 13px; box-shadow: var(--shadow); background: #fff; border-left: 4px solid var(--primary); font-size: .84rem; font-weight: 700; animation: flashIn .3s ease both; }
.flash-success { border-left-color: var(--success); }
.flash-warning { border-left-color: var(--warning); }
.flash-danger { border-left-color: var(--danger); }
@keyframes flashIn { from { opacity: 0; transform: translateX(20px); } }
.toast-stack { position: fixed; z-index: 130; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(380px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; color: #fff; border-radius: 13px; background: #18324a; box-shadow: var(--shadow); font-size: .82rem; font-weight: 700; animation: toastIn .25s ease both; }
.toast.success { background: #0f8f5d; }
.toast.error { background: #bd2d43; }
@keyframes toastIn { from { opacity: 0; transform: translateY(15px); } }

.screen-board-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.board-controls { position: sticky; top: 92px; }
.stop-selector { display: grid; gap: 7px; max-height: 58vh; overflow: auto; }
.stop-selector a { padding: 9px 11px; border-radius: 11px; color: #4f6378; font-size: .79rem; font-weight: 700; }
.stop-selector a:hover { background: #edf6fd; color: var(--primary); }
.stop-selector a.active { background: var(--primary); color: #fff; }
.board-preview { overflow: auto; padding: 18px; border-radius: var(--radius); background: #dbeaf4; box-shadow: inset 0 0 35px rgba(35,78,112,.12); }

.timetable-sheet { --route-color: #087cf0; flex: 0 0 auto; margin: 0 auto; color: #102033; background: #fff; box-shadow: 0 16px 45px rgba(22,55,81,.18); overflow: hidden; font-family: "Myriad Pro", "Myriad", "Helvetica Neue", Arial, sans-serif; box-sizing: border-box; page-break-after: always; break-after: page; }
.timetable-sheet.sheet-last { page-break-after: auto; break-after: auto; }
.timetable-sheet.paper-A4 { width: 210mm; height: 297mm; }
.timetable-sheet.paper-A5 { width: 148mm; height: 210mm; }
.sheet-colorbar { height: 3mm; background: var(--route-color); }
.sheet-inner { height: calc(100% - 3mm); display: flex; flex-direction: column; min-height: 0; padding: 4.2mm; overflow: hidden; }
.sheet-header { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 3mm; align-items: center; flex: 0 0 auto; padding-bottom: 2.6mm; border-bottom: .45mm solid #dce8f1; }
.sheet-header .route-badge { min-width: 17.5mm; min-height: 11.5mm; padding: 1.1mm 2.7mm; border-radius: 2.8mm; font-size: 1.48rem; line-height: .82; }
.sheet-header h1 { margin: 0; font-size: .92rem; line-height: 1.12; letter-spacing: -.035em; }
.sheet-header p { margin: .8mm 0 0; color: #65758a; font-size: .49rem; }
.sheet-current-stop { display: flex; justify-content: space-between; gap: 3mm; align-items: center; flex: 0 0 auto; margin: 2.4mm 0 2.7mm; padding: 2mm 2.5mm; border-radius: 2.4mm; background: #f1f6fa; background: color-mix(in srgb, var(--route-color) 10%, #fff); }
.sheet-current-stop span { color: #5f7185; font-size: .46rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.sheet-current-stop strong { display: block; margin-top: .25mm; font-size: .69rem; }
.sheet-grid { display: grid; grid-template-columns: minmax(54mm,.82fr) minmax(0,1.35fr); gap: 3mm; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.line-map { display: grid; grid-template-rows: repeat(var(--stop-count), minmax(0,1fr)); min-height: 0; height: 100%; overflow: hidden; }
.line-stop { display: grid; grid-template-columns: 10mm 5mm minmax(0,1fr); align-items: center; min-height: 0; color: #3c5065; font-size: .49rem; line-height: 1.05; border-radius: 1.4mm; overflow: hidden; }
.line-stop-name { min-width: 0; padding: .25mm .8mm; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-stop.major .line-stop-name { font-weight: 900; }
.line-stop.active { background: #eef5fb; background: color-mix(in srgb, var(--route-color) 12%, #fff); color: #0c2740; font-weight: 900; }
.line-stop.past { color: #9aa7b3; }
.line-stop-minutes { display: flex; align-items: baseline; justify-content: flex-end; gap: .55mm; padding-right: 1mm; color: #60758a; text-align: right; }
.line-stop-minutes b { font-size: .48rem; }
.line-stop-minutes small { font-size: .34rem; font-weight: 700; text-transform: uppercase; }
.line-stop.past .line-stop-minutes { color: #acb6bf; }
.line-stop-marker { position: relative; align-self: stretch; display: grid; place-items: center; min-height: 0; }
.line-stop-marker::before, .line-stop-marker::after { content: ""; position: absolute; left: 50%; width: 1mm; transform: translateX(-50%); background: var(--route-color); }
.line-stop-marker::before { top: 0; bottom: 50%; }
.line-stop-marker::after { top: 50%; bottom: 0; }
.line-stop.first .line-stop-marker::before, .line-stop.last .line-stop-marker::after { display: none; }
.line-stop.past .line-stop-marker::before, .line-stop.past .line-stop-marker::after, .line-stop.active .line-stop-marker::before { background: #b8c0c8; }
.line-stop-marker i { position: relative; display: block; z-index: 1; width: 2.2mm; height: 2.2mm; border: .65mm solid var(--route-color); border-radius: 50%; background: #fff; box-sizing: border-box; }
.line-stop.past .line-stop-marker i { border-color: #aeb8c1; background: #f3f5f6; }
.line-stop.active .line-stop-marker i { width: 3.2mm; height: 3.2mm; border: .75mm solid #fff; background: var(--route-color); box-shadow: 0 0 0 .65mm var(--route-color); }
.sheet-side { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 2mm; overflow: hidden; }
.schedule-groups { display: grid; grid-template-columns: repeat(var(--schedule-columns, 2), minmax(0,1fr)); gap: 1.5mm; align-content: start; min-height: 0; }
.schedule-group { overflow: hidden; border: .28mm solid #dce7ef; border-radius: 2mm; break-inside: avoid; }
.schedule-group h3 { margin: 0; padding: 1.35mm 1.8mm; color: var(--route-contrast, #fff); background: var(--route-color); font-size: .52rem; line-height: 1.1; letter-spacing: .01em; }
.hour-row { display: grid; grid-template-columns: 7mm 1fr; border-top: .25mm solid #e6edf3; min-height: 5.2mm; }
.hour-row:first-child { border-top: 0; }
.hour { display: grid; place-items: center; background: #eef4f8; color: #2c4358; font-size: .52rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.minutes { display: flex; flex-wrap: wrap; align-content: center; gap: .4mm 1.2mm; padding: .8mm 1.2mm; color: #182e43; font-size: .51rem; line-height: 1.08; font-weight: 800; font-variant-numeric: tabular-nums; }
.minutes span { display: inline-block; min-width: 1.15em; text-align: center; }
.no-service { padding: 2.2mm; color: #75869a; font-size: .44rem; font-style: italic; }
.sheet-legends { padding: 1.7mm 2mm; border: .25mm solid #dce7ef; border-radius: 1.8mm; background: #f8fbfd; overflow: hidden; }
.sheet-legends > h3 { margin: 0 0 1mm; color: #455c70; font-size: .44rem; text-transform: uppercase; letter-spacing: .06em; }
.sheet-legend-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8mm 1.5mm; }
.sheet-legend { display: grid; grid-template-columns: 5.8mm minmax(0,1fr); gap: 1mm; align-items: start; min-width: 0; }
.sheet-legend-symbol { display: grid; place-items: center; min-height: 5mm; padding: .6mm; border-radius: 1.2mm; background: var(--route-color); color: var(--route-contrast, #fff); font-size: .43rem; font-weight: 900; }
.sheet-legend strong, .sheet-legend span { display: block; }
.sheet-legend strong { font-size: .42rem; line-height: 1.15; }
.sheet-legend div > span { margin-top: .25mm; color: #66788a; font-size: .36rem; line-height: 1.18; }
.sheet-note { padding: 1.6mm 2mm; border-radius: 1.8mm; background: #f0f5f8; color: #53687c; font-size: .4rem; line-height: 1.35; overflow: hidden; }
.sheet-footer { display: flex; justify-content: space-between; gap: 3mm; align-items: center; flex: 0 0 auto; margin-top: 2.2mm; padding-top: 1.8mm; border-top: .25mm solid #dce7ef; color: #6f8091; font-size: .36rem; }
.sheet-brand { color: var(--route-color); font-weight: 900; }
.paper-A4 .sheet-colorbar { height: 4mm; }
.paper-A4 .sheet-inner { height: calc(100% - 4mm); padding: 6mm; }
.paper-A4 .sheet-header { gap: 4mm; padding-bottom: 3.5mm; }
.paper-A4 .sheet-header .route-badge { min-width: 22mm; min-height: 14.5mm; font-size: 1.88rem; }
.paper-A4 .sheet-header h1 { font-size: 1.25rem; }
.paper-A4 .sheet-header p { font-size: .58rem; }
.paper-A4 .sheet-current-stop { margin: 3mm 0 3.4mm; padding: 2.6mm 3mm; }
.paper-A4 .sheet-current-stop strong { font-size: .88rem; }
.paper-A4 .sheet-grid { grid-template-columns: minmax(66mm,.72fr) minmax(0,1.55fr); gap: 4mm; }
.paper-A4 .line-stop { grid-template-columns: 13mm 6mm minmax(0,1fr); font-size: .61rem; }
.paper-A4 .line-stop-minutes b { font-size: .58rem; }
.paper-A4 .line-stop-minutes small { font-size: .39rem; }
.paper-A4 .schedule-groups { grid-template-columns: repeat(var(--schedule-columns, 2), minmax(0,1fr)); gap: 2.2mm; }
.paper-A4 .schedule-group h3 { padding: 1.55mm 2mm; font-size: .68rem; }
.paper-A4 .hour-row { grid-template-columns: 8mm 1fr; min-height: 5.2mm; }
.paper-A4 .hour { font-size: .64rem; }
.paper-A4 .minutes { gap: .45mm 1.35mm; padding: .85mm 1.25mm; font-size: .64rem; }
.paper-A4 .sheet-legend-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
.paper-A4 .sheet-legends > h3, .paper-A4 .sheet-legend strong { font-size: .5rem; }
.paper-A4 .sheet-legend div > span, .paper-A4 .sheet-note { font-size: .43rem; }
.density-compact .line-stop { font-size: .44rem; }
.density-compact .line-stop-minutes b { font-size: .42rem; }
.density-compact .sheet-current-stop { margin-top: 1.8mm; margin-bottom: 2mm; }
.density-dense .line-stop { font-size: .39rem; }
.density-dense .line-stop-minutes b { font-size: .38rem; }
.density-dense .line-stop-minutes small { display: none; }
.density-dense .sheet-header { padding-bottom: 1.8mm; }
.density-dense .sheet-current-stop { margin: 1.5mm 0; padding-top: 1.4mm; padding-bottom: 1.4mm; }
.density-ultra .line-stop { font-size: .34rem; }
.density-ultra .line-stop-minutes b { font-size: .33rem; }
.density-ultra .line-stop-minutes small { display: none; }
.density-ultra .line-stop-marker i { width: 1.8mm; height: 1.8mm; border-width: .5mm; }
.density-ultra .line-stop.active .line-stop-marker i { width: 2.6mm; height: 2.6mm; }
.density-ultra .sheet-header { padding-bottom: 1.4mm; }
.density-ultra .sheet-current-stop { margin: 1mm 0; padding-top: 1mm; padding-bottom: 1mm; }
.schedule-compact .schedule-groups { grid-template-columns: repeat(var(--schedule-columns, 2), minmax(0,1fr)); gap: 1.1mm; }
.schedule-compact .schedule-group h3 { padding: 1mm 1.25mm; font-size: .4rem; }
.schedule-compact .hour-row { grid-template-columns: 5.5mm 1fr; min-height: 4mm; }
.schedule-compact .hour, .schedule-compact .minutes { font-size: .4rem; }
.schedule-compact .minutes { gap: .3mm .8mm; padding: .55mm .8mm; }
.schedule-dense .schedule-groups { grid-template-columns: repeat(var(--schedule-columns, 2), minmax(0,1fr)); gap: .85mm; }
.schedule-dense .schedule-group { border-radius: 1.3mm; }
.schedule-dense .schedule-group h3 { padding: .75mm 1mm; font-size: .35rem; }
.schedule-dense .hour-row { grid-template-columns: 4.8mm 1fr; min-height: 3.25mm; }
.schedule-dense .hour, .schedule-dense .minutes { font-size: .34rem; }
.schedule-dense .minutes { gap: .2mm .65mm; padding: .35mm .65mm; }
.schedule-dense .no-service { padding: 1.2mm; font-size: .34rem; }
.schedule-dense .sheet-side { gap: 1.2mm; }
.schedule-ultra .schedule-groups { grid-template-columns: repeat(var(--schedule-columns, 2), minmax(0,1fr)); gap: .65mm; }
.schedule-ultra .schedule-group { border-radius: 1mm; }
.schedule-ultra .schedule-group h3 { padding: .55mm .8mm; font-size: .31rem; }
.schedule-ultra .hour-row { grid-template-columns: 4.2mm 1fr; min-height: 2.65mm; }
.schedule-ultra .hour, .schedule-ultra .minutes { font-size: .29rem; }
.schedule-ultra .minutes { gap: .15mm .5mm; padding: .22mm .5mm; }
.schedule-ultra .no-service { padding: .8mm; font-size: .29rem; }
.schedule-ultra .sheet-side { gap: .8mm; }
.schedule-ultra .sheet-legends { padding: 1mm 1.2mm; }
.schedule-ultra .sheet-legends > h3 { margin-bottom: .5mm; }
.schedule-ultra .sheet-legend-list { gap: .45mm .8mm; }
.schedule-ultra .sheet-legend { grid-template-columns: 4.5mm minmax(0,1fr); gap: .6mm; }
.schedule-ultra .sheet-legend-symbol { min-height: 3.8mm; font-size: .32rem; }
.schedule-ultra .sheet-legend strong { font-size: .32rem; }
.schedule-ultra .sheet-legend div > span { font-size: .28rem; }
.schedule-ultra .sheet-note { padding: .8mm 1mm; font-size: .3rem; }

/* A4-en a menetrendi időpontok nyomtatási olvashatósága elsődleges.
   A sűrűségi módok sem zsugorítják 3–4 pontosra a számokat. */
.paper-A4.schedule-compact .schedule-group h3 { padding: 1.25mm 1.6mm; font-size: .61rem; }
.paper-A4.schedule-compact .hour-row { grid-template-columns: 7.3mm 1fr; min-height: 4.55mm; }
.paper-A4.schedule-compact .hour,
.paper-A4.schedule-compact .minutes { font-size: .58rem; }
.paper-A4.schedule-compact .minutes { gap: .35mm 1.05mm; padding: .65mm 1mm; }

.paper-A4.schedule-dense .schedule-group h3 { padding: 1mm 1.35mm; font-size: .55rem; }
.paper-A4.schedule-dense .hour-row { grid-template-columns: 6.6mm 1fr; min-height: 3.95mm; }
.paper-A4.schedule-dense .hour,
.paper-A4.schedule-dense .minutes { font-size: .52rem; }
.paper-A4.schedule-dense .minutes { gap: .25mm .85mm; padding: .48mm .8mm; }

.paper-A4.schedule-ultra .schedule-group h3 { padding: .8mm 1.1mm; font-size: .49rem; }
.paper-A4.schedule-ultra .hour-row { grid-template-columns: 6mm 1fr; min-height: 3.4mm; }
.paper-A4.schedule-ultra .hour,
.paper-A4.schedule-ultra .minutes { font-size: .46rem; }
.paper-A4.schedule-ultra .minutes { gap: .2mm .7mm; padding: .35mm .65mm; }

.notice { padding: 14px 16px; border-radius: 14px; background: #e8f5ff; color: #225875; border: 1px solid #cae5f6; font-size: .82rem; line-height: 1.55; }
.notice-warning { background: #fff6df; color: #735310; border-color: #f2ddb0; }
.code { padding: 2px 6px; border-radius: 6px; background: #e9f0f5; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.hidden { display: none !important; }

@media (max-width: 1060px) {
    .route-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .editor-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .editor-layout > :last-child { grid-column: 1 / -1; }
    .sticky-panel { position: static; }
}
@media (max-width: 780px) {
    .site-header { position: relative; align-items: flex-start; flex-direction: column; padding: 13px 18px; }
    .top-nav { justify-content: flex-start; }
    .page-shell, .page-shell-wide { width: min(100% - 22px, 1180px); padding-top: 30px; }
    .hero { grid-template-columns: 1fr; padding-top: 10px; }
    .hero-visual { min-height: 280px; }
    .section-head { align-items: flex-start; flex-direction: column; }
    .route-grid, .editor-layout, .screen-board-wrap, .legend-manager-grid { grid-template-columns: 1fr; }
    .board-controls { position: static; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }
    .site-footer { align-items: flex-start; flex-direction: column; }
    .legend-editor-item { grid-template-columns: auto minmax(0,1fr); }
    .legend-item-actions { grid-column: 2; display: flex; flex-wrap: wrap; }
}
@media (max-width: 520px) {
    .route-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2.8rem; }
    .mini-board { width: 90%; }
    .top-nav > a:not(.button), .user-pill { padding: 7px 8px; font-size: .75rem; }
    .board-preview { padding: 10px; }
    .add-stop-form { grid-template-columns: 1fr 72px; }
    .add-stop-form .button { grid-column: 1 / -1; }
    .legend-edit-head { grid-template-columns: 68px minmax(0,1fr); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
