/* wrl2go mini CRM — olive / grey / dark teal / mustard, minimal */

:root {
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --bg: #f0f1ed;
    --surface: #fafaf8;
    --surface-2: #ffffff;
    --text: #2c2e2a;
    --text-muted: #5c6058;
    --border: #d6d8d0;
    --teal: #2d4a4a;
    --teal-hover: #1f3535;
    --olive: #5f6b52;
    --olive-soft: #e8ebe3;
    --mustard: #b8a050;
    --mustard-soft: rgba(184, 160, 80, 0.18);
    --time-color: var(--teal);
    --route-bg: var(--olive-soft);
    --route-border: #c5cbb8;
    --shadow: 0 1px 3px rgba(45, 74, 74, 0.08);
    --sidebar-w: 15.5rem;
    --radius: 6px;
    --focus: 2px solid var(--mustard);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body.app-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

/* ——— Shell ——— */
.app-shell {
    min-height: 100vh;
}

.sidebar-toggle {
    display: block;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.sidebar-toggle--inbar {
    position: relative;
    top: auto;
    left: auto;
    z-index: 1;
    box-shadow: none;
    margin: 0;
}

.sidebar-toggle--floating {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 35;
}

.sidebar-toggle::before {
    content: "";
    display: block;
    width: 1.1rem;
    height: 2px;
    margin: 0.45rem auto;
    background: var(--teal);
    box-shadow:
        0 0.35rem 0 var(--teal),
        0 0.7rem 0 var(--teal);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(45, 74, 74, 0.25);
}

body.sidebar-open .sidebar-backdrop {
    display: block;
}

/* ——— Sidebar (fixed + grid = patička vždy dole ve viewportu, scroll jen nav) ——— */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    z-index: 20;
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0;
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
    transform: translateX(-100%);
    transition:
        transform 0.22s ease,
        opacity 0.18s ease,
        border-color 0.18s ease,
        visibility 0.22s ease;
}

@supports (height: 100dvh) {
    .sidebar {
        height: 100dvh;
        max-height: 100dvh;
    }
}

.sidebar-header {
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.85rem 0.75rem 0.85rem;
    margin: 0 0 0.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand {
    flex: 1;
    min-width: 0;
    padding: 0;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border: none;
}

.sidebar-nav {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0 0.65rem;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav a {
    display: block;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--olive-soft);
    color: var(--teal);
}

.sidebar-nav a.is-active {
    background: var(--teal);
    color: #f5f6f3;
    border-color: var(--teal-hover);
}

.sidebar-nav a.sidebar-nav__badged {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-nav__badged-label {
    min-width: 0;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: #c53030;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-nav a.is-active .nav-badge {
    background: #fff;
    color: #c53030;
}

.sidebar-nav-group {
    margin: 0 !important;
    padding: 0 !important;
    border: 0;
    border-radius: var(--radius);
    display: block;
    width: 100%;
    box-sizing: border-box;
}

/* stejná vertikální mezera jako mezi odkazy (UA často přidává margin u <details>) */
.sidebar-nav > .sidebar-nav-group {
    margin-block: 0 !important;
    margin-inline: 0 !important;
}

.sidebar-nav-summary {
    list-style: none;
    cursor: pointer;
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.85rem;
    margin: 0;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid transparent;
    user-select: none;
}

.sidebar-nav-summary::-webkit-details-marker {
    display: none;
}

.sidebar-nav-summary::after {
    content: "▸";
    float: right;
    font-size: 0.65rem;
    opacity: 0.55;
    margin-top: 0.2rem;
}

.sidebar-nav-group[open] .sidebar-nav-summary::after {
    content: "▾";
}

.sidebar-nav-summary:hover {
    background: var(--olive-soft);
    color: var(--teal);
}

.sidebar-nav-summary.is-active-parent {
    color: var(--teal);
    background: var(--olive-soft);
    border-color: var(--route-border);
}

.sidebar-nav-sub {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0.35rem 0 0.15rem 0.45rem;
    padding: 0.45rem 0.35rem 0.5rem 0.85rem;
    border-left: 3px solid var(--teal);
    background: var(--olive-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: inset 0 0 0 1px rgba(45, 74, 74, 0.08);
}

.sidebar-nav-sub a {
    font-size: 0.84rem;
    padding: 0.45rem 0.5rem 0.45rem 0.65rem;
    margin-left: 0.35rem;
    border-radius: var(--radius);
}

.sidebar-footer {
    grid-row: 3;
    flex-shrink: 0;
    padding: 0.85rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
    margin-top: 0;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--surface-2);
    box-shadow: 0 -4px 12px rgba(45, 74, 74, 0.06);
}

.sidebar-footer .user-name {
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 0.2rem;
}

.sidebar-footer a {
    color: var(--olive);
    font-size: 0.9rem;
}

/* ——— Main ——— */
.main {
    min-width: 0;
    padding: 1.25rem 1.5rem 2rem;
    max-width: 72rem;
    margin-left: 0;
}

@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0);
        visibility: visible;
    }

    .sidebar-toggle--floating {
        display: none;
    }

    body.sidebar-desktop-collapsed .sidebar-toggle--floating {
        display: block;
    }

    body.sidebar-desktop-collapsed .sidebar {
        transform: translateX(-100%);
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
        border-right-color: transparent;
    }

    body.sidebar-desktop-collapsed .main {
        margin-left: 0;
        padding-left: 3.75rem;
    }

    .main {
        margin-left: var(--sidebar-w);
    }
}

.main-header {
    margin-bottom: 1.25rem;
}

.main-header h1 {
    margin: 0 0 0.35rem;
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--teal);
    letter-spacing: -0.02em;
}

.order-page-header__back {
    margin: 0 0 0.5rem;
}

.order-page-header__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.order-page-header__titles h1 {
    margin-bottom: 0.35rem;
}

.order-page-header__tools {
    margin: 0;
    align-self: center;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.65rem;
}

.order-soft-delete-form,
.order-restore-form {
    margin: 0;
    display: inline-flex;
}

.btn-soft-delete {
    border-color: #c53030;
    color: #a02626;
}

.btn-soft-delete:hover {
    background: rgba(197, 48, 48, 0.1);
    color: #7a1c1c;
}

.order-transport-sheet-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--teal);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
}

.order-transport-sheet-link:hover {
    background: var(--olive-soft);
    border-color: var(--route-border);
}

.order-transport-sheet-link__icon {
    display: flex;
    color: var(--teal);
}

.subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ——— Day toolbar ——— */
.day-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.overview-result-count {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    color: var(--text-muted);
}

.overview-view-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    flex: 0 0 auto;
}

.overview-view-switch a {
    display: inline-block;
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--teal);
    border-right: 1px solid var(--border);
    line-height: 1.2;
}

.overview-view-switch a:last-child {
    border-right: none;
}

.overview-view-switch a.is-active {
    background: var(--olive-soft);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--route-border);
}

.overview-view-switch a:hover:not(.is-active) {
    background: var(--surface-2);
}

.overview-group-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 1.15rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.overview-group-heading:first-child {
    margin-top: 0;
}

.day-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.day-nav a,
.day-nav span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--teal);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 1.1rem;
    line-height: 1;
}

.day-nav a:hover {
    background: var(--olive-soft);
    border-color: var(--route-border);
}

.day-nav__today {
    min-width: auto;
    padding: 0 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: none;
}

.day-heading {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    min-width: 10rem;
    text-align: center;
}

.day-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
    margin-left: auto;
}

.day-filters label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.day-filters select,
.day-filters input[type="text"],
.day-filters input[type="search"],
.day-filters input[type="date"],
.day-filters .btn-small {
    font: inherit;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    min-width: 7rem;
}

.search-page-toolbar .search-page-filters {
    margin-left: 0;
    flex: 1 1 100%;
}

.btn-small {
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    color: var(--teal);
}

.btn-small:hover {
    background: var(--mustard-soft);
    border-color: var(--mustard);
}

/* ——— Transfer list ——— */
.transfer-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.transfer-row {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--teal);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Kotva po uložení řidiče — řádek zůstane pod horní lištou / filtry */
.transfer-row[id^="order-"] {
    scroll-margin-top: 1.25rem;
}

.transfer-row__main {
    display: grid;
    grid-template-columns: auto minmax(3.25rem, auto) minmax(0, 2.85fr) minmax(0, 11rem) auto;
    gap: 0.65rem 0.85rem;
    align-items: center;
    padding: 0.75rem 1rem;
}

@media (max-width: 900px) {
    .transfer-row__main {
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto auto;
    }

    .transfer-row__toggle {
        grid-column: 1;
        grid-row: 1;
    }

    .transfer-head {
        grid-column: 2;
        grid-row: 1;
    }

    .transfer-row__actions {
        grid-column: 3;
        grid-row: 1;
    }

    .transfer-row__route {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .transfer-customer-line {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .transfer-row__meta {
        grid-column: 1 / -1;
    }
}

.transfer-row__toggle {
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    color: var(--teal);
    font-size: 0.7rem;
    line-height: 1;
    transition: transform 0.15s ease;
}

.transfer-row__toggle[aria-expanded="true"] {
    transform: rotate(90deg);
}

.transfer-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    min-width: 0;
}

.transfer-time {
    font-weight: 700;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
    color: var(--time-color);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.transfer-type--sub {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--olive);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    max-width: 7rem;
}

.transfer-customer-line {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    min-width: 0;
    line-height: 1.35;
}

.transfer-pax {
    font-weight: 500;
    color: var(--text-muted);
}

.transfer-row__route {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.route-from,
.route-to {
    flex: 1 1 8rem;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    background: var(--route-bg);
    border: 1px solid var(--route-border);
    border-radius: var(--radius);
    font-size: 0.92rem;
    line-height: 1.38;
}

.route-arrow {
    flex: 0 0 auto;
    color: var(--mustard);
    font-weight: 700;
    font-size: 1.1rem;
}

.transfer-row__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-detail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius);
    background: var(--teal);
    color: #f5f6f3;
    text-decoration: none;
    font-size: 1.35rem;
    font-weight: 300;
    line-height: 1;
    border: 1px solid var(--teal-hover);
}

.btn-detail:hover {
    background: var(--teal-hover);
}

.transfer-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0 1rem 0.65rem;
}

.transfer-row__meta span strong {
    color: var(--text);
    font-weight: 600;
}

.transfer-row__meta-footer {
    flex: 1 1 100%;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.transfer-meta-driver {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

.inline-ack-form {
    display: inline-flex;
    margin: 0;
    align-items: center;
}

.inline-ack-form--vehicle {
    margin: 0;
}

.vehicle-ack-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.2rem;
    padding: 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--teal);
}

.btn-ack-inline {
    font-size: 0.72rem;
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius);
    border: 1px solid var(--teal);
    background: var(--teal);
    color: #f5f6f3;
    cursor: pointer;
    font-weight: 600;
    line-height: 1.2;
}

.btn-ack-inline:hover {
    background: var(--teal-hover);
    border-color: var(--teal-hover);
}

.transfer-vehicles-grid {
    flex: 1 1 100%;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 1rem;
    align-items: start;
}

@media (max-width: 42rem) {
    .transfer-vehicles-grid {
        grid-template-columns: 1fr;
    }
}

.transfer-vehicle-line {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.transfer-vehicle-line__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.45rem;
    line-height: 1.35;
}

.transfer-vehicle-line__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    width: 100%;
    min-width: 0;
}

.transfer-vehicle-line__actions .transfer-vehicle-line__driver-select {
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
}

.transfer-vehicle-line__btn-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.transfer-vehicle-line__btn-row .inline-assign-vehicle,
.transfer-vehicle-line__btn-row .inline-ack-form {
    display: inline-flex;
    margin: 0;
    align-items: center;
}

.transfer-vehicle-line__actions .btn-inline-save,
.transfer-vehicle-line__actions .btn-ack-inline {
    min-width: 5.25rem;
    min-height: 1.9rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
    line-height: 1.2;
    box-sizing: border-box;
}

.inline-assign-vehicle {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin: 0;
}

.inline-assign-vehicle--btn-only {
    flex-wrap: nowrap;
}

.order-vehicle-row--line {
    align-items: flex-end;
}

.btn-remove-vehicle {
    flex: 0 0 auto;
    align-self: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    margin-top: 1.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.btn-remove-vehicle:hover {
    background: #f3e8e8;
    color: #8b3a3a;
}

.transfer-row__detail {
    display: none;
    padding: 0 1rem 0.85rem;
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-muted);
    background: var(--surface);
}

.transfer-row__detail.is-open {
    display: block;
}

.detail-transport-sheet {
    margin: 0 0 0.65rem;
}

.detail-transport-sheet-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--teal);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
}

.detail-transport-sheet-link:hover {
    background: var(--olive-soft);
}

.detail-transport-sheet-link__icon {
    display: flex;
    flex-shrink: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.5rem 1rem;
    margin-top: 0.5rem;
}

.detail-grid dt {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0;
}

.detail-grid dd {
    margin: 0.1rem 0 0;
    color: var(--text);
}

.empty-state {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* ——— Forms (search, order card, admin) ——— */
.form-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    max-width: 40rem;
}

.form-card.wide {
    max-width: 48rem;
}

.field-password-wrap {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    width: 100%;
}

.field-password-wrap__input {
    flex: 1;
    min-width: 0;
}

.field-password-toggle {
    flex-shrink: 0;
    width: 2.6rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.field-password-toggle:hover {
    color: var(--teal);
    border-color: var(--teal);
}

.field-password-toggle:focus-visible {
    outline: var(--focus);
    outline-offset: 2px;
}

.field-password-toggle__icon--hide {
    display: none;
}

.main.main--order-import {
    max-width: none;
}

.form-card.order-import-panel {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

.order-import-lead {
    max-width: 48rem;
}

.main-header .order-import-env-fieldset {
    margin: 0.85rem 0 0;
    padding: 0;
    border: none;
    max-width: 48rem;
}

.main-header .order-import-env-fieldset .order-import-label {
    margin-bottom: 0.35rem;
}

.order-import-env-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: center;
}

.order-import-date-range-row {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1.25rem;
    width: 100%;
}

.order-import-date-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.order-import-date-field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0;
}

.order-import-date-field input[type="date"] {
    min-width: 10.5rem;
}

.order-import-date-range-row .order-import-quick-range {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding-bottom: 0.1rem;
}

.order-import-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.order-import-partner-line {
    margin: 0;
    font-size: 1rem;
}

.order-import-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
    gap: 1rem 1.25rem;
    align-items: end;
    margin-bottom: 0.5rem;
}

.order-import-status-fieldset {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    border: none;
    min-width: 0;
}

.order-import-status-fieldset legend {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.order-import-status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
}

label.order-import-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 0;
}

.order-import-hint {
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0.5rem 0 0.75rem;
    padding: 0.7rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.order-import-hint abbr {
    text-decoration: underline dotted;
    cursor: help;
}

.order-import-actions {
    margin-top: 0.35rem;
}

.order-import-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
    align-items: baseline;
    margin-bottom: 0.65rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.order-import-meta strong {
    color: var(--text);
}

.order-import-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.order-import-table-wrap .data-table {
    min-width: 52rem;
}

.order-import-table-wrap td.cell-route {
    max-width: 16rem;
    min-width: 10rem;
    vertical-align: top;
    word-break: break-word;
    font-size: 0.88rem;
}

@media (max-width: 768px) {
    .order-import-filter-grid {
        grid-template-columns: 1fr;
    }

    .order-import-table-wrap .data-table {
        min-width: 44rem;
    }
}

.change-requests-new-card__title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 650;
}

.change-request-desc {
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 22rem;
    vertical-align: top;
}

.change-requests-author-user {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.change-request-status-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
    margin: 0;
}

.change-request-status-select {
    min-width: 11rem;
}

.change-requests-list-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.change-requests-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.65rem;
    margin: 0;
}

.change-requests-filter label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.change-requests-filter__select {
    min-width: 11rem;
    max-width: 16rem;
}

.change-requests-table tbody tr.change-request-row--inactive td {
    background: #c5c9bc;
    color: #3d4038;
    border-bottom-color: #b0b5a8;
}

.change-requests-table tbody tr.change-request-row--inactive td:first-child {
    box-shadow: inset 4px 0 0 #7a8272;
}

.change-requests-table tbody tr.change-request-row--inactive .change-request-desc {
    color: #2f322c;
    opacity: 0.82;
}

.change-requests-table tbody tr.change-request-row--inactive .change-requests-author-user {
    color: #4d5248;
    opacity: 0.78;
}

.change-requests-table tbody tr.change-request-row--inactive .change-request-status-select,
.change-requests-table tbody tr.change-request-row--inactive .change-request-status-form .btn-ghost {
    opacity: 0.88;
}

.field-grid {
    display: grid;
    gap: 0.85rem;
}

.form-section {
    display: grid;
    gap: 0.65rem;
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--olive-soft);
}

.field-grid > .form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--olive);
}

.order-vehicles-panel {
    padding: 0.85rem;
    margin: 0;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.field {
    flex: 1 1 12rem;
}

.field label,
label.block {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: var(--focus);
    outline-offset: 1px;
}

textarea {
    min-height: 4.5rem;
    resize: vertical;
}

a.btn-primary {
    text-align: center;
}

.btn-primary {
    display: inline-block;
    padding: 0.55rem 1.15rem;
    background: var(--teal);
    color: #f5f6f3;
    border: 1px solid var(--teal-hover);
    border-radius: var(--radius);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--teal-hover);
}

.btn-ghost {
    display: inline-block;
    padding: 0.45rem 0.85rem;
    color: var(--olive);
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-ghost:hover {
    text-decoration: underline;
}

.msg-ok {
    color: var(--olive);
    font-weight: 500;
}

.msg-err {
    color: #8b3a3a;
    font-weight: 500;
}

.msg-warn {
    padding: 0.65rem 0.85rem;
    margin: 0 0 1rem;
    border-radius: var(--radius);
    border: 1px solid rgba(184, 160, 80, 0.6);
    background: var(--mustard-soft);
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.4;
}

/* ——— Order card page ——— */
.order-card-layout .form-card {
    max-width: 52rem;
}

.dl-readonly {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 0.35rem 1rem;
    font-size: 0.92rem;
}

.dl-readonly dt {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.dl-readonly dd {
    margin: 0;
    white-space: pre-wrap;
}

/* ——— Tables (search, users) ——— */
.data-table-wrap {
    overflow-x: auto;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th,
.data-table td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.data-table th {
    background: var(--olive-soft);
    color: var(--teal);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table a {
    color: var(--teal);
    font-weight: 500;
}

.data-table tr.inactive td {
    opacity: 0.65;
}

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.filters-bar label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ——— Login (no shell) ——— */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(160deg, var(--olive-soft) 0%, var(--bg) 45%, #e5e6e0 100%);
}

.login-box {
    width: 100%;
    max-width: 22rem;
    padding: 1.75rem 1.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-box h1 {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    color: var(--teal);
    font-weight: 600;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.inline-assign-driver {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin: 0;
}

.inline-assign-driver__select {
    min-width: 7rem;
    max-width: 10rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.35rem;
}

.btn-inline-save {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--teal);
    cursor: pointer;
}

.btn-inline-save:hover {
    background: var(--olive-soft);
}

.field-row--stack {
    flex-direction: column;
    align-items: stretch;
}

.field-row--route {
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
}

.field-row--route:last-child {
    margin-bottom: 0;
}

.field-row--route .field--preset {
    flex: 0 1 12rem;
    min-width: 9rem;
    max-width: 14rem;
}

.field-row--route .field--addr {
    flex: 1 1 14rem;
    min-width: 10rem;
}

.field-row--route textarea.route-address-text {
    min-height: 2.65rem;
    min-width: 0;
}

@media (max-width: 36rem) {
    .field-row--route {
        flex-direction: column;
        align-items: stretch;
    }

    .field-row--route .field--preset {
        max-width: none;
    }
}

.input-time-hm {
    max-width: 6.5rem;
}

.detail-addresses {
    margin-top: 0.65rem;
    display: grid;
    gap: 0.5rem;
    color: var(--text);
}

.detail-addresses p {
    margin: 0;
}

.detail-note {
    margin: 0.65rem 0 0;
    color: var(--text);
}

.driver-notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.driver-note-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow);
}

.driver-note-card.is-read {
    opacity: 0.72;
    background: #eceee9;
}

.driver-note-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.driver-note-card__readform {
    margin: 0;
}

.driver-note-card__driver {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.driver-note-card__body {
    margin: 0.5rem 0 0;
    color: var(--text);
    line-height: 1.45;
}

.driver-note-card__updated {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.order-ack-pending {
    color: #8a4b2a;
    font-weight: 600;
}

.order-ack-ok {
    color: var(--olive);
}

.order-ack-partial {
    color: #7a6220;
    font-weight: 600;
}

.order-history-title {
    margin: 0 0 0.65rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--teal);
}

.order-history-list {
    margin: 0;
    padding-left: 1.15rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.order-history-list li {
    margin-bottom: 0.35rem;
}

/* ——— Mobile sidebar ——— */
@media (max-width: 768px) {
    .sidebar-toggle--floating {
        display: block;
    }

    body.sidebar-open .sidebar-toggle--floating {
        visibility: hidden;
        pointer-events: none;
    }

    .sidebar {
        box-shadow: none;
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    }

    .main {
        margin-left: 0 !important;
        padding: 3.25rem 1rem 2rem;
        width: 100%;
        max-width: none;
    }

    .day-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .day-filters {
        margin-left: 0;
    }
}
