@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg-body: #f8f9fb;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-main: #1a1d23;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --primary: #3b5bdb;
    --primary-light: #eef2ff;
    --primary-hover: #364fc7;
    --accent-green: #059669;
    --accent-amber: #b45309;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 12px 32px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
    --shadow-modal: 0 25px 60px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-width: 270px;
    --focus-ring: 0 0 0 3px rgba(59, 91, 219, 0.3);
}
[data-theme="dark"] {
    --bg-body: #0f1117; --bg-card: #1a1d28; --bg-sidebar: #1a1d28;
    --text-main: #f1f3f5; --text-secondary: #adb5bd; --text-muted: #6c757d;
    --border: #2d3140; --border-light: #252836;
    --primary: #5c7cfa; --primary-light: #1c2340; --primary-hover: #748ffc;
    --shadow-card-hover: 0 12px 32px rgba(0,0,0,0.3);
    --shadow-modal: 0 25px 60px rgba(0,0,0,0.4);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', -apple-system, sans-serif; background: var(--bg-body); color: var(--text-main); min-height: 100vh; transition: background 0.3s, color 0.3s; }

/* Accessibility */
.skip-link { position: absolute; top: -100px; left: 16px; background: var(--primary); color: #fff; padding: 12px 24px; border-radius: var(--radius-sm); font-weight: 700; z-index: 10000; text-decoration: none; transition: top 0.2s; }
.skip-link:focus { top: 16px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===== HEADER ===== */
.site-header { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 0 40px; position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.header-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.header-title { font-size: 1.05rem; font-weight: 700; color: var(--text-main); }
.header-subtitle { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.3px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-btn { padding: 8px 18px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; transition: all 0.15s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.header-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.header-btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.header-btn-primary:hover { background: var(--primary-hover); color: #fff; }
.header-btn-admin { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.header-btn-admin:hover { background: #d97706; border-color: #d97706; color: #fff; }
.btn-icon-sm { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; font-size: 0.9rem; }
.btn-icon-sm:hover { color: var(--primary); border-color: var(--primary); }

/* ===== HERO ===== */
.page-hero { max-width: 1440px; margin: 0 auto; padding: 44px 40px 28px; text-align: center; }
.page-hero h1 { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.page-hero p { color: var(--text-secondary); font-size: 0.88rem; max-width: 740px; margin: 0 auto; line-height: 1.6; }
.hero-divider { border: none; height: 3px; background: linear-gradient(90deg, var(--primary), #7c3aed, #ec4899, #f59e0b); margin: 0; width: 100%; }

/* ===== ANNOUNCEMENT BANNER ===== */
.announcement-banner { max-width: 1440px; margin: 0 auto; padding: 18px 40px 0; }
.announcement-inner { display: flex; align-items: flex-start; gap: 14px; padding: 16px 22px; border-radius: var(--radius); background: #fef2f2; border: 2px solid #fca5a5; color: #991b1b; font-size: 0.88rem; line-height: 1.55; font-weight: 500; }
.announcement-inner i { font-size: 1.15rem; flex-shrink: 0; margin-top: 2px; color: #dc2626; }
.announcement-inner strong { font-weight: 800; }
[data-theme="dark"] .announcement-inner { background: #450a0a; border-color: #991b1b; color: #fecaca; }
[data-theme="dark"] .announcement-inner i { color: #f87171; }

/* ===== NECPRS BANNER ===== */
.necprs-banner { max-width: 1440px; margin: 0 auto; padding: 18px 40px 0; }
.necprs-banner-inner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-radius: var(--radius); background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; font-size: 0.84rem; line-height: 1.5; }
.necprs-banner-inner i { font-size: 1.1rem; flex-shrink: 0; }
.necprs-banner-inner a { color: #1e40af; font-weight: 700; text-decoration: underline; }
[data-theme="dark"] .necprs-banner-inner { background: #172554; border-color: #1e3a8a; color: #93c5fd; }
[data-theme="dark"] .necprs-banner-inner a { color: #93c5fd; }

/* ===== ADMIN TOOLBAR ===== */
.admin-toolbar { display: none; max-width: 1440px; margin: 0 auto; padding: 8px 40px 0; }
.admin-toolbar-inner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-radius: var(--radius-sm); background: #fef3c7; border: 1px solid #fcd34d; font-size: 0.82rem; font-weight: 600; color: #92400e; }
[data-theme="dark"] .admin-toolbar-inner { background: #451a03; border-color: #b45309; color: #fde68a; }
.admin-toolbar-inner .spacer { flex: 1; }

/* ===== MAIN LAYOUT ===== */
.main-layout { max-width: 1440px; margin: 0 auto; display: flex; gap: 0; padding: 24px 40px 60px; min-height: calc(100vh - 220px); }

/* ===== FILTER SIDEBAR ===== */
.filter-sidebar { width: var(--sidebar-width); flex-shrink: 0; padding-right: 28px; position: sticky; top: 92px; max-height: calc(100vh - 120px); overflow-y: auto; align-self: flex-start; }
.filter-sidebar::-webkit-scrollbar { width: 4px; }
.filter-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Clear Filters button at top of sidebar */
.clear-filters-sidebar-btn {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all 0.15s;
}
.clear-filters-sidebar-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.clear-filters-sidebar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.clear-filters-count {
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.65rem;
    margin-left: 4px;
    font-weight: 700;
}

.filter-section { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-sidebar); margin-bottom: 8px; overflow: hidden; }
.filter-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: none; border: none; font-family: inherit; font-size: 0.82rem; font-weight: 700; color: var(--text-main); cursor: pointer; transition: background 0.1s; }
.filter-toggle:hover { background: var(--border-light); }
.filter-toggle .chevron { font-size: 0.65rem; color: var(--text-muted); transition: transform 0.2s; }
.filter-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.filter-toggle .filter-count { background: var(--primary); color: #fff; font-size: 0.6rem; width: 18px; height: 18px; border-radius: 50%; display: none; align-items: center; justify-content: center; margin-left: auto; margin-right: 8px; font-weight: 700; }
.filter-toggle .filter-count.visible { display: flex; }
.filter-body { padding: 0 14px 10px; display: none; }
.filter-body.open { display: block; }
.filter-search { width: 100%; padding: 7px 10px 7px 28px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.75rem; font-family: inherit; background: var(--bg-body); color: var(--text-main); margin-bottom: 6px; }
.filter-search:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.filter-search-wrap { position: relative; }
.filter-search-wrap i { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.65rem; pointer-events: none; }
.filter-options { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.filter-options::-webkit-scrollbar { width: 4px; }
.filter-options::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.filter-option { display: flex; align-items: flex-start; gap: 8px; padding: 5px 6px; border-radius: 5px; cursor: pointer; transition: background 0.1s; font-size: 0.78rem; color: var(--text-secondary); line-height: 1.35; }
.filter-option:hover { background: var(--border-light); }
.filter-option input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; margin-top: 1px; }
.filter-option.checked { color: var(--primary); font-weight: 600; }

/* ===== CONTENT AREA ===== */
.content-area { flex: 1; min-width: 0; }
.content-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.search-bar-wrap { position: relative; flex: 1; max-width: 480px; }
.search-bar { width: 100%; padding: 10px 16px 10px 38px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--text-main); font-size: 0.88rem; font-family: inherit; transition: all 0.15s; }
.search-bar:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.search-bar::placeholder { color: var(--text-muted); }
.search-bar-wrap > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.85rem; pointer-events: none; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.results-count { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.results-count strong { color: var(--text-main); font-weight: 700; }
.view-toggle { display: flex; gap: 2px; background: var(--border-light); border-radius: 8px; padding: 3px; }
.view-btn { width: 32px; height: 32px; border-radius: 6px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; font-size: 0.85rem; }
.view-btn.active { background: var(--bg-card); color: var(--text-main); box-shadow: var(--shadow-sm); }

/* Active filters */
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.active-filter-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-light); color: var(--primary); padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; }
.active-filter-tag button { background: none; border: none; color: inherit; cursor: pointer; padding: 0; font-size: 1rem; line-height: 1; opacity: 0.6; }
.active-filter-tag button:hover { opacity: 1; }
.clear-all-btn { background: none; border: 1px solid var(--border); cursor: pointer; padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; font-family: inherit; color: var(--text-muted); transition: all 0.15s; }
.clear-all-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Webinar warning inline */
.webinar-warning { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; font-size: 0.75rem; line-height: 1.4; margin-bottom: 14px; }
.webinar-warning i { margin-top: 2px; flex-shrink: 0; }
.webinar-warning a { color: #92400e; font-weight: 700; }
[data-theme="dark"] .webinar-warning { background: #451a03; border-color: #b45309; color: #fde68a; }
[data-theme="dark"] .webinar-warning a { color: #fde68a; }

/* ===== GRADIENTS ===== */
.gradient-0  { background: linear-gradient(135deg, #ff6b6b, #ffa56b); }
.gradient-1  { background: linear-gradient(135deg, #845ef7, #5c7cfa); }
.gradient-2  { background: linear-gradient(135deg, #f06595, #cc5de8); }
.gradient-3  { background: linear-gradient(135deg, #20c997, #38d9a9); }
.gradient-4  { background: linear-gradient(135deg, #339af0, #5c7cfa); }
.gradient-5  { background: linear-gradient(135deg, #ff922b, #ffd43b); }
.gradient-6  { background: linear-gradient(135deg, #7950f2, #be4bdb); }
.gradient-7  { background: linear-gradient(135deg, #22b8cf, #66d9e8); }
.gradient-8  { background: linear-gradient(135deg, #f76707, #ff6b6b); }
.gradient-9  { background: linear-gradient(135deg, #51cf66, #94d82d); }
.gradient-10 { background: linear-gradient(135deg, #e64980, #f06595); }
.gradient-11 { background: linear-gradient(135deg, #4c6ef5, #748ffc); }
.gradient-12 { background: linear-gradient(135deg, #fab005, #fcc419); }
.gradient-13 { background: linear-gradient(135deg, #12b886, #38d9a9); }
.gradient-14 { background: linear-gradient(135deg, #ae3ec9, #e599f7); }
.gradient-15 { background: linear-gradient(135deg, #fd7e14, #ffa94d); }
.gradient-16 { background: linear-gradient(135deg, #1098ad, #66d9e8); }
.gradient-17 { background: linear-gradient(135deg, #5f3dc4, #9775fa); }
.gradient-18 { background: linear-gradient(135deg, #c2255c, #f783ac); }
.gradient-19 { background: linear-gradient(135deg, #2f9e44, #69db7c); }

/* ===== CARDS ===== */
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.org-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: all 0.2s ease; display: flex; flex-direction: column; text-decoration: none; color: inherit; position: relative; }
.org-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); border-color: var(--primary); }
.card-gradient { height: 100px; position: relative; overflow: hidden; }
.card-gradient::before { content: ''; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,0.12); }
.card-gradient::after { content: ''; position: absolute; right: 25px; top: 25px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.08); }
.card-wave { position: absolute; bottom: 0; left: 0; width: 100%; height: 18px; }
.card-body { padding: 16px 18px 14px; flex: 1; display: flex; flex-direction: column; }
.card-org-name { font-size: 0.95rem; font-weight: 700; color: var(--text-main); margin-bottom: 3px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* FIX: align-self prevents flex column from stretching the anchor to full card width,
   which was making the entire row clickable instead of just the link text. */
.card-website { font-size: 0.75rem; color: var(--primary); text-decoration: none; margin-bottom: 12px; display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; align-self: flex-start; }
.card-website:hover { text-decoration: underline; }
.card-divider { width: 100%; height: 1px; background: var(--border); margin-bottom: 12px; }
.card-field { margin-bottom: 10px; }
.card-field:last-child { margin-bottom: 0; }
.card-field-label { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.card-tag { padding: 3px 10px; border-radius: 16px; font-size: 0.68rem; font-weight: 600; background: var(--primary-light); color: var(--primary); }
.card-tag.cost-free { background: #ecfdf5; color: #059669; }
.card-tag.cost-paid { background: #fef3c7; color: #b45309; }
.card-tag.cost-high { background: #fef2f2; color: #dc2626; }
[data-theme="dark"] .card-tag.cost-free { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .card-tag.cost-paid { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .card-tag.cost-high { background: #450a0a; color: #fca5a5; }
.card-tag.webinar-tag { background: #fef3c7; color: #92400e; border: 1px dashed #fbbf24; }
[data-theme="dark"] .card-tag.webinar-tag { background: #451a03; color: #fde68a; border-color: #b45309; }
.cost-tooltip { position: relative; cursor: help; }
.cost-tooltip .cost-detail { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding: 6px 10px; background: var(--text-main); color: var(--bg-card); font-size: 0.68rem; border-radius: 6px; white-space: nowrap; z-index: 10; margin-bottom: 4px; }
.cost-tooltip:hover .cost-detail { display: block; }

/* Admin overlay */
.admin-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius); z-index: 5; }
.edit-mode .org-card:hover .admin-overlay { display: flex; }
.admin-overlay button { padding: 8px 18px; border-radius: 8px; font-weight: 600; font-size: 0.82rem; cursor: pointer; border: none; font-family: inherit; transition: all 0.15s; }
.admin-overlay .edit-btn { background: #fff; color: var(--primary); }
.admin-overlay .delete-btn { background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.admin-overlay .delete-btn:hover { background: #ef4444; border-color: #ef4444; }
.add-card { border: 2px dashed var(--border); background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; min-height: 260px; color: var(--text-muted); border-radius: var(--radius); transition: all 0.2s; }
.add-card:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.add-card i { font-size: 2rem; margin-bottom: 8px; }
.add-card span { font-weight: 600; font-size: 0.85rem; }

/* ===== TABLE ===== */
.org-table-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow-x: auto; display: none; }
.org-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.org-table thead { background: var(--bg-body); }
.org-table th { padding: 10px 14px; font-weight: 700; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
.org-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.org-table tbody tr { transition: background 0.1s; cursor: pointer; }
.org-table tbody tr:hover { background: var(--primary-light); }
.table-name { font-weight: 700; color: var(--text-main); }
.table-tags { display: flex; gap: 3px; flex-wrap: wrap; }
.table-tag { padding: 2px 7px; border-radius: 4px; font-size: 0.65rem; font-weight: 600; background: var(--border-light); color: var(--text-secondary); }

/* ===== DETAIL MODAL ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); z-index: 9999; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal-panel { background: var(--bg-card); border-radius: var(--radius-lg); width: 100%; max-width: 640px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-modal); animation: modalIn 0.25s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 28px 0; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--border-light); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1rem; transition: all 0.15s; flex-shrink: 0; }
.modal-close:hover { background: var(--border); color: var(--text-main); }
.modal-subtitle { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 16px; padding: 0 28px; line-height: 1.5; }
.detail-row { display: flex; padding: 12px 28px; border-top: 1px solid var(--border-light); }
.detail-label { width: 200px; flex-shrink: 0; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.detail-value { flex: 1; font-size: 0.82rem; color: var(--text-main); line-height: 1.5; }
.modal-footer { padding: 18px 28px; border-top: 1px solid var(--border-light); display: flex; gap: 10px; }
.btn-go-website { display: inline-flex; align-items: center; gap: 8px; padding: 10px 24px; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 600; font-size: 0.82rem; text-decoration: none; transition: all 0.15s; border: none; cursor: pointer; font-family: inherit; }
.btn-go-website:hover { background: var(--primary-hover); }

/* ===== EDIT MODAL ===== */
.edit-modal-panel { max-width: 720px; }
.edit-modal-body { padding: 24px 28px; max-height: 60vh; overflow-y: auto; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); margin-bottom: 5px; }
.form-group label .req { color: #ef4444; }
.form-input { width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-body); color: var(--text-main); font-size: 0.82rem; font-family: inherit; }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
textarea.form-input { min-height: 70px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.checkbox-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
.checkbox-item { display: flex; align-items: flex-start; gap: 7px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; font-size: 0.76rem; transition: all 0.1s; line-height: 1.3; }
.checkbox-item:hover { border-color: var(--primary); background: var(--primary-light); }
.checkbox-item.checked { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 600; }
.checkbox-item input { accent-color: var(--primary); width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; margin-top: 1px; }
.edit-modal-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; border-top: 1px solid var(--border); background: var(--bg-body); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.btn-save { padding: 10px 28px; border-radius: 8px; background: var(--primary); color: #fff; border: none; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 0.82rem; transition: all 0.15s; }
.btn-save:hover { background: var(--primary-hover); }
.btn-cancel { background: none; border: none; color: var(--text-muted); font-weight: 600; cursor: pointer; font-size: 0.82rem; font-family: inherit; padding: 10px 20px; }
.btn-cancel:hover { color: var(--text-main); }
.btn-delete { padding: 10px 20px; border-radius: 8px; background: transparent; border: 1px solid #ef4444; color: #ef4444; font-weight: 600; cursor: pointer; font-size: 0.8rem; font-family: inherit; transition: all 0.15s; }
.btn-delete:hover { background: #ef4444; color: #fff; }

/* Toasts */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 18px; box-shadow: var(--shadow-modal); font-size: 0.82rem; font-weight: 600; display: flex; align-items: center; gap: 10px; animation: toastIn 0.25s ease; min-width: 260px; }
.toast.success { border-left: 4px solid #059669; }
.toast.error { border-left: 4px solid #ef4444; }
@keyframes toastIn { from { opacity:0; transform:translateX(30px); } to { opacity:1; transform:none; } }

/* Empty */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); grid-column: 1/-1; }
.empty-state i { font-size: 3rem; opacity: 0.3; margin-bottom: 12px; display: block; }
.empty-state h3 { font-weight: 700; color: var(--text-main); margin-bottom: 6px; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 24px 0 8px; grid-column: 1 / -1; }
.page-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.82rem; font-weight: 600; font-family: inherit; transition: all 0.15s; }
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-ellipsis { color: var(--text-muted); font-size: 0.82rem; padding: 0 4px; }
.page-info { font-size: 0.75rem; color: var(--text-muted); margin-left: 12px; font-weight: 500; }

/* Footer */
.site-footer { text-align: center; padding: 2rem 2rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg-card); }
.footer-contact { margin-bottom: 14px; }
.footer-contact-label { display: block; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }
.footer-contact-info { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: 0.85rem; }
.footer-contact-name { font-weight: 700; color: var(--text-main); }
.footer-divider { color: var(--border); }
.footer-contact-info a { color: var(--primary); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.footer-contact-info a:hover { text-decoration: underline; }
.footer-contact-info a i { font-size: 0.75rem; }
.footer-copyright { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

/* Animations */
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
.org-card { animation: fadeUp 0.3s ease forwards; opacity: 0; }
.org-card:nth-child(1) { animation-delay: 0ms; } .org-card:nth-child(2) { animation-delay: 30ms; }
.org-card:nth-child(3) { animation-delay: 60ms; } .org-card:nth-child(4) { animation-delay: 90ms; }
.org-card:nth-child(5) { animation-delay: 120ms; } .org-card:nth-child(6) { animation-delay: 150ms; }
mark.hl { background: #fef08a; padding: 0 2px; border-radius: 2px; color: #713f12; }
[data-theme="dark"] mark.hl { background: #854d0e; color: #fef9c3; }

/* ========================================================================
   RESPONSIVE / MOBILE
   The filter sidebar becomes an off-canvas drawer below 900px. The drawer
   chrome (Filters toggle button + in-drawer header) is mobile-only and is
   hidden on desktop by default, then revealed inside the media query.
   ======================================================================== */

/* Mobile-only filter chrome — hidden on desktop */
.mobile-filter-btn,
.mobile-filter-header { display: none; }

/* Filters toggle button (lives in the content toolbar; shown on mobile) */
.mobile-filter-btn {
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.mobile-filter-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.mobile-filter-count {
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
}

/* Sticky header inside the drawer */
.mobile-filter-header {
    align-items: center;
    justify-content: space-between;
    padding: 14px 2px 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-sidebar);
    z-index: 2;
}
.mobile-filter-title { font-size: 1rem; font-weight: 800; color: var(--text-main); }
.mobile-filter-done {
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}
.mobile-filter-done:hover { background: var(--primary-hover); }

/* Backdrop behind the drawer (tap to close — see toggleMobileFilters) */
.filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
    z-index: 9997;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.filter-backdrop.show { opacity: 1; visibility: visible; }
@media (min-width: 901px) { .filter-backdrop { display: none; } }

/* ---- Tablet / small laptop ---- */
@media (max-width: 900px) {
    .site-header { padding: 0 16px; }
    .header-inner { height: auto; min-height: 60px; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
    .header-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

    .page-hero { padding: 28px 16px 20px; }
    .page-hero h1 { font-size: 1.5rem; }
    .announcement-banner,
    .necprs-banner,
    .admin-toolbar { padding-left: 16px; padding-right: 16px; }

    .main-layout { display: block; padding: 20px 16px 40px; }

    /* Reveal the Filters toggle */
    .mobile-filter-btn { display: inline-flex; }

    /* Sidebar -> off-canvas drawer */
    .filter-sidebar {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 340px);
        height: 100%;
        max-height: none;
        margin: 0;
        padding: 0 16px 28px;
        background: var(--bg-sidebar);
        box-shadow: 6px 0 28px rgba(0,0,0,0.22);
        z-index: 9998;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
    }
    .filter-sidebar.mobile-open { transform: translateX(0); }
    .mobile-filter-header { display: flex; }

    /* Content uses the full width; search goes full-width on its own row */
    .content-area { width: 100%; }
    .content-toolbar { gap: 10px; }
    .search-bar-wrap { flex: 1 1 100%; max-width: none; order: -1; }
    .toolbar-right { flex: 1 1 100%; justify-content: space-between; }

    .org-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}

/* ---- Phones ---- */
@media (max-width: 600px) {
    .header-subtitle { display: none; }
    .page-hero h1 { font-size: 1.3rem; }

    .org-grid { grid-template-columns: 1fr; }

    /* Detail modal: stack label over value */
    .detail-row { flex-direction: column; gap: 3px; padding: 12px 18px; }
    .detail-label { width: auto; }
    .modal-header { padding: 18px 18px 0; }
    .modal-subtitle { padding: 0 18px; }
    .modal-footer { padding: 16px 18px; }

    /* Edit modal: collapse multi-column grids */
    .edit-modal-body { padding: 18px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .checkbox-grid, .checkbox-grid-3 { grid-template-columns: 1fr 1fr; }
    .edit-modal-footer { padding: 14px 18px; }

    /* Pagination wraps cleanly */
    .pagination { flex-wrap: wrap; }
    .page-info { width: 100%; text-align: center; margin: 6px 0 0; }

    /* Toasts span the screen width */
    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { min-width: 0; }
}