@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary-theme: #0d6efd;
    --primary-theme-gradient: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    --primary-theme-light: #e7f1ff;
    --text-main: #1a1a1a;
    --text-muted: #6c757d;
    --bg-light: #f3f5f8;
    --border-color: #e5e7eb;
}

html, body {
    touch-action: manipulation;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
}

/* Navbar specific styling */
.custom-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.brand-icon {
    background-color: var(--primary-theme);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-product-brand img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-product-brand span {
    font-size: 1.05rem;
    letter-spacing: .35px;
}

.nav-pill-btn {
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.4rem 1.2rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    background: transparent;
    transition: all 0.2s;
    text-decoration: none;
}
.nav-pill-btn:hover {
    background-color: var(--bg-light);
}
.nav-pill-btn.active {
    background-color: var(--primary-theme-light);
    color: var(--primary-theme);
    border-color: var(--primary-theme-light);
}

/* Dashboard Filter Bar */
.filter-btn {
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.4rem 1.2rem;
}
.filter-btn.active {
    background-color: var(--primary-theme);
    color: white;
    border-color: var(--primary-theme);
}
.custom-search, .custom-select {
    border-radius: 20px;
    font-size: 0.85rem;
    background-color: white;
}

/* Station Cards */
.station-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}
.station-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.status-badge-normal {
    background-color: var(--primary-theme-light);
    color: var(--primary-theme);
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.frequency-badge {
    background-color: var(--primary-theme-light);
    color: var(--primary-theme);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
}

/* Presenter Panel */
.presenter-panel {
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
}

.simulation-card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.bg-light-purple { background-color: #f3e8ff; }
.text-purple { color: #9333ea; }
.fs-7 { font-size: 0.85rem; }

/* Login Modal / Card */
.auth-wrapper {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3rem;
}
.auth-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
}
.auth-icon-top {
    width: 60px;
    height: 60px;
    background-color: var(--primary-theme-light);
    color: var(--primary-theme);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1.5rem auto;
}

/* Admin Layout */
.admin-layout-wrapper {
    height: 100vh;
    overflow: hidden;
}

/* The application shell must always occupy the remaining viewport width beside
   the sidebar.  A content-sized flex basis caused report and form pages to
   shrink around their contents, leaving unused space and clipping the POS. */
.admin-layout-wrapper > .app-main-shell {
    flex: 1 1 0 !important;
    width: 0;
    min-width: 0;
    max-width: none;
    margin: 0;
}

.admin-layout-wrapper > .app-main-shell > header,
.admin-layout-wrapper > .app-main-shell > main.admin-content {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
}

/* Printed reports are documents, not screenshots of the running application. */
.print-report-header { display: none; }

@media print {
    @page { size: auto; margin: 12mm; }

    html, body { width: auto !important; height: auto !important; background: #fff !important; }
    body { color: #111827 !important; font: 10pt Arial, sans-serif !important; }
    #page-loader-overlay, .admin-sidebar, .sidebar-overlay,
    .app-main-shell > header, .mobile-bottom-nav, .no-print,
    .app-breadcrumb, .swal2-container, .ui-autocomplete { display: none !important; }

    .admin-layout-wrapper, .app-main-shell, .admin-content {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        box-shadow: none !important;
    }

    .print-report-header {
        display: flex !important;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
        width: 100%;
        margin: 0 0 8mm;
        padding: 0 0 4mm;
        border-bottom: 1.5px solid #172b4d;
        color: #172b4d;
    }
    .print-report-brand { display: flex; align-items: center; min-height: 34px; max-width: 68%; }
    .print-report-brand > img { display: block; max-width: 100%; max-height: 26mm; object-fit: contain; object-position: left center; }
    .print-report-brand .print-branch-logo { width: 14mm; height: 14mm; margin-right: 4mm; }
    .print-branch-name { font-size: 14pt; font-weight: 700; margin-bottom: 1mm; }
    .print-report-brand div:not(.print-branch-name) { font-size: 8.5pt; color: #4b5563; }
    .print-report-meta { text-align: right; font-size: 8.5pt; color: #4b5563; white-space: nowrap; }
    .print-report-title { color: #111827; font-size: 13pt; font-weight: 700; margin-bottom: 2mm; white-space: normal; }

    .admin-content > h1, .admin-content > h2, .admin-content > h3, .admin-content > h4,
    .admin-content > h5, .admin-content > .app-screen-header { margin-top: 0 !important; }
    .card, .card-body, .card-header { box-shadow: none !important; border-color: #cbd5e1 !important; background: #fff !important; }
    .table-responsive, .stock-report-scroll { overflow: visible !important; max-height: none !important; }
    table, .table { width: 100% !important; border-collapse: collapse !important; font-size: 8.5pt !important; }
    .table th, .table td { padding: 2.2mm !important; border: 1px solid #cbd5e1 !important; color: #111827 !important; white-space: normal !important; }
    .table thead th, .table-light th { background: #eaf0f8 !important; font-weight: 700 !important; }
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    tr, img { break-inside: avoid; page-break-inside: avoid; }
    .badge { border: 0 !important; background: transparent !important; color: #111827 !important; padding: 0 !important; }
    .text-primary, .text-success, .text-danger, .text-muted { color: inherit !important; }
}

.admin-sidebar {
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow: hidden;
}

.nav-links {
    overflow-y: auto;
    overflow-x: hidden;
}

.admin-sidebar.collapsed {
    width: 70px;
    min-width: 70px;
}

.admin-sidebar.collapsed .menu-label,
.admin-sidebar.collapsed .nav-text,
.admin-sidebar.collapsed .user-details {
    display: none !important;
}

.admin-sidebar.collapsed .brand-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    justify-content: center !important;
}

.admin-sidebar.collapsed .brand-container .brand-icon {
    margin: 0 auto;
}

.admin-sidebar.collapsed .admin-nav-link {
    justify-content: center;
    padding: 0.75rem 0;
}
.admin-sidebar.collapsed .admin-nav-link i {
    margin-right: 0;
    font-size: 1.25rem;
}

.admin-sidebar.collapsed .user-profile {
    justify-content: center;
}

.admin-sidebar.collapsed .logout-form {
    padding: 0 !important;
    display: flex;
    justify-content: center;
}

.admin-sidebar.collapsed .logout-form button {
    width: auto !important;
    border-radius: 50%;
    padding: 0.5rem;
}
.admin-sidebar.collapsed .logout-form button i {
    margin-right: 0;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.8rem;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.admin-nav-link i {
    font-size: 1.1rem;
    transition: color 0.2s;
}
.admin-nav-link:hover, .admin-nav-link.active {
    background-color: var(--primary-theme-light);
    color: var(--primary-theme);
}
.admin-content {
    flex-grow: 1;
    padding: 2rem;
}

.dashboard-bg {
    background-color: #f8f9fc;
}

/* Telemetry Entry Specifics */
.header-card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.panel-card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.number-control-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background-color: #ffffff;
}

.number-btn {
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}
.number-btn:hover {
    background-color: var(--bg-light);
    color: var(--primary-theme);
}

.number-input-lg {
    border: none;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    width: 100%;
    color: var(--text-main);
}
.number-input-lg:focus {
    outline: none;
}

.freq-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 12px;
    padding: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}
.freq-btn.active {
    border-color: var(--primary-theme);
    color: var(--primary-theme);
    background-color: var(--primary-theme-light);
}

.status-tag {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}
.status-tag.active {
    background-color: var(--primary-theme-light);
    color: var(--primary-theme);
    border-color: var(--primary-theme-light);
}

.dispatch-item {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}
.dispatch-item:last-child {
    border-bottom: none;
}

/* Modal Specifics */
.custom-tabs {
    border-bottom: 2px solid var(--border-color);
}
.custom-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    position: relative;
    background: transparent;
}
.custom-tabs .nav-link.active {
    color: var(--primary-theme);
}
.custom-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-theme);
}

.stat-card {
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.log-item {
    transition: background-color 0.2s;
}
.log-item:hover {
    background-color: var(--bg-light);
}

/* Station Switcher */
.current-station-card {
    background-color: var(--primary-theme-light) !important;
    border-radius: 12px !important;
    padding: 0.75rem !important;
    transition: all 0.2s;
}
.current-station-card:hover {
    background-color: #cfe2ff !important;
}

.admin-sidebar.collapsed .current-station-card {
    padding: 0.25rem !important;
    justify-content: center !important;
    margin-bottom: 0.5rem;
}
.admin-sidebar.collapsed .station-card-container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}
.admin-sidebar.collapsed .current-station-card i.bi-chevron-expand {
    display: none !important;
}
.admin-sidebar.collapsed .current-station-card .nav-text-container {
    justify-content: center !important;
    width: 100%;
}

.station-selector-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s;
}
.station-selector-card:hover {
    border-color: var(--primary-theme);
    background-color: var(--primary-theme-light);
    transform: translateY(-2px);
}
.station-selector-card.active-station {
    border-color: var(--primary-theme);
    background-color: var(--primary-theme-light);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

.system-title {
    font-size: 1.1rem;
}

/* -----------------------------------------
   Mobile Responsiveness & Media Queries
----------------------------------------- */
@media (max-width: 768px) {
    /* Navbar Adjustments */
    .custom-navbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .custom-navbar > div:first-child {
        width: auto;
    }
    
    .custom-navbar > div:last-child {
        width: auto;
        margin-left: auto;
    }
    
    .brand-container {
        justify-content: flex-start !important;
    }
    
    .system-title {
        font-size: 0.8rem;
    }

    .custom-navbar .d-flex.gap-3 {
        width: 100%;
        justify-content: space-around;
        flex-wrap: wrap;
        gap: 0.5rem !important;
        order: 3;
        margin-top: 0.5rem;
    }
    
    .nav-pill-btn {
        flex-grow: 1;
        text-align: center;
        padding: 0.4rem 0.5rem;
    }
    
    /* Layout Adjustments */
    .admin-layout-wrapper {
        position: relative;
    }
    
    /* Off-Canvas Sidebar */
    .admin-sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        z-index: 1050;
        width: 280px;
        min-width: 280px;
        box-shadow: 10px 0 30px rgba(0,0,0,0.15);
        transition: left 0.3s cubic-bezier(0.1, 0.7, 0.1, 1); /* springy feel */
        border-radius: 0 24px 24px 0; /* native drawer look */
        padding-top: calc(1.5rem + env(safe-area-inset-top)); /* account for notch */
    }
    
    body.sidebar-open .admin-sidebar {
        left: 0;
    }
    
    /* Overlay Backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 1040;
    }
    
    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    /* Larger Sidebar Text for Mobile Touch */
    .admin-nav-link {
        font-size: 1.1rem !important;
        padding: 0.75rem 1.2rem !important;
    }
    .admin-nav-link i {
        font-size: 1.3rem !important;
    }
    .menu-label {
        font-size: 0.9rem !important;
    }
    
    /* Mobile Toggle Button */
    .mobile-sidebar-toggle {
        display: block !important;
    }
    
    .desktop-sidebar-toggle {
        display: none !important;
    }
    
    /* Admin Content */
    .admin-content {
        padding: 1rem;
        /* 70px nav + its 20px floating offset, with extra room for action buttons and phone safe areas. */
        padding-bottom: calc(130px + env(safe-area-inset-bottom));
        scroll-padding-bottom: calc(130px + env(safe-area-inset-bottom));
    }
}

/* Mobile Bottom Navigation Styles */
.mobile-bottom-nav {
    position: fixed;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 20px;
    width: calc(100% - 40px);
    height: 70px;
    background-color: #ffffff;
    border-radius: 50px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.12);
    z-index: 1030;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    width: 20%;
    height: 100%;
    transition: color 0.2s;
}

.bottom-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--primary-theme);
}

.bottom-nav-center-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 20%;
    height: 100%;
}

.bottom-nav-center-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-theme);
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    outline: none;
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.4);
}

.bottom-nav-center-btn:active {
    transform: scale(0.95);
}

/* Hide mobile toggle on desktop */
.mobile-sidebar-toggle {
    display: none;
}

/* --- Shared Screen Title Icon ---
   Every page header is normalized by the layout into .app-screen-heading.
   This intentionally supports both locally bundled Font Awesome and the
   older Bootstrap icons while legacy views are gradually simplified. */
.app-screen-heading {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    color: #102a43;
    letter-spacing: -0.025em;
}

.app-screen-heading > .app-title-icon,
.admin-content h4 > i.bi:first-child,
.container-fluid h4 > i.bi:first-child {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin: 0 !important;
    border-radius: 20px;
    color: #fff !important;
    background: linear-gradient(135deg, #0d6efd 0%, #4b8dff 100%);
    box-shadow: 0 10px 20px rgba(13, 110, 253, 0.23);
    font-size: 1.55rem !important;
    line-height: 1;
}

.app-screen-heading > .app-title-icon {
    flex: 0 0 56px;
}

.app-screen-header {
    align-items: center !important;
    gap: 1rem;
}

.app-screen-header > :first-child {
    min-width: 0;
}

/* Titles implemented as a standalone reusable badge already have the same
   visual language; keep their icon dimensions in sync with all other pages. */
.page-title-icon {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-title-icon__badge {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(135deg, #0d6efd 0%, #4b8dff 100%);
    box-shadow: 0 10px 20px rgba(13, 110, 253, 0.23);
    font-size: 1.55rem;
}

.page-title-icon__badge i {
    color: inherit !important;
}

@media (max-width: 576px) {
    .app-screen-heading {
        gap: 10px;
    }

    .app-screen-heading > .app-title-icon,
    .admin-content h4 > i.bi:first-child,
    .container-fluid h4 > i.bi:first-child,
    .page-title-icon__badge {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        border-radius: 16px;
        font-size: 1.3rem !important;
    }

    .app-screen-header {
        align-items: flex-start !important;
    }
}

/* --- Skeleton Loader Overlay --- */
#page-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-light);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    padding: 20px;
    box-sizing: border-box;
}

#page-loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.skeleton-box {
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 12px;
    margin-bottom: 15px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-header { height: 60px; width: 100%; margin-bottom: 30px; }
.skeleton-card { height: 120px; width: 100%; margin-bottom: 20px; }

.spinner-border.text-primary-custom {
    color: #0d6efd !important;
    width: 3rem;
    height: 3rem;
    border-width: 0.25rem;
}

/* --- Pull to Refresh --- */
#ptr-container {
    position: fixed;
    top: -60px;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1040;
    transition: transform 0.2s cubic-bezier(0.1, 0.7, 0.1, 1);
}

#ptr-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-theme);
    font-size: 1.5rem;
    transform: rotate(0deg);
}

/* --- Dark Theme Styles --- */
body.dark-theme .admin-sidebar,
body.dark-theme .admin-layout-wrapper header {
    background: linear-gradient(135deg, #0b1121 0%, #111827 100%) !important;
    border-color: #1f2937 !important;
    color: #ffffff !important;
}

body.dark-theme .admin-sidebar .nav-text,
body.dark-theme .admin-sidebar .system-title,
body.dark-theme .admin-layout-wrapper header h4.text-dark,
body.dark-theme .admin-layout-wrapper header p.text-muted,
body.dark-theme .admin-layout-wrapper header .text-dark,
body.dark-theme .admin-layout-wrapper header .lang-text,
body.dark-theme .admin-layout-wrapper header i:not(.text-success),
body.dark-theme .admin-layout-wrapper header .bi-x-lg {
    color: #ffffff !important;
}

body.dark-theme .admin-nav-link {
    color: rgba(255, 255, 255, 0.7);
}

body.dark-theme .admin-nav-link:hover,
body.dark-theme .admin-nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

body.dark-theme .current-station-card {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

body.dark-theme .current-station-card .text-muted,
body.dark-theme .current-station-card .text-dark {
    color: #ffffff !important;
}

body.dark-theme .admin-layout-wrapper header .bg-light,
body.dark-theme .admin-layout-wrapper header .btn-white,
body.dark-theme .admin-layout-wrapper header .btn-light {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

body.dark-theme .admin-sidebar .menu-label {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Custom Scrollbar for Dark Theme */
body.dark-theme ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.dark-theme ::-webkit-scrollbar-track {
    background: transparent;
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Compact filter card used by master/list screens with a single search field. */
.master-filter-shell {
    background: #ffffff;
    padding: 0.45rem;
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 0.125rem 0.35rem rgba(0, 0, 0, 0.075);
}

.master-filter-shell .input-group .form-control {
    background-color: #f8f9fa;
}

body.dark-theme .master-filter-shell {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Simple two-field forms should use only the space their controls need.  The
   layout script adds this class to master, list, and entry form rows. */
.app-compact-form-row > .app-compact-field {
    flex: 0 0 auto;
    width: min(100%, 23rem);
}

.app-compact-form-row > .app-compact-field .form-control,
.app-compact-form-row > .app-compact-field .form-select,
.app-compact-form-row > .app-compact-field .input-group {
    max-width: 23rem;
}

@media (max-width: 767.98px) {
    .app-compact-form-row > .app-compact-field,
    .app-compact-form-row > .app-compact-field .form-control,
    .app-compact-form-row > .app-compact-field .form-select,
    .app-compact-form-row > .app-compact-field .input-group { width: 100%; max-width: none; }
}

/* Shared table actions: direct, solid icons with the original action meaning retained. */
.app-action-cell {
    white-space: nowrap;
}

.app-action-icon,
.icon-action,
.table .app-line-action {
    appearance: none;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 1.95rem;
    height: 1.95rem;
    min-width: 1.95rem;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 1.3rem;
    line-height: 1;
    text-decoration: none;
    transition: color .15s ease, transform .15s ease;
}

.app-action-icon:hover,
.app-action-icon:focus,
.icon-action:hover,
.icon-action:focus,
.table .app-line-action:hover,
.table .app-line-action:focus {
    transform: translateY(-1px);
    box-shadow: none !important;
}

.app-action-blue, .action-blue { color: #084298 !important; }
.app-action-blue:hover, .app-action-blue:focus, .action-blue:hover, .action-blue:focus { color: #052c65 !important; }
.app-action-green, .action-green { color: #146c43 !important; }
.app-action-green:hover, .app-action-green:focus, .action-green:hover, .action-green:focus { color: #0a482c !important; }
.app-action-amber, .action-amber { color: #9a6700 !important; }
.app-action-amber:hover, .app-action-amber:focus, .action-amber:hover, .action-amber:focus { color: #6f4c00 !important; }
.app-action-red, .action-red { color: #b02a37 !important; }
.app-action-red:hover, .app-action-red:focus, .action-red:hover, .action-red:focus { color: #842029 !important; }
.app-action-teal, .action-teal { color: #0f6674 !important; }
.app-action-teal:hover, .app-action-teal:focus, .action-teal:hover, .action-teal:focus { color: #084c57 !important; }
.app-action-slate, .action-slate { color: #495057 !important; }
.app-action-slate:hover, .app-action-slate:focus, .action-slate:hover, .action-slate:focus { color: #212529 !important; }

/* Static fallback for every standard action column, including server-rendered master screens. */
.table tbody td:last-child .btn.btn-sm:has(i),
.d-md-none .btn.btn-sm:has(i) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 1.95rem;
    height: 1.95rem;
    min-width: 1.95rem;
    padding: 0 !important;
    margin: 0 .35rem 0 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 0;
    line-height: 1;
    text-decoration: none;
}

.table tbody td:last-child .btn.btn-sm:has(i) i,
.d-md-none .btn.btn-sm:has(i) i {
    font-size: 1.3rem;
}

.table tbody td:last-child .btn-outline-primary:has(i), .d-md-none .btn-outline-primary:has(i) { color: #084298 !important; }
.table tbody td:last-child .btn-outline-success:has(i), .d-md-none .btn-outline-success:has(i) { color: #146c43 !important; }
.table tbody td:last-child .btn-outline-warning:has(i), .d-md-none .btn-outline-warning:has(i) { color: #9a6700 !important; }
.table tbody td:last-child .btn-outline-danger:has(i), .d-md-none .btn-outline-danger:has(i) { color: #b02a37 !important; }
.table tbody td:last-child .btn-outline-secondary:has(i), .d-md-none .btn-outline-secondary:has(i) { color: #495057 !important; }

/* Keep data-dense screens compact and consistent across masters, reports and modals. */
@media screen {
    .admin-content table tbody td,
    .admin-content table tbody th,
    .admin-content table tfoot td,
    .admin-content table tfoot th,
    body > main.container-fluid table tbody td,
    body > main.container-fluid table tbody th,
    body > main.container-fluid table tfoot td,
    body > main.container-fluid table tfoot th {
        font-size: .84rem;
    }

    .admin-content table thead th,
    .admin-content table thead td,
    body > main.container-fluid table thead th,
    body > main.container-fluid table thead td {
        font-size: .76rem;
    }

    .admin-content table .form-control,
    .admin-content table .form-select,
    .admin-content table .input-group-text,
    body > main.container-fluid table .form-control,
    body > main.container-fluid table .form-select,
    body > main.container-fluid table .input-group-text {
        font-size: .82rem;
    }
}

@media screen and (max-width: 767.98px) {
    .admin-content table tbody td,
    .admin-content table tbody th,
    .admin-content table tfoot td,
    .admin-content table tfoot th,
    body > main.container-fluid table tbody td,
    body > main.container-fluid table tbody th,
    body > main.container-fluid table tfoot td,
    body > main.container-fluid table tfoot th {
        font-size: .8rem;
    }
}
