/* ============================================================
   Congre – Premium Church Management · Main Stylesheet
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Custom Properties ─────────────────────────────────────── */
:root {
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --sidebar-bg: #0b1629;
    --sidebar-text: rgba(255,255,255,0.65);
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(37,99,235,0.14);
    --sidebar-active: rgba(37,99,235,0.22);
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --radius: 0.75rem;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

/* ── Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: #1e293b;
    background: #f1f5f9;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 40;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-logo-mark {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-weight: 700;
    font-size: 1.125rem;
    color: #fff;
    letter-spacing: -0.025em;
}

.sidebar-logo-sub {
    font-size: 0.625rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    line-height: 1;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
    padding: 0.75rem 0.75rem 0.25rem;
    margin-top: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    margin-bottom: 1px;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active svg { opacity: 1; }

/* nav group toggle button (shares base style with .nav-item) */
.nav-item-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--sidebar-text);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    margin-bottom: 1px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    justify-content: space-between;
}
.nav-item-btn:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

/* active state – used as a class (not just .nav-item.active combinator) */
.nav-item-active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    box-shadow: inset 3px 0 0 #3b82f6;
}

/* nav icon (the SVG inside every nav item) */
.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.75;
}
.nav-item-active .nav-icon,
.nav-item-btn.nav-item-active .nav-icon,
.nav-item:hover .nav-icon,
.nav-item-btn:hover .nav-icon { opacity: 1; }

/* chevron arrow for expandable groups */
.nav-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
    flex-shrink: 0;
    opacity: 0.5;
}

/* sub-menu container */
.nav-sub {
    overflow: hidden;
}

/* sub-menu items */
.nav-sub-item {
    display: block;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    color: rgba(255,255,255,0.55);
    font-size: 0.78125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav-sub-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.nav-sub-active {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 1rem 1.25rem;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.5);
}

.sidebar-logout {
    margin-left: auto;
    color: rgba(255,255,255,0.4);
    transition: color 0.15s;
    flex-shrink: 0;
    text-decoration: none;
}

.sidebar-logout:hover { color: #fff; }

/* ── Main Content ─────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    position: relative;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.topbar-btn:hover { background: #e2e8f0; color: #1e293b; }

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    border-radius: 50%;
    font-size: 0.5625rem;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    color: #64748b;
}

/* ── Page Content ─────────────────────────────────────────────── */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.card-hover {
    transition: box-shadow 0.2s, transform 0.2s;
}

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

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

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
}

.card-body {
    padding: 1.25rem;
}

/* ── Stat Cards ───────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

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

.stat-icon-indigo  { background: #eff6ff; color: var(--primary); }
.stat-icon-green   { background: #d1fae5; color: var(--success); }
.stat-icon-amber   { background: #fef3c7; color: var(--warning); }
.stat-icon-red     { background: #fee2e2; color: var(--danger); }
.stat-icon-blue    { background: #dbeafe; color: var(--info); }
.stat-icon-purple  { background: #f3e8ff; color: #9333ea; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-label {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.stat-trend {
    font-size: 0.6875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-trend-up   { color: var(--success); }
.stat-trend-down { color: var(--danger); }

.stat-sub {
    font-size: 0.6875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* ── Mini Stat Cards (dashboard secondary row) ────────────────── */
.mini-stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
}
.mini-stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.mini-stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}
.mini-stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 0.125rem;
}

/* ── Event Date Badge ─────────────────────────────────────────── */
.event-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    background: #eff6ff;
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
}
.event-date-day {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.event-date-mon {
    font-size: 0.5625rem;
    font-weight: 600;
    color: #1D4ED8;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ── Event Type Badge ─────────────────────────────────────────── */
.event-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}
.event-type-culto, .event-type-culto         { background: #dbeafe; color: #1e40af; }
.event-type-reunion, .event-type-reuniao     { background: #f3e8ff; color: #6b21a8; }
.event-type-conference,.event-type-conferencia { background: #fef3c7; color: #92400e; }
.event-type-cell, .event-type-celula         { background: #d1fae5; color: #065f46; }
.event-type-kids                             { background: #fce7f3; color: #9d174d; }
.event-type-other, .event-type-outro         { background: #f1f5f9; color: #475569; }

/* ── Calendar Event Chips ─────────────────────────────────────── */
.event-chip {
    display: block;
    border: none;
    cursor: pointer;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s;
}
.event-chip:hover { opacity: 0.75; }
.event-chip-culto                              { background: #dbeafe; color: #1e40af; }
.event-chip-reunion, .event-chip-reuniao       { background: #f3e8ff; color: #6b21a8; }
.event-chip-conference, .event-chip-conferencia{ background: #fef3c7; color: #92400e; }
.event-chip-cell, .event-chip-celula           { background: #d1fae5; color: #065f46; }
.event-chip-kids                               { background: #fce7f3; color: #9d174d; }
.event-chip-other, .event-chip-outro           { background: #f1f5f9; color: #475569; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    gap: 0.375rem;
    white-space: nowrap;
    line-height: 1.25;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

.btn-secondary {
    background: #f1f5f9;
    color: #374151;
    border-color: #e2e8f0;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover { background: #059669; }

.btn-warning {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}
.btn-warning:hover { background: #d97706; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; }

.btn-outline {
    background: transparent;
    border-color: #e2e8f0;
    color: #374151;
}
.btn-outline:hover { background: #f8fafc; }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: #64748b;
}
.btn-ghost:hover { background: #f1f5f9; color: #374151; }

.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.9375rem; }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 0.5rem;
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    line-height: 1.5;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder { color: #9ca3af; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-input-sm,
.form-select-sm {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: #1e293b;
    background: #fff;
    font-family: inherit;
    line-height: 1.4;
}
.form-input-sm:focus,
.form-select-sm:focus { outline: none; border-color: var(--primary); }
.form-select-sm {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.75rem;
    cursor: pointer;
}

/* icon absolutely positioned inside a .relative wrapper */
.form-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #9ca3af;
    display: flex;
    align-items: center;
}

/* ── Photo Upload Area ────────────────────────────────────────── */
.photo-upload-area {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px dashed #cbd5e1;
    cursor: pointer;
    overflow: hidden;
    background: #f8fafc;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.photo-upload-area:hover { border-color: var(--primary); }
.photo-upload-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.form-help {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

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

.form-input-prefix {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-right: 0;
    border-radius: 0.5rem 0 0 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
}

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success    { background: #d1fae5; color: #065f46; }
.badge-danger     { background: #fee2e2; color: #991b1b; }
.badge-warning    { background: #fef3c7; color: #92400e; }
.badge-info       { background: #dbeafe; color: #1e40af; }
.badge-secondary  { background: #f1f5f9; color: #475569; }
.badge-purple     { background: #f3e8ff; color: #6b21a8; }
.badge-indigo     { background: #eff6ff; color: #1D4ED8; }

/* Event type badges */
.badge-culto      { background: #dbeafe; color: #1e40af; }
.badge-reuniao    { background: #f3e8ff; color: #6b21a8; }
.badge-conferencia { background: #fef3c7; color: #92400e; }
.badge-celula     { background: #d1fae5; color: #065f46; }
.badge-kids       { background: #fce7f3; color: #9d174d; }
.badge-outro      { background: #f1f5f9; color: #475569; }

/* ── Tables ───────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead tr {
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: #f8fafc;
}

.data-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    vertical-align: middle;
}

.table-row-hover:hover td { background: #f8fafc; }

.data-table tbody tr:last-child td { border-bottom: 0; }

/* ── Avatars ──────────────────────────────────────────────────── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
}

/* ── Action Buttons ───────────────────────────────────────────── */
.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.action-btn:hover { background: #f1f5f9; color: #0f172a; }
.action-btn-danger:hover { background: #fee2e2; color: var(--danger); }

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: #f1f5f9;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: #94a3b8;
}

.empty-state-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.empty-state-text {
    font-size: 0.875rem;
    color: #9ca3af;
    max-width: 280px;
}

/* ── Flash Toast ──────────────────────────────────────────────── */
.flash-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    border-left: 3px solid;
    box-shadow: var(--shadow);
}

.flash-success { background: #f0fdf4; border-color: var(--success); color: #166534; }
.flash-error   { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.flash-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.flash-info    { background: #eff6ff; border-color: var(--info);    color: #1e40af; }

.flash-dismiss {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.5;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    color: inherit;
    flex-shrink: 0;
}
.flash-dismiss:hover { opacity: 1; }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

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

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

.modal-title {
    font-weight: 700;
    font-size: 1rem;
    color: #0f172a;
}

.modal-body { padding: 1.25rem 1.5rem; }

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
.modal-close:hover { color: #374151; }

/* ── Logo Upload Area ─────────────────────────────────────────── */
.logo-upload-area {
    width: 120px;
    height: 120px;
    border: 2px dashed #e2e8f0;
    border-radius: 1rem;
    cursor: pointer;
    overflow: hidden;
    background: #f8fafc;
    transition: border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-upload-area:hover { border-color: var(--primary); }

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    background: #fff;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.page-item:hover { background: #f1f5f9; }

.page-item.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-item.disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* ── Progress Bar ─────────────────────────────────────────────── */
.progress {
    height: 8px;
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 9999px;
    background: var(--primary);
    transition: width 0.6s ease;
}

/* ── Divider ──────────────────────────────────────────────────── */
.divider {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 1rem 0;
}

/* ── Mobile Sidebar Overlay ───────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 39;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open { display: block; }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }
}

@media (max-width: 640px) {
    .page-content { padding: 0.875rem; }
    .page-header { flex-direction: column; gap: 0.75rem; }
    .topbar { padding: 0 1rem; }
    .stat-card { padding: 1rem; gap: 0.625rem; }
    .stat-icon { width: 38px; height: 38px; border-radius: 10px; }
    .stat-icon svg { width: 18px; height: 18px; }
    .stat-value { font-size: 1.125rem; }
    .stat-label { font-size: 0.75rem; }
    .card-header { padding: 0.875rem 1rem; }
    .card-body { padding: 1rem; }
    .card-title { font-size: 0.875rem; }
    .data-table th, .data-table td { padding: 0.625rem 0.75rem; }
    .mini-stat-value { font-size: 1rem; }
}
