/* ==========================================================================
   Cargo CRM — design tokens
   Light values live on :root; dark values are redefined once under
   [data-bs-theme="dark"] — every rule below reads color/spacing through a
   variable so a component only needs writing once to work in both themes.
   ========================================================================== */

:root {
    --sidebar-width: 260px;

    --brand-color: #16a34a;
    --brand-dark: #15803d;
    --brand-light: #22c55e;
    --brand-soft: #ecfdf5;

    --body-bg: #f4f6f9;
    --surface: #ffffff;
    --surface-alt: #f9fafb;
    --surface-hover: #f3f4f6;

    --border-color: #e5e7eb;
    --border-color-strong: #d1d5db;

    --text-heading: #111827;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-md: 0 6px 20px -6px rgba(15, 23, 42, .12);
    --shadow-lg: 0 20px 45px -20px rgba(15, 23, 42, .25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition-fast: .15s ease;
    --transition-base: .2s ease;
}

[data-bs-theme="dark"] {
    --brand-color: #22c55e;
    --brand-dark: #16a34a;
    --brand-light: #4ade80;
    --brand-soft: #0f2a1c;

    --body-bg: #0b1220;
    --surface: #131b2c;
    --surface-alt: #182338;
    --surface-hover: #1c2942;

    --border-color: #263349;
    --border-color-strong: #334155;

    --text-heading: #f1f5f9;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 10px 28px -8px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 55px -20px rgba(0, 0, 0, .65);
}

* {
    scrollbar-color: var(--border-color-strong) transparent;
}

body {
    background: var(--body-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Smooth, but never for people who've asked their OS to reduce motion. */
.app-sidebar, .app-topbar, .card, .stat-card, .filters-card, .btn, .form-control, .form-select,
.nav-link, .badge-status, .modal-content, .table {
    transition: background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base), box-shadow var(--transition-fast), transform var(--transition-fast);
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    letter-spacing: -.01em;
}

/* ---------- Layout shell ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    transition: transform var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
    overflow-y: auto;
}

.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.15rem 1.25rem;
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--text-heading);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 3px 10px -2px rgba(22, 163, 74, .5);
}

.sidebar-brand .brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.sidebar-nav {
    padding: .85rem .65rem;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .8rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: var(--surface-hover);
    color: var(--text-heading);
}

.sidebar-nav .nav-link.active {
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-weight: 600;
}

.sidebar-nav .nav-section-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: .9rem .8rem .3rem;
}

/* ---------- Topbar ---------- */

.app-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: .65rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-search {
    max-width: 360px;
    width: 100%;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.topbar-icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: var(--surface-alt);
    border: 1px solid transparent;
}

.topbar-icon-btn:hover {
    background: var(--surface-hover);
    color: var(--text-heading);
}

.topbar-icon-btn .badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 999px;
    box-shadow: 0 0 0 2px var(--surface);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .85rem;
}

/* ---------- Content ---------- */

.app-content {
    padding: 1.5rem;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: .2rem;
    color: var(--text-heading);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: .88rem;
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.card .card-body {
    padding: 1.35rem;
}

.stat-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--surface);
    padding: 1.15rem 1.3rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-base), border-color var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: .82rem;
    margin-bottom: .4rem;
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text-heading);
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--brand-dark);
    background: var(--brand-soft);
    margin-bottom: .6rem;
}

.filters-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

/* ---------- Tables ---------- */

.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
}

.table > :not(caption) > * > * {
    padding: .8rem .9rem;
}

.table thead th {
    background: var(--surface-alt);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table tbody tr {
    border-color: var(--border-color);
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.card > .table-responsive:first-child > .table,
.card > .table-responsive:last-child > .table {
    margin-bottom: 0;
}

/* ---------- Forms ---------- */

.form-control, .form-select {
    background-color: var(--surface);
    border: 1px solid var(--border-color-strong);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.form-control:focus, .form-select:focus {
    background-color: var(--surface);
    color: var(--text-primary);
    border-color: var(--brand-color);
    box-shadow: 0 0 0 .2rem var(--brand-soft);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-primary);
}

.form-text {
    color: var(--text-secondary);
}

.input-group-text {
    background: var(--surface-alt);
    border-color: var(--border-color-strong);
    color: var(--text-secondary);
}

/* ---------- Buttons ---------- */

.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.btn-success {
    background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
    border-color: var(--brand-dark);
    box-shadow: 0 4px 14px -4px rgba(22, 163, 74, .55);
}

.btn-success:hover, .btn-success:focus {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -4px rgba(22, 163, 74, .65);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color-strong);
}

.btn-outline-secondary:hover {
    background: var(--surface-hover);
    color: var(--text-heading);
    border-color: var(--border-color-strong);
}

.btn-light {
    background: var(--surface-alt);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-light:hover {
    background: var(--surface-hover);
}

/* ---------- Modals ---------- */

.modal-content {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header, .modal-footer {
    border-color: var(--border-color);
}

.modal-backdrop.show {
    opacity: .55;
}

/* ---------- Dropdowns ---------- */

.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.dropdown-item {
    color: var(--text-primary);
}

.dropdown-item:hover, .dropdown-item:focus {
    background: var(--surface-hover);
    color: var(--text-heading);
}

/* ---------- Alert boxes (left-accent notice, e.g. scan not-found/warning) ----------
   Themed replacement for the inline `style="background:#fbeaea;color:#b91c1c"`
   pattern used ad hoc in a few views — those hardcoded hex colors never
   adapted to dark mode (a bright pink/yellow box on a dark page). Colors
   pull from the same status hue families as the order badges above, with
   dark variants further down. */

.alert-box {
    border-left: 3px solid;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: .9rem 1.1rem;
}

.alert-box.error {
    border-left-color: #b91c1c;
    background: #fbeaea;
    color: #b91c1c;
}

.alert-box.warning {
    border-left-color: #b45309;
    background: #fef3c7;
    color: #92400e;
}

.alert-box.success {
    border-left-color: #15803d;
    background: #dcfce7;
    color: #166534;
}

/* ---------- Theme-safe replacements for fixed Bootstrap utilities ----------
   Bootstrap's .bg-white/.bg-light/.text-dark utilities resolve to literal,
   non-theme-relative colors (Bootstrap never redefines --bs-light-rgb/
   --bs-dark-rgb under [data-bs-theme=dark]) — using them anywhere left a
   bright white/near-black patch that dark mode couldn't touch. These read
   the same tokens as the rest of the app instead. */

.bg-surface-alt {
    background: var(--surface-alt) !important;
    color: var(--text-primary);
}

.bg-unread {
    background: var(--brand-soft) !important;
}

.bg-chat-bubble {
    background: var(--surface-alt) !important;
    color: var(--text-primary) !important;
}

/* ---------- Status badges ---------- */

.badge-status {
    display: inline-flex;
    align-items: center;
    padding: .34rem .68rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .01em;
}

/* ---------- Order status badges ----------
   One dedicated, intuitive color per status, reused everywhere a status is
   shown (orders list/detail, dashboard chart via orderStatusHex(), printed
   labels via the matching classes in print.css) — see
   core/helpers.php::orderStatusColor(). Light values below; dark overrides
   in the dark-theme section further down keep the same hue family but
   tuned for a dark surface (softer background tint, brighter text). */

.order-badge-accepted     { background: #ffedd5; color: #c2410c; }
.order-badge-in_transit_to_warehouse { background: #fef9c3; color: #a16207; }
.order-badge-in_warehouse { background: #ede9fe; color: #6d28d9; }
.order-badge-in_transit   { background: #cffafe; color: #0e7490; }
.order-badge-arrived      { background: #ccfbf1; color: #0f766e; }
.order-badge-in_pickup_point { background: #ede9fe; color: #6d28d9; }
.order-badge-issued       { background: #bbf7d0; color: #166534; }
.order-badge-closed       { background: #e2e8f0; color: #334155; }
.order-badge-cancelled    { background: #fee2e2; color: #b91c1c; }
.order-badge-failed       { background: #7f1d1d; color: #fecaca; }

.timeline-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
}

.timeline-dot.order-badge-accepted     { background: #f97316; }
.timeline-dot.order-badge-in_transit_to_warehouse { background: #eab308; }
.timeline-dot.order-badge-in_warehouse { background: #7c3aed; }
.timeline-dot.order-badge-in_transit   { background: #06b6d4; }
.timeline-dot.order-badge-arrived      { background: #14b8a6; }
.timeline-dot.order-badge-in_pickup_point { background: #7c3aed; }
.timeline-dot.order-badge-issued       { background: #16a34a; }
.timeline-dot.order-badge-closed       { background: #64748b; }
.timeline-dot.order-badge-cancelled    { background: #ef4444; }
.timeline-dot.order-badge-failed       { background: #7f1d1d; }

/* ---------- License Active badge (topbar) ---------- */

.badge-license-active {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .36rem .8rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: #fff;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 2px 10px rgba(22, 163, 74, .3);
    border: 1px solid rgba(255, 255, 255, .2);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

.badge-license-active:hover,
.badge-license-active:focus {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(22, 163, 74, .4);
}

.badge-license-active-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    animation: badgeLicenseActivePulse 2.4s ease-in-out infinite;
}

@keyframes badgeLicenseActivePulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .6); }
    70% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .badge-license-active-dot {
        animation: none;
    }
}

@media (max-width: 575.98px) {
    .badge-license-active {
        padding: .3rem .6rem;
        font-size: .68rem;
    }
}

/* ---------- Company logo (Settings > Company) ---------- */

.logo-preview-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.logo-preview-img {
    max-height: 56px;
    max-width: 140px;
    object-fit: contain;
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border-color);
}

/* ---------- Admin section ---------- */

.admin-nav-pills .nav-link {
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: .86rem;
    font-weight: 600;
    padding: .45rem 1rem;
}

.admin-nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
    color: #fff;
}

.admin-nav-pills .nav-link:not(.active):hover {
    background: var(--surface-hover);
    color: var(--text-heading);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .7rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    white-space: nowrap;
}

.pill-ok { background: var(--brand-soft); color: var(--brand-dark); }
.pill-fail { background: #fee2e2; color: #b91c1c; }
.pill-warn { background: #fdf3e0; color: #b45309; }

[data-bs-theme="dark"] .pill-fail { background: #3b1616; color: #fca5a5; }
[data-bs-theme="dark"] .pill-warn { background: #2c220f; color: #f5a524; }

.system-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    border: 1px solid var(--border-color);
}

.system-check-row + .system-check-row {
    margin-top: .5rem;
}

/* ---------- License page ---------- */

.license-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.4rem 1.6rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.license-hero-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.license-hero-ok .license-hero-icon      { background: #bbf7d0; color: #166534; }
.license-hero-warn .license-hero-icon    { background: #fef9c3; color: #a16207; }
.license-hero-danger .license-hero-icon  { background: #fee2e2; color: #b91c1c; }
.license-hero-neutral .license-hero-icon { background: var(--brand-soft); color: var(--brand-dark); }

[data-bs-theme="dark"] .license-hero-ok .license-hero-icon      { background: #12301f; color: #86efac; }
[data-bs-theme="dark"] .license-hero-warn .license-hero-icon    { background: #3a3410; color: #fde047; }
[data-bs-theme="dark"] .license-hero-danger .license-hero-icon  { background: #3b1616; color: #fca5a5; }

.license-hero-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: .15rem;
}

.license-hero-sub {
    color: var(--text-secondary);
    font-size: .85rem;
}

.license-hero-days {
    margin-left: auto;
    text-align: right;
    flex-shrink: 0;
    padding-left: 1rem;
}

.license-hero-days .days-value {
    font-size: 2.1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.license-hero-days.license-hero-ok .days-value      { color: #166534; }
.license-hero-days.license-hero-warn .days-value    { color: #a16207; }
.license-hero-days.license-hero-danger .days-value  { color: #b91c1c; }
.license-hero-days.license-hero-neutral .days-value { color: var(--text-heading); }

[data-bs-theme="dark"] .license-hero-days.license-hero-ok .days-value     { color: #86efac; }
[data-bs-theme="dark"] .license-hero-days.license-hero-warn .days-value   { color: #fde047; }
[data-bs-theme="dark"] .license-hero-days.license-hero-danger .days-value { color: #fca5a5; }

.license-hero-days .days-label {
    font-size: .76rem;
    color: var(--text-secondary);
    margin-top: .15rem;
}

.license-progress {
    height: 7px;
    border-radius: 999px;
    background: var(--surface-hover);
    overflow: hidden;
    margin-top: .85rem;
    max-width: 420px;
}

.license-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width var(--transition-base);
}

.license-progress-bar.license-hero-ok      { background: #22c55e; }
.license-progress-bar.license-hero-warn    { background: #eab308; }
.license-progress-bar.license-hero-danger  { background: #ef4444; }
.license-progress-bar.license-hero-neutral { background: var(--brand-dark); }

.license-detail-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border-color);
}

.license-detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.license-detail-row .detail-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-soft);
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.license-detail-row .detail-label {
    color: var(--text-secondary);
    font-size: .82rem;
    flex: 0 0 40%;
}

.license-detail-row .detail-value {
    font-weight: 600;
    color: var(--text-heading);
    text-align: right;
    flex: 1;
    word-break: break-word;
}

@media (max-width: 767.98px) {
    .license-hero {
        flex-wrap: wrap;
    }

    .license-hero-days {
        margin-left: 0;
        text-align: left;
        padding-left: 0;
        width: 100%;
    }
}

/* ---------- Sub-navigation (Settings/Admin tab pills) ---------- */

.nav-pills .nav-link {
    color: var(--text-secondary);
    border-radius: 999px;
}

.nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--brand-color), var(--brand-dark)) !important;
    color: #fff !important;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .app-content {
        padding: 1rem;
    }
    .card .card-body {
        padding: 1rem;
    }
    .stat-card .stat-value {
        font-size: 1.3rem;
    }
}

/* ---------- Auth screens ---------- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #16a34a 140%);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

.auth-brand-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--brand-color), var(--brand-dark));
    color: #fff;
    overflow: hidden;
}

.auth-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

/* ==========================================================================
   Dark theme — every component above reads its colors from the tokens
   redefined at the top of this file under [data-bs-theme="dark"], so this
   section only needs to cover the handful of places that use a literal
   color instead of a token (brand gradients, order-status hues, the auth
   screen's gradient background).
   ========================================================================== */

[data-bs-theme="dark"] .alert-box.error   { background: #3b1616; color: #fca5a5; }
[data-bs-theme="dark"] .alert-box.warning { background: #2c220f; color: #f5a524; }
[data-bs-theme="dark"] .alert-box.success { background: #12301f; color: #86efac; }

[data-bs-theme="dark"] .order-badge-accepted     { background: #3a2410; color: #fdba74; }
[data-bs-theme="dark"] .order-badge-in_transit_to_warehouse { background: #3a3410; color: #fde047; }
[data-bs-theme="dark"] .order-badge-in_warehouse { background: #2c1f47; color: #c4b5fd; }
[data-bs-theme="dark"] .order-badge-in_transit   { background: #113238; color: #67e8f9; }
[data-bs-theme="dark"] .order-badge-arrived      { background: #0f2e2b; color: #5eead4; }
[data-bs-theme="dark"] .order-badge-in_pickup_point { background: #2c1f47; color: #c4b5fd; }
[data-bs-theme="dark"] .order-badge-issued       { background: #12301f; color: #86efac; }
[data-bs-theme="dark"] .order-badge-closed       { background: #1e293b; color: #cbd5e1; }
[data-bs-theme="dark"] .order-badge-cancelled    { background: #3b1616; color: #fca5a5; }
[data-bs-theme="dark"] .order-badge-failed       { background: #2a0d0d; color: #fca5a5; }

[data-bs-theme="dark"] .badge-license-active {
    background: linear-gradient(135deg, #15803d, #16a34a);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
    border-color: rgba(255, 255, 255, .12);
}

[data-bs-theme="dark"] .logo-preview-img,
[data-bs-theme="dark"] .sidebar-brand .brand-icon img,
[data-bs-theme="dark"] .auth-brand-icon img {
    background: #f8fafc;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: transparent;
}

[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
