/* Crate Track — enterprise UI (bordered, colored menus, icons) */
:root {
    --ct-navy: #0c2340;
    --ct-navy-mid: #14365c;
    --ct-steel: #1b4f72;
    --ct-primary: #1b4f72;
    --ct-accent: #0d7377;
    --ct-border: #c5d0dc;
    --ct-border-strong: #9aadc0;
    --ct-bg: #e8eef4;
    --ct-surface: #ffffff;
    --ct-muted: #5a6a7a;
    --ct-text: #1a2332;
    --ct-card-shadow: none;
    --ct-radius: 4px;
    --ct-menu-masters: #0d7377;
    --ct-menu-txn: #b45309;
    --ct-menu-reports: #1d4ed8;
    --ct-menu-history: #475569;
    --ct-menu-settings: #334155;
    --ct-menu-home: #0c2340;
    --ct-menu-license: #7c3aed;
    --mobile-nav-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --touch-min: 48px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background: var(--ct-bg);
    background-image:
        linear-gradient(180deg, rgba(12, 35, 64, 0.04) 0%, transparent 180px),
        repeating-linear-gradient(
            -12deg,
            transparent,
            transparent 14px,
            rgba(27, 79, 114, 0.03) 14px,
            rgba(27, 79, 114, 0.03) 15px
        );
    color: var(--ct-text);
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: var(--safe-top);
    -webkit-tap-highlight-color: transparent;
}

body.has-mobile-nav {
    padding-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom));
}

/* Top bar */
.ct-topbar {
    background: linear-gradient(90deg, var(--ct-navy) 0%, var(--ct-steel) 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 0.5rem 0.75rem;
    padding-top: calc(0.5rem + var(--safe-top));
    border-bottom: 3px solid var(--ct-accent);
    box-shadow: 0 2px 0 rgba(12, 35, 64, 0.15);
}

.ct-topbar-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 1280px;
    margin: 0 auto;
}

.ct-brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.02em;
}

.ct-brand i {
    margin-right: 0.35rem;
    opacity: 0.95;
}

.ct-brand:hover,
.ct-brand:focus {
    color: #fff;
}

.ct-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.ct-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-min);
    height: var(--touch-min);
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: var(--ct-radius);
    font-size: 1.25rem;
    text-decoration: none;
}

.ct-icon-btn:hover,
.ct-icon-btn:focus {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.55);
}

/* Desktop nav */
.ct-desktop-nav {
    display: none;
    background: linear-gradient(180deg, var(--ct-navy) 0%, var(--ct-navy-mid) 100%);
    border-bottom: 3px solid var(--ct-accent);
    box-shadow: 0 2px 0 rgba(12, 35, 64, 0.12);
    padding: 0 0.75rem;
}

.ct-desktop-nav .container-fluid {
    max-width: 1400px;
}

.ct-desktop-nav .navbar-brand {
    color: #fff !important;
    font-size: 1.12rem;
    letter-spacing: 0.03em;
    font-weight: 700;
    padding: 0.55rem 0.75rem;
    margin-right: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--ct-radius);
    background: rgba(255, 255, 255, 0.06);
}

.ct-desktop-nav .navbar-brand i {
    color: #5eead4;
    margin-right: 0.3rem;
}

.ct-desktop-nav .navbar-brand:hover,
.ct-desktop-nav .navbar-brand:focus {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.12);
}

/* Colored nav chips */
.ct-desktop-nav .navbar-nav.me-auto {
    gap: 0.2rem;
    padding: 0.35rem 0;
}

.ct-desktop-nav .nav-link {
    color: #e8eef4 !important;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.55rem 0.75rem !important;
    border-radius: var(--ct-radius);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.ct-desktop-nav .nav-link i {
    font-size: 1rem;
    opacity: 0.95;
}

.ct-desktop-nav .nav-link:hover,
.ct-desktop-nav .nav-link:focus,
.ct-desktop-nav .nav-link.active,
.ct-desktop-nav .nav-link.show {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
}

/* Per-menu accent bars */
.ct-desktop-nav .nav-link.ct-nav-home {
    border-bottom: 2px solid #94a3b8;
}
.ct-desktop-nav .nav-link.ct-nav-masters {
    border-bottom: 2px solid #2dd4bf;
}
.ct-desktop-nav .nav-link.ct-nav-txn {
    border-bottom: 2px solid #fb923c;
}
.ct-desktop-nav .nav-link.ct-nav-reports {
    border-bottom: 2px solid #60a5fa;
}
.ct-desktop-nav .nav-link.ct-nav-history {
    border-bottom: 2px solid #cbd5e1;
}
.ct-desktop-nav .nav-link.ct-nav-settings {
    border-bottom: 2px solid #a5b4fc;
}
.ct-desktop-nav .nav-link.ct-nav-license {
    border-bottom: 2px solid #c4b5fd;
}
.ct-desktop-nav .nav-link.ct-nav-out {
    border-bottom: 2px solid #4ade80;
}
.ct-desktop-nav .nav-link.ct-nav-in {
    border-bottom: 2px solid #fbbf24;
}

.ct-desktop-nav .navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.45);
    padding: 0.45rem 0.65rem;
    border-radius: var(--ct-radius);
}

.ct-desktop-nav .navbar-toggler:focus {
    box-shadow: 0 0 0 0.15rem rgba(94, 234, 212, 0.35);
}

.ct-desktop-nav .form-control {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.96);
    border-radius: var(--ct-radius);
    color: var(--ct-text);
}

.ct-desktop-nav .form-control:focus {
    border-color: var(--ct-accent);
    box-shadow: 0 0 0 0.15rem rgba(13, 115, 119, 0.25);
}

/* Enterprise bordered dropdowns */
.ct-desktop-nav .dropdown-menu {
    border: 1px solid var(--ct-border-strong);
    border-radius: var(--ct-radius);
    box-shadow: 0 8px 24px rgba(12, 35, 64, 0.18);
    margin-top: 0.35rem;
    padding: 0.35rem 0;
    min-width: 14rem;
    background: var(--ct-surface);
}

.ct-desktop-nav .dropdown-menu.ct-dd-masters {
    border-top: 3px solid var(--ct-menu-masters);
}
.ct-desktop-nav .dropdown-menu.ct-dd-txn {
    border-top: 3px solid var(--ct-menu-txn);
}
.ct-desktop-nav .dropdown-menu.ct-dd-reports {
    border-top: 3px solid var(--ct-menu-reports);
}

.ct-desktop-nav .dropdown-item {
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border-left: 3px solid transparent;
    color: var(--ct-text);
}

.ct-desktop-nav .dropdown-item i {
    width: 1.15rem;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.ct-desktop-nav .dropdown-item:hover,
.ct-desktop-nav .dropdown-item:focus {
    background: #f0f5fa;
    border-left-color: var(--ct-steel);
    color: var(--ct-navy);
}

.ct-desktop-nav .dropdown-item.ct-mi-teal:hover {
    border-left-color: var(--ct-menu-masters);
    background: #e6f7f7;
}
.ct-desktop-nav .dropdown-item.ct-mi-orange:hover {
    border-left-color: var(--ct-menu-txn);
    background: #fff7ed;
}
.ct-desktop-nav .dropdown-item.ct-mi-blue:hover {
    border-left-color: var(--ct-menu-reports);
    background: #eff6ff;
}
.ct-desktop-nav .dropdown-item.ct-mi-green:hover {
    border-left-color: #16a34a;
    background: #f0fdf4;
}
.ct-desktop-nav .dropdown-item.ct-mi-amber:hover {
    border-left-color: #d97706;
    background: #fffbeb;
}
.ct-desktop-nav .dropdown-item.ct-mi-slate:hover {
    border-left-color: #64748b;
    background: #f8fafc;
}
.ct-desktop-nav .dropdown-item.ct-mi-red:hover {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.ct-desktop-nav .dropdown-divider {
    border-color: var(--ct-border);
    margin: 0.35rem 0;
}

.ct-desktop-nav .dropdown-header {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ct-muted);
    padding: 0.4rem 1rem 0.2rem;
}

.ct-desktop-nav .nav-user .nav-link {
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 991.98px) {
    .ct-desktop-nav .navbar-collapse {
        background: var(--ct-navy);
        margin: 0.5rem 0 0.75rem;
        padding: 0.65rem;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--ct-radius);
        max-height: calc(100dvh - 4.5rem);
        overflow-y: auto;
    }

    .ct-desktop-nav .nav-link {
        padding: 0.7rem 0.85rem !important;
        min-height: var(--touch-min);
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .ct-desktop-nav .dropdown-menu {
        background: #fff;
        margin-left: 0.35rem;
        border: 1px solid var(--ct-border);
    }

    .ct-desktop-nav form.d-none.d-md-flex {
        display: flex !important;
        margin: 0.5rem 0 !important;
        width: 100%;
    }

    .ct-desktop-nav form .form-control {
        width: 100%;
        min-width: 0 !important;
    }
}

/* Main content */
.ct-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 0.75rem 1.5rem;
}

.ct-main-narrow {
    max-width: 640px;
}

/* Bordered cards */
.card {
    border: 1px solid var(--ct-border);
    box-shadow: none;
    border-radius: var(--ct-radius);
    background: var(--ct-surface);
}

.card-header {
    background: linear-gradient(180deg, #f7fafc 0%, #eef3f8 100%);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ct-navy);
    border-bottom: 1px solid var(--ct-border);
    border-radius: var(--ct-radius) var(--ct-radius) 0 0 !important;
    padding: 0.7rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.card-header i {
    color: var(--ct-steel);
}

.card-body {
    border-top: none;
}

.stat-card {
    border: 1px solid var(--ct-border);
    box-shadow: none;
    border-radius: var(--ct-radius);
    border-left-width: 4px;
    background: var(--ct-surface);
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ct-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--ct-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card .stat-sub {
    color: #94a3b8;
    font-size: 0.72rem;
    margin-top: 0.15rem;
}

.stat-card .stat-icon {
    float: right;
    font-size: 1.35rem;
    opacity: 0.35;
    margin-top: 0.15rem;
}

.stat-card-company {
    border-left-color: #1565c0;
}
.stat-card-company .stat-value { color: #1565c0; }
.stat-card-salesman {
    border-left-color: #7b1fa2;
}
.stat-card-salesman .stat-value { color: #7b1fa2; }
.stat-card-customer {
    border-left-color: #00838f;
}
.stat-card-customer .stat-value { color: #00838f; }
.stat-card-total {
    border-left-color: #2e7d32;
}
.stat-card-total .stat-value { color: #2e7d32; }
.stat-card-neutral {
    border-left-color: var(--ct-steel);
}

/* Page header */
.page-header {
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--ct-border);
}

.page-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--ct-navy);
    letter-spacing: -0.01em;
}

.page-header h1 .page-title-icon {
    color: var(--ct-steel);
    margin-right: 0.35rem;
}

.page-header .subtitle {
    color: var(--ct-muted);
    font-size: 0.875rem;
    margin: 0;
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Action tiles — bordered + color accent */
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (min-width: 576px) {
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .action-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

.action-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--ct-surface);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    border-top: 3px solid var(--ct-steel);
    transition: border-color 0.12s, background 0.12s, transform 0.12s;
    -webkit-user-select: none;
    user-select: none;
}

.action-tile:hover {
    border-color: var(--ct-border-strong);
    background: #f8fbfd;
    color: inherit;
}

.action-tile:active {
    transform: scale(0.98);
}

.action-tile .tile-body {
    text-align: center;
    padding: 1.15rem 0.65rem;
}

.action-tile i {
    font-size: 1.85rem;
    display: block;
    margin-bottom: 0.4rem;
}

.action-tile .tile-label {
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.25;
    color: var(--ct-navy);
}

.action-tile .tile-hint {
    font-size: 0.7rem;
    color: var(--ct-muted);
    margin-top: 0.15rem;
}

.action-tile.tile-primary { border-top-color: #1565c0; }
.action-tile.tile-danger { border-top-color: #c62828; }
.action-tile.tile-success { border-top-color: #2e7d32; }
.action-tile.tile-warning { border-top-color: #ef6c00; }
.action-tile.tile-secondary { border-top-color: #546e7a; }
.action-tile.tile-info { border-top-color: #00838f; }

/* Mobile bottom nav */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: #fff;
    border-top: 2px solid var(--ct-border);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    z-index: 1030;
    box-shadow: 0 -2px 0 rgba(12, 35, 64, 0.06);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.3rem 0.35rem;
    min-width: 56px;
    min-height: var(--touch-min);
    border: none;
    background: transparent;
    flex: 1;
    border-top: 3px solid transparent;
    border-radius: 0;
}

.mobile-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
    color: var(--ct-steel);
}

.mobile-nav-item.active {
    color: var(--ct-navy);
    background: #f0f5fa;
    border-top-color: var(--ct-accent);
}

/* Stock panels */
.stock-panel {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.75rem;
    font-size: 0.875rem;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    background: #fafcfe;
}

.stock-panel table {
    width: 100%;
    margin: 0;
}

.stock-panel td {
    padding: 0.4rem 0;
    border-bottom: 1px solid #e8eef4;
}

.stock-panel .empty-msg {
    color: var(--ct-muted);
    text-align: center;
    padding: 1rem 0;
}

/* Line items */
#lineItemsTable thead {
    display: none;
}

#lineItemsTable tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

#lineItemsTable tbody td {
    display: block;
    border: none;
    padding: 0.25rem 0;
}

#lineItemsTable tbody td:last-child {
    text-align: right;
    padding-top: 0.5rem;
}

#lineItemsTable .remove-line {
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    font-size: 1.25rem;
}

@media (min-width: 768px) {
    #lineItemsTable thead {
        display: table-header-group;
    }

    #lineItemsTable tbody tr {
        display: table-row;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        margin-bottom: 0;
    }

    #lineItemsTable tbody td {
        display: table-cell;
        border-bottom: 1px solid var(--ct-border);
        padding: 0.5rem;
        vertical-align: middle;
    }

    #lineItemsTable tbody td:last-child {
        text-align: center;
        padding-top: 0.5rem;
    }
}

/* Data tables / cards */
.data-table-wrap {
    display: none;
}

.data-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.data-card {
    background: #fff;
    border-radius: var(--ct-radius);
    border: 1px solid var(--ct-border);
    padding: 1rem;
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.data-card-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.data-card-meta {
    font-size: 0.8rem;
    color: var(--ct-muted);
}

.data-card-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 0.2rem 0;
}

.data-card-row .label {
    color: var(--ct-muted);
}

.data-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ct-border);
}

.data-card-actions .btn {
    flex: 1;
    min-height: 40px;
}

@media (min-width: 768px) {
    .data-table-wrap {
        display: block;
    }

    .data-cards {
        display: none;
    }
}

.master-card .field-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 0.15rem 0;
}

.master-card .field-row .fname {
    color: var(--ct-muted);
    flex-shrink: 0;
    margin-right: 0.5rem;
}

/* Tables — enterprise border */
.table {
    --bs-table-border-color: var(--ct-border);
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--ct-border);
}

.table thead th {
    background: #eef3f8;
    color: var(--ct-navy);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--ct-border-strong) !important;
    white-space: nowrap;
}

.table-bordered {
    border: 1px solid var(--ct-border);
}

.table-bordered > :not(caption) > * {
    border-width: 1px 0;
    border-color: var(--ct-border);
}

.table-bordered > :not(caption) > * > * {
    border-width: 0 1px;
    border-color: var(--ct-border);
}

/* Forms */
.form-control,
.form-select {
    min-height: var(--touch-min);
    font-size: 1rem;
    border-radius: var(--ct-radius);
    border-color: var(--ct-border-strong);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ct-steel);
    box-shadow: 0 0 0 0.15rem rgba(27, 79, 114, 0.2);
}

.form-control-lg,
.form-select-lg {
    min-height: 52px;
    font-size: 1rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ct-navy);
}

input[type="date"].date-picker {
    min-height: var(--touch-min);
    padding: 0.375rem 0.65rem;
}

input[type="date"].date-picker::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.8;
}

.btn {
    min-height: 44px;
    border-radius: var(--ct-radius);
    font-weight: 600;
    border-width: 1px;
}

.btn-primary {
    --bs-btn-bg: var(--ct-steel);
    --bs-btn-border-color: var(--ct-navy);
    --bs-btn-hover-bg: var(--ct-navy);
    --bs-btn-hover-border-color: var(--ct-navy);
    --bs-btn-active-bg: #0a1c33;
    --bs-btn-active-border-color: #0a1c33;
}

.btn-outline-primary {
    --bs-btn-color: var(--ct-steel);
    --bs-btn-border-color: var(--ct-steel);
    --bs-btn-hover-bg: var(--ct-steel);
    --bs-btn-hover-border-color: var(--ct-steel);
}

.btn-lg {
    min-height: var(--touch-min);
    font-size: 1rem;
}

.btn-sm {
    min-height: 36px;
}

.report-loading {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(12, 35, 64, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.report-loading-card {
    background: #fff;
    border: 1px solid var(--ct-border-strong);
    border-radius: var(--ct-radius);
    padding: 1.5rem 2rem;
    text-align: center;
    min-width: 240px;
    border-top: 3px solid var(--ct-accent);
}

.offline-banner {
    min-height: 44px;
    border-radius: var(--ct-radius);
}

/* Sticky submit bar */
.sticky-submit-bar {
    position: sticky;
    bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 8px);
    z-index: 100;
    background: linear-gradient(transparent, var(--ct-bg) 20%);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

body:not(.has-mobile-nav) .sticky-submit-bar {
    bottom: 8px;
}

@media (max-width: 767px) {
    .collapse-mobile .card-header {
        cursor: pointer;
    }

    .collapse-mobile .card-header::after {
        content: "\F282";
        font-family: bootstrap-icons;
        float: right;
        transition: transform 0.2s;
    }

    .collapse-mobile.collapsed .card-body,
    .collapse-mobile.collapsed .card-body + * {
        display: none;
    }

    .collapse-mobile.collapsed .card-header::after {
        transform: rotate(-90deg);
    }
}

/* Login — enterprise panel */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    background:
        linear-gradient(145deg, var(--ct-navy) 0%, var(--ct-steel) 55%, #0d7377 100%);
    padding: 1rem;
    padding-bottom: calc(1rem + var(--safe-bottom));
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--ct-radius);
    border-top: 4px solid var(--ct-accent);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.login-card .login-brand-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--ct-border);
    border-radius: var(--ct-radius);
    background: #f0f7f8;
    color: var(--ct-steel);
    font-size: 1.75rem;
}

/* Barcode scanner */
.barcode-reader {
    width: 100%;
    min-height: 260px;
    border-radius: var(--ct-radius);
    overflow: hidden;
    background: #000;
    border: 1px solid #334155;
}

.barcode-reader video {
    width: 100% !important;
    border-radius: var(--ct-radius);
}

#barcodeModal .modal-dialog {
    margin: 0.5rem;
    max-width: 100%;
}

.list-group-item {
    padding: 0.85rem 1rem;
    border-color: var(--ct-border);
}

/* Offcanvas menu — colored sections */
.offcanvas {
    border-left: 1px solid var(--ct-border-strong);
}

.offcanvas-header {
    background: linear-gradient(90deg, var(--ct-navy) 0%, var(--ct-steel) 100%);
    color: #fff;
    border-bottom: 3px solid var(--ct-accent) !important;
}

.offcanvas-header .btn-close {
    filter: invert(1);
}

.offcanvas-title {
    font-weight: 700;
}

.offcanvas-menu .list-group-item {
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    border-left: 4px solid transparent;
    border-radius: 0;
    color: var(--ct-text);
}

.offcanvas-menu .list-group-item i {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
}

.offcanvas-menu .list-group-item:hover,
.offcanvas-menu .list-group-item:focus {
    background: #f0f5fa;
}

.offcanvas-menu .list-group-item.ct-mi-teal {
    border-left-color: var(--ct-menu-masters);
}
.offcanvas-menu .list-group-item.ct-mi-orange {
    border-left-color: var(--ct-menu-txn);
}
.offcanvas-menu .list-group-item.ct-mi-blue {
    border-left-color: var(--ct-menu-reports);
}
.offcanvas-menu .list-group-item.ct-mi-green {
    border-left-color: #16a34a;
}
.offcanvas-menu .list-group-item.ct-mi-amber {
    border-left-color: #d97706;
}
.offcanvas-menu .list-group-item.ct-mi-slate {
    border-left-color: #64748b;
}
.offcanvas-menu .list-group-item.ct-mi-red {
    border-left-color: #dc2626;
}

.oc-section {
    padding: 0.55rem 1rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ct-muted);
    background: #f1f5f9;
    border-top: 1px solid var(--ct-border);
    border-bottom: 1px solid var(--ct-border);
}

/* Report cards on index */
.report-card {
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    border-left: 4px solid var(--ct-menu-reports);
    height: 100%;
    transition: border-color 0.12s, background 0.12s;
}

.report-card:hover {
    border-color: var(--ct-border-strong);
    background: #f8fbfd;
}

.report-card .report-card-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    background: #eff6ff;
    color: var(--ct-menu-reports);
    margin-bottom: 0.65rem;
    font-size: 1.1rem;
}

/* Report gold header */
.report-gold-header thead th {
    background: #ffc000;
    color: #000;
    font-weight: 700;
    border-bottom: 2px solid #e6ac00;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: 0;
    font-size: inherit;
}

@media (max-width: 767.98px) {
    .report-gold-header {
        font-size: 0.8rem;
    }

    .data-table-wrap .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* Desktop layout */
@media (min-width: 992px) {
    body.has-mobile-nav {
        padding-bottom: 0;
    }

    .mobile-bottom-nav {
        display: none !important;
    }

    .ct-topbar {
        display: none;
    }

    .ct-desktop-nav {
        display: block;
    }

    .sticky-submit-bar {
        bottom: 8px;
    }

    .page-header h1 {
        font-size: 1.45rem;
    }

    .stat-card .stat-value {
        font-size: 1.75rem;
    }
}

@media (min-width: 768px) {
    .ct-main {
        padding: 1.25rem 1.5rem 2rem;
    }
}

/* GPS */
.gps-status {
    padding: 0.5rem 0.75rem;
    border-radius: var(--ct-radius);
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.gps-status-pending,
.gps-status-loading {
    background: #fff8e6;
    color: #664d03;
    border-color: #f0d78c;
}

.gps-status-ready {
    background: #e8f5e9;
    color: #0f5132;
    border-color: #a5d6a7;
}

.gps-status-error {
    background: #fdecea;
    color: #842029;
    border-color: #f5c2c7;
}

.gps-status-warning {
    background: #fff8e6;
    color: #664d03;
    border: 1px solid #f0d78c;
}

.location-map {
    height: 420px;
    min-height: 320px;
    width: 100%;
    z-index: 1;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
}

.location-map-timeline {
    height: 480px;
}

.gps-timeline-layout {
    align-items: stretch;
}

.gps-timeline-card {
    max-height: 520px;
    display: flex;
    flex-direction: column;
}

.gps-timeline {
    overflow-y: auto;
    flex: 1;
    max-height: 460px;
    -webkit-overflow-scrolling: touch;
}

.gps-timeline-item {
    display: flex;
    gap: 0.65rem;
    width: 100%;
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--ct-border);
    background: #fff;
    padding: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.gps-timeline-item:hover,
.gps-timeline-item.active {
    background: #eef4fa;
}

.gps-timeline-item.gps-tl-out {
    border-left: 4px solid #198754;
}

.gps-timeline-item.gps-tl-in {
    border-left: 4px solid #ffc107;
}

.gps-tl-time {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--ct-steel);
    min-width: 2.5rem;
}

.gps-tl-seq {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 2px;
    background: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--ct-border);
}

.gps-timeline-item.active .gps-tl-seq {
    background: var(--ct-steel);
    color: #fff;
    border-color: var(--ct-navy);
}

.gps-tl-body {
    flex: 1;
    min-width: 0;
}

.gps-tl-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.gps-tl-meta,
.gps-tl-district,
.gps-tl-loc {
    font-size: 0.75rem;
    line-height: 1.35;
}

.gps-trail-arrow-wrap {
    background: transparent !important;
    border: none !important;
}

.gps-trail-arrow {
    font-size: 16px;
    line-height: 1;
    text-shadow: 0 0 2px #fff, 0 0 4px #fff;
    pointer-events: none;
}

.gps-end-marker div {
    width: 22px;
    height: 22px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.gps-start-marker div {
    background: var(--ct-steel);
}

.gps-finish-marker div {
    background: #dc3545;
}

.map-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.map-legend-out {
    background: #198754;
}

.map-legend-in {
    background: #ffc107;
}

@media (min-width: 768px) {
    .location-map {
        height: 520px;
    }

    .location-map-timeline {
        height: 560px;
    }

    .gps-timeline-card {
        max-height: 600px;
    }

    .gps-timeline {
        max-height: 540px;
    }
}

@media (min-width: 992px) {
    .dropdown-menu .dropend .dropdown-menu {
        top: 0;
        left: 100%;
        margin-left: 0.125rem;
    }
}

.gps-info .gps-coords {
    white-space: nowrap;
}

.pwa-install-banner {
    position: fixed;
    bottom: calc(var(--mobile-nav-height, 0px) + 12px);
    left: 12px;
    right: 12px;
    background: var(--ct-navy);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: var(--ct-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 4px solid var(--ct-accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1050;
}

.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #664d03;
    color: #fff;
    text-align: center;
    padding: 0.35rem;
    font-size: 0.875rem;
    z-index: 2000;
}

/* Quick action buttons on dashboards */
.btn-qa {
    justify-content: flex-start;
    gap: 0.5rem;
    border: 1px solid var(--ct-border);
    text-align: left;
}

.btn-qa i {
    width: 1.25rem;
    text-align: center;
}

/* Modal enterprise border */
.modal-content {
    border: 1px solid var(--ct-border-strong);
    border-radius: var(--ct-radius);
    border-top: 3px solid var(--ct-steel);
}

.modal-header {
    background: #f7fafc;
    border-bottom: 1px solid var(--ct-border);
}

.badge.border {
    font-weight: 600;
}

.alert {
    border-radius: var(--ct-radius);
    border-width: 1px;
    border-left-width: 4px;
}
