:root {
    --pipe-bg: #f4f7fb;
    --pipe-surface: #ffffff;
    --pipe-surface-soft: #f8fafc;
    --pipe-border: #dbe3ef;
    --pipe-text: #172033;
    --pipe-muted: #637083;
    --pipe-primary: #1d4ed8;
    --pipe-primary-dark: #173ea8;
    --pipe-accent: #0f766e;
    --pipe-danger: #b42318;
    --pipe-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
    --pipe-radius: 8px;
}

html,
body {
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    color: var(--pipe-text);
    background: var(--pipe-bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
    flex: 1 0 auto;
}

a {
    color: var(--pipe-primary);
    text-decoration: none;
}

a:hover {
    color: var(--pipe-primary-dark);
    text-decoration: none;
}

.btn {
    border-radius: 7px;
    font-weight: 600;
}

.btn-primary {
    --bs-btn-bg: var(--pipe-primary);
    --bs-btn-border-color: var(--pipe-primary);
    --bs-btn-hover-bg: var(--pipe-primary-dark);
    --bs-btn-hover-border-color: var(--pipe-primary-dark);
}

.btn-quiet {
    color: var(--pipe-text);
    background: #eef3f8;
    border-color: #eef3f8;
}

.btn-quiet:hover {
    color: var(--pipe-primary);
    background: #e6edf7;
    border-color: #e6edf7;
}

.site-navbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--pipe-border);
    backdrop-filter: blur(12px);
}

.site-navbar .navbar-brand,
.site-navbar .nav-link {
    color: var(--pipe-text);
}

.site-navbar .nav-link {
    border-radius: 7px;
    font-weight: 600;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus {
    color: var(--pipe-primary);
    background: #eef4ff;
}

.site-navbar .navbar-toggler {
    border-color: var(--pipe-border);
}

.site-navbar .navbar-toggler-icon {
    background-image: var(--bs-navbar-toggler-icon-bg);
}

.brand-mark {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--pipe-primary);
    border-radius: 8px;
    font-weight: 800;
    letter-spacing: 0;
}

.site-footer {
    margin-top: auto;
    padding: 28px 0;
    background: var(--pipe-surface);
    border-top: 1px solid var(--pipe-border);
}

.page-hero {
    padding: 54px 0 34px;
    background: var(--pipe-surface);
    border-bottom: 1px solid var(--pipe-border);
}

.page-hero-inner {
    max-width: 760px;
}

.page-hero h1,
.admin-heading h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: 0;
}

.page-hero p:not(.eyebrow),
.admin-heading p:not(.eyebrow) {
    max-width: 680px;
    margin: 16px 0 0;
    color: var(--pipe-muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.eyebrow {
    margin: 0;
    color: var(--pipe-accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
}

.section-block {
    padding: 38px 0;
}

.surface-panel,
.table-panel,
.auth-panel,
.metric-card,
.feature-card,
.post-detail {
    background: var(--pipe-surface);
    border: 1px solid var(--pipe-border);
    border-radius: var(--pipe-radius);
    box-shadow: var(--pipe-shadow);
}

.surface-panel,
.auth-panel {
    padding: 28px;
}

.feature-card {
    height: 100%;
    padding: 24px;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: #b8c7dd;
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.11);
}

.feature-card h2,
.feature-card h3 {
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: 0;
}

.feature-card p,
.text-muted-readable {
    color: var(--pipe-muted);
    line-height: 1.7;
}

.content-body {
    line-height: 1.85;
    white-space: normal;
}

.post-detail {
    padding: 28px;
}

.post-meta {
    color: var(--pipe-muted);
    font-size: 0.92rem;
}

.table-panel {
    overflow: hidden;
    box-shadow: none;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    color: var(--pipe-muted);
    background: var(--pipe-surface-soft);
    border-bottom: 1px solid var(--pipe-border);
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0;
}

.table tbody td {
    padding-top: 16px;
    padding-bottom: 16px;
    vertical-align: middle;
}

.table-row-link {
    color: var(--pipe-text);
    font-weight: 700;
}

.table-row-link:hover {
    color: var(--pipe-primary);
}

.empty-state {
    display: flex;
    min-height: 180px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--pipe-muted);
    background: var(--pipe-surface);
    border: 1px dashed #b8c7dd;
    border-radius: var(--pipe-radius);
}

.empty-state-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    color: var(--pipe-primary);
    background: #eef4ff;
    border-radius: 8px;
    font-weight: 800;
}

.auth-page {
    width: min(100%, 1040px);
}

.auth-panel h1 {
    font-weight: 800;
    letter-spacing: 0;
}

.form-control,
.form-select {
    min-height: 44px;
    border-color: #cbd5e1;
    border-radius: 7px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--pipe-primary);
    box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.12);
}

.admin-shell {
    padding: 34px 0 54px;
}

.admin-sidebar {
    position: sticky;
    top: 92px;
    padding: 16px;
    background: var(--pipe-surface);
    border: 1px solid var(--pipe-border);
    border-radius: var(--pipe-radius);
    box-shadow: var(--pipe-shadow);
}

.admin-sidebar-title {
    padding: 8px 10px 14px;
    color: var(--pipe-muted);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0;
}

.admin-nav {
    display: grid;
    gap: 4px;
}

.admin-nav-link {
    display: block;
    padding: 10px 12px;
    color: var(--pipe-text);
    border-radius: 7px;
    font-weight: 700;
}

.admin-nav-link:hover {
    color: var(--pipe-primary);
    background: #eef4ff;
}

.admin-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.d-flex > .admin-heading {
    flex: 1;
    margin-bottom: 0;
}

.metric-card {
    padding: 22px;
    box-shadow: none;
}

.metric-label {
    color: var(--pipe-muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.metric-value {
    margin-top: 8px;
    color: var(--pipe-text);
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

.badge-soft {
    color: var(--pipe-primary);
    background: #eef4ff;
}

.badge-soft-green {
    color: var(--pipe-accent);
    background: #e7f6f4;
}

.table-writer {
    width: 140px;
}

.table-count {
    width: 90px;
}

.table-date {
    width: 130px;
}

@media (max-width: 991.98px) {
    .site-navbar .navbar-collapse {
        padding-top: 14px;
    }

    .nav-actions {
        align-items: stretch !important;
        padding-top: 10px;
    }

    .admin-sidebar {
        position: static;
    }
}

@media (max-width: 575.98px) {
    .page-hero {
        padding: 40px 0 28px;
    }

    .surface-panel,
    .auth-panel,
    .post-detail {
        padding: 20px;
    }

    .admin-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-writer,
    .table-count,
    .table-date {
        width: auto;
    }
}
