html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.navbar {
  position: relative;
  z-index: 1030;
}

.navbar .dropdown-menu {
  z-index: 1031;
}

/* ── Order List component ──────────────────────────────────────────────────── */

.order-list-scroll.hide-date .order-date-col {
    display: none !important;
}

/* ── Products table readability ─────────────────────────────────────────────── */

#productsTable td,
#productsTable th {
    font-size: 14px;
}

/* ── Chip Select component ─────────────────────────────────────────────────── */

.chip-select {
    position: relative;
}

.cs-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-height: 38px;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.cs-input:focus,
.cs-input.open {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

.cs-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 4px 2px 8px;
    background: #0d6efd;
    color: #fff;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    line-height: 1.5;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.cs-chip-label {
    min-width: 0;
}

.cs-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    border-radius: 0.2rem;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.cs-chip-remove:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.cs-placeholder {
    color: #6c757d;
    font-size: 0.875rem;
    padding: 2px 0;
}

.cs-dropdown {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1050;
    overflow: hidden;
}

.cs-controls {
    display: flex;
    gap: 6px;
    padding: 7px 10px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.cs-ctrl-btn {
    padding: 2px 10px;
    font-size: 0.78rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    background: #fff;
    cursor: pointer;
    color: #495057;
    line-height: 1.5;
}

.cs-ctrl-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.cs-options {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 260px;
    overflow-y: auto;
}

.cs-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #212529;
    min-width: 0;
}

.cs-option-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.cs-option:hover {
    background: #f0f4ff;
}

.cs-option.selected {
    background: #e8f0fe;
}

.cs-checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #0d6efd;
    font-size: 0.9rem;
    font-weight: 700;
    visibility: hidden;
}

.cs-option.selected .cs-checkmark {
    visibility: visible;
}

/* ── Tag Input component (free-text chip entry, e.g. Order Numbers) ─────────── */

.tag-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-height: 38px;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    cursor: text;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.tag-input-wrapper:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.tag-input-field {
    border: none;
    outline: none;
    flex: 1;
    min-width: 80px;
    font-size: 0.875rem;
    padding: 2px 0;
    background: transparent;
    color: #212529;
}

.tag-input-field::placeholder {
    color: #6c757d;
}

/* ── Order list: route selection + highlight ────────────────────────────────── */

.order-route-cb {
    display: none;
    margin-top: 2px;
    vertical-align: middle;
}

.order-list-scroll.route-select-mode .order-route-cb {
    display: inline-block;
}

#orderList li.order-highlight {
    background-color: #fff3cd !important;
}

/* ── Route table ─────────────────────────────────────────────────────────────── */

.route-table td,
.route-table th {
    vertical-align: middle;
    font-size: 0.82rem;
}

.route-table .drag-handle {
    cursor: grab;
    color: #adb5bd;
    user-select: none;
    font-size: 1rem;
    line-height: 1;
}

.route-table tbody tr.drag-over {
    border-top: 2px solid #0d6efd;
}

.route-table .stop-num {
    color: #6c757d;
    font-variant-numeric: tabular-nums;
}

.route-table .stop-type-departure td,
.route-table .stop-type-finish td {
    background-color: #f0f4ff;
    font-weight: 500;
}

.route-table .stop-type-break td {
    background-color: #f8f9fa;
    font-style: italic;
}

.route-table input.duration-input {
    width: 60px;
    min-width: 0;
    padding: 1px 4px;
    font-size: 0.82rem;
    text-align: right;
}

.route-table .break-note-input {
    min-width: 100px;
    width: 100%;
    padding: 1px 4px;
    font-size: 0.82rem;
}

/* ── Route progress bar ──────────────────────────────────────────────────────── */

#routeProgressBar {
    transition: width 0.3s ease;
}

/* ── Three-column app layout ────────────────────────────────────────────────── */

.app-layout {
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    grid-template-rows: calc(100vh - 80px);
    gap: 0 8px;
    align-items: stretch;
    margin-bottom: 0;
}

.app-layout.sidebar-collapsed {
    grid-template-columns: 36px 1fr 300px;
}

/* Filter sidebar */
.filter-sidebar {
    display: flex;
    flex-direction: row;
    min-width: 0;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    overflow-x: hidden;
    overflow-y: visible;
}

.sidebar-toggle-btn {
    flex-shrink: 0;
    width: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    border: none;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    cursor: pointer;
    color: #6c757d;
    font-size: 1rem;
}

.sidebar-toggle-btn:hover {
    background: #e9ecef;
    color: #212529;
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible;
    min-width: 0;
}

.app-layout.sidebar-collapsed .sidebar-content {
    display: none;
}

.filter-label {
    font-size: 0.8rem;
    margin-bottom: 2px;
    color: #495057;
}

.filter-panel-header {
    background: #f8f9fa;
    flex-shrink: 0;
}

/* Main content panel */
.main-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    overflow: hidden;
}

.tab-content-area {
    overflow: hidden;
}

.tab-pane-content {
    min-height: 0;
}

/* Order list panel */
.order-list-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.order-list-panel .card {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Kanban board ────────────────────────────────────────────────────────────── */

.kanban-board {
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: flex-start;
}

.kanban-col {
    flex: 0 0 210px;
    width: 210px;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    max-height: calc(100vh - 200px);
}

.kanban-col-header {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    background: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.375rem 0.375rem 0 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #495057;
    flex-shrink: 0;
}

.kanban-col-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-col-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 72px;
}

.kanban-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 9px 11px;
    margin-bottom: 7px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.15s, border-color 0.15s;
    font-size: 0.875rem;
}

.kanban-card:last-child {
    margin-bottom: 0;
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    border-color: #adb5bd;
}

.kanban-card.sortable-drag {
    cursor: grabbing;
}

.kanban-card-ghost {
    opacity: 0.35;
}

.kanban-card-name {
    line-height: 1.3;
}

/* Responsive: collapse to single column on small screens */
@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }
    .app-layout.sidebar-collapsed {
        grid-template-columns: 1fr;
    }
    .filter-sidebar,
    .main-panel,
    .order-list-panel {
        min-height: 300px;
    }
}