:root {
    color-scheme: light;
    --bg: #f4f7fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #dce5ec;
    --line-strong: #cbd8e2;
    --text: #17212b;
    --muted: #657483;
    --primary: #1769e0;
    --primary-dark: #1054b8;
    --primary-soft: #eaf2ff;
    --success: #1e8b5b;
    --success-soft: #eaf8f1;
    --warning: #a66a00;
    --warning-soft: #fff5dd;
    --danger: #c43c3c;
    --danger-soft: #fff0f0;
    --shadow: 0 12px 34px rgba(25, 46, 66, .08);
    --radius: 20px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { touch-action: manipulation; }

.app-shell { width: 100%; min-height: 100vh; }
.app-main { width: min(1420px, 100%); margin: 0 auto; padding: 26px; }

.topbar {
    position: sticky;
    z-index: 100;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    min-height: 74px;
    padding: 10px max(24px, calc((100vw - 1420px) / 2 + 26px));
    border-bottom: 1px solid rgba(203, 216, 226, .88);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(145deg, var(--primary), #3c85e9);
    color: #fff;
    box-shadow: 0 8px 18px rgba(23, 105, 224, .24);
    font-weight: 850;
    font-size: 1.15rem;
}
.brand-mark.large { width: 62px; height: 62px; flex-basis: 62px; border-radius: 19px; font-size: 1.4rem; }
.brand > span:last-child { display: grid; min-width: 0; gap: 1px; }
.brand strong { font-size: 1rem; }
.brand small { color: var(--muted); font-size: .76rem; }
.topbar-nav { display: flex; align-items: center; gap: 7px; }
.topbar-nav a, .link-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #425261;
    cursor: pointer;
    font-weight: 700;
}
.topbar-nav a:hover, .link-button:hover { background: var(--surface-soft); color: var(--text); }
.topbar-nav form { margin: 0; }

.flash {
    width: min(1368px, calc(100% - 52px));
    margin: 18px auto -6px;
    padding: 14px 18px;
    border: 1px solid;
    border-radius: 14px;
    font-weight: 650;
}
.flash-success { border-color: #b8e4cf; background: var(--success-soft); color: #126641; }
.flash-error { border-color: #efc2c2; background: var(--danger-soft); color: #9e2929; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
}
.page-head.compact { align-items: flex-start; }
.page-head h1 { margin: 5px 0 6px; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.15; letter-spacing: -.035em; }
.page-head p { max-width: 720px; margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary); font-size: .76rem; font-weight: 850; letter-spacing: .1em; }
.back-link { display: block; width: fit-content; margin-bottom: 17px; color: var(--primary); font-weight: 750; }

.button {
    display: inline-flex;
    min-height: 48px;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 19px;
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 800;
    text-align: center;
    transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { background: var(--primary); color: #fff; box-shadow: 0 9px 20px rgba(23, 105, 224, .18); }
.button.primary:hover { background: var(--primary-dark); }
.button.dark { background: #263747; color: #fff; }
.button.secondary { border-color: #b9ccec; background: var(--primary-soft); color: #155abc; }
.button.ghost { border-color: var(--line-strong); background: var(--surface); color: #41515f; }
.button.large { min-height: 56px; padding-inline: 25px; font-size: 1rem; }
.button.small { min-height: 39px; padding-inline: 13px; border-radius: 11px; font-size: .82rem; }
.button.full { width: 100%; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.icon-button {
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 800;
}

.field { display: grid; min-width: 0; gap: 8px; }
.field > span { color: #354555; font-size: .9rem; font-weight: 800; }
.field > span small { color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    outline: 0;
    background: #fff;
    color: var(--text);
}
.field textarea { min-height: 104px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(23, 105, 224, .11); }
.field input:disabled { background: #f0f4f7; color: #778592; }
.field small { color: var(--muted); }
.stack-form { display: grid; gap: 18px; }
.two-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.auth-page .app-main { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-wrap { width: min(520px, 100%); }
.auth-card { padding: 34px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 17px; margin-bottom: 30px; }
.auth-brand h1 { margin: 0 0 3px; font-size: 1.65rem; }
.auth-brand p { margin: 0; color: var(--muted); }
.help-text { margin: 22px 0 0; color: var(--muted); font-size: .88rem; text-align: center; }

.join-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .7fr);
    align-items: center;
    gap: 25px;
    margin-bottom: 24px;
    padding: 23px 25px;
    border: 1px solid #cdddf3;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #fff, #f1f6ff);
}
.join-card h2 { margin: 0 0 4px; font-size: 1.13rem; }
.join-card p { margin: 0; color: var(--muted); }
.join-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.join-form input {
    min-width: 0;
    min-height: 50px;
    padding: 0 15px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    outline: 0;
    background: #fff;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 850;
}
.join-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(23, 105, 224, .1); }
.room-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.room-card, .empty-card, .form-card, .submit-card, .profile-simple-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.room-card { display: flex; min-height: 310px; flex-direction: column; padding: 22px; }
.room-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-pill, .role-pill { display: inline-flex; min-height: 28px; align-items: center; padding: 0 10px; border-radius: 999px; font-size: .72rem; font-weight: 850; }
.status-pill.active { background: var(--success-soft); color: #16724a; }
.status-pill.muted { background: #eef2f5; color: #647482; }
.role-pill { background: var(--primary-soft); color: #195cae; }
.room-card h2 { margin: 20px 0 8px; font-size: 1.25rem; }
.room-card > p { flex: 1; margin: 0 0 18px; color: var(--muted); }
.room-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; }
.room-meta div { min-width: 0; padding: 10px; border-radius: 12px; background: var(--surface-soft); }
.room-meta dt { color: var(--muted); font-size: .72rem; }
.room-meta dd { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; font-size: .86rem; font-weight: 800; white-space: nowrap; }
.empty-card { grid-column: 1 / -1; padding: 48px 24px; text-align: center; }
.empty-card h2 { margin: 10px 0 7px; }
.empty-card p { max-width: 520px; margin: 0 auto 22px; color: var(--muted); }
.empty-icon { font-size: 2.3rem; }

.create-room-layout { display: grid; gap: 22px; }
.form-card { padding: 25px; }
.section-title { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 23px; }
.step-number { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 850; }
.section-title h2 { margin: 0 0 3px; font-size: 1.25rem; }
.section-title p { margin: 0; color: var(--muted); }
.map-form-card { overflow: hidden; }
.route-step-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.route-step {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 0 11px;
    min-width: 0;
    min-height: 74px;
    align-items: center;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}
.route-step > span { grid-row: 1 / 3; display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: #eef3f7; font-weight: 850; }
.route-step strong { align-self: end; }
.route-step small { align-self: start; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.route-step.active { border-color: #8eb8ee; background: var(--primary-soft); box-shadow: inset 0 0 0 1px rgba(23, 105, 224, .12); }
.route-step.active > span { background: var(--primary); color: #fff; }
.route-step.compact, .route-step-buttons.compact .route-step { min-height: 58px; }

.map-frame {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background:
        linear-gradient(rgba(209, 221, 229, .55) 1px, transparent 1px),
        linear-gradient(90deg, rgba(209, 221, 229, .55) 1px, transparent 1px),
        #eef3f6;
    background-size: 48px 48px;
    isolation: isolate;
}
.create-map-frame { height: clamp(360px, 58vh, 620px); }
.convoy-map-frame { height: clamp(430px, 66vh, 760px); }
.map-canvas { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; user-select: none; background: transparent; }
.map-canvas.is-dragging { cursor: grabbing; }
.map-tile-layer, .map-marker-layer, .map-vector-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-tile { position: absolute; width: 256px; height: 256px; object-fit: cover; background: #edf2f5; user-select: none; -webkit-user-drag: none; }
.map-vector-layer { overflow: visible; }
.map-route-line { fill: none; stroke: #1769e0; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 2px rgba(19, 69, 126, .25)); }
.map-route-line.fallback { stroke-dasharray: 12 10; }
.map-marker { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer; }
.map-marker-pin {
    display: grid;
    min-width: 46px;
    height: 46px;
    place-items: center;
    padding: 0 8px;
    border: 4px solid #fff;
    border-radius: 17px 17px 17px 4px;
    background: #1769e0;
    color: #fff;
    box-shadow: 0 6px 18px rgba(20, 48, 75, .28);
    transform: rotate(-45deg);
    font-weight: 850;
}
.map-marker-pin > span { transform: rotate(45deg); }
.map-marker.start .map-marker-pin { background: #1e8b5b; }
.map-marker.end .map-marker-pin { background: #c43c3c; }
.map-marker.member .map-marker-pin { width: 48px; border-radius: 50%; transform: none; background: #263747; }
.map-marker.member .map-marker-pin > span { transform: none; }
.map-marker.member.self .map-marker-pin { background: var(--primary); }
.map-marker.member.owner .map-marker-pin { background: #7c4cc9; }
.map-marker.member.stale { opacity: .55; }
.map-marker-label {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    width: max-content;
    max-width: 180px;
    padding: 7px 9px;
    border: 1px solid rgba(203, 216, 226, .9);
    border-radius: 10px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 7px 18px rgba(23, 42, 61, .15);
    color: var(--text);
    font-size: .76rem;
    font-weight: 750;
    transform: translateX(-50%);
    white-space: nowrap;
}
.map-attribution { position: absolute; z-index: 7; right: 7px; bottom: 5px; padding: 2px 5px; border-radius: 5px; background: rgba(255,255,255,.88); color: #4e5e6b; font-size: 10px; }
.map-status { position: absolute; z-index: 9; top: 12px; left: 50%; max-width: calc(100% - 130px); padding: 8px 12px; border: 1px solid rgba(203,216,226,.92); border-radius: 999px; background: rgba(255,255,255,.94); color: #52616e; font-size: .78rem; font-weight: 750; text-align: center; transform: translateX(-50%); pointer-events: none; }
.map-status.ready { color: #126641; }
.map-status.warning { color: #935d00; }
.map-zoom-controls { position: absolute; z-index: 10; top: 12px; right: 12px; display: grid; gap: 7px; }
.map-zoom-controls button { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line-strong); border-radius: 13px; background: rgba(255,255,255,.96); color: var(--text); cursor: pointer; font-size: 1.35rem; font-weight: 800; box-shadow: 0 5px 14px rgba(31,51,69,.12); }
.map-bottom-buttons { position: absolute; z-index: 10; right: 12px; bottom: 25px; display: flex; gap: 7px; }
.map-bottom-buttons button { min-height: 44px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 13px; background: rgba(255,255,255,.96); color: #254258; cursor: pointer; font-weight: 800; box-shadow: 0 5px 14px rgba(31,51,69,.12); }
.map-action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.route-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-soft); }
.route-summary div { display: grid; gap: 2px; }
.route-summary span { color: var(--muted); font-size: .78rem; }
.route-summary strong { font-size: 1.03rem; }
.route-summary small { grid-column: 1 / -1; color: var(--muted); }
.submit-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 25px; }
.submit-card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.submit-card p { margin: 0; color: var(--muted); }

.convoy-body .app-main { width: 100%; max-width: 1600px; padding: 18px 22px calc(26px + var(--safe-bottom)); }
.convoy-page { display: grid; gap: 15px; min-width: 0; }
.convoy-header { min-width: 0; padding: 17px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.convoy-title-row { display: flex; align-items: center; gap: 13px; min-width: 0; }
.convoy-title { flex: 1; min-width: 0; }
.convoy-title h1 { margin: 1px 0 1px; overflow: hidden; text-overflow: ellipsis; font-size: clamp(1.32rem, 2.3vw, 1.9rem); line-height: 1.2; white-space: nowrap; }
.convoy-title p { margin: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.live-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .73rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.live-status i { width: 8px; height: 8px; border-radius: 50%; background: #93a0aa; }
.live-status.online { color: #16724a; }
.live-status.online i { background: #29a66b; box-shadow: 0 0 0 5px rgba(41,166,107,.12); }
.convoy-summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.convoy-summary-strip div { min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-soft); }
.convoy-summary-strip span { display: block; color: var(--muted); font-size: .72rem; }
.convoy-summary-strip strong { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; white-space: nowrap; }
.convoy-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(350px, .65fr); align-items: start; gap: 15px; min-width: 0; }
.convoy-map-card, .convoy-panel { min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.route-info-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: center; gap: 9px; padding: 12px 14px; border-top: 1px solid var(--line); }
.route-info-bar > div { min-width: 0; }
.route-info-bar span { display: block; color: var(--muted); font-size: .72rem; }
.route-info-bar strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; white-space: nowrap; }
.route-editor { padding: 15px; border-top: 1px solid var(--line); background: #f8fbff; }
.route-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.route-editor-head div { display: grid; }
.route-editor-head small { color: var(--muted); }
.convoy-panel { height: clamp(522px, calc(66vh + 63px), 823px); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.panel-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 7px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.panel-tabs button { min-height: 45px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; }
.panel-tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 3px 10px rgba(28,48,67,.08); }
.count-badge { display: inline-grid; min-width: 22px; height: 22px; place-items: center; margin-left: 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; }
.panel-section { display: none; min-height: 0; overflow: hidden; }
.panel-section.active { display: flex; flex-direction: column; }
.panel-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px 10px; }
.panel-section-head h2 { margin: 0; font-size: 1rem; }
.panel-section-head span { color: var(--muted); font-size: .76rem; }
.member-list { min-height: 0; overflow-y: auto; padding: 4px 10px 14px; }
.member-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-width: 0; padding: 11px 7px; border-bottom: 1px solid #edf1f4; }
.member-avatar { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 15px; background: #e8eef4; color: #344a5d; font-weight: 850; }
.member-avatar.self { background: var(--primary-soft); color: #155abc; }
.member-copy { min-width: 0; }
.member-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-copy span { display: block; overflow: hidden; color: var(--muted); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.member-metrics { text-align: right; }
.member-metrics strong { display: block; font-size: .85rem; }
.member-metrics span { display: block; color: var(--muted); font-size: .7rem; }
.member-row.stale { opacity: .58; }
.chat-section { min-height: 0; }
.message-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 15px; background: #f8fafc; }
.message-item { width: fit-content; max-width: 88%; margin: 8px 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 13px 13px 13px 4px; background: #fff; }
.message-item.self { margin-left: auto; border-color: #bdd2f1; border-radius: 13px 13px 4px 13px; background: var(--primary-soft); }
.message-item.alert { width: 100%; max-width: 100%; border-color: #f0c7a5; border-radius: 12px; background: #fff5e8; color: #81460e; text-align: center; }
.message-item strong { display: block; margin-bottom: 2px; font-size: .75rem; }
.message-item p { margin: 0; overflow-wrap: anywhere; }
.message-item time { display: block; margin-top: 3px; color: var(--muted); font-size: .66rem; text-align: right; }
.message-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #fff; }
.message-composer textarea { width: 100%; min-width: 0; min-height: 48px; max-height: 130px; padding: 12px 13px; border: 1px solid var(--line-strong); border-radius: 13px; outline: 0; resize: none; }
.message-composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(23,105,224,.1); }
.quick-alerts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick-alert { display: flex; min-width: 0; min-height: 68px; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; border: 1px solid; border-radius: 16px; cursor: pointer; font-size: 1rem; }
.quick-alert span { font-size: 1.35rem; }
.quick-alert.warning { border-color: #efd49a; background: #fff7e4; color: #8c5900; }
.quick-alert.stop { border-color: #c7d2dc; background: #f0f4f7; color: #344755; }
.quick-alert.danger { border-color: #efb3b3; background: #fff0f0; color: #a62e2e; }
.quick-alert.break { border-color: #b8dfcf; background: #edf9f3; color: #126641; }
.alert-banner { position: absolute; z-index: 20; right: 14px; left: 14px; top: 70px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 15px; border: 2px solid #e3a05e; border-radius: 15px; background: #fff7ea; box-shadow: 0 12px 30px rgba(61,40,18,.22); color: #703d09; }
.alert-banner div { display: grid; }
.alert-banner button { min-height: 42px; padding: 0 15px; border: 0; border-radius: 11px; background: #8d4d0e; color: #fff; cursor: pointer; font-weight: 850; }
.convoy-footer-actions { display: flex; justify-content: flex-end; }

.profile-simple-card { display: grid; grid-template-columns: 170px minmax(0, 620px); align-items: start; gap: 28px; padding: 28px; }
.profile-avatar-large { display: grid; width: 150px; height: 150px; place-items: center; border-radius: 40px; background: var(--primary-soft); color: var(--primary); font-size: 2.2rem; font-weight: 900; }
.profile-form-simple { min-width: 0; }

.toast-region { position: fixed; z-index: 500; right: 18px; bottom: calc(18px + var(--safe-bottom)); display: grid; gap: 9px; width: min(380px, calc(100% - 36px)); pointer-events: none; }
.toast { padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.97); box-shadow: 0 14px 30px rgba(25,45,64,.18); font-weight: 700; animation: toast-in .18s ease; }
.toast.error { border-color: #efbcbc; background: #fff1f1; color: #9d2828; }
.toast.success { border-color: #b9e2ce; background: #edf9f3; color: #126641; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.error-page { display: grid; min-height: 60vh; place-items: center; align-content: center; gap: 8px; text-align: center; }
.error-page h1 { margin: 0; }
.error-page p { max-width: 540px; margin: 0 0 16px; color: var(--muted); }
.error-code { color: var(--primary); font-size: 3rem; font-weight: 900; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 1100px) {
    .room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .convoy-layout { grid-template-columns: minmax(0, 1fr); }
    .convoy-panel { height: 560px; }
    .convoy-map-frame { height: clamp(420px, 60vh, 650px); }
}

@media (max-width: 760px) {
    body { font-size: 16px; }
    .app-main { padding: 17px 14px calc(24px + var(--safe-bottom)); }
    .topbar { min-height: 66px; padding: 8px 13px; }
    .brand small { display: none; }
    .brand-mark { width: 42px; height: 42px; flex-basis: 42px; border-radius: 13px; }
    .topbar-nav { gap: 2px; }
    .topbar-nav a, .link-button { min-height: 42px; padding: 0 9px; font-size: .83rem; }
    .flash { width: calc(100% - 28px); margin-top: 13px; }
    .page-head { align-items: stretch; flex-direction: column; gap: 15px; }
    .page-head .button { width: 100%; }
    .join-card { grid-template-columns: minmax(0, 1fr); padding: 19px; }
    .room-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .room-card { min-height: 0; padding: 19px; }
    .auth-card { padding: 24px 20px; border-radius: 21px; }
    .two-fields { grid-template-columns: minmax(0, 1fr); }
    .form-card { padding: 18px; }
    .route-step-buttons { gap: 8px; }
    .route-step { grid-template-columns: 34px minmax(0,1fr); min-height: 70px; padding: 9px 10px; }
    .route-step > span { width: 34px; height: 34px; }
    .create-map-frame { height: min(58vh, 480px); min-height: 350px; }
    .submit-card { align-items: stretch; flex-direction: column; padding: 20px; }
    .submit-card .button { width: 100%; }
    .profile-simple-card { grid-template-columns: minmax(0,1fr); padding: 21px; }
    .profile-avatar-large { width: 110px; height: 110px; border-radius: 30px; }

    .convoy-body .app-main { padding: 10px 9px calc(18px + var(--safe-bottom)); }
    .convoy-page { gap: 10px; }
    .convoy-header { padding: 12px; border-radius: 16px; }
    .convoy-title-row { gap: 9px; }
    .convoy-title p { font-size: .82rem; }
    .convoy-summary-strip { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
    .convoy-summary-strip div { padding: 8px 9px; }
    .convoy-map-card, .convoy-panel { border-radius: 16px; }
    .convoy-map-frame { height: min(54svh, 510px); min-height: 360px; }
    .route-info-bar { grid-template-columns: repeat(3, minmax(0,1fr)); padding: 10px; }
    .route-info-bar .button { grid-column: 1 / -1; width: 100%; }
    .convoy-panel { height: 520px; }
    .quick-alerts { position: sticky; z-index: 80; bottom: calc(7px + var(--safe-bottom)); grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; padding: 7px; border: 1px solid rgba(203,216,226,.92); border-radius: 16px; background: rgba(255,255,255,.96); box-shadow: 0 10px 28px rgba(23,43,61,.18); backdrop-filter: blur(10px); }
    .quick-alert { min-height: 62px; flex-direction: column; gap: 1px; padding: 5px 2px; border-radius: 12px; font-size: .73rem; }
    .quick-alert span { font-size: 1.12rem; }
    .message-composer { grid-template-columns: minmax(0,1fr); }
    .message-composer .button { width: 100%; }
    .map-status { max-width: calc(100% - 116px); font-size: .7rem; }
    .map-zoom-controls button { width: 42px; height: 42px; }
}

@media (max-width: 430px) {
    .brand > span:last-child strong { font-size: .88rem; }
    .topbar-nav a { display: none; }
    .page-head h1 { font-size: 1.7rem; }
    .join-form { grid-template-columns: minmax(0,1fr); }
    .join-form .button { width: 100%; }
    .room-meta { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .route-step small { font-size: .69rem; }
    .map-action-row { display: grid; grid-template-columns: minmax(0,1fr); }
    .map-action-row .button { width: 100%; }
    .convoy-title-row .icon-button { width: 44px; height: 44px; flex-basis: 44px; }
    .convoy-title h1 { font-size: 1.18rem; }
    .convoy-map-frame { min-height: 340px; }
    .route-info-bar { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .route-info-bar > div:nth-child(3) { grid-column: 1 / -1; }
    .route-info-bar .button { grid-column: 1 / -1; }
    .convoy-panel { height: 500px; }
    .member-row { grid-template-columns: 44px minmax(0,1fr); }
    .member-metrics { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* =========================================================
   AUTH / REGISTER — v3.0.1
   ========================================================= */
.auth-wrap-wide { width: min(680px, 100%); }
.stack-form { display: grid; gap: 17px; }
.two-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.existing-account-note { display: grid; gap: 8px; margin-top: 22px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); text-align: center; }
.existing-account-note strong { font-size: .95rem; }
.existing-account-note span { color: var(--muted); font-size: .84rem; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); background: #fffafa; }
.field.has-error input:focus, .field.has-error textarea:focus, .field.has-error select:focus { box-shadow: 0 0 0 4px rgba(196, 60, 60, .10); }
.field .field-error { color: var(--danger); font-weight: 750; }
.setup-help-card { width: min(620px, 100%); margin: 10px 0 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.setup-help-card strong { display: block; margin-bottom: 8px; }
.setup-help-card ol { margin: 0; padding-left: 21px; }
.setup-help-card li + li { margin-top: 6px; }
.setup-help-card code { padding: 2px 5px; border-radius: 5px; background: var(--surface-soft); }
.setup-help-card small { display: block; margin-top: 13px; color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 760px) {
    .auth-wrap-wide { width: 100%; }
    .two-fields { grid-template-columns: minmax(0, 1fr); }
    .auth-brand { align-items: flex-start; }
}

/* ==========================================================
   KonvoyLink 3.1 Bootstrap entegrasyonu ve mobil stabilizasyon
   ========================================================== */
body { overflow-x: hidden; }
.app-container { width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 24px; }
.app-navbar { z-index: 1000; box-shadow: 0 2px 14px rgba(15, 23, 42, .05); }
.app-navbar-inner { max-width: 1480px; margin: 0 auto; padding: 10px 24px; }
.app-navbar .brand { display: inline-flex; align-items: center; gap: 11px; }
.app-navbar .navbar-brand strong, .app-navbar .navbar-brand small { display: block; line-height: 1.15; }
.app-navbar .navbar-brand small { margin-top: 3px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.app-navbar .nav-link { padding: 10px 13px !important; border-radius: 11px; color: #4b5967 !important; font-weight: 750; }
.app-navbar .nav-link:hover { background: var(--surface-soft); color: var(--primary) !important; }
.app-navbar .admin-link { background: var(--primary-soft); color: var(--primary) !important; }
.app-logout-button { min-height: 40px; padding-inline: 15px; border-radius: 11px; font-weight: 700; }
.app-alert { margin: 18px 0 0; border-radius: 14px; font-weight: 650; }
.auth-page { background: linear-gradient(145deg, #edf4ff 0%, #f7f9fc 46%, #eff4f7 100%); }
.auth-page .app-container { max-width: none; padding: 0; }
.auth-bootstrap-wrap { width: min(520px, 100%); padding: 20px; }
.auth-bootstrap-wrap.wide { width: min(760px, 100%); }
.auth-bootstrap-card { border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 18px 50px rgba(24, 46, 69, .1); }
.auth-bootstrap-card .card-body { padding: 34px; }
.auth-bootstrap-logo { display: grid; flex: 0 0 58px; width: 58px; height: 58px; place-items: center; border-radius: 18px; background: linear-gradient(145deg, #2a78e8, #165dbf); color: #fff; font-size: 1.4rem; font-weight: 900; box-shadow: 0 12px 26px rgba(23, 105, 224, .25); }
.auth-bootstrap-title { margin: 0; font-size: 1.55rem; letter-spacing: -.025em; }
.auth-bootstrap-subtitle { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.auth-bootstrap-card .form-label { color: #354555; font-size: .9rem; font-weight: 750; }
.auth-bootstrap-card .form-control { min-height: 52px; border-color: var(--line-strong); border-radius: 13px; }
.auth-bootstrap-card .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 .25rem rgba(23, 105, 224, .11); }
.auth-bootstrap-card .btn { min-height: 52px; border-radius: 13px; font-weight: 750; }
.auth-note { padding: 15px; border-radius: 14px; background: #f6f8fb; color: var(--muted); font-size: .87rem; line-height: 1.55; }
.field-error { display: block; margin-top: 6px; color: var(--danger) !important; font-weight: 650; }
.bootstrap-profile-card { max-width: 860px; margin: 0 auto; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.bootstrap-profile-card .card-body { padding: 28px; }
.bootstrap-profile-avatar { display: grid; width: 92px; height: 92px; place-items: center; margin: 0 auto 22px; border-radius: 28px; background: var(--primary-soft); color: var(--primary); font-size: 1.5rem; font-weight: 900; }
.bootstrap-profile-card .form-control { min-height: 50px; border-radius: 13px; border-color: var(--line-strong); }
.bootstrap-profile-card .btn { min-height: 52px; border-radius: 13px; font-weight: 750; }
.error-standalone { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f4f7fa; color: #17212b; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.error-standalone-card { width: min(560px, 100%); padding: 34px; border: 1px solid #dce5ec; border-radius: 24px; background: #fff; box-shadow: 0 18px 50px rgba(20, 43, 65, .09); text-align: center; }
.error-standalone-code { display: grid; width: 72px; height: 72px; margin: 0 auto 20px; place-items: center; border-radius: 22px; background: #fff0f0; color: #bd3434; font-size: 1.3rem; font-weight: 900; }
.error-standalone-card h1 { margin: 0 0 10px; font-size: 1.55rem; }
.error-standalone-card p { margin: 0 0 22px; color: #687584; line-height: 1.6; }
.error-standalone-card a { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 0 18px; border-radius: 13px; background: #1769e0; color: #fff; text-decoration: none; font-weight: 750; }
@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse { padding: 12px 0 3px; }
    .app-navbar .navbar-nav { align-items: stretch !important; }
    .app-navbar .nav-item, .app-navbar .nav-link, .app-navbar form, .app-logout-button { width: 100%; }
    .app-logout-button { min-height: 44px; }
}
@media (max-width: 767.98px) {
    .app-container { padding: 0 14px; }
    .app-navbar-inner { padding: 8px 14px; }
    .auth-bootstrap-card .card-body { padding: 24px 20px; }
    .auth-bootstrap-wrap { padding: 14px; }
    .bootstrap-profile-card .card-body { padding: 20px; }
    .page-head { align-items: stretch; flex-direction: column; }
}
@media (max-width: 575.98px) {
    .auth-bootstrap-card { border-radius: 20px; }
    .auth-bootstrap-logo { width: 50px; height: 50px; flex-basis: 50px; border-radius: 15px; }
    .auth-bootstrap-title { font-size: 1.35rem; }
    .app-navbar .navbar-brand small { display: none; }
}


/* =========================================================
   KONVOYLINK MOTO THEME — v3.2.0
   Soft, yüksek kontrastlı ve yaş dostu arayüz
   ========================================================= */
:root {
    --bg: #f3f1ec;
    --surface: #ffffff;
    --surface-soft: #f8f7f3;
    --line: #dedbd3;
    --line-strong: #c8c4ba;
    --text: #202326;
    --muted: #687078;
    --primary: #c77b18;
    --primary-dark: #a75f0a;
    --primary-soft: #fff1d8;
    --success: #39735b;
    --success-soft: #eaf5ef;
    --warning: #a76500;
    --warning-soft: #fff2d2;
    --danger: #b8443d;
    --danger-soft: #fff0ee;
    --shadow: 0 14px 36px rgba(38, 40, 41, .08);
}
body {
    background:
        radial-gradient(circle at 12% 0%, rgba(199,123,24,.08), transparent 28rem),
        var(--bg);
}
.app-navbar {
    border-bottom-color: rgba(48,52,55,.12) !important;
    background: rgba(255,255,255,.96) !important;
    box-shadow: 0 8px 28px rgba(38,40,41,.05);
}
.brand-mark,
.auth-bootstrap-logo,
.admin-brand-mark {
    background: linear-gradient(145deg, #252a2e, #111315) !important;
    color: #efad43 !important;
    box-shadow: 0 10px 22px rgba(22,24,25,.22) !important;
}
.brand-mark svg,
.auth-bootstrap-logo svg,
.admin-brand-mark svg { width: 72%; height: 72%; display: block; }
.brand strong { color: #222629; letter-spacing: -.01em; }
.nav-link { border-radius: 11px; font-weight: 700; }
.nav-link:hover { background: #f4f1ea; }
.admin-link { color: #8d570d !important; }
.btn-primary,
.button.primary {
    border-color: #c77b18 !important;
    background: #c77b18 !important;
    color: #fff !important;
    box-shadow: 0 10px 22px rgba(167,95,10,.18) !important;
}
.btn-primary:hover,
.button.primary:hover { border-color: #a75f0a !important; background: #a75f0a !important; }
.btn-outline-primary,
.button.secondary { border-color: #d7b06f !important; background: #fff8ea !important; color: #85510c !important; }
.button.dark { background: #2e3438; }
.page-head h1,
.convoy-title h1 { color: #202326; }
.eyebrow { color: #9a5d0d; }
.join-card,
.room-card,
.form-card,
.submit-card,
.profile-simple-card,
.convoy-header,
.convoy-map-card,
.convoy-panel {
    border-color: #ddd8ce;
    box-shadow: var(--shadow);
}
.room-card { position: relative; overflow: hidden; }
.room-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(#d89731, #3b4145);
}
.status-pill.active { background: #eaf5ef !important; color: #2f6a51 !important; }
.role-pill { background: #f0eee8 !important; color: #4c5358 !important; }

/* Login — güven veren motorcu kimliği */
.auth-page {
    background:
        linear-gradient(135deg, rgba(24,27,29,.97), rgba(38,43,46,.92)),
        radial-gradient(circle at 80% 20%, rgba(224,151,45,.35), transparent 22rem);
}
.auth-bootstrap-wrap::before {
    content: 'YOLDA BİRLİKTE · GÜVENLE';
    display: block;
    margin-bottom: 14px;
    color: rgba(255,255,255,.72);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-align: center;
}
.auth-bootstrap-card {
    border: 1px solid rgba(255,255,255,.28) !important;
    background: rgba(255,255,255,.985);
    box-shadow: 0 28px 70px rgba(0,0,0,.32);
}
.auth-bootstrap-title { color: #202326; }
.auth-bootstrap-subtitle { color: #687078; }
.auth-bootstrap-card .form-control {
    min-height: 54px;
    border-color: #cbc7bd;
    border-radius: 13px;
    font-size: 1rem;
}
.auth-bootstrap-card .form-control:focus {
    border-color: #c77b18;
    box-shadow: 0 0 0 4px rgba(199,123,24,.13);
}

/* Harita hiçbir zaman siyah görünmez */
.map-frame,
.map-canvas,
.convoy-map-frame,
.create-map-frame {
    background-color: #e9ece8 !important;
    background-image:
        linear-gradient(28deg, transparent 46%, rgba(255,255,255,.85) 47%, rgba(255,255,255,.85) 53%, transparent 54%),
        linear-gradient(118deg, transparent 46%, rgba(205,211,205,.72) 47%, rgba(205,211,205,.72) 51%, transparent 52%),
        linear-gradient(#dfe4df 1px, transparent 1px),
        linear-gradient(90deg, #dfe4df 1px, transparent 1px) !important;
    background-size: 160px 160px, 220px 220px, 42px 42px, 42px 42px !important;
}
.map-tile { opacity: 1 !important; filter: none !important; mix-blend-mode: normal !important; }
.map-status { border-color: rgba(46,52,56,.18); background: rgba(255,255,255,.94); color: #394147; }
.map-route-line { stroke: #c96f16 !important; stroke-width: 6 !important; filter: drop-shadow(0 2px 2px rgba(255,255,255,.9)); }
.map-marker-pin { background: #2e3438 !important; border-color: #fff !important; color: #f3b34e !important; }
.map-marker.self .map-marker-pin { background: #c77b18 !important; color: #fff !important; }
.map-marker.leader .map-marker-pin { box-shadow: 0 0 0 5px rgba(199,123,24,.18), 0 8px 18px rgba(35,38,40,.25); }

/* Convoy ekranı: net durum hiyerarşisi */
.convoy-body { background: #edeae4; }
.convoy-header {
    border-top: 4px solid #c77b18;
    background: linear-gradient(135deg, #fff, #faf8f3);
}
.live-status { color: #2f6a51; font-weight: 800; }
.live-status i { background: #3b7b5e; box-shadow: 0 0 0 5px rgba(59,123,94,.14); }
.convoy-summary-strip div { border-color: #dfdbd2; background: #f7f5f0; }
.convoy-summary-strip span { color: #70777c; }
.convoy-summary-strip strong { color: #252a2e; font-size: 1rem; }
.route-info-bar { background: #fff; border-top-color: #ddd8ce; }
.panel-tabs button.active { color: #8b530a; border-color: #c77b18; background: #fff8e9; }
.quick-alert { font-weight: 850; box-shadow: none; }
.quick-alert.warning { border-color: #e0bb75; background: #fff5df; color: #825108; }
.quick-alert.stop { border-color: #aeb7bd; background: #f2f4f4; color: #343b40; }
.quick-alert.danger { border-color: #db9b96; background: #fff0ee; color: #a53630; }
.quick-alert.break { border-color: #9ccbb5; background: #edf7f1; color: #2d674f; }

@media (max-width: 760px) {
    .app-container { padding-right: 0 !important; padding-left: 0 !important; }
    .app-navbar-inner { padding-inline: 14px !important; }
    .navbar-collapse { padding-bottom: 12px; }
    .navbar-nav { align-items: stretch !important; }
    .navbar-nav .nav-link,
    .app-logout-button { width: 100%; min-height: 46px; justify-content: flex-start; text-align: left; }
    .auth-bootstrap-wrap { padding: 16px 12px; }
    .auth-bootstrap-card .card-body { padding: 24px 20px !important; }
    .convoy-map-frame { height: min(50svh, 480px) !important; min-height: 330px !important; }
    .convoy-summary-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .quick-alerts { background: rgba(250,248,243,.97); border-color: #d9d4ca; }
}

@media (max-width: 390px) {
    .app-main { padding-inline: 10px !important; }
    .convoy-title-row { grid-template-columns: 44px minmax(0,1fr) 44px; }
    .convoy-title h1 { font-size: 1.08rem !important; }
    .convoy-title p { display: none; }
    .route-info-bar { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .quick-alert { min-width: 0; font-size: .7rem; }
}
