/* ==========================================================================
   components.css - CSS for the shared tenant components (Layer 3.5)
   See docs/UI_CONSISTENCY_PLAN.md

   These three components ship on every shell page: base.html includes
   breadcrumb.html and quick_nav.html, and quick_nav.html includes
   notifications.html. Their CSS used to live in a <style> block inside each
   component, so ~28 KB of byte-identical CSS was re-sent inside all 138 shell
   pages and could never be cached. It is one cacheable file now.

   LOAD ORDER: linked after mobile.css and before the page's own CSS, which is
   where the old <style> blocks effectively sat relative to the shared sheets.
   A page can still override anything here from its own block.

   The three components share no selectors, so section order is arbitrary.
   ========================================================================== */



/* ==========================================================================
   BREADCRUMB - Breadcrumb navigation
   source: templates/tenant/components/breadcrumb.html
   ========================================================================== */

/* ================================
   BREADCRUMB COMPONENT — PharmaEdge
   Prefixed with pe- to avoid collisions
   Designed to sit INSIDE page headers
   ================================ */
.pe-breadcrumb-nav {
    width: 100%;
    margin-bottom: 0;
}

.pe-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    padding: 0 0 10px 0;
    margin: 0;
    gap: 0;
    font-size: 13px;
    line-height: 1.4;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
}

.pe-breadcrumb-item {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted, #64748b);
}

.pe-breadcrumb-item a {
    color: var(--primary, #173269);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 2px;
    border-radius: 4px;
    transition: color 0.2s ease, background 0.2s ease;
}

.pe-breadcrumb-item a:hover {
    color: var(--primary-dark, #0F2B64);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pe-breadcrumb-item a i {
    font-size: 13px;
}

.pe-breadcrumb-sep {
    display: inline-flex;
    align-items: center;
    margin: 0 6px;
    color: var(--text-muted, #94a3b8);
    font-size: 10px;
    opacity: 0.7;
}

.pe-breadcrumb-item.active {
    color: var(--text-secondary, #475569);
    font-weight: 600;
    font-size: 12.5px;
}

/* ================================
   DARK THEME
   ================================ */
[data-theme="dark"] .pe-breadcrumb {
    border-bottom-color: var(--border-light, #334155);
}

[data-theme="dark"] .pe-breadcrumb-item a {
    color: var(--text-link, #60a5fa);
}

[data-theme="dark"] .pe-breadcrumb-item a:hover {
    color: var(--primary-light, #93c5fd);
}

[data-theme="dark"] .pe-breadcrumb-item.active {
    color: var(--text-primary, #f1f5f9);
}

[data-theme="dark"] .pe-breadcrumb-sep {
    color: var(--text-muted, #64748b);
}

/* ================================
   LIGHT VARIANT — for dark/gradient headers
   Set breadcrumb_light = true before including
   ================================ */
.pe-breadcrumb-light .pe-breadcrumb {
    border-bottom-color: rgba(255,255,255,0.2);
}

.pe-breadcrumb-light .pe-breadcrumb-item a {
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.pe-breadcrumb-light .pe-breadcrumb-item a:hover {
    color: #fff;
}

.pe-breadcrumb-light .pe-breadcrumb-item.active {
    color: rgba(255,255,255,0.7);
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.pe-breadcrumb-light .pe-breadcrumb-sep {
    color: rgba(255,255,255,0.5);
}

/* Light variant overrides dark theme too (gradient headers stay the same) */
[data-theme="dark"] .pe-breadcrumb-light .pe-breadcrumb-item a {
    color: rgba(255,255,255,0.9);
}

[data-theme="dark"] .pe-breadcrumb-light .pe-breadcrumb-item.active {
    color: rgba(255,255,255,0.7);
}

[data-theme="dark"] .pe-breadcrumb-light .pe-breadcrumb-sep {
    color: rgba(255,255,255,0.5);
}

[data-theme="dark"] .pe-breadcrumb-light .pe-breadcrumb {
    border-bottom-color: rgba(255,255,255,0.15);
}

/* ================================
   RTL SUPPORT
   ================================ */
html[dir="rtl"] .pe-breadcrumb {
    direction: rtl;
}

html[dir="rtl"] .pe-breadcrumb-sep i {
    transform: scaleX(-1);
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 768px) {
    .pe-breadcrumb {
        font-size: 12px;
        padding: 0 0 8px 0;
    }

    .pe-breadcrumb-sep {
        margin: 0 4px;
    }

    .pe-breadcrumb-item.active {
        font-size: 11.5px;
    }
}

/* ================================
   PRINT — hide breadcrumb on print
   ================================ */
@media print {
    .pe-breadcrumb-nav {
        display: none !important;
    }
}


/* ==========================================================================
   QUICK_NAV - Quick navigation drawer + header nav button
   source: templates/tenant/components/quick_nav.html
   ========================================================================== */

/* Header Navigation Button - Add this button to your page header */
.header-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: var(--primary-gradient, linear-gradient(180deg, #173269 0%, #1F4699 100%));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb, 23, 50, 105), 0.3);
    flex-shrink: 0;
}
.header-nav-btn:hover {
    background: var(--primary-gradient-hover, linear-gradient(180deg, #1F4699 0%, #0F2B64 100%));
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb, 23, 50, 105), 0.4);
}

/* Quick Navigation Sidebar */
.quick-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.quick-nav-overlay.show {
    opacity: 1;
    visibility: visible;
}

.quick-nav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-dark, #0F2B64) 0%, var(--primary, #173269) 100%);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: hidden;
}

.quick-nav-sidebar.show {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
}

.quick-nav-header {
    padding: 16px 20px;
    background: var(--primary-gradient, linear-gradient(180deg, #173269 0%, #1F4699 100%));
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 2px solid var(--primary-lighter, #7ACEFF);
}

.quick-nav-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 700;
    font-size: 1.1em;
}

.quick-nav-title i {
    font-size: 1.2em;
}

.quick-nav-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    transition: all 0.2s;
}

.quick-nav-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Welcome Bar */
.quick-nav-welcome {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(122, 206, 255, 0.15) 0%, rgba(122, 206, 255, 0.05) 100%);
    border-bottom: 1px solid rgba(122, 206, 255, 0.2);
    flex-shrink: 0;
}

.quick-nav-welcome-greeting {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #7ACEFF;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-nav-welcome-greeting i {
    font-size: 1.2em;
}

.quick-nav-welcome-name {
    font-size: 1.05em;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-nav-welcome-user {
    font-size: 0.78em;
    color: #94a3b8;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-nav-welcome-user i {
    font-size: 0.9em;
    color: #64748b;
}

.quick-nav-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.quick-nav-body::-webkit-scrollbar {
    width: 6px;
}

.quick-nav-body::-webkit-scrollbar-track {
    background: transparent;
}

.quick-nav-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.quick-nav-section {
    margin-bottom: 8px;
}

/* Group label (Operations / Money / Administration) */
.quick-nav-group-label {
    padding: 14px 20px 6px;
    margin-top: 4px;
    font-size: 0.68em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #7ACEFF;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid rgba(122, 206, 255, 0.12);
}

.quick-nav-group-label:first-child {
    border-top: none;
    margin-top: 0;
}

.quick-nav-group-label i {
    font-size: 1.1em;
    color: #7ACEFF;
}

[data-theme="dark"] .quick-nav-group-label {
    color: #7ACEFF;
    border-top-color: rgba(122, 206, 255, 0.08);
}

.quick-nav-section-title {
    padding: 10px 20px;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #94a3b8;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-nav-section-title i {
    font-size: 1.3em;
    color: #64748b;
}

.quick-nav-links {
    display: flex;
    flex-direction: column;
}

.quick-nav-link {
    padding: 12px 20px 12px 48px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.quick-nav-link i {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.quick-nav-link:hover {
    background: rgba(99, 102, 241, 0.15);
    color: white;
    border-left-color: #6366f1;
}

.quick-nav-link:hover i {
    opacity: 1;
    color: #a5b4fc;
}

.quick-nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.25) 0%, transparent 100%);
    color: white;
    border-left-color: #6366f1;
}

.quick-nav-link.active::before {
    content: '';
    position: absolute;
    left: 20px;
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
}

.quick-nav-link.active i {
    color: #a5b4fc;
}

.quick-nav-footer {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.quick-nav-home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95em;
    border-radius: 10px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(122, 206, 255, 0.3);
}

.quick-nav-home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(122, 206, 255, 0.4);
}

.quick-nav-home-btn i {
    font-size: 1.2em;
}

/* Preference row (theme + language) above Home button */
.quick-nav-prefs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.quick-nav-pref-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-nav-pref-btn:hover {
    background: rgba(122, 206, 255, 0.18);
    border-color: rgba(122, 206, 255, 0.4);
    color: #ffffff;
    transform: translateY(-1px);
}

.quick-nav-pref-btn i {
    font-size: 1.05em;
    opacity: 0.9;
}

/* Sun / Moon swap inside the theme button */
.quick-nav-pref-btn .light-icon,
.quick-nav-pref-btn .light-label { display: inline-flex; }
.quick-nav-pref-btn .dark-icon,
.quick-nav-pref-btn .dark-label { display: none; }
[data-theme="dark"] .quick-nav-pref-btn .light-icon,
[data-theme="dark"] .quick-nav-pref-btn .light-label { display: none; }
[data-theme="dark"] .quick-nav-pref-btn .dark-icon,
[data-theme="dark"] .quick-nav-pref-btn .dark-label { display: inline-flex; }

[data-theme="dark"] .quick-nav-pref-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(122, 206, 255, 0.18);
    color: #cbd5e1;
}

[data-theme="dark"] .quick-nav-pref-btn:hover {
    background: rgba(122, 206, 255, 0.12);
    border-color: rgba(122, 206, 255, 0.35);
    color: #ffffff;
}

/* Responsive styles for quick nav */
@media (max-width: 768px) {
    .quick-nav-sidebar {
        width: 280px;
    }
}

/* RTL Support */
[dir="rtl"] .quick-nav-sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.3);
}

[dir="rtl"] .quick-nav-sidebar.show {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
}

[dir="rtl"] .quick-nav-group {
    text-align: right;
}

[dir="rtl"] .quick-nav-item {
    text-align: right;
}

[dir="rtl"] .quick-nav-footer {
    text-align: right;
}

[dir="rtl"] .quick-nav-welcome {
    text-align: right;
}

[dir="rtl"] .quick-nav-welcome-greeting {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

[dir="rtl"] .quick-nav-welcome-user {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

/* ===========================
   DARK MODE OVERRIDES
   Match the POS nav sidebar dark aesthetic
   =========================== */
[data-theme="dark"] .quick-nav-sidebar {
    background: linear-gradient(180deg, #0C1929 0%, #152F4E 100%);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .quick-nav-header {
    background: linear-gradient(135deg, #0F2B64 0%, #173269 100%);
    border-bottom-color: rgba(122, 206, 255, 0.25);
}

[data-theme="dark"] .quick-nav-close {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .quick-nav-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .quick-nav-welcome {
    background: linear-gradient(135deg, rgba(122, 206, 255, 0.08) 0%, rgba(122, 206, 255, 0.02) 100%);
    border-bottom-color: rgba(122, 206, 255, 0.1);
}

[data-theme="dark"] .quick-nav-welcome-greeting {
    color: #7ACEFF;
}

[data-theme="dark"] .quick-nav-welcome-name {
    color: #EEF2F7;
}

[data-theme="dark"] .quick-nav-welcome-user {
    color: #96A2BB;
}

[data-theme="dark"] .quick-nav-welcome-user i {
    color: #6B7A94;
}

[data-theme="dark"] .quick-nav-section-title {
    color: #96A2BB;
}

[data-theme="dark"] .quick-nav-section-title i {
    color: #6B7A94;
}

[data-theme="dark"] .quick-nav-link {
    color: #BEC6D5;
}

[data-theme="dark"] .quick-nav-link i {
    opacity: 0.7;
}

[data-theme="dark"] .quick-nav-link:hover {
    background: rgba(122, 206, 255, 0.1);
    color: #ffffff;
    border-left-color: #7ACEFF;
}

[data-theme="dark"] .quick-nav-link:hover i {
    opacity: 1;
    color: #7ACEFF;
}

[data-theme="dark"] .quick-nav-link.active {
    background: linear-gradient(90deg, rgba(122, 206, 255, 0.15) 0%, transparent 100%);
    color: #ffffff;
    border-left-color: #7ACEFF;
}

[data-theme="dark"] .quick-nav-link.active i {
    color: #7ACEFF;
    opacity: 1;
}

[data-theme="dark"] .quick-nav-footer {
    background: rgba(0, 0, 0, 0.3);
    border-top-color: rgba(122, 206, 255, 0.1);
}

[data-theme="dark"] .quick-nav-home-btn {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

[data-theme="dark"] .quick-nav-home-btn:hover {
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

[data-theme="dark"] .quick-nav-overlay {
    background: rgba(0, 0, 0, 0.6);
}

/* RTL dark mode */
[data-theme="dark"][dir="rtl"] .quick-nav-sidebar {
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.5);
}


/* ==========================================================================
   NOTIFICATIONS - Toasts / notification popups / confirm dialog
   source: templates/tenant/components/notifications.html
   ========================================================================== */

/* ========================================
   NOTIFICATION TOAST SYSTEM
   ======================================== */

/* Toast Container - Fixed position for all toasts */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    pointer-events: none;
}

/* Individual Toast */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    pointer-events: all;
    animation: toastSlideIn 0.4s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    transform: translateX(120%);
    border-left: 4px solid;
    min-width: 320px;
}

.toast.removing {
    animation: toastSlideOut 0.3s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* Toast Icon */
.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

/* Toast Content */
.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Toast Close Button */
.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
}

.toast-close:hover {
    background: #f1f5f9;
    color: #475569;
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 12px 12px;
    animation: toastProgress 5s linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Toast Types */
.toast-success {
    border-left-color: #10b981;
}
.toast-success .toast-icon {
    background: #d1fae5;
    color: #059669;
}
.toast-success .toast-progress {
    color: #10b981;
}

.toast-error, .toast-danger {
    border-left-color: #ef4444;
}
.toast-error .toast-icon, .toast-danger .toast-icon {
    background: #fee2e2;
    color: #dc2626;
}
.toast-error .toast-progress, .toast-danger .toast-progress {
    color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}
.toast-warning .toast-icon {
    background: #fef3c7;
    color: #d97706;
}
.toast-warning .toast-progress {
    color: #f59e0b;
}

.toast-info {
    border-left-color: #5c6bc0;
}
.toast-info .toast-icon {
    background: #dbeafe;
    color: #3f51b5;
}
.toast-info .toast-progress {
    color: #5c6bc0;
}

/* ========================================
   INLINE ALERT MESSAGES (for forms, etc.)
   ======================================== */
.alert-inline {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: alertFadeIn 0.3s ease-out;
    position: relative;
}

@keyframes alertFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-inline-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}

.alert-inline-content {
    flex: 1;
}

.alert-inline-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.alert-inline-message {
    font-size: 13px;
    line-height: 1.5;
}

.alert-inline-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    opacity: 0.6;
    transition: opacity 0.2s;
    font-size: 16px;
}

.alert-inline-close:hover {
    opacity: 1;
}

/* Inline Alert Types */
.alert-inline-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.alert-inline-success .alert-inline-icon {
    background: #10b981;
    color: white;
}

.alert-inline-error, .alert-inline-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    color: #991b1b;
}
.alert-inline-error .alert-inline-icon, .alert-inline-danger .alert-inline-icon {
    background: #ef4444;
    color: white;
}

.alert-inline-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    color: #92400e;
}
.alert-inline-warning .alert-inline-icon {
    background: #f59e0b;
    color: white;
}

.alert-inline-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    color: #1e40af;
}
.alert-inline-info .alert-inline-icon {
    background: #5c6bc0;
    color: white;
}

/* ========================================
   CONFIRMATION DIALOG
   ======================================== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: overlayFadeIn 0.2s ease-out;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confirm-dialog {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 420px;
    width: 100%;
    animation: dialogSlideIn 0.3s cubic-bezier(0.21, 1.02, 0.73, 1);
    overflow: hidden;
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.confirm-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.confirm-icon.warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.confirm-icon.danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.confirm-icon.info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #3f51b5;
}

.confirm-icon.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.confirm-body {
    padding: 0 24px 24px;
}

.confirm-message {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.confirm-footer {
    padding: 16px 24px;
    background: #f8fafc;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.confirm-btn-cancel {
    background: white;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.confirm-btn-cancel:hover {
    background: #f1f5f9;
    color: #475569;
}

.confirm-btn-confirm {
    background: linear-gradient(135deg, #5c6bc0 0%, #3f51b5 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(92, 107, 192, 0.3);
}

.confirm-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 107, 192, 0.4);
}

.confirm-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.confirm-btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* ========================================
   PERMISSION DENIED BANNER
   ======================================== */
.permission-denied-banner {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: bannerSlideIn 0.4s ease-out;
}

@keyframes bannerSlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.permission-denied-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.permission-denied-content {
    flex: 1;
}

.permission-denied-title {
    font-size: 16px;
    font-weight: 700;
    color: #991b1b;
    margin: 0 0 4px 0;
}

.permission-denied-message {
    font-size: 14px;
    color: #b91c1c;
    margin: 0;
    line-height: 1.5;
}

.permission-denied-action {
    padding: 10px 20px;
    background: white;
    color: #dc2626;
    border: 2px solid #fca5a5;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}

.permission-denied-action:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 480px) {
    .toast-container {
        left: 12px;
        right: 12px;
        top: 12px;
    }
    
    .toast {
        min-width: unset;
    }
    
    .confirm-dialog {
        margin: 12px;
    }
    
    .confirm-footer {
        flex-direction: column-reverse;
    }
    
    .confirm-btn {
        width: 100%;
    }
    
    .permission-denied-banner {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   DARK MODE CONTRAST FIXES
   ======================================== */

/* Toast backgrounds */
[data-theme="dark"] .toast {
    background: var(--bg-card, #152F4E);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast-title {
    color: var(--text-primary, #EEF2F7);
}

[data-theme="dark"] .toast-message {
    color: var(--text-secondary, #BEC6D5);
}

[data-theme="dark"] .toast-close {
    color: var(--text-muted, #96A2BB);
}

[data-theme="dark"] .toast-close:hover {
    background: var(--bg-hover, #1F4060);
    color: var(--text-primary, #EEF2F7);
}

/* Toast type icons in dark mode */
[data-theme="dark"] .toast-success .toast-icon {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

[data-theme="dark"] .toast-error .toast-icon,
[data-theme="dark"] .toast-danger .toast-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

[data-theme="dark"] .toast-warning .toast-icon {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

[data-theme="dark"] .toast-info .toast-icon {
    background: rgba(92, 107, 192, 0.2);
    color: #a5b4fc;
}

/* Inline alerts in dark mode */
[data-theme="dark"] .alert-inline-success {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.4) 0%, rgba(6, 95, 70, 0.3) 100%);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

[data-theme="dark"] .alert-inline-error,
[data-theme="dark"] .alert-inline-danger {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.4) 0%, rgba(153, 27, 27, 0.3) 100%);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

[data-theme="dark"] .alert-inline-warning {
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.4) 0%, rgba(146, 64, 14, 0.3) 100%);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

[data-theme="dark"] .alert-inline-info {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.4) 0%, rgba(30, 64, 175, 0.3) 100%);
    border-color: rgba(92, 107, 192, 0.3);
    color: #93c5fd;
}

/* Confirmation dialog in dark mode */
[data-theme="dark"] .confirm-dialog {
    background: var(--bg-card, #152F4E);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .confirm-title {
    color: var(--text-primary, #EEF2F7);
}

[data-theme="dark"] .confirm-message {
    color: var(--text-secondary, #BEC6D5);
}

[data-theme="dark"] .confirm-footer {
    background: var(--bg-surface-secondary, #0C1929);
}

[data-theme="dark"] .confirm-btn-cancel {
    background: var(--bg-surface-secondary, #1F4060);
    color: var(--text-secondary, #BEC6D5);
    border-color: var(--border-light, #2A5070);
}

[data-theme="dark"] .confirm-btn-cancel:hover {
    background: var(--bg-hover, #2A5070);
    color: var(--text-primary, #EEF2F7);
}

/* Confirm icon backgrounds in dark mode */
[data-theme="dark"] .confirm-icon.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 119, 6, 0.2) 100%);
    color: #fcd34d;
}

[data-theme="dark"] .confirm-icon.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(220, 38, 38, 0.2) 100%);
    color: #fca5a5;
}

[data-theme="dark"] .confirm-icon.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(63, 81, 181, 0.2) 100%);
    color: #93c5fd;
}

[data-theme="dark"] .confirm-icon.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.2) 100%);
    color: #6ee7b7;
}

/* Permission denied banner in dark mode */
[data-theme="dark"] .permission-denied-banner {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.3) 0%, rgba(153, 27, 27, 0.25) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .permission-denied-title {
    color: #fca5a5;
}

[data-theme="dark"] .permission-denied-message {
    color: #f87171;
}

[data-theme="dark"] .permission-denied-action {
    background: var(--bg-card, #152F4E);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

[data-theme="dark"] .permission-denied-action:hover {
    background: #dc2626;
    color: white;
}

/* ==========================================================================
   Working-branch switcher (tenant/components/branch_switcher.html)
   Rendered in the page header by base.html on every shell page, so it lives
   here rather than in a <style> block that could never be cached.
   Only shown to users assigned to more than one branch.
   ========================================================================== */
.pe-branch-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2, .5rem);
    margin: 0;
}

.pe-branch-switch-label {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    font-size: var(--text-sm, .875rem);
}

.pe-branch-switch-select {
    appearance: auto;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    padding: var(--space-2, .375rem) var(--space-3, .625rem);
    font-size: var(--text-sm, .875rem);
    font-family: inherit;
    line-height: 1.4;
    max-width: 12rem;
    cursor: pointer;
}

.pe-branch-switch-select:hover {
    border-color: var(--primary);
}

.pe-branch-switch-select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

@media (max-width: 640px) {
    .pe-branch-switch-select { max-width: 8.5rem; }
}

/* ========================================
   BARCODE SCAN NOTICES (static/js/pe-scan.js)
   A scan that finds nothing, or is refused because a dialog is open, says so
   without taking focus - the next scan must still land. Only used by pages
   that have no toast of their own.
   ======================================== */
.pe-scan-toasts {
    position: fixed;
    inset-inline: 0;
    bottom: var(--space-6, 1.5rem);
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2, .5rem);
    pointer-events: none;
}

.pe-scan-toast {
    max-width: min(32rem, calc(100vw - 2rem));
    padding: var(--space-3, .75rem) var(--space-4, 1rem);
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--primary-light);
    background: var(--primary-bg);
    color: var(--on-info-bg);
    box-shadow: var(--shadow-lg);
    font-size: .9rem;
    font-weight: 500;
    unicode-bidi: plaintext;
}

.pe-scan-toast.is-success { background: var(--success-bg); border-color: var(--success); color: var(--on-success-bg); }
.pe-scan-toast.is-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--on-warning-bg); }
.pe-scan-toast.is-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--on-danger-bg); }
