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

.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--pico-card-background-color);
    border-right: 1px solid var(--pico-muted-border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar header h3 {
    margin-bottom: 1rem;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav ul li {
    margin-bottom: 0.25rem;
}

.sidebar nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--pico-color);
}

.sidebar nav a:hover {
    background: var(--pico-primary-focus);
}

.sidebar nav a.active {
    background: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--pico-muted-border-color);
}

.sidebar-status {
    margin-bottom: 1rem;
}

.sidebar-status h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-user small {
    color: var(--pico-muted-color);
}

.content {
    flex: 1;
    margin-left: 240px;
    padding: 2rem 3rem;
    max-width: 1100px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.success {
    background: #c8e6c9;
    color: #2e7d32;
}

.badge.warning {
    background: #fff3cd;
    color: #856404;
}

.badge.error {
    background: #ffcdd2;
    color: #c62828;
}

/* Metrics grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.metric-card {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-card small {
    color: var(--pico-muted-color);
    font-size: 0.8rem;
}

.metric-card strong {
    font-size: 1.1rem;
}

/* Status messages */
.success {
    color: #2e7d32;
}

.error {
    color: #c62828;
}

.warning {
    color: #e65100;
}

.text-success {
    color: #2e7d32;
}

.text-error {
    color: #c62828;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--pico-muted-border-color);
    padding-bottom: 0;
}

.tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--pico-muted-color);
    font-weight: 500;
}

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

.tab.active {
    color: var(--pico-primary);
    border-bottom-color: var(--pico-primary);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    font-size: 0.9rem;
}

/* Search */
.search-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.search-input-wrap {
    flex: 1;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--pico-background-color);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-container article {
    padding: 2rem;
}

.login-container header {
    text-align: center;
    margin-bottom: 1rem;
}

.login-container header p {
    color: var(--pico-muted-color);
}

/* Small button */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* HTMX indicator */
.htmx-indicator {
    display: none;
    color: var(--pico-muted-color);
    font-style: italic;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        width: 100%;
        min-width: auto;
        border-right: none;
        border-bottom: 1px solid var(--pico-muted-border-color);
    }

    .layout {
        flex-direction: column;
    }

    .content {
        margin-left: 0;
        padding: 1rem;
    }

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

    .search-header {
        flex-direction: column;
    }
}
