/* Structural layout: app shell, content container, spacing primitives and footer. */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1;
    padding-block: 2rem 3rem;
}

.app-container {
    width: min(100% - 2 * var(--app-gutter), var(--app-container-max));
    margin-inline: auto;
}

.app-container--narrow {
    max-width: 48rem;
}

/* The home dashboard gets more room than the reading pages. */
.app-container--wide {
    width: min(100% - 2 * var(--app-gutter), var(--app-container-wide-max));
}

/* Vertical rhythm: children stack with a consistent gap. */
.app-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-stack--lg {
    gap: 2rem;
}

/* Horizontal cluster that wraps: buttons, meta lines, tag lists. */
.app-cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.app-cluster--between {
    justify-content: space-between;
}

.app-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1.25rem;
}

.app-section {
    margin-top: 2.5rem;
}

/* Home dashboard: main column plus a sidebar for the small status panels. */
.app-dashboard {
    display: grid;
    gap: 0 2rem;
    align-items: start;
}

.app-dashboard-side .app-section {
    margin-top: 2rem;
}

.app-dashboard-main .app-section:first-child,
.app-dashboard-side .app-section:first-child {
    margin-top: 2rem;
}

@media (min-width: 900px) {
    .app-dashboard {
        grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem);
    }
}

.app-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--app-border);
}

.app-section-heading h2 {
    font-size: 1.2rem;
}

.app-footer {
    margin-top: 3rem;
    padding-block: 1.5rem;
    border-top: 1px solid var(--app-border);
    background: rgba(0, 0, 0, 0.35);
    color: var(--app-muted);
    font-size: 0.85rem;
}

.app-footer a {
    color: var(--app-muted);
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--app-gold-soft);
}

.app-footer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1.5rem;
}

.app-footer-attribution {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    color: rgba(154, 147, 127, 0.8);
}

.app-version-badge {
    opacity: 0.55;
    font-size: 0.72rem;
    font-family: var(--app-font-mono);
    letter-spacing: 0.04em;
}

@media (max-width: 575.98px) {
    .app-main {
        padding-block: 1.25rem 2rem;
    }
}
