/* Shared module-level styles centralized from module HTML files. */

/* ========== UTILITY CLASSES ========== */

/* Display & Layout Utilities */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Spacing Utilities */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }

/* Text Utilities */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.font-500 { font-weight: 500; }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Color Utilities */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-light { color: var(--text-light); }
.bg-light { background: var(--bg-light); }
.bg-primary { background: var(--primary); }
.bg-danger { background: var(--danger); }
.bg-warning { background: var(--warning); }
.bg-success { background: var(--success); }

/* Border & Styling */
.border { border: 1px solid var(--border); }
.rounded { border-radius: 6px; }
.rounded-lg { border-radius: 8px; }
.cursor-pointer { cursor: pointer; }
.user-select-none { user-select: none; }
.inline-block { display: inline-block; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { inset: 0; }

/* ========== BUTTON SYSTEM ========== */

/* Base Button */
button {
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: none;
    font-weight: 500;
}

/* Button Sizes */
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-md {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-xl {
    padding: 0.875rem 2rem;
    font-size: 1.125rem;
}

/* Button Variants */
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
}

.btn-secondary.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: var(--shadow);
}

.btn-danger:hover {
    background: #dc2626;
    opacity: 0.9;
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: var(--shadow);
}

.btn-success:hover {
    background: #059669;
    opacity: 0.9;
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: var(--warning);
    color: white;
    box-shadow: var(--shadow);
}

.btn-warning:hover {
    background: #f59e0b;
    opacity: 0.9;
    box-shadow: var(--shadow-md);
}

.btn-info {
    background: var(--info);
    color: white;
    box-shadow: var(--shadow);
}

.btn-info:hover {
    background: #0ea5e9;
    opacity: 0.9;
    box-shadow: var(--shadow-md);
}

/* Icon Button */
.btn-icon {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Button Group */
.btn-group {
    display: inline-flex;
    gap: 0.25rem;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.2rem;
}

.btn-group .btn {
    border-radius: 6px;
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
}

.btn-group .btn:not(.active) {
    background: transparent;
    border: none;
}

/* Action Button Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.action-bar-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ========== FORM ELEMENTS ========== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    font-family: inherit;
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--text);
}

label .required,
label span[style*="color:#dc2626"] {
    color: var(--danger);
}

input[type="checkbox"] {
    cursor: pointer;
}

/* Search Input */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper input {
    padding-left: 2rem;
    width: 100%;
}

.search-input-wrapper i {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.875rem;
    pointer-events: none;
}

/* ========== FILTER & SEARCH BAR ========== */

.filter-bar {
    position: sticky;
    top: 0.5rem;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ========== BULK ACTIONS TOOLBAR ========== */

.bulk-actions {
    display: none;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.bulk-actions.show {
    display: flex;
}

.bulk-actions-count {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
}

.bulk-actions-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bulk-delete-btn {
    padding: 0.25rem 0.5rem;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}

.bulk-delete-btn:hover {
    background: #fca5a5;
}

/* ========== KANBAN BOARD ========== */

.kanban-container {
    overflow: hidden;
    margin-bottom: 1rem;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    gap: 0.75rem;
    min-width: 1060px;
    overflow-x: auto;
}

.kanban-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kanban-column-header {
    font-weight: 600;
    padding: 0.5rem;
    color: var(--text);
}

.kanban-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

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

.kanban-board [data-kanban-task-id] {
    -webkit-user-select: none;
    user-select: none;
}

.kanban-board [data-kanban-task-id][data-ui-button="true"],
.kanban-board [data-kanban-task-id].btn-standard,
.kanban-board [data-kanban-task-id].is-action-button {
    background: #ffffff !important;
    color: var(--text) !important;
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

.kanban-board [data-kanban-task-id]::selection {
    background: rgba(37, 99, 235, 0.18);
    color: #0f172a;
}

/* ========== TABLE STYLING ========== */

.table-card {
    overflow: visible;
    max-width: 100%;
}

.table-body {
    padding: 0;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.table-body::-webkit-scrollbar {
    height: 6px;
}

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

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

.table-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========== APPEALS MODULE ========== */

#appealsModule .appeal-form-main-card {
    overflow: visible;
}

#appealsModule .appeal-form-layout {
    grid-template-columns: 1fr 280px;
}

#appealsModule .appeal-two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#appealsModule .appeal-sticky-bar {
    flex-wrap: wrap;
}

#appealsModule #appealsTable {
    min-width: 980px;
}

#appealsModule .appeal-pricing-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

#appealsModule .appeal-frequency-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}

@media (max-width: 1100px) {
    #appealsModule .appeal-form-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    #appealsModule .appeal-sticky-bar {
        margin: -1.25rem -1.25rem 1rem;
        padding: 0.75rem 1.25rem;
        gap: 0.75rem;
    }

    #appealsModule .appeal-two-col,
    #appealsModule #customAmountFields {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #appealsModule .appeal-pricing-row {
        grid-template-columns: minmax(0, 1fr);
    }

    #appealsModule .appeal-frequency-row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    #appealsModule .appeal-frequency-row label[style*="justify-self: end"] {
        justify-self: start !important;
    }
}

/* Enable fixed table layout for consistent column widths */
.data-table {
    table-layout: auto;
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

table th {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
    white-space: nowrap;
}

table th:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

table th:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

table th i {
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

/* ========== TABLE COLUMN RESIZING ========== */

/* Resize handle styling */
.column-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
    padding: 0 2px;
    margin-right: -2px;
    background: transparent;
    transition: background-color 0.2s;
}

.column-resize-handle:hover {
    background-color: rgba(37, 99, 235, 0.3);
}

.column-resize-handle.action-column-handle {
    cursor: col-resize;
}

/* Table column header styles during resize */
table th {
    position: relative;
    overflow: visible;
}

table th.resizing {
    background: rgba(37, 99, 235, 0.08);
}

body.resizing-table-column {
    user-select: none;
    -webkit-user-select: none;
    cursor: col-resize;
}

body.resizing-table-column * {
    cursor: col-resize !important;
}

/* ========== TABLE COLUMN WIDTH DEFAULTS ========== */

#tasksDataTable th[data-sort] {
    text-align: center;
    width: 40px;
}

/* Action column - last column in table (minimal) */
#tasksDataTable th:last-child {
    width: 60px;
    min-width: 60px;
    max-width: 70px;
    padding: 0.75rem 0.35rem;
    text-align: center;
    flex-shrink: 0;
}

#tasksDataTable td:last-child {
    width: 60px;
    min-width: 60px;
    max-width: 70px;
    padding: 0.75rem 0.35rem;
    text-align: center;
    flex-shrink: 0;
}

/* Checkbox column (non-resizable) */
#tasksDataTable th:nth-child(1),
#tasksDataTable td:nth-child(1) {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    padding: 0.75rem 0.5rem;
    flex-shrink: 0;
}

/* Task ID column (resizable) */
#tasksDataTable th:nth-child(2),
#tasksDataTable td:nth-child(2) {
    width: 80px;
    min-width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Task column (resizable, flexible) */
#tasksDataTable th:nth-child(3),
#tasksDataTable td:nth-child(3) {
    width: 180px;
    min-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Created Date column (resizable) */
#tasksDataTable th:nth-child(4),
#tasksDataTable td:nth-child(4) {
    width: 100px;
    min-width: 85px;
    white-space: nowrap;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Due Date column (resizable) */
#tasksDataTable th:nth-child(5),
#tasksDataTable td:nth-child(5) {
    width: 100px;
    min-width: 85px;
    white-space: nowrap;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status column (resizable) */
#tasksDataTable th:nth-child(6),
#tasksDataTable td:nth-child(6) {
    width: 90px;
    min-width: 75px;
    text-align: center;
}

/* Priority column (resizable) */
#tasksDataTable th:nth-child(7),
#tasksDataTable td:nth-child(7) {
    width: 80px;
    min-width: 70px;
    text-align: center;
}

/* Assigned To column (resizable, flexible) */
#tasksDataTable th:nth-child(8),
#tasksDataTable td:nth-child(8) {
    width: 120px;
    min-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Attachments column (resizable) */
#tasksDataTable th:nth-child(9),
#tasksDataTable td:nth-child(9) {
    width: 70px;
    min-width: 60px;
    text-align: center;
}

table input[type="checkbox"] {
    cursor: pointer;
}

.sort-icon {
    font-size: 0.75rem;
    opacity: 0.4;
    margin-left: 0.5rem;
}

/* ========== STATUS BADGES ========== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background: rgba(30, 58, 138, 0.1);
    color: var(--primary);
}

.badge-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
}

.badge-info {
    background: rgba(2, 132, 199, 0.1);
    color: var(--info);
}

/* Priority Badges */
.priority-low {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.priority-medium {
    background: rgba(217, 119, 6, 0.1);
    color: #b45309;
}

.priority-high {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

/* Status Badge */
.status-pending {
    background: rgba(217, 119, 6, 0.1);
    color: #b45309;
}

.status-in-progress {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.status-completed {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.status-cancelled {
    background: rgba(107, 114, 128, 0.1);
    color: #374151;
}

/* ========== TAG STYLING ========== */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(30, 58, 138, 0.1);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-gray {
    background: #f1f5f9;
    color: #64748b;
}

.tag-blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-light);
}

.tag-info {
    background: rgba(2, 132, 199, 0.1);
    color: var(--info);
}

/* Badge Counters */
.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
}

.badge-count-gray {
    background: #f1f5f9;
    color: #64748b;
}

.badge-count-blue {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge-count-primary {
    background: rgba(30, 58, 138, 0.1);
    color: var(--primary);
}

/* Attachment Badge */
.attachment-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.72rem;
    max-width: 180px;
    overflow: hidden;
}

.attachment-badge i {
    font-size: 0.65rem;
    flex-shrink: 0;
}

.attachment-badge span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== MODAL DIALOGS ========== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    --modal-overlay-padding: clamp(0.875rem, 2vw, 1.5rem);
    --modal-surface-padding-inline: clamp(1rem, 1.9vw, 1.5rem);
    --modal-surface-padding-block: clamp(1rem, 1.7vw, 1.25rem);
    --modal-surface-radius: 14px;
    --modal-max-height: calc(100vh - (var(--modal-overlay-padding) * 2));
    padding: var(--modal-overlay-padding);
    box-sizing: border-box;
    overflow-y: auto;
}

.modal.show {
    display: flex;
}

/* Keep shared global modal card visible inside #modalOverlay. */
#modalOverlay > .modal {
    position: relative;
    inset: auto;
    background: var(--card);
    z-index: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    max-height: min(90dvh, var(--modal-max-height));
    overflow: hidden;
    border-radius: var(--modal-surface-radius);
    box-shadow: var(--shadow-xl);
    padding: 0;
}

/* Keep module-local overlay dialogs visible (e.g. People -> Add Donor). */
.modal-overlay > .modal {
    position: relative;
    inset: auto;
    background: var(--card);
    z-index: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    max-height: min(90dvh, var(--modal-max-height));
    overflow: hidden;
    border-radius: var(--modal-surface-radius);
    box-shadow: var(--shadow-xl);
    padding: 0;
}

#modalOverlay .modal-body,
.modal-overlay > .modal .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

#modalOverlay .modal-footer,
.modal-overlay > .modal .modal-footer {
    flex-shrink: 0;
}

.modal-content {
    background: white;
    border-radius: var(--modal-surface-radius);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: min(100%, calc(100vw - (var(--modal-overlay-padding) * 2)));
    max-height: min(90vh, var(--modal-max-height));
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: var(--modal-surface-padding-block) var(--modal-surface-padding-inline);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    color: var(--text);
}

.modal-body {
    padding: var(--modal-surface-padding-block) var(--modal-surface-padding-inline);
    overflow-y: auto;
    min-height: 0;
    flex: 1;
    scrollbar-gutter: stable;
}

.modal-footer {
    padding: 1rem var(--modal-surface-padding-inline);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .modal {
        --modal-overlay-padding: 0.625rem;
        --modal-surface-padding-inline: 0.95rem;
        --modal-surface-padding-block: 0.95rem;
    }
}

/* Large Modal */
.modal-content.modal-lg {
    max-width: 900px;
}

/* Medium Modal */
.modal-content.modal-md {
    max-width: 640px;
}

/* ========== STAT CARDS ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card,
.bento-stat-card {
    --stat-accent: #2563eb;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.stat-card::before,
.bento-stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--stat-accent);
    opacity: 0.95;
    pointer-events: none;
}

.stat-card:hover,
.bento-stat-card:hover {
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.14);
    transform: translateY(-3px);
    border-color: rgba(59, 130, 246, 0.34);
}

.stat-card.primary,
.bento-stat-card.primary { --stat-accent: #2563eb; }
.stat-card.success,
.bento-stat-card.success { --stat-accent: #059669; }
.stat-card.warning,
.bento-stat-card.warning { --stat-accent: #d97706; }
.stat-card.info,
.bento-stat-card.info { --stat-accent: #0284c7; }

.stat-card.primary .stat-icon,
.bento-stat-card.primary .bento-stat-icon,
.stat-icon.blue,
.bento-stat-icon.blue { color: #1d4ed8; background: #e8f0ff; border-color: rgba(37, 99, 235, 0.16); }

.stat-card.success .stat-icon,
.bento-stat-card.success .bento-stat-icon,
.stat-icon.green,
.bento-stat-icon.green { color: #047857; background: #e6f8f1; border-color: rgba(5, 150, 105, 0.2); }

.stat-card.warning .stat-icon,
.bento-stat-card.warning .bento-stat-icon,
.stat-icon.orange,
.bento-stat-icon.orange { color: #b45309; background: #fff4e8; border-color: rgba(217, 119, 6, 0.22); }

.stat-card.danger .stat-icon,
.bento-stat-card.danger .bento-stat-icon,
.stat-icon.red,
.bento-stat-icon.red { color: #b91c1c; background: #feeceb; border-color: rgba(220, 38, 38, 0.24); }

.stat-card.purple .stat-icon,
.bento-stat-card.purple .bento-stat-icon,
.stat-icon.purple,
.bento-stat-icon.purple { color: #6d28d9; background: #f1ecff; border-color: rgba(124, 58, 237, 0.22); }

.stat-card.info .stat-icon,
.bento-stat-card.info .bento-stat-icon { color: #0369a1; background: #e8f6ff; border-color: rgba(2, 132, 199, 0.2); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.stat-value,
.bento-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.stat-label,
.bento-stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    font-weight: 600;
}

.stat-icon,
.bento-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #1d4ed8;
    background: #e8f0ff;
    border: 1px solid rgba(37, 99, 235, 0.16);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
    flex-shrink: 0;
}

.stat-card .stat-icon {
    color: #1d4ed8;
    background: #e8f0ff;
    border-color: rgba(37, 99, 235, 0.16);
}

.stat-card.primary .stat-icon,
.stat-card.success .stat-icon,
.stat-card.warning .stat-icon,
.stat-card.info .stat-icon,
.stat-card.purple .stat-icon,
.stat-card.danger .stat-icon,
.stat-card.secondary .stat-icon {
    color: #1d4ed8;
    background: #e8f0ff;
    border-color: rgba(37, 99, 235, 0.16);
}

.stat-icon.blue,
.bento-stat-icon.blue { color: #1d4ed8; background: #e8f0ff; border-color: rgba(37, 99, 235, 0.16); }
.stat-icon.green,
.bento-stat-icon.green { color: #047857; background: #e6f8f1; border-color: rgba(5, 150, 105, 0.2); }
.stat-icon.orange,
.bento-stat-icon.orange { color: #b45309; background: #fff4e8; border-color: rgba(217, 119, 6, 0.22); }
.stat-icon.red,
.bento-stat-icon.red { color: #b91c1c; background: #feeceb; border-color: rgba(220, 38, 38, 0.24); }
.stat-icon.purple,
.bento-stat-icon.purple { color: #6d28d9; background: #f1ecff; border-color: rgba(124, 58, 237, 0.22); }
.stat-icon.gray,
.bento-stat-icon.gray { color: #334155; background: #edf2f7; border-color: rgba(71, 85, 105, 0.2); }

body.dark .stat-card,
body.dark .bento-stat-card {
    background: linear-gradient(150deg, rgba(17, 25, 40, 0.96) 0%, rgba(11, 19, 32, 0.96) 100%);
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 18px 36px rgba(2, 6, 23, 0.34);
}

body.dark .stat-card.primary,
body.dark .stat-card.success,
body.dark .stat-card.warning,
body.dark .stat-card.info,
body.dark .stat-card.purple,
body.dark .stat-card.danger,
body.dark .stat-card.secondary {
    background: linear-gradient(150deg, rgba(17, 25, 40, 0.96) 0%, rgba(11, 19, 32, 0.96) 100%);
}

body.dark .stat-value,
body.dark .bento-stat-value {
    color: #e2e8f0;
}

body.dark .stat-icon,
body.dark .bento-stat-icon {
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.28);
}

/* Dark mode fail-safe overrides for legacy inline styles in module templates/scripts */
body.dark [style*="background: white"],
body.dark [style*="background:white"],
body.dark [style*="background: #fff"],
body.dark [style*="background:#fff"],
body.dark [style*="background: #ffffff"],
body.dark [style*="background:#ffffff"],
body.dark [style*="background: #f8f9fa"],
body.dark [style*="background:#f8f9fa"],
body.dark [style*="background: #f9fbff"],
body.dark [style*="background:#f9fbff"],
body.dark [style*="background: #eff6ff"],
body.dark [style*="background:#eff6ff"],
body.dark [style*="background: #f8fafc"],
body.dark [style*="background:#f8fafc"],
body.dark [style*="background: #f1f5f9"],
body.dark [style*="background:#f1f5f9"],
html.dark body [style*="background: white"],
html.dark body [style*="background:white"],
html.dark body [style*="background: #fff"],
html.dark body [style*="background:#fff"],
html.dark body [style*="background: #ffffff"],
html.dark body [style*="background:#ffffff"],
html.dark body [style*="background: #f8f9fa"],
html.dark body [style*="background:#f8f9fa"],
html.dark body [style*="background: #f9fbff"],
html.dark body [style*="background:#f9fbff"],
html.dark body [style*="background: #eff6ff"],
html.dark body [style*="background:#eff6ff"],
html.dark body [style*="background: #f8fafc"],
html.dark body [style*="background:#f8fafc"],
html.dark body [style*="background: #f1f5f9"],
html.dark body [style*="background:#f1f5f9"] {
    background: var(--surface-2) !important;
    color: var(--text);
    border-color: var(--border);
}

body.dark [style*="linear-gradient(180deg, #ffffff"],
body.dark [style*="linear-gradient(90deg, #eff6ff"],
body.dark [style*="linear-gradient(90deg, #ffffff"],
html.dark body [style*="linear-gradient(180deg, #ffffff"],
html.dark body [style*="linear-gradient(90deg, #eff6ff"],
html.dark body [style*="linear-gradient(90deg, #ffffff"] {
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
}

body.dark [style*="color: #1e293b"],
body.dark [style*="color:#1e293b"],
body.dark [style*="color: #0f172a"],
body.dark [style*="color:#0f172a"],
body.dark [style*="color: #334155"],
body.dark [style*="color:#334155"],
body.dark [style*="color: #64748b"],
body.dark [style*="color:#64748b"],
body.dark [style*="color: #94a3b8"],
body.dark [style*="color:#94a3b8"],
body.dark [style*="color: #212529"],
body.dark [style*="color:#212529"],
body.dark [style*="color: black"],
body.dark [style*="color:black"],
html.dark body [style*="color: #1e293b"],
html.dark body [style*="color:#1e293b"],
html.dark body [style*="color: #0f172a"],
html.dark body [style*="color:#0f172a"],
html.dark body [style*="color: #334155"],
html.dark body [style*="color:#334155"],
html.dark body [style*="color: #64748b"],
html.dark body [style*="color:#64748b"],
html.dark body [style*="color: #94a3b8"],
html.dark body [style*="color:#94a3b8"],
html.dark body [style*="color: #212529"],
html.dark body [style*="color:#212529"],
html.dark body [style*="color: black"],
html.dark body [style*="color:black"] {
    color: var(--text) !important;
}

body.dark .integration-card,
body.dark .security-card,
html.dark body .integration-card,
html.dark body .security-card {
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
}

body.dark .integration-card h3,
body.dark .security-card h3,
html.dark body .integration-card h3,
html.dark body .security-card h3 {
    color: var(--text) !important;
}

body.dark .integration-card p,
body.dark .security-card p,
html.dark body .integration-card p,
html.dark body .security-card p {
    color: var(--text-light) !important;
}

body.dark .charity-objects,
html.dark body .charity-objects {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}

body.dark .widget-setup-tab:hover,
html.dark body .widget-setup-tab:hover {
    background: var(--surface-3) !important;
}

body.dark [style*="border: 1px solid #e2e8f0"],
body.dark [style*="border:1px solid #e2e8f0"],
body.dark [style*="border: 1px solid #d1d5db"],
body.dark [style*="border:1px solid #d1d5db"],
body.dark [style*="border: 1px solid #cbd5e1"],
body.dark [style*="border:1px solid #cbd5e1"],
body.dark [style*="border: 1px solid #dee2e6"],
body.dark [style*="border:1px solid #dee2e6"],
body.dark [style*="border-bottom: 1px solid #f1f5f9"],
body.dark [style*="border-bottom:1px solid #f1f5f9"],
html.dark body [style*="border: 1px solid #e2e8f0"],
html.dark body [style*="border:1px solid #e2e8f0"],
html.dark body [style*="border: 1px solid #d1d5db"],
html.dark body [style*="border:1px solid #d1d5db"],
html.dark body [style*="border: 1px solid #cbd5e1"],
html.dark body [style*="border:1px solid #cbd5e1"],
html.dark body [style*="border: 1px solid #dee2e6"],
html.dark body [style*="border:1px solid #dee2e6"],
html.dark body [style*="border-bottom: 1px solid #f1f5f9"],
html.dark body [style*="border-bottom:1px solid #f1f5f9"] {
    border-color: var(--border) !important;
}

body.dark .badge.bg-light,
html.dark body .badge.bg-light {
    background: var(--surface-3) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark .badge-dark,
html.dark body .badge-dark,
body.dark .badge-light,
html.dark body .badge-light {
    background: var(--surface-3) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark .text-dark,
html.dark body .text-dark {
    color: var(--text) !important;
}

body.dark .table-light,
html.dark body .table-light {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}

/* Strong module-level dark mode normalization for legacy module styles */
body.dark .module-section [class*="card"],
body.dark .module-section [class*="panel"],
body.dark .module-section [class*="sheet"],
body.dark .module-section [class*="drawer"],
body.dark .module-section [class*="modal"],
body.dark .module-section [class*="table-wrap"],
body.dark .module-section [class*="content-box"],
body.dark .module-section [class*="detail-box"],
html.dark body .module-section [class*="card"],
html.dark body .module-section [class*="panel"],
html.dark body .module-section [class*="sheet"],
html.dark body .module-section [class*="drawer"],
html.dark body .module-section [class*="modal"],
html.dark body .module-section [class*="table-wrap"],
html.dark body .module-section [class*="content-box"],
html.dark body .module-section [class*="detail-box"] {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

body.dark .module-section table,
body.dark .module-section thead,
body.dark .module-section tbody,
body.dark .module-section tr,
body.dark .module-section th,
body.dark .module-section td,
html.dark body .module-section table,
html.dark body .module-section thead,
html.dark body .module-section tbody,
html.dark body .module-section tr,
html.dark body .module-section th,
html.dark body .module-section td {
    border-color: var(--border);
    color: var(--text);
}

body.dark .module-section thead th,
html.dark body .module-section thead th {
    background: var(--surface-3);
    color: var(--text-light);
}

body.dark .module-section input,
body.dark .module-section select,
body.dark .module-section textarea,
html.dark body .module-section input,
html.dark body .module-section select,
html.dark body .module-section textarea {
    background: var(--surface-1);
    color: var(--text);
    border-color: var(--border);
}

body.dark .module-section .btn-secondary,
html.dark body .module-section .btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

/* Focused dark mode treatment for modules with dense legacy light styles */
body.dark #donations .invoice-lines-wrap,
body.dark #donations .invoice-lines-table,
body.dark #donations .invoice-lines-table thead,
body.dark #donations .invoice-lines-table tbody tr:hover,
body.dark #donations .field-wrapper,
body.dark #donations .invoice-add-row button,
body.dark #donations .receipt-sheet,
body.dark #donations [id*="Dropdown"],
body.dark #donations [id*="Picker"],
body.dark #donations [id*="Modal"] > div,
html.dark body #donations .invoice-lines-wrap,
html.dark body #donations .invoice-lines-table,
html.dark body #donations .invoice-lines-table thead,
html.dark body #donations .invoice-lines-table tbody tr:hover,
html.dark body #donations .field-wrapper,
html.dark body #donations .invoice-add-row button,
html.dark body #donations .receipt-sheet,
html.dark body #donations [id*="Dropdown"],
html.dark body #donations [id*="Picker"],
html.dark body #donations [id*="Modal"] > div {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #donations .invoice-lines-table th,
body.dark #donations .line-num,
body.dark #donations .line-dash,
body.dark #donations .receipt-subtitle,
html.dark body #donations .invoice-lines-table th,
html.dark body #donations .line-num,
html.dark body #donations .line-dash,
html.dark body #donations .receipt-subtitle {
    color: var(--text-light) !important;
}

body.dark #donations .inv-input,
body.dark #donations .inv-select,
body.dark #donations .field-wrapper input,
body.dark #donations .field-wrapper select,
html.dark body #donations .inv-input,
html.dark body #donations .inv-select,
html.dark body #donations .field-wrapper input,
html.dark body #donations .field-wrapper select {
    background: var(--surface-1) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #pledges .pledge-stat-card,
body.dark #pledges .pledge-table-wrap,
body.dark #pledges .pledge-table thead,
body.dark #pledges .pledge-table tbody tr:hover,
body.dark #pledges .pledge-progress,
body.dark #pledges .pledge-detail-drawer,
body.dark #pledges .modal-box,
body.dark #pledges .payment-history-item,
body.dark #pledges .installment-table th,
html.dark body #pledges .pledge-stat-card,
html.dark body #pledges .pledge-table-wrap,
html.dark body #pledges .pledge-table thead,
html.dark body #pledges .pledge-table tbody tr:hover,
html.dark body #pledges .pledge-progress,
html.dark body #pledges .pledge-detail-drawer,
html.dark body #pledges .modal-box,
html.dark body #pledges .payment-history-item,
html.dark body #pledges .installment-table th {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #pledges .pledge-stat-card .label,
body.dark #pledges .pledge-table th,
body.dark #pledges .pledge-detail-section h4,
body.dark #pledges .pledge-detail-field .label,
body.dark #pledges .note-item .meta,
body.dark #pledges #pledgePaginationInfo,
html.dark body #pledges .pledge-stat-card .label,
html.dark body #pledges .pledge-table th,
html.dark body #pledges .pledge-detail-section h4,
html.dark body #pledges .pledge-detail-field .label,
html.dark body #pledges .note-item .meta,
html.dark body #pledges #pledgePaginationInfo {
    color: var(--text-light) !important;
}

body.dark #pledges .pledge-filters input,
body.dark #pledges .pledge-filters select,
body.dark #pledges .form-group input,
body.dark #pledges .form-group select,
body.dark #pledges .form-group textarea,
html.dark body #pledges .pledge-filters input,
html.dark body #pledges .pledge-filters select,
html.dark body #pledges .form-group input,
html.dark body #pledges .form-group select,
html.dark body #pledges .form-group textarea {
    background: var(--surface-1) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #profile .profile-card,
body.dark #profile .card-body-modern,
body.dark #profile .profile-actions,
body.dark #profile .trustee-sync-box,
body.dark #profile .other-trusteeships-list,
html.dark body #profile .profile-card,
html.dark body #profile .card-body-modern,
html.dark body #profile .profile-actions,
html.dark body #profile .trustee-sync-box,
html.dark body #profile .other-trusteeships-list {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #profile .card-header-modern h3,
body.dark #profile .profile-title-section h1,
body.dark #profile .profile-job-title,
body.dark #profile .profile-meta,
html.dark body #profile .card-header-modern h3,
html.dark body #profile .profile-title-section h1,
html.dark body #profile .profile-job-title,
html.dark body #profile .profile-meta {
    color: var(--text) !important;
}

body.dark #profile .card-header-modern p,
body.dark #profile .input-hint,
body.dark #profile .profile-meta span,
html.dark body #profile .card-header-modern p,
html.dark body #profile .input-hint,
html.dark body #profile .profile-meta span {
    color: var(--text-light) !important;
}

body.dark #profile .input-modern,
body.dark #profile .textarea-modern,
html.dark body #profile .input-modern,
html.dark body #profile .textarea-modern {
    background: var(--surface-1) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #settings .settings-container,
body.dark #settings .settings-content,
body.dark #settings .settings-panel,
body.dark #settings .card,
body.dark #settings .modal-overlay > div,
body.dark #settings .integrations-grid .integration-card,
body.dark #settings .security-grid .security-card,
html.dark body #settings .settings-container,
html.dark body #settings .settings-content,
html.dark body #settings .settings-panel,
html.dark body #settings .card,
html.dark body #settings .modal-overlay > div,
html.dark body #settings .integrations-grid .integration-card,
html.dark body #settings .security-grid .security-card {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #settings .tab-btn,
body.dark #settings .settings-tabs,
html.dark body #settings .tab-btn,
html.dark body #settings .settings-tabs {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #settings .tab-btn.active,
html.dark body #settings .tab-btn.active {
    background: var(--surface-3) !important;
    color: var(--text) !important;
}

body.dark #settings .form-input,
body.dark #settings .form-textarea,
body.dark #settings input,
body.dark #settings select,
body.dark #settings textarea,
html.dark body #settings .form-input,
html.dark body #settings .form-textarea,
html.dark body #settings input,
html.dark body #settings select,
html.dark body #settings textarea {
    background: var(--surface-1) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark #donations h1,
body.dark #donations h2,
body.dark #donations h3,
body.dark #donations h4,
body.dark #donations h5,
body.dark #donations h6,
body.dark #donations p,
body.dark #donations span,
body.dark #donations label,
body.dark #pledges h1,
body.dark #pledges h2,
body.dark #pledges h3,
body.dark #pledges h4,
body.dark #pledges h5,
body.dark #pledges h6,
body.dark #pledges p,
body.dark #pledges span,
body.dark #pledges label,
body.dark #profile h1,
body.dark #profile h2,
body.dark #profile h3,
body.dark #profile h4,
body.dark #profile h5,
body.dark #profile h6,
body.dark #profile p,
body.dark #profile span,
body.dark #profile label,
body.dark #settings h1,
body.dark #settings h2,
body.dark #settings h3,
body.dark #settings h4,
body.dark #settings h5,
body.dark #settings h6,
body.dark #settings p,
body.dark #settings span,
body.dark #settings label,
html.dark body #donations h1,
html.dark body #donations h2,
html.dark body #donations h3,
html.dark body #donations h4,
html.dark body #donations h5,
html.dark body #donations h6,
html.dark body #donations p,
html.dark body #donations span,
html.dark body #donations label,
html.dark body #pledges h1,
html.dark body #pledges h2,
html.dark body #pledges h3,
html.dark body #pledges h4,
html.dark body #pledges h5,
html.dark body #pledges h6,
html.dark body #pledges p,
html.dark body #pledges span,
html.dark body #pledges label,
html.dark body #profile h1,
html.dark body #profile h2,
html.dark body #profile h3,
html.dark body #profile h4,
html.dark body #profile h5,
html.dark body #profile h6,
html.dark body #profile p,
html.dark body #profile span,
html.dark body #profile label,
html.dark body #settings h1,
html.dark body #settings h2,
html.dark body #settings h3,
html.dark body #settings h4,
html.dark body #settings h5,
html.dark body #settings h6,
html.dark body #settings p,
html.dark body #settings span,
html.dark body #settings label {
    color: var(--text);
}

body.dark #donations .text-muted,
body.dark #donations .input-hint,
body.dark #pledges .text-muted,
body.dark #profile .text-muted,
body.dark #profile .input-hint,
body.dark #settings .text-muted,
body.dark #settings .input-hint,
html.dark body #donations .text-muted,
html.dark body #donations .input-hint,
html.dark body #pledges .text-muted,
html.dark body #profile .text-muted,
html.dark body #profile .input-hint,
html.dark body #settings .text-muted,
html.dark body #settings .input-hint {
    color: var(--text-light) !important;
}

body.dark select[style*="background: white"],
body.dark select[style*="background:white"],
body.dark select[style*="background: #fff"],
body.dark select[style*="background:#fff"],
body.dark input[style*="background: white"],
body.dark input[style*="background:white"],
body.dark input[style*="background: #fff"],
body.dark input[style*="background:#fff"],
body.dark textarea[style*="background: white"],
body.dark textarea[style*="background:white"],
body.dark textarea[style*="background: #fff"],
body.dark textarea[style*="background:#fff"],
html.dark body select[style*="background: white"],
html.dark body select[style*="background:white"],
html.dark body select[style*="background: #fff"],
html.dark body select[style*="background:#fff"],
html.dark body input[style*="background: white"],
html.dark body input[style*="background:white"],
html.dark body input[style*="background: #fff"],
html.dark body input[style*="background:#fff"],
html.dark body textarea[style*="background: white"],
html.dark body textarea[style*="background:white"],
html.dark body textarea[style*="background: #fff"],
html.dark body textarea[style*="background:#fff"] {
    background: var(--surface-1) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* ========== HELPER UTILITIES ========== */

.help-text {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.35rem;
}

.error-text {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

.error-text i {
    margin-right: 0.25rem;
}

.hidden { display: none !important; }
.visible { display: block !important; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* Tasks module table sorting states */
#tasksDataTable th[onclick*="sortTasks"] {
    transition: background-color 0.2s;
}

#tasksDataTable th[onclick*="sortTasks"]:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

#tasksDataTable th[onclick*="sortTasks"] i {
    margin-left: 0.5rem;
    font-size: 0.875rem;
}

/* Tasks confirmation modal animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* Meetings module */
.meeting-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.meeting-tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 8px;
}

.meeting-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.5);
}

.meeting-tab.active {
    background: white;
    box-shadow: var(--shadow);
    color: var(--primary);
}

.meeting-detail-tab {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.9rem;
}

.meeting-detail-tab:hover {
    color: var(--text);
}

.meeting-detail-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.meeting-item:hover {
    background: var(--bg-light);
    border-left: 3px solid var(--primary);
    padding-left: calc(1.25rem - 3px) !important;
}

.agenda-item {
    transition: all 0.2s;
}

.agenda-item:hover {
    background: var(--primary-light);
}

.cmw-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.cmw-step-dot.active {
    background: var(--primary);
    color: #fff;
}

.cmw-step-dot.completed {
    background: var(--success);
    color: #fff;
}

.meeting-action-menu-wrap {
    position: relative;
    display: inline-block;
}

.meeting-action-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    min-width: 160px;
    z-index: 100;
    display: none;
}

.meeting-action-dropdown.show {
    display: block;
}

.meeting-action-dropdown button {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meeting-action-dropdown button:hover {
    background: var(--bg-light);
}

.meeting-empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-light);
}

.meeting-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

@media (max-width: 768px) {
    .meeting-tab {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    .meeting-detail-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* ========== GLOBAL ACTION BUTTON NORMALIZATION ========== */

.module-section [data-ui-button="true"],
.module-section [data-ui-button="true"]:visited {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    min-height: 34px !important;
    padding: 0.5rem 0.85rem !important;
    border: 1px solid var(--border) !important;
    border-radius: 9px !important;
    font-family: inherit !important;
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease !important;
}

.module-section [data-ui-button="true"]:focus-visible {
    outline: 2px solid var(--primary-light) !important;
    outline-offset: 2px !important;
}

.module-section [data-ui-button="true"]:disabled {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
}

body.dark .module-section .btn:disabled,
html.dark body .module-section .btn:disabled {
    opacity: 1 !important;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
    background: var(--surface-2) !important;
    color: var(--text-light) !important;
    border-color: var(--border) !important;
}

body.dark .module-section .btn-primary:disabled,
html.dark body .module-section .btn-primary:disabled {
    background: color-mix(in srgb, var(--primary) 45%, var(--surface-2)) !important;
    color: #e6efff !important;
}

body.dark .module-section .btn-outline:disabled,
body.dark .module-section .btn-secondary:disabled,
html.dark body .module-section .btn-outline:disabled,
html.dark body .module-section .btn-secondary:disabled {
    background: var(--surface-2) !important;
    color: var(--text-light) !important;
}

.module-section [data-ui-button="true"][data-ui-button-variant="primary"] {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

.module-section [data-ui-button="true"][data-ui-button-variant="primary"]:hover {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}

.module-section [data-ui-button="true"][data-ui-button-variant="secondary"] {
    background: #fff !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.module-section [data-ui-button="true"][data-ui-button-variant="secondary"]:hover,
.module-section [data-ui-button="true"].active[data-ui-button-variant="secondary"],
.module-section [data-ui-button="true"][aria-pressed="true"][data-ui-button-variant="secondary"] {
    background: var(--bg-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary-light) !important;
}

.module-section [data-ui-button="true"][data-ui-button-variant="danger"] {
    background: #fff5f5 !important;
    color: var(--danger) !important;
    border-color: #fecaca !important;
}

.module-section [data-ui-button="true"][data-ui-button-variant="danger"]:hover {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
}

.module-section .is-action-button.btn-standard,
.module-section .is-action-button.btn-standard:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0.55rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.module-section .is-action-button.btn-standard:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

.module-section .is-action-button.btn-standard:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.module-section .is-action-button.btn-standard.btn-standard-primary {
    background: var(--primary);
    color: #fff;
}

.module-section .is-action-button.btn-standard.btn-standard-primary:hover {
    background: var(--primary-dark);
}

.module-section .is-action-button.btn-standard[data-button-role="primary"] {
    background: var(--primary);
    color: #fff;
}

.module-section .is-action-button.btn-standard[data-button-role="primary"]:hover {
    background: var(--primary-dark);
}

.module-section .is-action-button.btn-standard.btn-standard-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}

.module-section .is-action-button.btn-standard.btn-standard-secondary:hover {
    background: var(--bg-light);
    border-color: var(--primary-light);
}

.module-section .is-action-button.btn-standard[data-button-role="secondary"] {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}

.module-section .is-action-button.btn-standard[data-button-role="secondary"]:hover {
    background: var(--bg-light);
    border-color: var(--primary-light);
}

body.dark .module-section [data-ui-button="true"][data-ui-button-variant="secondary"],
html.dark body .module-section [data-ui-button="true"][data-ui-button-variant="secondary"] {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark .module-section [data-ui-button="true"][data-ui-button-variant="secondary"]:hover,
body.dark .module-section [data-ui-button="true"].active[data-ui-button-variant="secondary"],
body.dark .module-section [data-ui-button="true"][aria-pressed="true"][data-ui-button-variant="secondary"],
html.dark body .module-section [data-ui-button="true"][data-ui-button-variant="secondary"]:hover,
html.dark body .module-section [data-ui-button="true"].active[data-ui-button-variant="secondary"],
html.dark body .module-section [data-ui-button="true"][aria-pressed="true"][data-ui-button-variant="secondary"] {
    background: var(--surface-3) !important;
    color: var(--text) !important;
    border-color: var(--border-strong, var(--text-light)) !important;
}

body.dark .module-section .is-action-button.btn-standard.btn-standard-secondary,
body.dark .module-section .is-action-button.btn-standard[data-button-role="secondary"],
html.dark body .module-section .is-action-button.btn-standard.btn-standard-secondary,
html.dark body .module-section .is-action-button.btn-standard[data-button-role="secondary"] {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark .module-section .is-action-button.btn-standard.btn-standard-secondary:hover,
body.dark .module-section .is-action-button.btn-standard[data-button-role="secondary"]:hover,
html.dark body .module-section .is-action-button.btn-standard.btn-standard-secondary:hover,
html.dark body .module-section .is-action-button.btn-standard[data-button-role="secondary"]:hover {
    background: var(--surface-3) !important;
    color: var(--text) !important;
    border-color: var(--border-strong, var(--text-light)) !important;
}

.module-section .is-action-button.btn-standard.btn-standard-danger {
    background: var(--danger);
    color: #fff;
}

.module-section .is-action-button.btn-standard.btn-standard-danger:hover {
    background: #dc2626;
}

.module-section .is-action-button.btn-standard[data-button-role="danger"] {
    background: var(--danger);
    color: #fff;
}

.module-section .is-action-button.btn-standard[data-button-role="danger"]:hover {
    background: #dc2626;
}

/* Keep action icons visually identical across modules, even when module-local styles exist. */
.module-section .btn-action {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    border-radius: 9px !important;
    border-width: 1.5px !important;
    border-style: solid !important;
    font-size: 0.85rem !important;
    line-height: 1 !important;
}

.module-section .btn-action-view {
    background: #eaf8ff !important;
    color: #0ea5e9 !important;
    border-color: #bfe8fb !important;
}

.module-section .btn-action-edit {
    background: #edf2ff !important;
    color: #2563eb !important;
    border-color: #c9d8ff !important;
}

.module-section .btn-action-pause,
.module-section .btn-action-play {
    background: #fff6e8 !important;
    color: #f59e0b !important;
    border-color: #f7dfb3 !important;
}

.module-section .btn-action-delete {
    background: #ffeff1 !important;
    color: #ef4444 !important;
    border-color: #f5c9cf !important;
}

.module-section .btn-action-group,
.module-section .action-buttons,
.module-section .actions-cell,
.module-section .table-actions,
.module-section .action-cell,
.module-section .action-column {
    gap: 0.35rem !important;
}

/* File Management: Windows Explorer layout */
.file-explorer-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.file-explorer-shell {
    --explorer-border: #d6dbe4;
    --explorer-surface: #f6f8fc;
    --explorer-surface-2: #eef2f8;
    --explorer-text-muted: #5f6f84;
    border: 1px solid var(--explorer-border);
    border-radius: 10px;
    background: linear-gradient(180deg, #fafcff 0%, #f2f6fb 100%);
    overflow: hidden;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.file-explorer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--explorer-border);
    background: #f7f9fd;
    flex-wrap: wrap;
}

.file-explorer-nav-controls,
.file-explorer-primary-actions,
.file-row-actions,
.file-explorer-view-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.explorer-icon-btn,
.explorer-action-btn,
.sidebar-item {
    border: 1px solid transparent;
    background: transparent;
    color: #1e293b;
    border-radius: 6px;
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
}

.explorer-icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.explorer-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-color: #cfd7e3;
    background: #ffffff;
    font-weight: 600;
}

.explorer-icon-btn:hover,
.explorer-action-btn:hover,
.sidebar-item:hover {
    background: #e8edf7;
    border-color: #c8d2e2;
}

.explorer-icon-btn.active,
.sidebar-item.active {
    background: #dbe9ff;
    border-color: #acc5ef;
    color: #1d4ed8;
}

.file-explorer-path-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 320px);
    gap: 0.65rem;
    padding: 0.65rem 0.8rem;
    background: var(--explorer-surface);
    border-bottom: 1px solid var(--explorer-border);
}

.file-explorer-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--explorer-border);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    background: #fff;
    font-size: 0.82rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}

.crumb {
    overflow: hidden;
    text-overflow: ellipsis;
}

.crumb.current {
    font-weight: 700;
}

.crumb-separator {
    color: #93a2b8;
    font-size: 0.72rem;
}

.file-explorer-search {
    position: relative;
}

.file-explorer-search i {
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.78rem;
}

.file-explorer-search input {
    width: 100%;
    padding: 0.45rem 0.6rem 0.45rem 1.85rem;
    border-radius: 6px;
    border: 1px solid var(--explorer-border);
    background: #fff;
    font-size: 0.82rem;
}

.file-explorer-workspace {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: 440px;
}

.file-explorer-sidebar {
    border-right: 1px solid var(--explorer-border);
    background: var(--explorer-surface);
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sidebar-group-title {
    margin: 0.35rem 0.2rem 0.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.65rem;
    color: var(--explorer-text-muted);
    font-weight: 700;
}

.sidebar-item {
    width: 100%;
    text-align: left !important;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start !important;
    gap: 0.55rem;
    font-weight: 500;
}

.sidebar-item span,
.explorer-container-item span {
    flex: 1;
    text-align: left !important;
}

.sidebar-item i {
    width: 14px;
    text-align: center;
    color: #3b82f6;
}

.file-explorer-sidebar .sidebar-item[data-source] {
    justify-content: flex-start !important;
    text-align: left !important;
    padding-left: 0.65rem;
}

.explorer-container-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 220px;
    overflow: auto;
    padding-right: 0.2rem;
}

.explorer-container-item {
    font-size: 0.78rem;
}

.explorer-container-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-year-label {
    font-size: 0.72rem;
    color: var(--explorer-text-muted);
    font-weight: 700;
    padding: 0.35rem 0.45rem 0.15rem;
}

.explorer-date-month {
    padding-left: 1.25rem;
}

.sidebar-empty {
    font-size: 0.75rem;
    color: var(--explorer-text-muted);
    padding: 0.45rem 0.35rem;
}

.file-explorer-content {
    background: #fff;
    display: flex;
    flex-direction: column;
}

.file-explorer-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--explorer-border);
    background: #fdfefe;
}

.content-title h4 {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 700;
}

.content-title span {
    font-size: 0.76rem;
    color: var(--explorer-text-muted);
}

.file-explorer-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.file-explorer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 760px;
}

.file-explorer-table thead th {
    text-align: left;
    background: var(--explorer-surface-2);
    color: #3e4b5e;
    border-bottom: 1px solid var(--explorer-border);
    border-right: 1px solid #e4e9f2;
    padding: 0.55rem 0.65rem;
    font-size: 0.76rem;
    text-transform: none;
    letter-spacing: 0;
}

.file-explorer-table thead th:last-child,
.file-explorer-table td:last-child {
    border-right: none;
}

.file-explorer-table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid #ecf0f6;
    border-right: 1px solid #f0f3f8;
    color: #1f2937;
}

.file-explorer-table tbody tr:hover {
    background: #f3f8ff;
}

.file-explorer-table tbody tr.selected-row {
    background: #d7e9ff;
}

.file-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 500;
}

.file-icon.pdf { color: #ef4444; }
.file-icon.xls { color: #16a34a; }
.file-icon.doc { color: #2563eb; }
.file-icon.folder { color: #f59e0b; }

.file-explorer-dropzone {
    border-top: 1px dashed #cfd9e8;
    background: #f8fbff;
    color: #5b6b7f;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem;
}

.file-explorer-dropzone.active-drop {
    background: #eaf3ff;
    color: #1d4ed8;
}

.file-explorer-statusbar {
    border-top: 1px solid var(--explorer-border);
    padding: 0.42rem 0.75rem;
    background: #edf2fb;
    color: #4b5b70;
    font-size: 0.74rem;
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
}

@media (max-width: 980px) {
    .file-explorer-path-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .file-explorer-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .file-explorer-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--explorer-border);
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem;
    }

    .sidebar-group-title {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .file-explorer-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-explorer-primary-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .explorer-action-btn {
        white-space: nowrap;
    }
}

body.dark .file-explorer-shell,
html.dark body .file-explorer-shell {
    --explorer-border: var(--border);
    --explorer-surface: var(--surface-2);
    --explorer-surface-2: var(--surface-3);
    --explorer-text-muted: var(--text-light);
    background: var(--surface-2);
}

body.dark .file-explorer-content,
body.dark .file-explorer-breadcrumb,
body.dark .file-explorer-search input,
body.dark .explorer-action-btn,
html.dark body .file-explorer-content,
html.dark body .file-explorer-breadcrumb,
html.dark body .file-explorer-search input,
html.dark body .explorer-action-btn {
    background: var(--surface-1);
    color: var(--text);
    border-color: var(--border);
}

body.dark .file-explorer-table thead th,
html.dark body .file-explorer-table thead th {
    background: var(--surface-3);
    color: var(--text-light);
    border-color: var(--border);
}

body.dark .file-explorer-table td,
html.dark body .file-explorer-table td {
    color: var(--text);
    border-color: var(--border);
}

body.dark .file-explorer-table tbody tr:hover,
html.dark body .file-explorer-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.14);
}
