:root {
    /* Color Palette - Premium Emerald & Gold */
    --primary: #047857;
    /* Emerald 700 */
    --primary-light: #10B981;
    /* Emerald 500 */
    --primary-dark: #064E3B;
    /* Emerald 900 */
    --accent: #D97706;
    /* Amber 600 (Gold-ish) */
    --accent-light: #FBBF24;
    /* Amber 400 */
    --bg-body: #F3F4F6;
    /* Cool Gray 100 */
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --text-main: #111827;
    /* Gray 900 */
    --text-muted: #6B7280;
    /* Gray 500 */
    --border: rgba(229, 231, 235, 0.8);

    /* Spacing & Radius */
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    background-image:
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(217, 119, 6, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 1.875rem;
    color: var(--primary-dark);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

p {
    color: var(--text-muted);
    line-height: 1.5;
}

.text-sm {
    font-size: 0.875rem;
}

.text-gold {
    color: var(--accent);
}

/* Layout */
#mainApp {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.75)), url('sidebar_pattern_1769117522960.png');
    background-size: 300px;
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 10;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    text-align: center;
}

.brand-logo {
    width: 140px;
    height: auto;
    border-radius: var(--radius-md);
    mix-blend-mode: multiply;
}

.brand span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    max-width: 1600px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-accent {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent);
}

.btn-accent:hover {
    background: rgba(251, 191, 36, 0.25);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.icon-blue {
    background: #E0F2FE;
    color: #0284C7;
}

.icon-green {
    background: #D1FAE5;
    color: #059669;
}

.icon-gold {
    background: #FEF3C7;
    color: #D97706;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
}

th {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.875rem;
}

tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active {
    background: #D1FAE5;
    color: #065F46;
}

.badge-inactive {
    background: #F3F4F6;
    color: #374151;
}

.badge-pending {
    background: #FEF3C7;
    color: #92400E;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-main);
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #F9FAFB;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    background: white;
}

.hidden {
    display: none !important;
}

/* Dependent Logic Style */
.dependents-list {
    background: #F9FAFB;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

/* Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.w-full {
    width: 100%;
}

.mt-auto {
    margin-top: auto;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.p-4 {
    padding: 1rem;
}

.border-t {
    border-top: 1px solid var(--border);
}

/* Component: Mirror Banner */
.mirror-banner {
    background: var(--accent);
    color: white;
    padding: 0.75rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.mirror-banner .btn {
    background: white;
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* Component: Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.logout-btn {
    width: 100%;
    padding: 0.75rem;
    background: #FEE2E2;
    color: #B91C1C;
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #FECACA;
    transform: translateY(-1px);
}

.role-select {
    background: transparent;
    border: none;
    color: inherit;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.875rem;
    width: 100%;
}

/* Component: Header */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Specific Buttons */
.btn-secondary {
    background: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-danger {
    background: white;
    border: 1px solid var(--border);
    color: #EF4444;
}

.btn-danger:hover {
    background: #FEF2F2;
}

/* Form Sections */
.form-section {
    margin: 1.5rem 0;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.form-box {
    background: var(--bg-body);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Progress Bar */
.progress-container {
    height: 12px;
    background: #E5E7EB;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    transition: width 0.5s ease;
}

.progress-green {
    background: linear-gradient(90deg, #059669, #10B981);
}

.progress-blue {
    background: #3B82F6;
}

/* Opt-In Box */
.opt-in-box {
    background: #ECFDF5;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid #10B981;
}

.opt-in-box label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.opt-in-box input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 0.25rem;
}

/* JS Dynamic Utilities */
.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

/* Role Management Board (Kanban) */
.role-board {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    overflow-x: auto;
    height: calc(100vh - 280px);
    min-height: 400px;
    align-items: stretch;
}

.role-column {
    flex: 1;
    min-width: 180px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.role-column.drag-over {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--primary);
}

.role-column-header {
    padding: 1.25rem;
    background: white;
    border-bottom: 2px solid var(--primary-light);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.role-column-count {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: bold;
}

.role-cards-container {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    min-height: 0;
}

.role-item-card {
    background: white;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: grab;
    border: 1px solid transparent;
    transition: var(--transition);
}

.role-item-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.role-item-card.dragging {
    opacity: 0.5;
}

.role-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.role-item-id {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mt-8 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.ml-1 {
    margin-left: 0.25rem;
}

.mr-1 {
    margin-right: 0.25rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-bold {
    font-weight: 700;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-wide {
    letter-spacing: 0.05em;
}

.inline-block {
    display: inline-block;
}

.text-primary {
    color: var(--primary);
}

/* Dynamic Components */
.salah-time {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-danger-soft {
    background: #FEE2E2;
    color: #B91C1C;
}

.btn-danger-soft:hover {
    background: #FECACA;
}

.text-danger {
    color: #B91C1C;
}

.text-success {
    color: #059669;
}


/* Report Rows with Leaders */
.report-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.report-row .label {
    padding-right: 0.5rem;
    color: var(--text-muted);
}

.report-row .leader {
    flex: 1;
    border-bottom: 1px dotted #D1D5DB;
    margin: 0 0.5rem;
    opacity: 0.5;
    position: relative;
    top: -4px;
}

.report-row .value {
    padding-left: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.report-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.25rem;
    margin-bottom: 0.75rem;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    /* Sidebar Slide-in Logic */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        z-index: 100;
        width: 260px;
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* Overlay when menu is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Main Content Adjustments */
    .main-content {
        padding: 1rem;
        width: 100%;
    }

    /* Stack Grids */
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .card-grid {
        grid-template-columns: 1fr !important;
    }

    /* Header Adjustments */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    header>div {
        width: 100%;
        justify-content: space-between;
    }

    .header-controls {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    /* Show Hamburger */
    .mobile-menu-btn {
        display: block !important;
    }
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.5rem;
}

/* --- Donation Feature Styles --- */
.btn-gold {
    background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%);
    color: #333 !important;
    font-weight: 700;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #E6C200;
}

.btn-gold:hover {
    background: linear-gradient(135deg, #FDB931 0%, #e6a800 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.modal-donation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-donation-content {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
}