/* === Layout === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3.5rem;
}

/* Full-viewport pages (Connections): no width cap, and the page is
   height-locked to the viewport — the compact header keeps its natural
   size and the graph flexes into everything else. No magic constants,
   so it cannot produce scroll. */
body:has(.container.full-bleed) {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.container.full-bleed {
    max-width: none;
    width: 100%;
    /* bottom padding clears the fixed activity bar */
    padding: 0.75rem 0.75rem 3rem;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin-bottom: 0.25rem;
}

.page-header .subtitle {
    color: var(--comment);
    font-size: 0.9rem;
}

/* === Filters Bar === */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--bg-darker);
    border-radius: var(--radius-lg);
    border: 1px solid var(--current);
}

.filters-bar .separator {
    width: 1px;
    height: 28px;
    background: var(--current);
}

/* === Two-column layout === */
.two-col {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* === Character detail header === */
.char-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.char-info {
    flex: 1;
    min-width: 200px;
}

.char-info h1 {
    margin-bottom: 0.25rem;
}

.char-info .group-name {
    color: var(--cyan);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.char-counts {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

.char-counts .count-item {
    text-align: center;
}

.char-counts .count-item .num {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

.char-counts .count-item .label {
    font-size: 0.7rem;
    color: var(--comment);
    text-transform: uppercase;
}

/* === Tabs (for character detail sections) === */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--current);
    margin-bottom: 1.25rem;
}

.tab-btn {
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--comment);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-sans);
}

.tab-btn:hover {
    color: var(--fg);
}

.tab-btn.active {
    color: var(--purple);
    border-bottom-color: var(--purple);
}

/* === Admin action grid === */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.admin-grid .card {
    display: flex;
    flex-direction: column;
}

.admin-grid form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-grid .result {
    margin-top: 0.75rem;
    min-height: 1.5rem;
}

/* === Table wrapper for horizontal scroll === */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--current);
}

.table-wrap .data-table th:first-child,
.table-wrap .data-table td:first-child {
    padding-left: 1rem;
}

.table-wrap .data-table th:last-child,
.table-wrap .data-table td:last-child {
    padding-right: 1rem;
}

/* === Responsive === */
@media (max-width: 768px) {
    .container {
        padding: 1rem 1rem 3.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .char-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-bar .separator {
        width: 100%;
        height: 1px;
    }

    .search-input {
        max-width: 100%;
    }

    .nav {
        padding: 0 1rem;
    }

    .nav-brand {
        margin-right: 1rem;
    }

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* === Version tag === */
.version-tag {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--comment);
    white-space: nowrap;
}
