/* Hub Delivery Ops — Unified Design System
   Tier 2 | Professional, minimal, no icons, accessible, mobile-first */

:root {
    --dark: #232F3E;
    --dark-alt: #1A3A4A;
    --teal: #2D90BC;
    --teal-hover: #246F8F;
    --teal-light: #E8F4F8;
    --green: #27AE60;
    --green-light: #D4EFDF;
    --red: #C0392B;
    --red-light: #FADBD8;
    --orange: #E67E22;
    --orange-light: #FDEBD0;
    /* Accessible variants for small status text: --green and --orange sit at
       ~2.8:1 on white, below the 4.5:1 WCAG AA threshold. */
    --green-text: #1E7E45;
    --amber-text: #7E5109;
    --bg: #F7F8FA;
    --white: #FFFFFF;
    --border: #D0D5DD;
    --text: #2B2D33;
    --text-sec: #667085;
    --text-muted: #6B7280;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 8px;
    --radius-lg: 12px;
    --header-h: 48px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-top: var(--header-h);
    cursor: default;
}

/* ── Focus & Accessibility ─────────────────────────────────────── */

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Header ────────────────────────────────────────────────────── */

.header {
    background: var(--dark);
    height: var(--header-h);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
}

.header .brand {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.header .nav-links {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.header .nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

.header .nav-links a:hover,
.header .nav-links a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.header .user-badge {
    color: rgba(255,255,255,0.6);
    font-size: 11px;
    margin-left: 12px;
    white-space: nowrap;
}

/* ── Layout ────────────────────────────────────────────────────── */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-sec);
    margin-bottom: 16px;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── Card ──────────────────────────────────────────────────────── */

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-sec);
    margin-bottom: 12px;
}

/* ── KPI Grid ──────────────────────────────────────────────────── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: center;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--teal);
}

.kpi-label {
    font-size: 11px;
    color: var(--text-sec);
    margin-top: 2px;
}

/* ── Buttons ───────────────────────────────────────────────────── */

.btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-hover); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #219a52; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a93226; }

.btn-outline { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.btn-outline:hover:not(:disabled) { background: var(--teal-light); }

.btn-ghost { background: transparent; color: var(--text-sec); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }

.btn-sm { font-size: 11px; padding: 5px 12px; }
.btn-lg { font-size: 15px; padding: 14px 36px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────────────────────────── */

input, select, textarea {
    font-family: inherit;
    font-size: 13px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--teal);
}

label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sec);
    display: block;
    margin-bottom: 4px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* ── Filters ───────────────────────────────────────────────────── */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.filters .btn {
    padding: 8px 16px;
    font-size: 13px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filter-group label {
    margin-bottom: 0;
}

/* ── Table ─────────────────────────────────────────────────────── */

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

thead th {
    background: var(--teal);
    color: #fff;
    padding: 9px 10px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:nth-child(even) { background: var(--bg); }
tbody tr:hover { background: var(--teal-light); }

/* ── Badges ────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-open { background: var(--teal-light); color: var(--teal-hover); }
.badge-claimed { background: var(--orange-light); color: #7E5109; }
.badge-completed { background: var(--green-light); color: #1E8449; }
.badge-returned { background: var(--green-light); color: #1E8449; }
.badge-cancelled { background: #E5E7EB; color: #6B7280; }
.badge-missing { background: var(--red-light); color: #922B21; }
.badge-self-resolved { background: #E8DAEF; color: #6C3483; }

/* ── Tabs ──────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.tab {
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-sec);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--teal); }
.tab.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 600; }

.tab-content { display: none; opacity: 0; transition: opacity 0.2s ease; }
.tab-content.active { display: block; opacity: 1; }

/* ── Upload zone ───────────────────────────────────────────────── */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--teal);
    background: var(--teal-light);
}

.upload-zone p {
    color: var(--text-sec);
    font-size: 13px;
}

/* ── Charts (bar) ──────────────────────────────────────────────── */

.chart-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.chart-container h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
}

.chart-bar .bar-label {
    width: 80px;
    font-size: 11px;
    text-align: right;
    color: var(--text-sec);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-bar .bar-track {
    flex: 1;
    height: 18px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar .bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.chart-bar .bar-value {
    width: 48px;
    font-size: 11px;
    font-weight: 600;
}

/* ── Notifications ─────────────────────────────────────────────── */

.notif-badge {
    background: var(--red);
    color: #fff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notif-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.notif-item:hover { background: var(--teal-light); }
.notif-item.unread { border-left: 3px solid var(--teal); }
.notif-item .notif-title { font-size: 13px; font-weight: 600; }
.notif-item .notif-body { font-size: 12px; color: var(--text-sec); margin-top: 2px; }
.notif-item .notif-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ── Mobile top bar group (single fixed container) ─────────────── */

.top-bar-group {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--dark);
    padding-top: env(safe-area-inset-top, 0px);
}

.top-bar-group .header {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
}

.top-bar-group .session-bar {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
}

.top-bar-group .mobile-tabs {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
}

/* ── Mobile / Driver / Partner common ──────────────────────────── */

.mobile-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.session-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 7px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 199;
    margin: 0;
    border-top: none;
}

.session-bar .session-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sec);
    letter-spacing: 0.3px;
}

.mobile-tabs {
    display: flex;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: calc(var(--header-h) + 35px);
    left: 0;
    right: 0;
    z-index: 198;
    margin: 0;
    border-top: none;
}

.mobile-tab {
    flex: 1;
    text-align: center;
    padding: 11px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.mobile-tab.active {
    color: var(--teal);
    border-bottom-color: var(--teal);
}

.mobile-content {
    flex: 1;
    padding: 16px;
    padding-top: calc(var(--header-h) + 35px + 42px + 16px);
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

/* When inside .top-bar-group, override the fixed positioning */
.top-bar-group .session-bar,
.top-bar-group .mobile-tabs {
    position: static;
    z-index: auto;
}

/* Content padding when using top-bar-group */
.top-bar-group ~ .mobile-content,
.top-bar-group + .mobile-content {
    padding-top: 16px;
    margin-top: calc(var(--header-h) + 35px + 42px + env(safe-area-inset-top, 0px));
}

.mobile-panel { display: none; }
.mobile-panel.active { display: block; }

/* ── Action cards (mobile) ─────────────────────────────────────── */

.action-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
}

.action-card h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 12px;
}

/* ── Drop cards (queue) ────────────────────────────────────────── */

.drop-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: box-shadow 0.15s;
}

.drop-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.drop-card .drop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.drop-card .drop-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--teal);
}

.drop-card .drop-meta {
    font-size: 12px;
    color: var(--text-sec);
    margin-bottom: 4px;
}

.drop-card .drop-time {
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Parcel cards (mobile) ─────────────────────────────────────── */

.parcel-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.parcel-card .parcel-tid {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parcel-card .parcel-meta {
    font-size: 11px;
    color: var(--text-sec);
    margin-top: 2px;
}

/* ── Scanner overlay ───────────────────────────────────────────── */

.scanner-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.scanner-overlay.visible { display: flex; }

.scanner-reader-wrap {
    flex: 1;
    position: relative;
}

.scanner-result {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 18px;
    text-align: center;
    display: none;
}

.scanner-result.result-green { background: rgba(39,174,96,0.95); color: #fff; display: block; }
.scanner-result.result-red { background: rgba(192,57,43,0.95); color: #fff; display: block; }
.scanner-result .result-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.scanner-result .result-info { font-size: 12px; opacity: 0.9; margin-bottom: 10px; }

.scanner-controls {
    background: var(--dark);
    padding: 14px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* ── Offline banner ────────────────────────────────────────────── */

.offline-banner {
    background: var(--orange);
    color: #fff;
    text-align: center;
    padding: 6px;
    font-size: 11px;
    font-weight: 600;
    display: none;
}

.offline-banner.visible { display: block; }

/* ── Map container ─────────────────────────────────────────────── */

.map-container {
    width: 100%;
    height: 400px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    background: #e8ecf0;
}

/* ── Overlay / Modal ───────────────────────────────────────────── */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.overlay.visible { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

/* ── Loading spinner ───────────────────────────────────────────── */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(247,248,250,0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.visible { display: flex; }

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toasts ────────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--dark);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    animation: toast-in 0.3s ease;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Confirm modal ──────────────────────────────────────────── */
.confirm-modal-content { text-align: center; }
.confirm-modal-content p { font-size: 13px; color: var(--text-sec); margin-bottom: 16px; }
.confirm-modal-content .confirm-actions { display: flex; gap: 8px; justify-content: center; }
.confirm-modal-input { width: 100%; margin-bottom: 12px; }

/* ── Login screen ──────────────────────────────────────────────── */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.login-box {
    width: 100%;
    max-width: 340px;
}

.login-box h1 {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}

.login-box .subtitle {
    text-align: center;
    font-size: 12px;
    color: var(--text-sec);
    margin-bottom: 24px;
}

.login-box .error-msg {
    background: var(--red-light);
    color: var(--red);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 12px;
    display: none;
}

.login-box .error-msg.visible { display: block; }
.login-box .error-msg.success { background: var(--green-light); color: #1E8449; }

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .container { padding: 14px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .split-layout { grid-template-columns: 1fr; }
    .filters { flex-direction: column; align-items: stretch; }
    .filter-group { width: 100%; }
    .filter-group input,
    .filter-group select { width: 100%; }
    .header .nav-links a { font-size: 11px; padding: 5px 8px; }
    .map-container { height: 250px; }
}

@media (max-width: 480px) {
    html { font-size: 13px; }
    .header { padding: 0 12px; }
    .header .brand { font-size: 13px; }
    /* Prevent iOS zoom on input focus */
    input, select, textarea { font-size: 16px !important; }
}


/* ══════════════════════════════════════════════════════════════════
   PHASE 2 ADDITIONS
   ══════════════════════════════════════════════════════════════════ */

/* ── Header logo ───────────────────────────────────────────────── */

.header-logo {
    height: calc((var(--header-h) - 5px) * 0.5);
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.header-right a:hover { background: rgba(255,255,255,0.1); color: #fff; }

.user-icon { opacity: 0.7; vertical-align: middle; }

/* ── Dropdown navigation ───────────────────────────────────────── */

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown > a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

.nav-dropdown > a:hover,
.nav-dropdown > a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: var(--dark);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    padding: 4px 0;
    z-index: 300;
    margin-top: 4px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 8px 16px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 12px;
    transition: background 0.1s;
}

.nav-dropdown-menu a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* ── Views system (replaces tab-content for main sections) ─────── */

.view { display: none; }
.view.active { display: block; }

/* ── Drops Day0 layout (kanban + map) ──────────────────────────── */

.drops-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - var(--header-h));
}

.drops-map-panel {
    position: relative;
    border-right: 1px solid var(--border);
}

.map-container-full {
    width: 100%;
    height: 100%;
    background: #e8ecf0;
    user-select: none;
    -webkit-user-select: none;
}

.map-container-full img,
.drops-map-panel img {
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.map-search-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 10;
    max-width: 360px;
}

.map-search-overlay input {
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.map-search-results {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.map-search-results.visible { display: block; }

.map-search-results .search-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.map-search-results .search-item:hover { background: var(--teal-light); }
.map-search-results .search-item .search-name { font-weight: 600; }
.map-search-results .search-item .search-address { color: var(--text-sec); font-size: 11px; }

.map-filter-toggle {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 10;
    display: flex;
    gap: 4px;
}

.map-filter-toggle .btn { background: var(--white); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.map-filter-toggle .btn.active { background: var(--teal); color: #fff; }

/* ── Kanban ────────────────────────────────────────────────────── */

.drops-kanban-panel {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h));
    overflow: hidden;
}

.kanban-filters {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    background: var(--white);
    flex-shrink: 0;
}

.kanban-filters select { flex: 1; max-width: 200px; }
.kanban-filters .btn { padding: 8px 16px; font-size: 13px; }

.kanban-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    overflow: hidden;
}

.kanban-column {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.kanban-column:last-child { border-right: none; }

.kanban-column-header {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-sec);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.kanban-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-color: var(--teal);
}

.kanban-card .kc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.kanban-card .kc-count { font-size: 16px; font-weight: 700; color: var(--teal); }
.kanban-card .kc-store { font-size: 12px; font-weight: 600; color: var(--text); }
.kanban-card .kc-meta { font-size: 11px; color: var(--text-sec); }
.kanban-card .kc-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Drop detail modal expanded ────────────────────────────────── */

.modal-xl {
    max-width: 860px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
}

.drop-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.drop-detail-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drop-detail-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-section {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}

.detail-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-sec);
    margin-bottom: 8px;
}

.detail-info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}

.detail-info-row:last-child { border-bottom: none; }
.detail-info-label { color: var(--text-sec); font-weight: 500; }
.detail-info-value { font-weight: 600; text-align: right; }

.detail-timeline {
    max-height: 200px;
    overflow-y: auto;
}

.timeline-event {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.timeline-event:last-child { border-bottom: none; }
.timeline-event .te-action { font-weight: 600; color: var(--text); }
.timeline-event .te-actor { color: var(--text-sec); }
.timeline-event .te-time { color: var(--text-muted); font-size: 10px; }

.packages-list {
    max-height: 250px;
    overflow-y: auto;
}

.packages-list .pkg-item {
    padding: 4px 8px;
    font-size: 11px;
    font-family: monospace;
    border-bottom: 1px solid var(--border);
}

.packages-list .pkg-item.match { background: var(--green-light); }
.packages-list .pkg-item.mismatch { background: var(--orange-light); }

/* ── RTS badge (RED: priority state — needs Ops Supervisor action) ─
   Decisión del owner 2026-08-18: RTS en rojo para que llame la atención en el
   panel admin; Cancelado en gris (drop "borrado", sin acción). Supersede UX 1.6. */
.badge-rts { background: var(--red-light); color: var(--red); }
.badge-deliver-tomorrow { background: #DBEAFE; color: #1E40AF; }

/* ── Store detail modal (square, compact) ──────────────────────── */

.modal-store {
    max-width: 380px;
    width: 90%;
    aspect-ratio: 1 / 1;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.store-detail-header {
    margin-bottom: 12px;
}

.store-detail-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.store-detail-shortcode {
    font-size: 12px;
    color: var(--text-sec);
    font-weight: 500;
}

.store-detail-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.store-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 3px 0;
    border-bottom: 1px solid var(--border);
}

.store-detail-row:last-child { border-bottom: none; }
.store-detail-row .sd-label { color: var(--text-sec); }
.store-detail-row .sd-value { font-weight: 600; text-align: right; }

.store-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.store-status-badge.active { background: var(--green-light); color: var(--green); }
.store-status-badge.pending { background: var(--orange-light); color: var(--orange); }

.store-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.store-metric-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    text-align: center;
}

.store-metric-card .smc-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--teal);
}

.store-metric-card .smc-sub {
    font-size: 11px;
    color: var(--text-sec);
    margin-top: 2px;
}

.store-metric-card .smc-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Override button ───────────────────────────────────────────── */
.btn-override {
    background: transparent;
    color: var(--text-sec);
    border: 1px dashed var(--border);
    font-size: 11px;
    padding: 4px 10px;
}

.btn-override:hover { border-color: var(--red); color: var(--red); }

/* ── Scanner redesign (75/25 split) ────────────────────────────── */

.scanner-split {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.scanner-camera-area {
    flex: 3;
    position: relative;
    overflow: hidden;
}

.scanner-bottom-panel {
    flex: 1;
    background: var(--dark);
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 25%;
}

.scanner-last-scan {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.scanner-count {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

/* ── Store selection by geo ────────────────────────────────────── */

.store-select-list {
    max-height: 60vh;
    overflow-y: auto;
}

.store-select-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.store-select-item:hover { background: var(--teal-light); }
.store-select-item .ssi-name { font-size: 13px; font-weight: 600; }
.store-select-item .ssi-address { font-size: 11px; color: var(--text-sec); margin-top: 2px; }
.store-select-item .ssi-distance { font-size: 11px; color: var(--teal); font-weight: 600; margin-top: 2px; }

/* ── Responsive for new layout ─────────────────────────────────── */

@media (max-width: 1024px) {
    .drops-layout { grid-template-columns: 1fr; }
    .drops-map-panel { height: 300px; border-right: none; border-bottom: 1px solid var(--border); }
    .drops-kanban-panel { height: auto; }
    .drop-detail-grid { grid-template-columns: 1fr; }
    .drop-detail-right { grid-template-columns: 1fr; }
}


/* ── Pull-to-refresh ───────────────────────────────────────────── */

.pull-refresh-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-sec);
    overflow: hidden;
    transition: height 0.1s;
    height: 0;
}

/* ── Scan confirmation banner ──────────────────────────────────── */

.scan-confirm-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 32px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 700;
    z-index: 30000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: scan-pop 0.2s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.scan-confirm-banner.scan-confirm-success {
    background: var(--green);
    color: #fff;
}

.scan-confirm-banner.scan-confirm-error {
    background: var(--red);
    color: #fff;
}

@keyframes scan-pop {
    from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}


/* ══════════════════════════════════════════════════════════════════
   PHASE 4 — Utility classes (UX 3.3: replace inline styles)
   ══════════════════════════════════════════════════════════════════ */

.text-sec-sm { font-size: 12px; color: var(--text-sec); }
.text-muted-sm { font-size: 12px; color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.flex-row-gap { display: flex; gap: 6px; }
.flex-col-gap { display: flex; flex-direction: column; gap: 8px; }

/* ── Mobile touch targets (UX 1.2: 44px minimum) ───────────────── */

@media (max-width: 768px) {
    .mobile-container .btn,
    .mobile-content .btn { min-height: 44px; }
    .mobile-container .btn-sm,
    .mobile-content .btn-sm { min-height: 40px; }
    .mobile-tab { min-height: 44px; display: flex; align-items: center; justify-content: center; }
    #change-route-btn { min-height: 34px; font-size: 12px; }
}

/* ── Session text ellipsis (UX 1.3: blindar altura barra) ──────── */

.session-bar > div { min-width: 0; }
.session-bar .session-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

/* ── Typographic floor 12px on mobile apps (UX 1.4) ────────────── */

@media (max-width: 768px) {
    .drop-time, .notif-item .notif-time, .parcel-card .parcel-meta,
    .drop-card .drop-time { font-size: 12px; }
}

/* ── Stacked decision pairs on narrow screens (UX 2.3) ─────────── */

@media (max-width: 360px) {
    .confirm-modal-content .confirm-actions { flex-direction: column; }
    .confirm-modal-content .confirm-actions .btn { width: 100%; }
}

/* ── Temporary password modal (admin reset) ─────────────────────── */

.temp-pass-input {
    font-family: Consolas, "Courier New", monospace;
    font-size: 20px;
    letter-spacing: 2px;
    text-align: center;
    font-weight: 600;
    color: var(--text);
}

.temp-pass-status {
    font-size: 12px;
    margin: 10px 0 0;
}

.temp-pass-status.ok { color: var(--green-text); }
.temp-pass-status.warn { color: var(--amber-text); }

.temp-pass-warning {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--orange);
    border-radius: 6px;
    background: var(--bg);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-sec);
}
