:root {
    --primary: #1e3a8a;
    --primary-dark: #172554;
    --primary-light: #3b82f6;
    --secondary: #991b1b; /* Jyoti Associates signature maroon/crimson */
    --accent: #d97706;
    --success: #15803d;
    --danger: #b91c1c;
    --warning: #b45309;
    --info: #0284c7;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 270px;
    --header-height: 70px;
    --radius: 10px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Agency Branding */
.agency-topbar {
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    padding: 6px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.agency-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.agency-logo-img {
    height: 52px;
    max-width: 300px;
    width: auto;
    object-fit: contain;
}

.agency-meta {
    font-size: 11px;
    color: #475569;
    line-height: 1.35;
}

.agency-meta strong {
    color: var(--secondary);
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Layout Wrapper */
.app-container {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 65px);
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #1e293b;
}

.sidebar-society-card {
    padding: 18px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.society-title {
    font-size: 13px;
    font-weight: 700;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.society-reg {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.sidebar-nav {
    list-style: none;
    padding: 12px 8px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 12px 14px 6px;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-link:hover {
    background: #1e293b;
    color: #ffffff;
}

.nav-link.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(30, 58, 138, 0.4);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.9;
}

.sidebar-footer {
    padding: 14px 18px;
    background: #090d16;
    border-top: 1px solid #1e293b;
    font-size: 11.5px;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Main Content Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.page-header {
    background: #ffffff;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.page-title p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.page-content {
    padding: 24px 28px;
    flex: 1;
}

/* Cards & Widgets */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* Stat Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-info .stat-label {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 6px;
}

.stat-info .stat-sub {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 4px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.primary { background: #dbeafe; color: #1d4ed8; }
.stat-icon.success { background: #dcfce7; color: #15803d; }
.stat-icon.danger { background: #fee2e2; color: #b91c1c; }
.stat-icon.warning { background: #fef3c7; color: #b45309; }

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.table th {
    background: #f1f5f9;
    padding: 12px 14px;
    font-weight: 600;
    color: #334155;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: #1e293b;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table-condensed th, .table-condensed td {
    padding: 8px 10px;
    font-size: 12.5px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-align: center;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #64748b; color: #ffffff; }
.btn-secondary:hover { background: #475569; }
.btn-success { background: #16a34a; color: #ffffff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #ffffff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #d97706; color: #ffffff; }
.btn-warning:hover { background: #b45309; }
.btn-outline { background: transparent; border-color: #cbd5e1; color: #334155; }
.btn-outline:hover { background: #f1f5f9; color: #0f172a; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-whatsapp {
    background: #25d366;
    color: #ffffff;
}
.btn-whatsapp:hover {
    background: #1ebd59;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.form-control, .form-select {
    width: 100%;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    font-size: 13.5px;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border-radius: var(--radius);
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.2s ease-out;
}

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

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 17px;
    color: #0f172a;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Alert Flashes */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* Responsive adjustments */
@media (max-width: 992px) {
    .app-sidebar {
        width: 70px;
    }
    .sidebar-society-card, .nav-section-title, .sidebar-footer, .nav-link span {
        display: none;
    }
    .nav-link {
        justify-content: center;
        padding: 12px;
    }
}

