.email-template-editor-wrapper {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}

.email-template-editor-wrapper .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.email-template-editor-wrapper .ql-container.ql-snow {
    border: none;
    min-height: 320px;
    font-size: 0.95rem;
}
/* ========= SUMMARY DETAIL ========= */
.summary-detail-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.summary-hero-card {
    flex-wrap: wrap;
    gap: 1rem;
}

.summary-hero-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.summary-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.summary-stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.summary-stat-card label {
    font-size: 0.85rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.summary-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a293b;
}

.summary-stat-card small {
    color: #64748b;
}

/* Summary Summary Stats - Thống kê tổng kết */
.summary-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.summary-summary-stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.75rem;
    background: #ffffff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    min-height: 100px;
    justify-content: flex-start;
}

.summary-summary-stat-item-expanded {
    min-height: 115px;
}

.summary-summary-stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #e2e8f0, #cbd5e1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.summary-summary-stat-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1);
    transform: translateY(-2px);
}

.summary-summary-stat-item:hover::before {
    opacity: 1;
}

.summary-summary-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 0.25rem;
}

.summary-summary-stat-icon .oi {
    font-size: 1.125rem;
    color: #ffffff;
    line-height: 1;
    display: inline-block;
}

.summary-summary-stat-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin: 0;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.summary-summary-stat-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    margin-top: 0.125rem;
}

.summary-summary-stat-value .text-primary {
    color: #2563eb !important;
}

.summary-summary-stat-value.text-success {
    color: #10b981 !important;
}

.summary-summary-stat-value.text-warning {
    color: #f59e0b !important;
}

.summary-summary-stat-value.text-info {
    color: #06b6d4 !important;
}

.summary-summary-stat-value .text-muted {
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.25rem;
    opacity: 0.7;
}

.summary-summary-stat-item small {
    color: #94a3b8;
    font-size: 0.6875rem;
    line-height: 1.3;
    margin-top: 0.125rem;
}

.summary-summary-stat-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}

.summary-summary-stat-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.summary-summary-stat-detail-item .text-muted {
    color: #94a3b8;
    font-size: 0.6875rem;
}

.summary-summary-stat-detail-item .fw-semibold {
    font-weight: 600;
    color: #475569;
}

.summary-section-card {
    background: #fff;
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    padding: 1.5rem;
}

.summary-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.summary-section-header h4 {
    margin: 0;
    font-weight: 700;
    color: #1f2937;
}

.summary-section-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
}

.summary-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.summary-info-grid label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-placeholder {
    padding: 0.35rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1976d2;
    border-bottom: 1px dashed #e2e8f0;
}

.summary-placeholder-table table {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.summary-placeholder-table .activity-table thead th {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.summary-note-board {
    min-height: 120px;
    border: 1px dashed #cbd5f5;
    border-radius: 0.75rem;
    padding: 1rem;
    background: #f8fbff;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.decision-block .decision-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.decision-list {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 0.85rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
    max-height: 200px;
    flex-wrap: nowrap;
}

.decision-list::-webkit-scrollbar {
    height: 8px;
}

.decision-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.decision-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.decision-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.decision-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 1rem 1.15rem;
    background: #fff;
    text-align: left;
    transition: all 0.2s ease;
    flex: 0 0 280px;
    min-width: 280px;
    max-width: 280px;
}

.decision-card:hover {
    border-color: #94a3b8;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.decision-card.active {
    border-color: var(--role-primary);
    box-shadow: 0 8px 22px rgba(47, 93, 245, 0.15);
}

.decision-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0.35rem;
}

.decision-type {
    font-size: 0.75rem;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
}

.type-election {
    background: rgba(14, 165, 233, 0.15);
    color: #0284c7;
}

.type-vote {
    background: rgba(16, 185, 129, 0.15);
    color: #0f9d58;
}

.decision-card h5 {
    margin: 0.35rem 0;
    font-size: 1rem;
    color: #1f2937;
}

.decision-card p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
}

.decision-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: #475569;
    align-items: center;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
}

.status-pill .proxy-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    margin-left: 0.4rem;
    background: rgba(255, 255, 255, 0.6);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.8);
    font-size: 0.7rem;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.status-pill .proxy-indicator .oi {
    line-height: 1;
    font-size: 0.75rem;
}

.status-preparing {
    background: rgba(251, 191, 36, 0.2);
    color: #92400e;
}

.status-voting {
    background: rgba(59, 130, 246, 0.2);
    color: #1d4ed8;
}

.status-finished {
    background: rgba(34, 197, 94, 0.2);
    color: #15803d;
}

.status-counting {
    background: rgba(14, 165, 233, 0.2);
    color: #0f766e;
}

.status-locked {
    background: rgba(148, 163, 184, 0.25);
    color: #334155;
}

.status-success {
    background: rgba(34, 197, 94, 0.18);
    color: #15803d;
}

.status-pending {
    background: rgba(249, 115, 22, 0.18);
    color: #c2410c;
}

.status-pill .vote-count-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.6rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.status-pill.status-success .vote-count-indicator {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.3);
}

.status-pill.status-pending .vote-count-indicator {
    background: rgba(249, 115, 22, 0.15);
    color: #c2410c;
    border-color: rgba(249, 115, 22, 0.3);
}

.decision-detail-panel {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.decision-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.25rem;
}

.decision-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
}

.decision-detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.decision-info-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    background: #f8fafc;
}

.decision-info-card.compact {
    flex-direction: column;
    align-items: flex-start;
}

.decision-type-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #fff;
}

.decision-type-icon span {
    line-height: 1;
}

.icon-election {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.icon-vote {
    background: linear-gradient(135deg, #34d399, #059669);
}

.decision-info-content label,
.decision-info-card label {
    font-size: 0.78rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.decision-info-content strong,
.decision-info-card strong {
    font-size: 1.05rem;
    color: #1f2937;
}

.decision-info-content small,
.decision-info-card small {
    color: #64748b;
}

.decision-detail-title h5 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

.decision-detail-title p {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

.decision-detail-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
    margin: 0;
}

.decision-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.decision-stat-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.decision-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 1.25rem;
}

.decision-stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.decision-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    line-height: 1.2;
}

.decision-stat-value {
    margin: 0;
    font-weight: 700;
    font-size: 1.125rem;
    color: #1e293b;
    line-height: 1.4;
}

.decision-detail-metadata > div {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.decision-detail-metadata label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    line-height: 1.2;
}

.decision-detail-metadata p {
    margin: 0;
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1e293b;
    line-height: 1.4;
}

.decision-details-table {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.decision-details-title,
.decision-attendee-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 2px solid #e2e8f0;
}

.decision-details-table table {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.decision-details-table th {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-align: left;
}

.decision-details-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    color: #334155;
}

.decision-details-table tbody tr:last-child td {
    border-bottom: none;
}

.detail-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.vote-ratio {
    font-weight: 700;
    color: #0284c7;
    font-size: 1rem;
}

.share-count {
    font-weight: 600;
    color: #059669;
    font-size: 0.95rem;
}

.vote-count {
    font-weight: 700;
    color: #0284c7;
    font-size: 1rem;
}

.vote-approved {
    font-weight: 700;
    color: #059669;
    font-size: 1rem;
}

.vote-disapproved {
    font-weight: 700;
    color: #dc2626;
    font-size: 1rem;
}

.vote-abstained {
    font-weight: 700;
    color: #64748b;
    font-size: 1rem;
}

.vote-percentage {
    font-weight: 600;
    color: #64748b;
    font-size: 0.85rem;
    font-style: italic;
}

.decision-details-table td > div {
    line-height: 1.4;
}

.decision-details-table td > div:first-child {
    margin-bottom: 0.25rem;
}

.decision-attendee-table {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.decision-attendee-table table {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    overflow: hidden;
}

.decision-attendee-table th {
    background: #f8fafc;
}

.attendee-name {
    font-weight: 600;
    color: #1f2937;
}

@media (max-width: 992px) {
    .decision-block .decision-layout {
        flex-direction: column;
    }

    .decision-list {
        width: 100%;
        flex-basis: auto;
    }
}
/* ========= GLOBAL ========= */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent body scroll */
}

body {
    background: #f0f4f8;
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

/* Extra small buttons */
.btn-xs {
    padding: 0.1rem 0.3rem;
    font-size: 0.7rem;
    line-height: 1.1;
    border-radius: 0.15rem;
    white-space: nowrap;
}

.btn-xs .oi {
    font-size: 0.65rem;
}

.program-action-buttons .btn {
    margin: 0 2px;
}

:root {
    --role-primary: #2f5df5;
    --role-primary-dark: #1d46d6;
    --role-primary-light: #ecf2ff;
    --role-primary-soft: rgba(47, 93, 245, 0.12);
    --role-text-primary: #1a293b;
}

.gradient-bg {
    background: linear-gradient(135deg, #2f5df5 0%, #4169e1 100%);
}

/* ========= SIDEBAR ========= */
.menu-gradient {
    background: linear-gradient(165deg, var(--role-primary) 0%, var(--role-primary-dark) 80%);
    color: #fff;
}

/* Ensure sidebar scrollbar styling */
.menu-gradient::-webkit-scrollbar {
    width: 6px;
}

.menu-gradient::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.menu-gradient::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.menu-gradient::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.sidebar-profile {
    margin-bottom:1.5rem;
    text-align:center;
    padding: 0 1rem;
}

.sidebar-profile img {
    border-radius:50%;
    border:2px solid #fff;
    margin-bottom:0.5rem;
}

.sidebar-profile .user-email {
    color:#def7f3;
    font-size:0.85rem;
}

/* ========= MENU ITEMS ========= */
.nav-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 0.15rem;
}

.nav-menu-item:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
    text-decoration: none;
}

.nav-menu-item.active {
    background: rgba(255,255,255,0.95);
    color: var(--role-primary);
    font-weight: 600;
}

.nav-menu-item span.oi {
    font-size: 1.1rem;
}

/* ========= LOGIN PAGE ========= */
.login-page-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #2f5df5 0%, #4169e1 100%);
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    display: flex;
    max-width: 950px;
    width: 100%;
    min-height: 650px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

/* Left Panel */
.login-left-panel {
    width: 380px;
    background: linear-gradient(135deg, rgba(47,93,245,0.95) 0%, rgba(65,105,225,0.95) 100%);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    color: #fff;
    align-self: stretch;
}

.login-header {
    text-align: center;
    color: #fff;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.login-logo {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.login-header p {
    font-size: 0.82rem;
    opacity: 0.9;
    margin: 0;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    flex: 1;
}

.feature-box {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border-radius: 0.9rem;
    padding: 1rem;
    display: flex;
    gap: 0.85rem;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
    transition: all 0.3s ease;
}

.feature-box:hover {
    background: rgba(255,255,255,0.28);
    transform: translateY(-2px);
}

.feature-icon {
    background: rgba(255,255,255,0.35);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.feature-text h3 {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
}

.feature-text p {
    font-size: 0.75rem;
    opacity: 0.85;
    margin: 0;
    line-height: 1.25;
}

/* Right Panel */
.login-right-panel {
    flex: 1;
    background: #fff;
    padding: 3rem 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
}

.login-box {
    width: 100%;
    max-width: 420px;
}

.login-box h2 {
    font-size: 1.85rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 0.5rem 0;
}

.login-desc {
    font-size: 0.95rem;
    color: #718096;
    margin: 0 0 2rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #2f5df5;
    font-size: 1.15rem;
}

.input-with-icon input {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 3.25rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    background: #f7fafc;
    transition: all 0.2s ease;
}

.input-with-icon input::placeholder {
    color: #a0aec0;
}

.input-with-icon input:focus {
    outline: none;
    border-color: #2f5df5;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(47,93,245,0.1);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #4a5568;
    cursor: pointer;
}

.checkbox-label input {
    cursor: pointer;
    width: 1.1rem;
    height: 1.1rem;
}

.forgot-link {
    font-size: 0.9rem;
    color: #2f5df5;
    text-decoration: none;
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

.login-button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(90deg, #2f5df5 0%, #4169e1 100%);
    color: #fff;
    border: none;
    border-radius: 0.85rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(47,93,245,0.25);
    transition: all 0.2s ease;
}

.login-button:hover {
    box-shadow: 0 6px 20px rgba(47,93,245,0.35);
    transform: translateY(-2px);
}

.signup-text {
    text-align: center;
    margin-top: 1.75rem;
    font-size: 0.9rem;
    color: #718096;
}

.signup-text a {
    color: #2f5df5;
    text-decoration: none;
    font-weight: 600;
}

.signup-text a:hover {
    text-decoration: underline;
}

/* ========= MAIN CONTENT SCROLLBAR ========= */
main::-webkit-scrollbar {
    width: 10px;
}

main::-webkit-scrollbar-track {
    background: #f0f4f8;
}

main::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 5px;
}

main::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ========= MODAL OVERFLOW FIX ========= */
/* These styles help prevent modal content overflow */
.modal-body table {
    table-layout: fixed;
    width: 100%;
}

.modal-body table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.modal-body pre {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
}

/* Query Results Modal - responsive tables */
.query-result-table {
    width: 100% !important;
    table-layout: auto !important;
}

.query-result-table th {
    white-space: nowrap;
    min-width: 100px;
    background-color: #212529 !important;
    color: #fff !important;
    font-weight: 600;
    padding: 0.5rem 0.75rem !important;
    border: 1px solid #495057 !important;
}

.query-result-table td {
    padding: 0.5rem 0.75rem !important;
    border: 1px solid #dee2e6 !important;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 300px;
}

.query-result-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

.query-result-table tbody tr:hover {
    background-color: #f8f9fa !important;
}

/* Responsive modal for query results */
#queryResultsModal .modal-dialog {
    margin: 2.5vh auto;
}

#queryResultsModal .modal-content {
    max-height: 95vh;
}

#queryResultsModal .table-responsive {
    max-height: calc(95vh - 120px);
    overflow-x: auto;
    overflow-y: auto;
}

@media (max-width: 991.98px) {
    #queryResultsModal .modal-dialog {
        margin: 0;
        max-width: 100vw;
        height: 100vh;
    }
    
    #queryResultsModal .modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
    
    #queryResultsModal .table-responsive {
        max-height: calc(100vh - 120px);
    }
}

/* ========= DASHBOARD PAGE ========= */
.dashboard-wrapper {
    background: #f0f4f8;
    padding: 1.5rem 2rem;
}
.page-wrapper {
    flex-direction: column;
    gap: 1.25rem !important;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header-icon {
    font-size: 2rem;
    color: #2d9eb8;
}

.page-header h2 {
    margin: 0;
    font-weight: 700;
    color: #1a5268;
}

.page-header-time {
    margin-left: auto;
    color: #6b7a8f;
    font-size: 0.95rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(45,158,184,0.08), 0 2px 4px rgba(45,158,184,0.04);
    transition: all 0.3s ease;
    border: 1px solid rgba(87,224,196,0.1);
}

.stat-card:hover {
    box-shadow: 0 8px 24px rgba(45,158,184,0.12), 0 4px 8px rgba(45,158,184,0.06);
    transform: translateY(-4px);
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.stat-card-icon {
    font-size: 1.75rem;
}

.stat-card-title {
    font-size: 0.9rem;
    color: #6b7a8f;
    font-weight: 500;
    margin: 0;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: #1a5268;
}

.stat-card-subtitle {
    font-size: 0.8rem;
    color: #9aa5b5;
    margin-top: 0.25rem;
}

/* Activity Table */
.activity-section {
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.75rem;
    box-shadow: 0 4px 16px rgba(45,158,184,0.08), 0 2px 4px rgba(45,158,184,0.04);
}

.activity-section h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a5268;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.activity-table thead {
    background: #f8fafb;
}

.activity-table th {
    padding: 0.9rem 1rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7a8f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-table td {
    padding: 1rem;
    border-top: 1px solid #e8ecf1;
    color: #1a5268;
    font-size: 0.9rem;
}

.activity-table tbody tr:hover {
    background: #f8fafb;
}

.status-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.success {
    background: #d4f4dd;
    color: #1e7e34;
}

.status-badge.info {
    background: #d1ecf9;
    color: #0c5460;
}

.status-badge.warning {
    background: #fff3cd;
    color: #856404;
}

/* User role badges (for displaying role names in table) */
.user-role-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.user-role-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Color variations for stat cards */
.stat-card.blue .stat-card-icon { color: #4da6ff; }
.stat-card.green .stat-card-icon { color: #4caf50; }
.stat-card.orange .stat-card-icon { color: #ff9800; }
.stat-card.purple .stat-card-icon { color: #9c27b0; }

/* ========= PROFILE PAGE ========= */
.profile-avatar-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2f5df5 0%, #4169e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(47,93,245,0.2);
}

.profile-avatar-icon {
    font-size: 4rem;
    color: #fff;
}

.profile-info-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f4f8;
}

.profile-info-item:last-child {
    border-bottom: none;
}

.profile-info-label {
    font-size: 0.9rem;
    color: #6b7a8f;
    font-weight: 500;
}

.profile-info-value {
    font-size: 0.9rem;
    color: #1a5268;
    font-weight: 600;
}

/* ========= PAGINATION ========= */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    font-size: 0.875rem;
    color: #64748b;
}

.pagination-controls {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.pagination-controls .btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.pagination-controls .btn-primary {
    background: var(--role-primary);
    border-color: var(--role-primary);
    color: #fff;
}

.pagination-controls .btn-primary:hover:not(:disabled) {
    background: var(--role-primary-dark);
    border-color: var(--role-primary-dark);
}

.pagination-controls .btn-outline-secondary {
    border-color: #cbd5e0;
    color: #64748b;
}

.pagination-controls .btn-outline-secondary:hover:not(:disabled) {
    background: var(--role-primary-light);
    border-color: var(--role-primary);
    color: var(--role-primary);
}

.pagination-controls .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========= CODE EDITOR ========= */
.code-editor {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    line-height: 1.6;
    tab-size: 4;
}

.code-editor:focus {
    background: #fff;
    border-color: #2f5df5;
    box-shadow: 0 0 0 0.2rem rgba(47,93,245,0.15);
}

/* ========= FORM SWITCHES ========= */
.form-check-input:checked {
    background-color: #2f5df5;
    border-color: #2f5df5;
}

.form-check-input:focus {
    border-color: #2f5df5;
    box-shadow: 0 0 0 0.2rem rgba(47,93,245,0.15);
}

/* ========= QUERY BUILDER ========= */
.table-item-btn {
    transition: all 0.2s ease !important;
}

.table-item-btn:hover {
    background-color: #e9ecef !important;
    color: #212529 !important;
    transform: translateX(3px);
    border-color: #6c757d !important;
}

.table-item-btn:hover strong {
    color: #212529 !important;
}

.table-item-btn:hover .text-primary {
    color: #0d6efd !important;
}

.table-item-btn:active {
    transform: translateX(1px);
    background-color: #dee2e6 !important;
}

.table-item-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
}

/* ========= MOBILE/TABLET WARNING BANNER ========= */
.mobile-warning-banner {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

/* Show banner only on mobile and tablet (portrait) */
@media (max-width: 991.98px) {
    .mobile-warning-banner {
        display: block !important;
    }
}

/* Hide banner on landscape tablets and larger screens */
@media (min-width: 992px) {
    .mobile-warning-banner {
        display: none !important;
    }
}

/* Adjust main content margin on mobile to account for banner */
@media (max-width: 991.98px) {
    main {
        margin-left: 0 !important;
    }
}

/* ========= CODEMIRROR STYLES ========= */
.CodeMirror {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    font-size: 14px;
    height: auto;
    min-height: 200px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background: #272822;
    color: #f8f8f2;
}

.CodeMirror-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    z-index: 9999;
    border-radius: 0;
}

.CodeMirror-focused {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.CodeMirror-scroll {
    min-height: 200px;
    max-height: 600px;
}

/* Source Query Editor - taller */
#sourceQueryTextarea + .CodeMirror {
    min-height: 300px;
}

/* Target Query Editor - shorter */
#targetInsertQueryTextarea + .CodeMirror {
    min-height: 200px;
}

/* CodeMirror line numbers */
.CodeMirror-linenumber {
    color: #6c757d;
    padding: 0 8px;
}

.CodeMirror-gutters {
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
}

.CodeMirror-linenumber {
    min-width: 3em;
}

/* CodeMirror cursor */
.CodeMirror-cursor {
    border-left: 2px solid #212529;
}

/* CodeMirror selected text */
.CodeMirror-selected {
    background: #b3d4fc !important;
}

/* CodeMirror active line */
.CodeMirror-activeline-background {
    background: rgba(0, 0, 0, 0.05);
}

/* CodeMirror hint dropdown - Enhanced */
.CodeMirror-hints {
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10000;
    color: #f8f8f2;
}

.CodeMirror-hint {
    padding: 6px 12px;
    cursor: pointer;
    color: #f8f8f2;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.CodeMirror-hint:hover {
    background: #2d2d2d;
    border-left-color: #0d6efd;
}

.CodeMirror-hint-active {
    background: #0d6efd !important;
    color: white !important;
    border-left-color: #0056b3;
}

/* CodeMirror fold gutter */
.CodeMirror-foldgutter {
    width: 1.2em;
}

.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
    cursor: pointer;
    color: #888;
}

.CodeMirror-foldgutter-open:after {
    content: "\25BE";
}

.CodeMirror-foldgutter-folded:after {
    content: "\25B8";
}

/* CodeMirror selection matches */
.CodeMirror-selected {
    background: #49483e !important;
}

.CodeMirror-focused .CodeMirror-selected {
    background: #49483e !important;
}

/* CodeMirror scrollbar matches */
.CodeMirror-scrollbar-filler {
    background: #272822;
}

/* CodeMirror trailing spaces */
.CodeMirror-trailingspace {
    background: rgba(255, 0, 0, 0.2);
    border-bottom: 1px dotted rgba(255, 0, 0, 0.5);
}

/* Responsive CodeMirror */
@media (max-width: 768px) {
    .CodeMirror {
        font-size: 12px;
    }
    
    #sourceQueryTextarea + .CodeMirror {
        min-height: 250px;
    }
    
    #targetInsertQueryTextarea + .CodeMirror {
        min-height: 150px;
    }
}

/* ========= ENHANCED PAGE HEADER ========= */
.page-header-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2f5df5 0%, #4169e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(47,93,245,0.25);
}

.page-header-icon {
    font-size: 2rem;
    color: #fff;
}

.page-header-subtitle {
    font-size: 0.9rem;
    color: #6b7a8f;
    margin-top: 0.25rem;
}

/* ========= ACTION BAR ========= */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.action-bar-left {
    flex: 1;
    min-width: 250px;
}

.action-bar-right {
    display: flex;
    gap: 0.75rem;
}

.search-box {
    position: relative;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7a8f;
    font-size: 1rem;
    z-index: 1;
}

.search-input {
    padding-left: 2.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #fff;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: #2f5df5;
    box-shadow: 0 0 0 3px rgba(47,93,245,0.1);
    outline: none;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* ========= LOADING & EMPTY STATES ========= */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    color: #cbd5e0;
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: #1a5268;
    margin-bottom: 0.5rem;
}

/* ========= USER TABLE ========= */
.user-table tbody tr {
    transition: all 0.2s ease;
}

.user-table tbody tr:hover {
    background: #f8fafb;
/*    transform: translateX(2px);
*/}

.user-table tbody tr.row-busy {
    opacity: 0.6;
    pointer-events: none;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2f5df5 0%, #4169e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(47,93,245,0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: #1a5268;
    font-size: 0.95rem;
}

.user-email {
    display: flex;
    align-items: center;
    color: #6b7a8f;
    font-size: 0.9rem;
}

.user-role-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.role-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--role-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    line-height: 1;
    text-align: center;
    padding: 0;
}

/* ========= ROLE TABLE ========= */
.role-table tbody tr {
    transition: all 0.2s ease;
}

.role-table tbody tr:hover {
    background: #f8fafb;
    transform: translateX(2px);
}

.role-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #9c27b0 0%, #673ab7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(156,39,176,0.2);
}

.role-info {
    display: flex;
    flex-direction: column;
}

.role-name {
    color: #1a5268;
    font-size: 0.95rem;
}

.role-code {
    background: #f0f4f8;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    color: #6b7a8f;
    font-family: 'Consolas', 'Monaco', monospace;
}

.role-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.role-type-badge.system {
    background: #d1ecf9;
    color: #0c5460;
}

.role-type-badge.default {
    background: #fff3cd;
    color: #856404;
}

.role-type-badge.custom {
    background: #e2e3e5;
    color: #383d41;
}

.permission-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    background: #f0f4f8;
    color: #1a5268;
}

.permission-count-badge.empty {
    background: #fff3cd;
    color: #856404;
}

/* ========= ACTION BUTTONS ========= */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.btn-action {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-action:active:not(:disabled) {
    transform: translateY(0);
}

.btn-edit {
    background: #e3f2fd;
    color: #1976d2;
}

.btn-edit:hover:not(:disabled) {
    background: #bbdefb;
}

.btn-password {
    background: #fff3e0;
    color: #f57c00;
}

.btn-password:hover:not(:disabled) {
    background: #ffe0b2;
}

.btn-toggle {
    background: #f3e5f5;
    color: #7b1fa2;
}

.btn-toggle:hover:not(:disabled) {
    background: #e1bee7;
}

.btn-delete {
    background: #ffebee;
    color: #c62828;
}

.btn-delete:hover:not(:disabled) {
    background: #ffcdd2;
}

.btn-action.btn-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.btn-action.btn-success:hover:not(:disabled) {
    background: #c8e6c9;
}

.btn-action.btn-primary {
    background: #e3f2fd;
    color: #1565c0;
}

.btn-action.btn-primary:hover:not(:disabled) {
    background: #bbdefb;
}

/* ========= MODAL ENHANCEMENTS ========= */
.modal-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.modal-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2f5df5 0%, #4169e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(47,93,245,0.25);
}

.modal-icon {
    font-size: 1.5rem;
    color: #fff;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: #6b7a8f;
    margin-top: 0.25rem;
}

/* ========= ROLE SELECTION GRID ========= */
.role-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
    background: var(--role-primary-light);
    border-radius: 0.75rem;
    border: 1px solid rgba(47, 93, 245, 0.12);
}

.role-card {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    background: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
}

.role-card:hover {
    border-color: var(--role-primary);
    box-shadow: 0 4px 14px rgba(47, 93, 245, 0.15);
    transform: translateY(-2px);
}

.role-card.selected {
    border-color: var(--role-primary);
    background: rgba(47, 93, 245, 0.1);
    box-shadow: 0 4px 14px rgba(47, 93, 245, 0.18);
}

.role-checkbox {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    cursor: pointer;
}

.role-card-label {
    display: block;
    cursor: pointer;
    margin: 0;
}

.role-card-header {
    display: block;
    margin-bottom: 0.5rem;
}

.role-card-name {
    color: var(--role-text-primary);
    font-size: 0.95rem;
}

.role-card-code {
    color: #6b7a8f;
    font-size: 0.8rem;
    display: block;
}

/* ========= PERMISSION GRID ========= */
.permission-grid {
    display: flex !important;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #f8fafb;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    visibility: visible !important;
    opacity: 1 !important;
}

.permission-module-group {
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: block !important;
    visibility: visible !important;
}

.permission-module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8fafb;
    border-bottom: 1px solid #e2e8f0;
}

.permission-module-header strong {
    color: var(--role-text-primary);
    font-size: 0.95rem;
}

.permission-count {
    padding: 0.25rem 0.75rem;
    background: var(--role-primary);
    color: #fff;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.permission-items {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
    visibility: visible !important;
    opacity: 1 !important;
}

.permission-item {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: #fff;
    transition: all 0.2s ease;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.permission-item:hover {
    border-color: var(--role-primary);
    box-shadow: 0 2px 6px rgba(47, 93, 245, 0.15);
}

.permission-item.selected {
    border-color: var(--role-primary);
    background: var(--role-primary-light);
}

.permission-item .form-check {
    margin: 0;
    display: flex !important;
    align-items: flex-start;
    gap: 0.75rem;
    visibility: visible !important;
}

.permission-checkbox {
    cursor: pointer;
    margin-top: 0.25rem;
    width: 1.25rem !important;
    height: 1.25rem !important;
    flex-shrink: 0;
    position: relative;
    z-index: 10 !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

.permission-item .form-check-input {
    margin-top: 0.125rem;
    cursor: pointer;
    width: 1.25rem !important;
    height: 1.25rem !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
    position: relative;
    z-index: 10 !important;
}

.permission-label {
    display: block !important;
    cursor: pointer;
    margin: 0;
    flex: 1;
    padding-left: 0;
    visibility: visible !important;
    opacity: 1 !important;
}

.permission-header {
    display: block;
    margin-bottom: 0.25rem;
}

.permission-name {
    color: var(--role-text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.permission-code {
    color: #6b7a8f;
    font-size: 0.8rem;
    display: block;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-top: 0.25rem;
}

.permission-desc {
    color: #9aa5b5;
    font-size: 0.75rem;
    line-height: 1.4;
}

/* ========= STATUS BADGE ENHANCEMENTS ========= */
.status-badge {
    display: inline-block;
    font-weight: 600;
}

/* ========= NEW ROLE MODAL UI ========= */
.role-modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.role-modal-header {
    background: linear-gradient(135deg, var(--role-primary) 0%, #3b5bdb 100%);
    color: #fff;
    border-bottom: none;
    padding: 1.5rem;
    border-radius: 1rem 1rem 0 0;
}

.role-modal-body {
    padding: 1.5rem;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.role-modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
    background: #f8fafb;
    border-radius: 0 0 1rem 1rem;
}

/* ========= ROLE TABS ========= */
.role-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

.role-tab {
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7a8f;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.role-tab:hover {
    color: var(--role-primary);
    background: rgba(47, 93, 245, 0.05);
    border-bottom-color: rgba(47, 93, 245, 0.3);
}

.role-tab.active {
    color: var(--role-primary);
    border-bottom-color: var(--role-primary);
    background: transparent;
    font-weight: 600;
}

.role-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7a8f;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: transparent;
}

.role-tabs .nav-link:hover {
    color: var(--role-primary);
    background: rgba(47, 93, 245, 0.05);
    border-bottom-color: rgba(47, 93, 245, 0.3);
}

.role-tabs .nav-link.active {
    color: var(--role-primary);
    border-bottom-color: var(--role-primary);
    background: transparent;
    font-weight: 600;
}

/* ========= PERMISSION CONTROLS ========= */
.permission-controls {
    background: #f8fafb;
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.permission-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.permission-search-wrapper .oi-magnifying-glass {
    position: absolute;
    left: 1rem;
    color: #6b7a8f;
    z-index: 1;
}

.permission-search-wrapper input {
    padding-left: 2.75rem;
    padding-right: 2.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    height: 42px;
}

.permission-search-wrapper input:focus {
    border-color: var(--role-primary);
    box-shadow: 0 0 0 3px rgba(47, 93, 245, 0.1);
}

.btn-clear-search {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: #6b7a8f;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-search:hover {
    background: #e2e8f0;
    color: #1a293e;
}

.permission-actions {
    display: flex;
    gap: 0.5rem;
    height: 100%;
    align-items: center;
}

.permission-summary {
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

/* ========= PERMISSION ACCORDION ========= */
.permission-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.permission-module-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.permission-module-card:hover {
    border-color: var(--role-primary);
    box-shadow: 0 4px 12px rgba(47, 93, 245, 0.1);
}

.permission-module-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: #f8fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.permission-module-card-header:hover {
    background: #f1f5f9;
}

.module-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.module-expand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 0.25rem;
    background: #fff;
    transition: transform 0.2s ease;
}

.module-expand-icon.expanded {
    transform: rotate(90deg);
}

.module-expand-icon .oi {
    font-size: 0.75rem;
    color: var(--role-primary);
}

.module-name {
    color: var(--role-text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.module-info {
    color: #6b7a8f;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.module-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.module-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-module-action {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7a8f;
    padding: 0;
}

.btn-module-action:hover {
    background: var(--role-primary);
    border-color: var(--role-primary);
    color: #fff;
    transform: scale(1.05);
}

.module-badge {
    background: var(--role-primary);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 2rem;
    text-align: center;
}

.permission-module-card-body {
    padding: 1rem 1.25rem;
    background: #fff;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* ========= PERMISSION LIST ========= */
.permission-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.75rem;
}

.permission-card {
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    background: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
}

.permission-card:hover {
    border-color: var(--role-primary);
    box-shadow: 0 4px 12px rgba(47, 93, 245, 0.1);
    transform: translateY(-2px);
}

.permission-card.selected {
    border-color: var(--role-primary);
    background: linear-gradient(135deg, rgba(47, 93, 245, 0.05) 0%, rgba(47, 93, 245, 0.02) 100%);
    box-shadow: 0 4px 12px rgba(47, 93, 245, 0.15);
}

.permission-card-content {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.permission-checkbox-wrapper {
    position: relative;
    flex-shrink: 0;
}

.permission-checkbox-new {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
    accent-color: var(--role-primary);
}

.permission-checkbox-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    border-radius: 0.25rem;
}

.permission-details {
    flex: 1;
    min-width: 0;
}

.permission-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.permission-title {
    color: var(--role-text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.permission-selected-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--role-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.permission-code-new {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-bottom: 0.5rem;
}

.permission-description {
    color: #6b7a8f;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

/* ========= TAB CONTENT ========= */
.tab-content-info,
.tab-content-permissions {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========= RESPONSIVE ========= */
@media (max-width: 768px) {
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-bar-left,
    .action-bar-right {
        width: 100%;
    }

    .search-box {
        max-width: 100%;
    }

    .role-selection-grid {
        grid-template-columns: 1fr;
    }

    .permission-items {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-wrap: wrap;
    }

    /* Role Modal Responsive */
    .role-modal-body {
        max-height: calc(100vh - 200px);
        padding: 1rem;
    }

    .role-tabs .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .permission-controls .row {
        flex-direction: column;
    }

    .permission-actions {
        width: 100%;
        justify-content: stretch;
    }

    .permission-actions .btn {
        flex: 1;
    }

    .permission-list {
        grid-template-columns: 1fr;
    }

    .permission-module-card-header {
        padding: 0.75rem 1rem;
    }

    .module-header-right {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }

    .module-actions {
        order: 2;
    }

    .module-badge {
        order: 1;
    }
}

.role-page-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1rem 1.5rem;
}

.role-hero-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    background: var(--role-primary);
    color: #fff;
    box-shadow: 0 6px 18px rgba(47, 93, 245, 0.25);
}

.role-hero-content {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.role-hero-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.role-hero-icon span {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.role-hero-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.role-hero-subtitle {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.9;
    line-height: 1.4;
}

.btn-hero {
    background: linear-gradient(135deg, #ff6a3d, #ff3b3b);
    border: none;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    box-shadow: 0 4px 12px rgba(255, 59, 59, 0.3);
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
}

.btn-hero:hover:not(:disabled) {
    color: #fff;
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 59, 59, 0.4);
}

.btn-hero:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.role-filters-card, .settings-tabs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.06);
    margin-bottom: 1rem;
    margin-top: 1rem;
}

.role-search-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f5f7fb;
    border-radius: 0.5rem;
    padding: 0 0.75rem;
    min-width: 250px;
}

.role-search-wrapper .oi {
    font-size: 0.875rem;
    color: #94a3b8;
}

.role-search-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    outline: none;
}

.role-filter-wrapper {
    min-width: 180px;
}

.role-filter-wrapper .form-select {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: #fff;
}

.role-search-wrapper input:focus {
    box-shadow: none;
}

.role-filter-wrapper {
    width: 180px;
}

.role-filter-wrapper .form-select {
    border-radius: 0.5rem;
    background: #f5f7fb;
    border: none;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.role-list-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    padding: 1.5rem;
}

.role-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.role-list-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.role-page-size-label {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
}

.role-page-size-select {
    width: auto;
    min-width: 80px;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.role-list-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1a293b;
}

.role-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--role-primary-light);
    color: var(--role-primary);
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.role-table-wrapper {
    overflow-x: auto;
}

.role-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.role-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 600;
    border: none;
    padding: 0.5rem 0.75rem;
}

.role-table tbody tr {
    background: #f9fbff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    border-radius: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.role-table tbody tr:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.role-table tbody tr td {
    border: none;
    padding: 0.75rem;
    vertical-align: middle;
}

.role-table tbody tr td:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.role-table tbody tr td:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

.role-name-cell {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    visibility: visible;
    opacity: 1;
}

.role-name-cell > div {
    display: block;
    visibility: visible;
}

.role-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--role-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    line-height: 1;
    text-align: center;
    padding: 0;
}

.role-name-text {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    line-height: 1.4;
    display: block;
    visibility: visible;
    opacity: 1;
}

.role-code-pill {
    display: inline-block;
    margin-top: 0.125rem;
    padding: 0.125rem 0.5rem;
    background: var(--role-primary-light);
    border-radius: 999px;
    font-size: 0.7rem;
    color: var(--role-primary);
    font-weight: 600;
}

.role-desc-text {
    color: #64748b;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.role-status-pill {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--role-primary-soft);
    color: var(--role-primary);
}

.role-status-pill.active {
    background: var(--role-primary-soft);
    color: var(--role-primary);
}

.role-status-pill.inactive {
    opacity: 0.6;
    background: rgba(148, 163, 184, 0.15);
    color: #64748b;
}

.role-default-pill {
    background: var(--role-primary-soft);
    color: var(--role-primary);
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.role-permission-pill {
    background: var(--role-primary-soft);
    color: var(--role-primary);
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.role-actions {
    display: inline-flex;
    gap: 0.375rem;
}

.btn-role-action {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.875rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-role-action.edit {
    background: linear-gradient(135deg, #60a5fa, #1d4ed8);
}

.btn-role-action.delete {
    background: linear-gradient(135deg, #f87171, #dc2626);
}

.btn-role-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(15, 23, 42, 0.1);
}

.btn-role-primary {
    background: var(--role-primary);
    border: 1px solid var(--role-primary);
    color: #fff;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1.1rem;
    border-radius: 0.5rem;
}

.btn-role-primary:hover:not(:disabled) {
    background: var(--role-primary-dark);
    border-color: var(--role-primary-dark);
    color: #fff;
}

.btn-role-primary:disabled {
    opacity: 0.7;
}

.btn-role-outline {
    background: #fff;
    border: 1px solid var(--role-primary);
    color: var(--role-primary);
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.5rem 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-role-outline:hover:not(:disabled) {
    background: var(--role-primary-soft);
    color: var(--role-primary);
}

.role-table tbody tr.row-busy {
    opacity: 0.6;
    pointer-events: none;
}

.role-page-wrapper .modal-icon-wrapper {
    background: var(--role-primary);
    box-shadow: 0 6px 16px rgba(47, 93, 245, 0.25);
}

.role-page-wrapper .modal-subtitle {
    color: rgba(26, 41, 59, 0.7);
}

.role-page-wrapper .pagination-wrapper {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
  
}

.role-page-wrapper .pagination-info {
    font-size: 0.875rem;
    color: #64748b;
}

.role-page-wrapper .pagination-controls {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.role-page-wrapper .pagination-controls .btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.role-page-wrapper .pagination-controls .btn-primary {
    background: var(--role-primary);
    border-color: var(--role-primary);
    color: #fff;
}

.role-page-wrapper .pagination-controls .btn-primary:hover:not(:disabled) {
    background: var(--role-primary-dark);
    border-color: var(--role-primary-dark);
}

.role-page-wrapper .pagination-controls .btn-outline-secondary {
    border-color: #cbd5e0;
    color: #64748b;
}

.role-page-wrapper .pagination-controls .btn-outline-secondary:hover:not(:disabled) {
    background: var(--role-primary-light);
    border-color: var(--role-primary);
    color: var(--role-primary);
}

/* ========= ROLE PAGINATION (for MeetingGroups, SystemConfigurations, etc.) ========= */
.role-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.role-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #cbd5e0;
    background: #fff;
    color: #64748b;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.role-page-btn:hover:not(:disabled) {
    background: var(--role-primary-light);
    border-color: var(--role-primary);
    color: var(--role-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(47, 93, 245, 0.15);
}

.role-page-btn:active:not(:disabled) {
    transform: translateY(0);
}

.role-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
}

.role-page-info {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    padding: 0 0.75rem;
}

.role-page-info strong {
    color: var(--role-primary);
    font-weight: 700;
}

/* ========= MAIN FOOTER ========= */
.main-footer {
    margin-top: auto;
    padding: 0.5rem;
    background: var(--role-primary);
    color: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 6px 18px rgba(47, 93, 245, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: calc(100% - 2rem);
    margin-bottom:0.2rem;
}

.main-footer-left {
    display: flex;
    align-items: center;
}

.main-footer-version {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.main-footer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-help {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-help:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-help span {
    font-size: 1rem;
    line-height: 1;
}

@media (max-width: 768px) {
    .main-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        width: calc(100% - 2rem);
    }
    
    .main-footer-right {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Department selection wrapper */
.department-selection-wrapper {
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.department-selection-wrapper .form-check {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    margin:0.5rem;
}

.department-selection-wrapper .form-check:hover {
    background: white;
}

.department-selection-wrapper .form-check-input {
    cursor: pointer;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.department-selection-wrapper .form-check-input:checked {
    background-color: #1565c0;
    border-color: #1565c0;
}

.department-selection-wrapper .form-check-label {
    cursor: pointer;
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    background: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.06);
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.settings-tab {
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 500;
    font-size: 0.9375rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.settings-tab:hover {
    background: #f8fafc;
    color: #1565c0;
}

.settings-tab.active {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(21, 101, 192, 0.3);
}

.settings-tab-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-section {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.settings-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

/* Email Templates Grid */
.email-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.25rem;
}

.email-template-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s;
}

.email-template-card:hover {
    border-color: #1565c0;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.15);
    transform: translateY(-2px);
}

.email-template-card.disabled {
    opacity: 0.6;
    background: #f8fafc;
}

.email-template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.email-template-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.5rem 0;
}

.email-template-subject {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

.email-template-variables {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.email-template-variables strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #475569;
    font-size: 0.875rem;
}

.variable-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.variable-tag {
    padding: 0.25rem 0.75rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-family: 'Courier New', monospace;
    color: #1e293b;
}

/* ========= ELECTION COMPONENTS ========= */
.election-wrapper {
    padding: 1.5rem;
}

.election-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.election-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    border-color: #cbd5e1;
}

.election-card.active {
    border-color: var(--role-primary);
    box-shadow: 0 2px 10px rgba(47, 93, 245, 0.12);
    background: linear-gradient(to right, rgba(47, 93, 245, 0.02), #fff);
}

.election-card .card-body {
    padding: 0.875rem 1rem;
}

.election-card h6 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a293b;
    margin-bottom: 0.25rem;
}

.election-card .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.election-content {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e2e8f0;
}

.election-content .card {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.election-content .card-body {
    padding: 1.5rem;
}

.election-content h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a293b;
    margin-bottom: 1rem;
}

.election-content .table {
    margin-top: 1rem;
}

.election-content .table thead th {
    background: #f8fafb;
    color: #475569;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
}

.election-content .table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.election-content .table tbody tr:hover {
    background: #f8fafb;
}

.election-content .form-control,
.election-content .form-select {
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    transition: all 0.2s ease;
}

.election-content .form-control:focus,
.election-content .form-select:focus {
    border-color: var(--role-primary);
    box-shadow: 0 0 0 3px rgba(47, 93, 245, 0.1);
}

.election-content .form-label {
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.email-template-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.email-template-actions .btn-action {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 0.5rem;
    color: #64748b;
    transition: all 0.2s;
}

.email-template-actions .btn-action:hover {
    border-color: #1565c0;
    background: #1565c0;
    color: white;
}
/* ========= STATUS BADGES (CHUẨN HÓA) ========= */
.status-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.35rem 0.75rem;
	border-radius: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 600;
	white-space: nowrap;
	gap: 0.375rem;
}

.status-badge .oi {
	font-size: 0.875rem;
	line-height: 1;
}

/* Đang chuẩn bị (0) - Warning/Yellow */
.status-preparing {
	background-color: #fef3c7;
	color: #92400e;
	border: 1px solid #fde68a;
}

/* Đang diễn ra (1) - Primary/Blue */
.status-ongoing {
	background-color: #dbeafe;
	color: #1e40af;
	border: 1px solid #93c5fd;
}

/* Hoàn thành (2) - Success/Green */
.status-completed {
	background-color: #d1fae5;
	color: #065f46;
	border: 1px solid #6ee7b7;
}

/* Hủy (3) - Secondary/Gray */
.status-cancelled {
	background-color: #e5e7eb;
	color: #374151;
	border: 1px solid #d1d5db;
}

/* Hoàn tất + Khoá (4) - Danger/Red */
.status-locked {
	background-color: #fee2e2;
	color: #991b1b;
	border: 1px solid #fca5a5;
}

/* Không xác định */
.status-unknown {
	background-color: #f3f4f6;
	color: #6b7280;
	border: 1px solid #d1d5db;
}

/* Legacy support */
.status-badge-warning { background-color: #fef3c7; color: #92400e; }
.status-badge-success { background-color: #d1fae5; color: #065f46; }
.status-badge-danger { background-color: #fee2e2; color: #991b1b; }
.status-badge-secondary { background-color: #e5e7eb; color: #374151; }
.status-active { background-color: #dbeafe; color: #1e40af; }
.status-inactive { background-color: #e5e7eb; color: #374151; }

/* ========= STICKY TABLE COLUMNS (CỐ ĐỊNH CỘT) ========= */
/* Table với sticky columns - 4 cột đầu và các cột cuối */
.table-responsive-sticky {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.table-responsive-sticky::-webkit-scrollbar {
    height: 8px;
}

.table-responsive-sticky::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive-sticky::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-responsive-sticky::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.table-sticky-columns {
    position: relative;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-sticky-columns thead th,
.table-sticky-columns tbody td {
    position: relative;
    background-color: #fff;
    white-space: nowrap;
}

.table-sticky-columns thead th {
    background-color: #e9ecef;
    position: sticky;
    top: 0;
    z-index: 12;
}

/* Cột 1: Checkbox - Cố định bên trái */
.table-sticky-columns thead th:nth-child(1),
.table-sticky-columns tbody td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 11;
    background-color: #e9ecef;
    min-width: 50px;
    width: 50px;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.table-sticky-columns tbody td:nth-child(1) {
    background-color: #fff;
    z-index: 10;
}

.table-sticky-columns tbody tr:hover td:nth-child(1) {
    background-color: #e9ecef !important;
}

/* Cột 2: Username - Cố định bên trái */
.table-sticky-columns thead th:nth-child(2),
.table-sticky-columns tbody td:nth-child(2) {
    position: sticky;
    left: 50px;
    z-index: 11;
    background-color: #e9ecef;
    min-width: 120px;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.table-sticky-columns tbody td:nth-child(2) {
    background-color: #fff;
    z-index: 10;
}

.table-sticky-columns tbody tr:hover td:nth-child(2) {
    background-color: #e9ecef !important;
}

/* Cột 3: Họ tên - Cố định bên trái (cột cuối cùng được cố định) */
.table-sticky-columns thead th:nth-child(3),
.table-sticky-columns tbody td:nth-child(3) {
    position: sticky;
    left: 170px;
    z-index: 11;
    background-color: #e9ecef;
    min-width: 150px;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.table-sticky-columns tbody td:nth-child(3) {
    background-color: #fff;
    z-index: 10;
}

.table-sticky-columns tbody tr:hover td:nth-child(3) {
    background-color: #e9ecef !important;
}


/* Hover effect cho các dòng */
.table-sticky-columns tbody tr:hover td {
    background-color: #e9ecef;
}

/* Đảm bảo các cột sticky giữ màu nền khi hover */
.table-sticky-columns tbody tr:hover td[style*="position: sticky"],
.table-sticky-columns tbody tr:hover td:first-child,
.table-sticky-columns tbody tr:hover td:nth-child(2),
.table-sticky-columns tbody tr:hover td:nth-child(3),
.table-sticky-columns tbody tr:hover td:last-child {
    background-color: #e9ecef !important;
}

/* ========= PROXY MODAL TABS ========= */
.modal-body .nav-tabs {
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 1.5rem;
}

.modal-body .nav-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background: transparent;
}

.modal-body .nav-tabs .nav-link:hover {
    color: var(--role-primary);
    border-bottom-color: rgba(47, 93, 245, 0.3);
    background: rgba(47, 93, 245, 0.05);
}

.modal-body .nav-tabs .nav-link.active {
    color: var(--role-primary);
    border-bottom-color: var(--role-primary);
    background: transparent;
    font-weight: 600;
}

.modal-body .tab-pane {
    display: none;
}

.modal-body .tab-pane.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chart Section Styles */
.decision-chart-section {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.chart-container {
    min-height: 300px;
}

.chart-legend {
    padding: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.chart-legend::-webkit-scrollbar {
    width: 6px;
}

.chart-legend::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.chart-legend::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chart-legend::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.legend-item:hover {
    background-color: #f8f9fa;
}

.legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
    font-weight: 500;
    color: #1a293b;
}

.legend-value {
    font-weight: 600;
    color: #64748b;
    font-size: 0.9rem;
}

/* Compact Legend Styles */
.legend-item-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.375rem;
    margin-bottom: 0.4rem;
    transition: background-color 0.2s ease;
}

.legend-item-compact:hover {
    background-color: #f8f9fa;
}

.legend-label-compact {
    flex: 1;
    font-weight: 500;
    color: #334155;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.legend-value-compact {
    font-weight: 600;
    color: #475569;
    font-size: 0.8125rem;
    min-width: 50px;
    text-align: right;
}

.legend-count {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Decision Item Legend Styles */
.legend-decision-item {
    padding: 0.75rem;
    margin-bottom: 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fafbfc;
    transition: all 0.2s ease;
}

.legend-decision-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.legend-decision-item:last-child {
    margin-bottom: 0;
}

.legend-decision-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.8125rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.legend-decision-desc {
    font-size: 0.6875rem;
    color: #64748b;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.legend-decision-stats {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.legend-stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.legend-stat-row .legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-stat-row .legend-label-compact {
    flex: 1;
    font-size: 0.75rem;
    color: #475569;
}

.legend-stat-row .legend-value-compact {
    font-size: 0.75rem;
    min-width: 45px;
    color: #334155;
}

.legend-stat-row .legend-count {
    font-size: 0.6875rem;
    color: #94a3b8;
}

/* Decision Tabs Styles */
.decision-tabs-section {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-top: 1.5rem;
}

.decision-tabs {
    border-bottom: 2px solid #e2e8f0;
    padding: 0;
    margin: 0;
    background: #f8fafc;
}

.decision-tabs .nav-item {
    margin-bottom: -2px;
}

.decision-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.875rem 1.25rem;
    color: #64748b;
    font-weight: 500;
    font-size: 0.875rem;
    background: transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.decision-tabs .nav-link:hover {
    color: var(--role-primary, #2f5df5);
    background: rgba(47, 93, 245, 0.05);
    border-bottom-color: rgba(47, 93, 245, 0.3);
}

.decision-tabs .nav-link.active {
    color: var(--role-primary, #2f5df5);
    background: #fff;
    border-bottom-color: var(--role-primary, #2f5df5);
    font-weight: 600;
}

.decision-tab-content {
    padding: 1.5rem;
    background: #fff;
    min-height: 200px;
}

.decision-tab-content .tab-pane {
    display: none;
}

.decision-tab-content .tab-pane.show {
    display: block;
    animation: fadeIn 0.3s ease;
}
.cd-name {
    min-width: 200px !important;
    font-weight: bold;
}
.shares-number-input {
    max-width: 150px;
}
.modal-body .list-unstyled li {
    background: #ffffff;
    border: #e2e8f0 1px solid;
    padding:5px;
    margin:2px;
    border-radius:5px;
}
table.has-border th:first-child,
table.has-border td:first-child {
    width: 50px !important; /* hoặc % tuỳ kích thước muốn */
    text-align: center;
    white-space: nowrap;
}
table.has-border th:nth-child(1),
table.has-border td:nth-child(1) {
  font-weight:bold;
}

table.has-border th:nth-child(2),
table.has-border td:nth-child(2) {
    text-align: center;
    font-weight: bold;
}

table.has-border th:nth-child(3),
table.has-border td:nth-child(3) {
    text-align: center;
    font-weight: bold;
}

table.has-border th:nth-child(4),
table.has-border td:nth-child(4) {
    text-align: center;
    font-weight: bold;
}

table.has-border th:nth-child(5),
table.has-border td:nth-child(5) {
    text-align: center;
    font-weight: bold;
}
.vote-status
{
    min-width:160px;
 }