/* ============================================================
   Digital Register System - Main Stylesheet
   Company: ASHRAI
   ============================================================ */

:root {
    --primary:       #1a6b3c;
    --primary-dark:  #124d2b;
    --primary-light: #e8f5e9;
    --accent:        #f9a825;
    --accent-light:  #fff8e1;
    --secondary:     #37474f;
    --success:       #2e7d32;
    --danger:        #c62828;
    --warning:       #f57f17;
    --info:          #0277bd;
    --bg:            #f0f2f5;
    --card-bg:       #ffffff;
    --sidebar-width: 250px;
    --navbar-height: 60px;
    --text-primary:  #1a1a2e;
    --text-secondary:#546e7a;
    --border-color:  #e0e0e0;
    --font-main:     'Plus Jakarta Sans', 'Noto Sans Bengali', sans-serif;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow-md:     0 4px 12px rgba(0,0,0,.1);
    --shadow-lg:     0 8px 30px rgba(0,0,0,.12);
    --radius:        10px;
    --radius-sm:     6px;
    --transition:    all .25s ease;
}

/* ============ RESET & BASE ============ */
*,*::before,*::after { box-sizing: border-box; }

html {
    overflow-x: auto;
    overflow-y: scroll;
    min-height: 100%;
}

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
    font-size: 14px;
    min-width: 360px;
    overflow-x: auto;
    overflow-y: auto;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============ TOP NAVBAR ============ */
.drs-navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    height: var(--navbar-height);
    z-index: 1030;
    padding: 0 1rem;
}
.drs-navbar .brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    letter-spacing: .5px;
}
.drs-navbar .navbar-brand img {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
}

/* ============ SIDEBAR ============ */
.drs-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: #fff;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 1020;
    transition: transform .3s ease;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--primary-dark);
    font-size: .95rem;
}
.sidebar-nav {
    padding: .5rem 0;
}
.sidebar-nav .nav-section {
    font-size: .65rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 1rem 1.2rem .4rem;
}
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem 1.2rem;
    color: var(--text-primary);
    font-size: .88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--transition);
}
.sidebar-nav .nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}
.sidebar-nav .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* ============ LAYOUT ============ */
.drs-wrapper {
    display: flex;
    margin-top: var(--navbar-height);
}
.drs-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left .3s ease;
    /* Allow horizontal scroll on low-res monitors instead of hiding */
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: auto;
    overflow-y: auto;
    box-sizing: border-box;
}

/* ============ PAGE HEADER ============ */
.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.page-header .breadcrumb {
    font-size: .8rem;
    margin: .2rem 0 0;
}

/* ============ CARDS ============ */
.drs-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.drs-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.drs-card .card-body {
    padding: 1.25rem;
}

/* ============ STAT CARDS ============ */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
/* Clickable stat cards */
a.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    position: relative;
}
a.stat-card-link:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
a.stat-card-link:hover .stat-arrow {
    opacity: 1;
    right: 12px;
}
a.stat-card-link:hover .stat-value {
    color: var(--primary);
}
.stat-arrow {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: all .25s ease;
}
.stat-info {
    flex: 1;
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.green  { background: #e8f5e9; color: #2e7d32; }
.stat-icon.blue   { background: #e3f2fd; color: #1565c0; }
.stat-icon.amber  { background: #fff8e1; color: #f57f17; }
.stat-icon.purple { background: #f3e5f5; color: #7b1fa2; }
.stat-info .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}
.stat-info .stat-label {
    font-size: .78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============ TABLES ============ */
.drs-table {
    width: 100%;
    font-size: .85rem;
}
.drs-table thead th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: .7rem .8rem;
    border-bottom: 2px solid var(--primary);
    white-space: nowrap;
}
.drs-table tbody td {
    padding: .6rem .8rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.drs-table tbody tr:hover {
    background: #fafbfc;
}

/* ============ FORMS ============ */
.form-label {
    font-weight: 600;
    font-size: .82rem;
    color: var(--text-secondary);
    margin-bottom: .3rem;
}
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: .88rem;
    padding: .5rem .75rem;
    transition: var(--transition);
}

/* ============ COMPACT FILTER BAR ============ */
.filter-card {
    overflow: visible;
}
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: #f8faf8;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}
.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 140px;
    min-width: 120px;
}
.filter-bar .filter-group.fg-date {
    flex: 0 0 130px;
    min-width: 120px;
}
.filter-bar .filter-group.fg-btn {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: flex-end;
    gap: 6px;
}
.filter-bar .filter-label {
    font-size: .65rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.filter-bar .form-select,
.filter-bar .form-control {
    font-size: .78rem;
    padding: 4px 6px;
    height: 32px;
    border-radius: 5px;
    min-width: 0; /* allow shrinking */
}
.filter-bar .form-select {
    padding-right: 24px; /* room for dropdown arrow */
    text-overflow: ellipsis;
}
.filter-bar .btn {
    height: 32px;
    font-size: .75rem;
    padding: 0 12px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
@media (max-width: 991.98px) {
    .filter-bar {
        flex-wrap: wrap;
    }
    .filter-bar .filter-group {
        flex: 1 1 calc(50% - 8px);
        min-width: calc(50% - 8px);
    }
    .filter-bar .filter-group.fg-date {
        flex: 1 1 calc(50% - 8px);
    }
    .filter-bar .filter-group.fg-btn {
        flex: 1 1 100%;
    }
}

/* ============ SELECT2 OVERRIDES ============ */
/* --- Base (outside filter bar, e.g. register entry page) --- */
.select2-container--bootstrap-5 .select2-selection {
    font-size: .82rem;
    min-height: 34px;
    height: 34px;
    border-color: var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0;
}
.select2-container--bootstrap-5 .select2-selection--single {
    display: flex !important;
    align-items: center !important;
    padding: 0 !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0 30px 0 10px !important;
    margin: 0 !important;
    line-height: 34px !important;
    font-size: .82rem;
    color: var(--text-primary);
    display: block;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: #999;
    font-size: .82rem;
    line-height: 34px !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    position: absolute;
    right: 6px;
    top: 0;
    height: 34px;
    display: flex;
    align-items: center;
}
.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: .82rem;
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    font-size: .82rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
}
.select2-container--bootstrap-5 .select2-results__option {
    padding: 6px 10px;
    font-size: .82rem;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: var(--primary) !important;
}

/* --- Inside filter bar: compact 32px height to match date inputs --- */
.filter-bar .select2-container--bootstrap-5 .select2-selection,
.filter-bar .select2-container--bootstrap-5 .select2-selection--single {
    min-height: 32px !important;
    height: 32px !important;
}
.filter-bar .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0 28px 0 8px !important;
    line-height: 32px !important;
    font-size: .78rem;
}
.filter-bar .select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    font-size: .78rem;
    line-height: 32px !important;
}
.filter-bar .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 32px;
}

/* --- Multi-select inside filter bar --- */
.filter-bar .select2-container--bootstrap-5 .select2-selection--multiple {
    min-height: 32px !important;
    height: auto !important;
    padding: 2px 4px !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}
.filter-bar .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    font-size: .7rem;
    padding: 1px 6px;
    margin: 0;
    border-radius: 3px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: #1a6b3c;
    line-height: 1.4;
}
.filter-bar .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    color: #c62828;
    margin-right: 3px;
    font-size: .8rem;
}
.filter-bar .select2-container--bootstrap-5 .select2-selection--multiple .select2-search--inline .select2-search__field {
    font-size: .75rem;
    margin: 0;
    padding: 0 4px;
    height: 24px;
}
.filter-bar .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0 !important;
}

/* --- Inside modals --- */
.modal .select2-container { z-index: 1060; }
.select2-container--open { z-index: 1065 !important; }

/* --- Ensure select2 container fills parent width --- */
.filter-group .select2-container {
    width: 100% !important;
}

/* ============ TABLE SEARCH BAR ============ */
.table-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #f8faf8;
    border-bottom: 1px solid var(--border-color);
}
.table-search-bar .search-input {
    flex: 1;
    max-width: 350px;
    font-size: .82rem;
    padding: 6px 12px 6px 34px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
    transition: border-color .2s, box-shadow .2s;
}
.table-search-bar .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,107,60,.12);
}
.table-search-bar .search-count {
    font-size: .75rem;
    color: var(--text-secondary);
}

/* ============ BRANCH ASSIGNMENT PANEL (User Modal) ============ */
.branch-assign-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.branch-assign-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8faf8;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.branch-assign-toolbar .branch-search-input {
    flex: 1;
    min-width: 180px;
    font-size: .8rem;
    padding: 5px 10px 5px 30px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 10px center;
    transition: border-color .2s;
}
.branch-assign-toolbar .branch-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,107,60,.12);
}
.branch-assign-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.branch-assign-actions .btn {
    font-size: .7rem;
    padding: 3px 10px;
}
.branch-selected-count {
    font-size: .72rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.branch-checkbox-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 6px 0;
}
.branch-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    cursor: pointer;
    transition: background .15s;
    font-size: .82rem;
    border-bottom: 1px solid #f5f5f5;
}
.branch-checkbox-item:hover {
    background: var(--primary-light);
}
.branch-checkbox-item input[type=checkbox] {
    flex-shrink: 0;
    cursor: pointer;
}
.branch-checkbox-item .branch-item-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}
.branch-checkbox-item .branch-item-code {
    font-size: .7rem;
    color: var(--text-secondary);
    background: #f0f0f0;
    padding: 1px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,107,60,.15);
}
.form-control.is-invalid {
    border-color: var(--danger);
}

/* ============ BUTTONS ============ */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    border-radius: var(--radius-sm);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
    border-radius: var(--radius-sm);
}
.btn-accent:hover {
    background: #f9b025;
    border-color: #f9b025;
    color: #000;
}

/* ============ BADGES ============ */
.badge-active   { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #ffebee; color: #c62828; }
.badge-admin    { background: #fff3e0; color: #e65100; }
.badge-user     { background: #e3f2fd; color: #1565c0; }

/* ============ LOGIN PAGE ============ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #2e7d32 100%);
    padding: 1rem;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-card .login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-card .login-logo img {
    height: 70px;
}
.login-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: .3rem;
}
.login-card .login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: .85rem;
    margin-bottom: 1.5rem;
}

/* ============ TOAST / ALERTS ============ */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    right: 1rem;
    z-index: 9999;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 991.98px) {
    .drs-sidebar {
        transform: translateX(-100%);
    }
    .drs-sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .drs-content {
        margin-left: 0;
        max-width: 100vw;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1015;
        display: none;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* ============ TABLE RESPONSIVE SCROLL ============ */
.table-responsive-custom {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* ============ LOADING SPINNER ============ */
.drs-spinner {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ REGISTER FORM GROUP HEADERS ============ */
.register-group-header {
    background: var(--primary-light);
    padding: .6rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--primary-dark);
    font-size: .88rem;
    margin: 1rem 0 .8rem;
    border-left: 3px solid var(--primary);
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: .4;
}

/* ============ SCROLL BAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ============ BILINGUAL LABEL ============ */
.label-bn {
    display: block;
    font-size: .75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ============ PRINT ============ */
@media print {
    .drs-navbar, .drs-sidebar, .no-print { display: none !important; }
    .drs-content { margin-left: 0 !important; padding: 0 !important; }
    .drs-card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============ EXCEL-LIKE SPREADSHEET ============ */
.excel-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    background: #fff;
    max-width: 100%;
}
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    min-width: 900px;
}

/* --- Header: English row --- */
.excel-table thead tr.header-en th {
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    color: #fff;
    font-weight: 700;
    font-size: .78rem;
    padding: 8px 10px 2px;
    text-align: center;
    border-right: 1px solid rgba(255,255,255,.2);
    border-bottom: none;
    letter-spacing: .3px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 3;
}
.excel-table thead tr.header-en th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}
.excel-table thead tr.header-en th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
    border-right: none;
}

/* --- Header: Bangla row --- */
.excel-table thead tr.header-bn th {
    background: linear-gradient(180deg, var(--primary), #228B22);
    color: rgba(255,255,255,.85);
    font-weight: 500;
    font-size: .72rem;
    padding: 2px 10px 8px;
    text-align: center;
    border-right: 1px solid rgba(255,255,255,.2);
    border-bottom: 2px solid var(--accent);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 3;
}
.excel-table thead tr.header-bn th:last-child {
    border-right: none;
}

/* --- Data rows (saved entries) --- */
.excel-table tbody tr.data-row td {
    padding: 6px 8px;
    border-bottom: 1px solid #e8e8e8;
    border-right: 1px solid #f0f0f0;
    text-align: center;
    vertical-align: middle;
    background: #fff;
    color: var(--text-primary);
    font-size: .82rem;
}
.excel-table tbody tr.data-row:nth-child(even) td {
    background: #f9fbf9;
}
.excel-table tbody tr.data-row:hover td {
    background: #edf7ed;
}
.excel-table tbody tr.data-row td:first-child {
    font-weight: 700;
    color: var(--primary);
    background: #f0f7f0;
}
.excel-table tbody tr.data-row td:last-child {
    border-right: none;
}

/* --- Input row (new entry) --- */
.excel-table tbody tr.input-row td {
    padding: 4px 3px;
    border-bottom: 2px solid var(--accent);
    border-right: 1px solid #e0e0e0;
    background: #fffde7;
    vertical-align: middle;
}
.excel-table tbody tr.input-row td:first-child {
    background: #fff8e1;
    text-align: center;
    font-weight: 700;
    font-size: .9rem;
    color: var(--accent);
}
.excel-table tbody tr.input-row td:last-child {
    border-right: none;
}

/* --- Input fields inside cells --- */
.excel-table .cell-input {
    width: 100%;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 5px 6px;
    font-size: .8rem;
    text-align: center;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    min-width: 60px;
}
.excel-table .cell-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,107,60,.2);
    background: #fff;
}
.excel-table .cell-input.is-invalid {
    border-color: var(--danger);
    background: #fff5f5;
}
.excel-table .cell-input[type="number"] {
    min-width: 70px;
}
.excel-table .cell-input[type="date"] {
    min-width: 120px;
}
.excel-table textarea.cell-input {
    min-width: 100px;
    resize: vertical;
    min-height: 32px;
}

/* --- Sl No column (narrow) --- */
.excel-table .col-sl {
    width: 50px;
    min-width: 50px;
}

/* --- Action column --- */
.excel-table .col-action {
    width: 80px;
    min-width: 80px;
}

/* --- Save button in input row --- */
.excel-save-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}
.excel-save-btn:hover {
    background: var(--primary-dark);
}
.excel-save-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

/* --- Delete button in data row --- */
.excel-del-btn {
    background: none;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: .72rem;
    cursor: pointer;
    transition: all .2s;
}
.excel-del-btn:hover {
    background: var(--danger);
    color: #fff;
}

/* --- Totals row --- */
.excel-table tfoot tr td {
    padding: 8px 10px;
    font-weight: 700;
    text-align: center;
    background: #e8f5e9;
    border-top: 2px solid var(--primary);
    color: var(--primary-dark);
    font-size: .82rem;
}

/* --- Register title bar --- */
.register-title-bar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.register-title-bar h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
}
.register-title-bar .reg-subtitle {
    font-size: .82rem;
    opacity: .85;
}
.register-title-bar .reg-meta {
    font-size: .78rem;
    background: rgba(255,255,255,.15);
    padding: 4px 12px;
    border-radius: 20px;
}

/* ============ PWA MOBILE STYLES ============ */

/* Standalone mode (installed as app) */
@media (display-mode: standalone) {
    body { -webkit-user-select: none; user-select: none; }
    .drs-navbar { padding-top: env(safe-area-inset-top, 0px); }
    #pwaInstallBtn { display: none !important; }
}

/* Mobile-friendly touches */
@media (max-width: 767.98px) {
    .drs-content { padding: 12px 10px 80px; }
    .page-header h1 { font-size: 1.1rem; }
    .stat-card { padding: .8rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }
    .stat-value { font-size: 1.2rem; }
    .stat-label { font-size: .7rem; }
    .stat-arrow { display: none; }
    .drs-card .card-header { padding: .6rem .8rem; font-size: .8rem; }
    .drs-card .card-body { padding: .8rem; }
    .filter-bar { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
    .filter-bar .filter-group { flex: 1 1 calc(50% - 6px); min-width: calc(50% - 6px); }
    .filter-bar .filter-group.fg-date { flex: 1 1 calc(50% - 6px); }
    .filter-bar .filter-group.fg-btn { flex: 1 1 100%; display: flex; gap: 6px; }
    .filter-bar .filter-group.fg-btn .btn { flex: 1; }
    .drs-table { font-size: .75rem; }
    .drs-table thead th { padding: .4rem .3rem; font-size: .7rem; }
    .drs-table tbody td { padding: .4rem .3rem; }
    .table-search-bar { padding: 8px 10px; }
    .table-search-bar .search-input { max-width: 100%; }
    .excel-table th, .excel-table td { font-size: .7rem; padding: 4px 6px; }
    .branch-assign-panel { max-height: 300px; overflow-y: auto; }
}

/* Small phones */
@media (max-width: 575.98px) {
    .stat-card { padding: .6rem; gap: .6rem; }
    .stat-icon { width: 36px; height: 36px; font-size: 1rem; border-radius: 8px; }
    .page-header { margin-bottom: .5rem; }
    .page-header h1 { font-size: 1rem; }
    .drs-content { padding: 8px 8px 80px; }
    .filter-bar .filter-group { flex: 1 1 100%; }
    .filter-bar .filter-group.fg-date { flex: 1 1 calc(50% - 4px); }
}

/* iOS safe areas */
@supports (padding-top: env(safe-area-inset-top)) {
    .drs-navbar {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--navbar-height) + env(safe-area-inset-top));
    }
    .drs-sidebar { padding-top: env(safe-area-inset-top); }
    .drs-content { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* Pull-to-refresh prevention in PWA */
@media (display-mode: standalone) {
    html { overscroll-behavior-y: contain; }
}

/* Hierarchy role badges */
.bg-purple { background-color: #7b1fa2 !important; color: #fff; }
.bg-purple.bg-opacity-10 { background-color: rgba(123,31,162,0.1) !important; color: #7b1fa2; }

