/* ══════════════════════════════════════════════════════════
   Routes V2 Panel  —  all selectors scoped under .sd-rv2-
   Zero collision with existing .routing-* / .route-* styles
══════════════════════════════════════════════════════════ */

/* ── Design tokens ───────────────────────────────────────── */
:root {
    --rv2-font:           'sd-avenir', system-ui, sans-serif;

    /* Text */
    --rv2-text-primary:   #0A0A0A;
    --rv2-text-secondary: #525252;
    --rv2-text-muted:     #737373;
    --rv2-text-subtle:    #A3A3A3;

    /* Surfaces */
    --rv2-bg-panel:       #FFFFFF;  /* matches ref --c-bg: white panel, cards blend via border */
    --rv2-bg-white:       #FFFFFF;
    --rv2-bg-hover:       #F4F4F5;
    --rv2-bg-input:       #FAFAFA;
    --rv2-bg-gray:        #F8F8F8;

    /* Borders */
    --rv2-border:         #E8E8E4;
    --rv2-border-hover:   #D4D4D4;

    /* Brand — inherits from theme_colors.css */
    --rv2-green:          var(--sd-dark-green-change);  /* #008062 light / #70facb dark */
    --rv2-green-hover:    #006b52;
    --rv2-green-bg:       rgba(0, 128, 98, 0.1);       /* green-tinted surface */

    /* Status */
    --rv2-danger:         #D92D20;
    --rv2-danger-bg:      #FEF2F2;
    --rv2-success-bg:     #D1FAE5;
    --rv2-success-text:   #047048;

    /* Radii */
    --rv2-radius-sm:      6px;
    --rv2-radius-md:      8px;
    --rv2-radius-lg:      10px;
    --rv2-radius-xl:      12px;
    --rv2-radius-full:    9999px;

    /* Dropdown / create button */
    --rv2-dropdown-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    --rv2-create-btn-fg:  #FFFFFF;
}

/* ── Dark theme overrides ────────────────────────────────── */
[data-theme="dark"] {
    /* Text */
    --rv2-text-primary:   var(--assignment-header-font-color); /* #f6f6f6 */
    --rv2-text-secondary: var(--dropdown-color);               /* #d8d8d8 */
    --rv2-text-muted:     var(--int-header-color);             /* #e4e4e4 */
    --rv2-text-subtle:    #6b7280;

    /* Surfaces */
    --rv2-bg-panel:       var(--modal-background);             /* #141414 */
    --rv2-bg-white:       var(--integration-card-bg);          /* #1F1F1F */
    --rv2-bg-hover:       var(--dropdown-hover-bg);            /* #383838 */
    --rv2-bg-input:       var(--modal-input-bg);               /* #141414 */
    --rv2-bg-gray:        var(--dispatch-assign-button-bg);    /* #1e1e1e */

    /* Borders */
    --rv2-border:         var(--hr);                           /* #2d2d2d */
    --rv2-border-hover:   #404040;

    /* Brand — --rv2-green auto-updates via --sd-dark-green-change */
    --rv2-green-hover:    #3dd9a4;
    --rv2-green-bg:       rgba(112, 250, 203, 0.12);

    /* Status */
    --rv2-danger:         #f87171;
    --rv2-danger-bg:      rgba(217, 45, 32, 0.15);
    --rv2-success-bg:     var(--status-green-bg);              /* #17C2891F */
    --rv2-success-text:   var(--status-green-color);           /* #18C289 */

    --rv2-dropdown-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --rv2-create-btn-fg:  #0A0A0A;
}

/* ── Panel shell ─────────────────────────────────────────── */
.sd-map-routes-v2-panel {
    background: var(--rv2-bg-panel);
    overflow: hidden;
}

.sd-rv2-panel-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────── */
.sd-rv2-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--rv2-border);
    flex-shrink: 0;
    background: var(--rv2-bg-panel);
    height: 64px;
}

.sd-rv2-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sd-rv2-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--sd-neutral-900);
}

.sd-rv2-count {
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    color: var(--rv2-text-muted);
}

.sd-rv2-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Create button + dropdown ────────────────────────────── */
.sd-rv2-create-wrapper {
    position: relative;
}

.sd-rv2-create-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--rv2-green);
    color: var(--rv2-create-btn-fg, #FFFFFF);
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}
.sd-rv2-create-btn:hover { background: var(--rv2-green-hover); }
.sd-rv2-create-btn-icon {
    font-size: 20px;
    color: inherit;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
    line-height: 1;
    user-select: none;
}

.sd-rv2-create-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--rv2-bg-white);
    border: 1px solid var(--rv2-border);
    border-radius: 10px;
    box-shadow: var(--rv2-dropdown-shadow);
    z-index: 50;
    min-width: 160px;
    overflow: hidden;
}

.sd-rv2-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    width: 100%;
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-primary);
    cursor: pointer;
    border: none;
    background: none;
    text-align: left;
    transition: background 0.1s;
}
.sd-rv2-dropdown-item-icon {
    font-size: 18px;
    color: var(--rv2-text-secondary);
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 18;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
}
.sd-rv2-dropdown-item:hover { background: var(--rv2-bg-hover); }

/* Theme-adaptive Material Symbols (routes v2) */
.sd-rv2-ms {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
    line-height: 1;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--rv2-text-secondary);
}
.sd-rv2-ms--18 { font-size: 18px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 18; }
.sd-rv2-ms--20 { font-size: 20px; }
.sd-rv2-ms--22 { font-size: 22px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 22; }
.sd-rv2-ms--24 { font-size: 24px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.sd-rv2-ms--28 { font-size: 28px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 28; }
.sd-rv2-ms--12 { font-size: 12px; font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 12; }
.sd-rv2-ms--muted { color: var(--rv2-text-muted); }
.sd-rv2-ms--subtle { color: var(--rv2-text-subtle); }
.sd-rv2-ms--danger { color: var(--rv2-danger); }
.sd-rv2-ms--success { color: var(--rv2-success-text); }
.sd-rv2-ms--inherit { color: inherit; }

.sd-rv2-modal-close { color: var(--rv2-text-muted); }
.sd-rv2-modal-close .material-symbols-outlined,
.sd-rv2-stepper-btn .material-symbols-outlined,
.sd-rv2-menu-btn .material-symbols-outlined,
.sd-rv2-expand-btn .material-symbols-outlined,
.sd-rv2-assign-btn--filled .material-symbols-outlined,
.sd-rv2-empty-icon .material-symbols-outlined,
.sd-rv2-ac-info-row .material-symbols-outlined,
.sd-rv2-accordion-trigger .material-symbols-outlined:not(.sd-rv2-accordion-chevron),
.sd-rv2-confirm-icon .material-symbols-outlined { color: inherit; }

.sd-rv2-empty-icon { color: var(--rv2-text-subtle); }
.sd-rv2-ac-info-row { color: var(--rv2-text-muted); }
.sd-rv2-accordion-chevron { color: var(--rv2-text-muted); margin-left: auto; }
.sd-rv2-stop-drag .material-symbols-outlined { color: var(--rv2-text-subtle); }
.sd-rv2-menu-item .material-symbols-outlined { color: var(--rv2-text-secondary); }
.sd-rv2-menu-item--danger,
.sd-rv2-menu-item--danger .material-symbols-outlined { color: var(--rv2-danger); }
.sd-rv2-done-badge .material-symbols-outlined { color: var(--rv2-success-text); }
.sd-rv2-confirm-icon { color: var(--rv2-danger); }

/* ── Empty state ─────────────────────────────────────────── */
.sd-rv2-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0 32px;
    text-align: center;
}

.sd-rv2-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--rv2-bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.sd-rv2-empty-title {
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 15px;
    color: var(--rv2-text-primary);
    margin-bottom: 6px;
}

.sd-rv2-empty-sub {
    font-family: var(--rv2-font);
    font-weight: 400;
    font-size: 14px;
    color: var(--rv2-text-muted);
    line-height: 1.5;
}

/* ── Route card list ─────────────────────────────────────── */
.sd-rv2-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    background: var(--rv2-bg-panel);
}

/* Thin scrollbar matching existing panels */
.sd-rv2-list::-webkit-scrollbar { width: 4px; }
.sd-rv2-list::-webkit-scrollbar-track { background: transparent; }
.sd-rv2-list::-webkit-scrollbar-thumb { background: rgba(155, 155, 155, 0.5); border-radius: 4px; }

/* ── Route card ──────────────────────────────────────────── */
.sd-rv2-card {
    background: var(--rv2-bg-white);
    border: 1px solid var(--rv2-border);
    border-radius: 12px;
    transition: box-shadow 0.15s;
    flex-shrink: 0;
}

.sd-rv2-card-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 14px 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* Top row: dot + name + actions */
.sd-rv2-card-top-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sd-rv2-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sd-rv2-card-name-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.sd-rv2-card-name {
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    color: var(--rv2-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: text;
}

.sd-rv2-card-name-input {
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    color: var(--rv2-text-primary);
    border: none;
    border-bottom: 1.5px solid var(--rv2-text-primary);
    outline: none;
    width: 100%;
    background: transparent;
    padding: 0;
    box-sizing: border-box;
}

.sd-rv2-card-stats {
    font-family: var(--rv2-font);
    font-weight: 300;
    font-size: 14px;
    line-height: 1.3;
    color: var(--rv2-text-muted);
}

.sd-rv2-card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* DONE badge — shown when every delivery stop is completed */
.sd-rv2-done-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--rv2-success-bg);
    color: var(--rv2-success-text);
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

/* ·· menu button */
.sd-rv2-menu-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    border-radius: var(--rv2-radius-sm);
    cursor: pointer;
    padding: 0;
    transition: background 0.1s;
    color: var(--rv2-text-muted);
    box-shadow: none;
}
.sd-rv2-menu-btn:hover { background: var(--rv2-bg-hover); }
.sd-rv2-menu-btn:focus-visible { outline: 2px solid var(--rv2-green); outline-offset: 1px; }

/* expand/collapse button */
.sd-rv2-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 6px;
    box-shadow: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.1s;
    color: var(--rv2-text-muted);
}
.sd-rv2-expand-btn:hover { background: var(--rv2-bg-hover); }
.sd-rv2-expand-btn:focus-visible { outline: 2px solid var(--rv2-green); outline-offset: 1px; }

/* ·· menu dropdown */
.sd-rv2-menu-dropdown {
    position: absolute;
    top: calc(100% - 4px);
    right: 8px;
    background: var(--rv2-bg-white);
    border: 1px solid var(--rv2-border);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 60;
    min-width: 160px;
    overflow: hidden;
}

.sd-rv2-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-primary);
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}
.sd-rv2-menu-item:hover { background: var(--rv2-bg-hover); }
.sd-rv2-menu-item--danger { color: var(--rv2-danger); }
.sd-rv2-menu-item--danger:hover { background: var(--rv2-danger-bg); }

/* ── Card body (stops — expandable) ─────────────────────── */
.sd-rv2-card-body {
}

/* ── Stop timeline ───────────────────────────────────────── */
.sd-rv2-stops {
    list-style: none;
    margin: 0;
    padding: 4px 12px 12px;
}

.sd-rv2-stop-item {
    display: flex;
    align-items: stretch;
    gap: 10px;
    user-select: none;
}

.sd-rv2-stop-timeline {
    width: 32px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sd-rv2-stop-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 11px;
    line-height: 1;
}

.sd-rv2-stop-dot--delivery { color: #FFFFFF; }

.sd-rv2-stop-dot--pickup {
    background: var(--rv2-bg-hover);
    border: 1.5px solid var(--rv2-border-hover);
    color: var(--rv2-text-secondary);
}

.sd-rv2-stop-line {
    width: 2px;
    flex: 1;
    background: var(--rv2-border);
}

/* Stop card — matches ref exactly */
.sd-rv2-stop-card {
    flex: 1;
    min-width: 0;
    background: var(--rv2-bg-white);
    border: 1px solid var(--rv2-border);
    border-radius: 10px;
    margin: 4px 0;
    overflow: hidden;
}

.sd-rv2-stop-card-header {
    display: flex;
    align-items: center;
    padding: 10px 12px 8px;
    gap: 8px;
}

.sd-rv2-stop-card-body {
    padding: 0 12px 10px;
}

.sd-rv2-stop-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 99px;
    padding: 2px 7px;
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    width: fit-content;
}

.sd-rv2-stop-badge--pickup {
    background: var(--rv2-bg-hover);
    color: var(--rv2-text-secondary);
}

.sd-rv2-stop-badge--deliver {
    background: var(--rv2-success-bg);
    color: var(--rv2-success-text);
}

.sd-rv2-stop-badge--delivered {
    background: var(--rv2-success-bg);
    color: var(--rv2-success-text);
}

.sd-rv2-stop-order-id {
    font-family: var(--rv2-font);
    font-weight: 400;
    font-size: 14px;
    color: var(--rv2-text-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sd-rv2-stop-name {
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 14px;
    color: var(--rv2-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-rv2-stop-addr {
    font-family: var(--rv2-font);
    font-weight: 400;
    font-size: 14px;
    color: var(--rv2-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Drag handle — inside card header, shown on hover */
.sd-rv2-stop-drag {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
    cursor: grab;
    color: var(--rv2-text-subtle);
}
.sd-rv2-stop-item:hover .sd-rv2-stop-drag { opacity: 1; }

/* Hide timeline column on the dragged clone */
.ui-sortable-helper .sd-rv2-stop-timeline {
    display: none;
}

/* Sortable drag placeholder */
.sd-rv2-drop-placeholder {
    height: 40px;
    background: var(--rv2-green-bg);
    border: 1.5px dashed var(--rv2-green);
    border-radius: 8px;
    margin: 2px 14px;
}

/* ── Driver assignment row ───────────────────────────────── */
.sd-rv2-assign-row {
    padding: 0 12px 12px;
}
.sd-rv2-assign-row--filled {
    padding-top: 4px;
}

.sd-rv2-assign-btn--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--rv2-green-bg);
    cursor: pointer;
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-green);
    transition: background 0.1s;
}
.sd-rv2-assign-btn--empty:hover { background: var(--rv2-bg-hover); }
.sd-rv2-assign-car { color: var(--rv2-green); flex-shrink: 0; }

.sd-rv2-assign-btn--filled {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
    border-radius: 8px;
    padding: 6px 8px;
    background: transparent;
    cursor: pointer;
    transition: background 0.1s;
}
.sd-rv2-assign-btn--filled:hover { background: var(--rv2-bg-hover); }

.sd-rv2-driver-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--rv2-bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sd-rv2-driver-avatar-initials {
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 11px;
    color: var(--rv2-text-secondary);
    line-height: 1;
    user-select: none;
}

.sd-rv2-driver-name {
    flex: 1;
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* ── Modal ───────────────────────────────────────────────── */
.sd-rv2-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sd-rv2-modal {
    background: var(--rv2-bg-white);
    border-radius: 16px;
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

/* ── Auto-create modal — matches ref exactly ─────────────── */
.sd-rv2-modal--autocreate {
    padding: 28px;
    gap: 24px;
}

.sd-rv2-ac-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sd-rv2-ac-title {
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 18px;
    color: var(--rv2-text-primary);
}

.sd-rv2-ac-info-card {
    border: 1px solid var(--rv2-border);
    border-radius: 10px;
    overflow: hidden;
}

.sd-rv2-ac-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
}

.sd-rv2-ac-info-row--divider {
    border-top: 1px solid var(--rv2-border);
}

.sd-rv2-ac-info-text {
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-secondary);
}

.sd-rv2-ac-stepper-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--rv2-border);
    border-radius: 10px;
    background: var(--rv2-bg-input);
}

.sd-rv2-ac-stepper-label {
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-secondary);
}

.sd-rv2-ac-count-input {
    width: 52px;
    height: 36px;
    text-align: center;
    border: 1px solid var(--rv2-border);
    border-radius: 8px;
    background: var(--rv2-bg-white);
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 18px;
    color: var(--rv2-text-primary);
    outline: none;
    transition: border-color 0.1s;
}
.sd-rv2-ac-count-input:focus { border-color: #008062; }

.sd-rv2-ac-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-rv2-ac-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: var(--rv2-green);
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 14px;
    color: var(--sd-neutral-100);
    cursor: pointer;
    transition: background 0.1s;
    box-sizing: border-box;
}
.sd-rv2-ac-cta:hover { background: var(--rv2-green-hover); }

.sd-rv2-ac-cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-secondary);
    cursor: pointer;
    transition: background 0.1s;
    box-sizing: border-box;
}
.sd-rv2-ac-cancel:hover { background: var(--rv2-bg-hover); }

.sd-rv2-modal-header {
    padding: 20px 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sd-rv2-modal-title {
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 16px;
    color: var(--rv2-text-primary);
}

.sd-rv2-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    transition: background 0.1s;
}
.sd-rv2-modal-close:hover { background: var(--rv2-bg-hover); }

.sd-rv2-modal-body {
    padding: 16px 20px;
    flex: 1;
}

.sd-rv2-modal-info {
    font-family: var(--rv2-font);
    font-weight: 400;
    font-size: 14px;
    color: var(--rv2-text-secondary);
    line-height: 1.5;
    padding: 12px 0 4px;
}

.sd-rv2-modal-footer {
    padding: 0 20px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.sd-rv2-modal-cancel {
    padding: 8px 16px;
    border: 1px solid var(--rv2-border);
    border-radius: 8px;
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-secondary);
    background: var(--rv2-bg-white);
    cursor: pointer;
    transition: background 0.1s;
}
.sd-rv2-modal-cancel:hover { background: var(--rv2-bg-hover); }

.sd-rv2-modal-cta {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 14px;
    color: #FFFFFF;
    background: var(--rv2-green);
    cursor: pointer;
    transition: background 0.1s;
}
.sd-rv2-modal-cta:hover { background: var(--rv2-green-hover); }
.sd-rv2-modal-cta:disabled { background: #D4D4D4; cursor: not-allowed; }

/* ── Stepper ─────────────────────────────────────────────── */
.sd-rv2-stepper-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid var(--rv2-border);
}

.sd-rv2-stepper-label {
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-primary);
}

.sd-rv2-stepper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sd-rv2-stepper-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--rv2-border);
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    color: var(--rv2-text-primary);
    background: var(--rv2-bg-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    flex-shrink: 0;
}
.sd-rv2-stepper-btn:hover { background: var(--rv2-bg-hover); }
.sd-rv2-stepper-btn:disabled { color: #D4D4D4; cursor: not-allowed; }

.sd-rv2-stepper-val {
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 16px;
    color: var(--rv2-text-primary);
    min-width: 24px;
    text-align: center;
}

/* ── Orders accordion in create modal ────────────────────── */
.sd-rv2-orders-accordion {
    border: 1px solid var(--rv2-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 4px;
}

.sd-rv2-accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: var(--rv2-bg-input);
    cursor: pointer;
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-primary);
    text-align: left;
    transition: background 0.1s;
}
.sd-rv2-accordion-trigger:hover { background: var(--rv2-bg-hover); }

.sd-rv2-accordion-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
}
.sd-rv2-accordion-chevron--open { transform: rotate(180deg); }

.sd-rv2-orders-list-collapsed {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--rv2-border);
}

.sd-rv2-modal-order-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--rv2-border);
}
.sd-rv2-modal-order-item:last-child { border-bottom: none; }

.sd-rv2-modal-order-name {
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 13px;
    color: var(--rv2-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-rv2-modal-order-addr {
    font-family: var(--rv2-font);
    font-weight: 400;
    font-size: 12px;
    color: var(--rv2-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Delete Confirm Modal ────────────────────────────────── */
.sd-rv2-modal--confirm {
    width: 360px;
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.sd-rv2-confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--rv2-danger-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sd-rv2-confirm-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.sd-rv2-confirm-title {
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 16px;
    color: var(--rv2-text-primary);
    line-height: 1.3;
}

.sd-rv2-confirm-message {
    font-family: var(--rv2-font);
    font-weight: 400;
    font-size: 14px;
    color: var(--rv2-text-muted);
    line-height: 1.4;
}

.sd-rv2-confirm-footer {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: stretch;
}

.sd-rv2-confirm-footer .sd-rv2-modal-cancel,
.sd-rv2-confirm-cta-danger {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: var(--rv2-font);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.sd-rv2-confirm-footer .sd-rv2-modal-cancel {
    border: 1px solid var(--rv2-border);
    background: var(--rv2-bg-white);
    color: var(--rv2-text-secondary);
}

.sd-rv2-confirm-footer .sd-rv2-modal-cancel:hover { background: var(--rv2-bg-hover); }

.sd-rv2-confirm-cta-danger {
    border: none;
    background: #D92D20;
    color: #FFFFFF;
}

.sd-rv2-confirm-cta-danger:hover { opacity: 0.88; }

/* ── Create route modal (ref-matching layout) ────────────── */
.sd-rv2-modal--create {
    width: 420px;
    padding: 0;
}

.sd-rv2-create-modal-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Shared card style for both accordion and stepper */
.sd-rv2-create-card {
    border: 1px solid var(--rv2-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--rv2-bg-input);
}

/* Accordion trigger variant inside create modal — higher specificity avoids !important */
.sd-rv2-modal--create .sd-rv2-accordion-trigger {
    background: var(--rv2-bg-input);
    gap: 10px;
    justify-content: flex-start;
}
.sd-rv2-modal--create .sd-rv2-accordion-trigger:hover { background: var(--rv2-bg-hover); }

/* Stepper card row */
.sd-rv2-create-stepper-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

/* Stacked footer */
.sd-rv2-create-footer {
    padding: 0 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-rv2-create-cta {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-family: var(--rv2-font);
    font-weight: 700;
    font-size: 15px;
    color: var(--sd-neutral-100);
    background: var(--rv2-green);
    cursor: pointer;
    transition: background 0.15s;
}
.sd-rv2-create-cta:hover { background: var(--rv2-green-hover); }
.sd-rv2-create-cta:disabled { background: #D4D4D4; cursor: not-allowed; }

.sd-rv2-create-cancel {
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    font-family: var(--rv2-font);
    font-weight: 500;
    font-size: 14px;
    color: var(--rv2-text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.1s;
}
.sd-rv2-create-cancel:hover { background: var(--rv2-bg-hover); }

/* ── Routes V2 skeleton ──────────────────────────────────── */
.sd-rv2-skeleton {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.sd-rv2-skel-card {
    background: var(--rv2-bg-white);
    border: 1px solid var(--rv2-border);
    border-radius: var(--rv2-radius-xl);
    padding: 14px;
}

.sd-rv2-skel-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sd-rv2-skel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sd-rv2-skel-name {
    height: 14px;
    width: 110px;
}

.sd-rv2-skel-chevron {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.sd-rv2-skel-stats {
    height: 12px;
    width: 150px;
    margin-top: 8px;
}

.sd-rv2-skel-driver {
    height: 36px;
    border-radius: var(--rv2-radius-md);
    margin-top: 12px;
}
