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

:root {
    --primary: #0f4c81;
    --primary-dark: #0a3560;
    --accent: #f0aa00;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f1f5f9;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 2px 12px rgba(15,76,129,0.10);
    --shadow-hover: 0 8px 28px rgba(15,76,129,0.18);
    --radius: 12px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
}

/* ── Navbar ── */
.dir-nav {
    background: var(--white);
    box-shadow: 0 1px 0 var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.dir-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dir-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
}
.dir-brand img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.dir-nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.dir-nav-links a:hover {
    background: var(--bg);
    color: var(--primary);
}

/* ── Hero ── */
.dir-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #1a6cb5 100%);
    padding: 64px 24px 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.dir-hero::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 40px;
    background: var(--bg);
    clip-path: ellipse(55% 100% at 50% 100%);
}
.dir-hero-inner { max-width: 680px; margin: 0 auto; position: relative; z-index: 1; }
.dir-hero-title {
    color: var(--white);
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 800;
    margin: 0 0 8px;
    line-height: 1.2;
}
.dir-hero-sub {
    color: rgba(255,255,255,0.75);
    font-size: 16px;
    margin: 0 0 28px;
}
.dir-search-wrap {
    position: relative;
    max-width: 540px;
    margin: 0 auto;
}
.dir-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}
.dir-search-input {
    width: 100%;
    height: 52px;
    padding: 0 20px 0 48px;
    border: none;
    border-radius: 26px;
    font-size: 15px;
    color: var(--text);
    background: var(--white);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    outline: none;
    transition: box-shadow 0.2s;
}
.dir-search-input:focus {
    box-shadow: 0 4px 24px rgba(0,0,0,0.2), 0 0 0 3px rgba(240,170,0,0.3);
}

/* ── Stats ── */
.dir-stats {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}
.dir-stats-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 0;
}
.dir-stat-item {
    flex: 1;
    text-align: center;
    padding: 18px 12px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}
.dir-stat-item:hover { background: var(--bg); }
.dir-stat-item.active { border-bottom-color: var(--accent); }
.dir-stat-num {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}
.dir-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Main content ── */
.dir-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

/* ── Tabs ── */
.dir-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.dir-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.dir-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f6ff;
}
.dir-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}
.dir-tab i { font-size: 15px; }

/* ── Filter ── */
.dir-filter {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.dir-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    margin: 0;
}
.dir-filter-select {
    height: 40px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    min-width: 260px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.dir-filter-select:focus { border-color: var(--primary); }

/* ── Results grid ── */
.dir-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 1024px) { .dir-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .dir-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px)  { .dir-grid { grid-template-columns: 1fr; } }

/* ── Person card ── */
.dir-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px 16px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1.5px solid transparent;
}
.dir-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}
.dir-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    margin-bottom: 12px;
    background: var(--bg);
}
.dir-card-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dir-card-id {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-family: monospace;
}
.dir-badge {
    display: inline-block;
    background: #e8f1fb;
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    line-height: 1.4;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dir-badge.accent { background: #fff4d0; color: #b07a00; }

/* ── Result count ── */
.dir-result-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 500;
}

/* ── Empty state ── */
.dir-empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}
.dir-empty-state i {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.3;
}
.dir-empty-state p { font-size: 15px; margin: 0; }

/* ── Loader ── */
.dir-loader {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.dir-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal overlay ── */
.dir-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,76,129,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 20px;
}
.dir-modal-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.dir-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    z-index: 1;
}
.dir-modal-close:hover { color: var(--text); }

/* ── Modal detail body ── */
.dir-detail-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 32px 24px 24px;
    text-align: center;
    border-radius: var(--radius) var(--radius) 0 0;
}
.dir-detail-photo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.4);
    margin-bottom: 12px;
}
.dir-detail-name {
    color: var(--white);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px;
}
.dir-detail-sub {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    margin: 0;
}
.dir-detail-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.dir-detail-badge {
    background: rgba(255,255,255,0.18);
    color: var(--white);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}
.dir-detail-body { padding: 20px 24px 24px; }
.dir-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.dir-detail-table tr:not(:last-child) td {
    border-bottom: 1px solid var(--border);
}
.dir-detail-table td {
    padding: 10px 4px;
    vertical-align: top;
}
.dir-detail-table td:first-child {
    color: var(--text-muted);
    width: 45%;
    font-weight: 500;
}
.dir-detail-table td:last-child {
    color: var(--text);
    font-weight: 600;
    text-align: right;
}
.dir-detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.dir-detail-stat {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}
.dir-detail-stat-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}
.dir-detail-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
