/* Nutria v003 — app shell layout, mobile-first; sidebar from tablet width */

body {
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header"
        "main";
    min-height: 100dvh;
}

.app-header {
    grid-area: header;
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.app-logo {
    font-weight: 700;
    letter-spacing: 0.14em;
    font-size: var(--font-lg);
}

.app-claim {
    font-size: var(--font-xs);
    color: var(--faint);
}

#app {
    grid-area: main;
    padding: 20px;
    /* keep content clear of the fixed tab bar */
    padding-bottom: calc(var(--tab-bar-height) + var(--spacing) + env(safe-area-inset-bottom));
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
    /* long words (BLS names, activity descriptions) must never cause page overflow */
    overflow-wrap: anywhere;
}

/* ----- Tab bar, fixed at the bottom on mobile ----- */

.tab-bar {
    position: fixed;
    inset: auto 0 0 0;
    height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--tabbar-bg);
    border-top: 1px solid var(--border);
    z-index: 50;
}

.tab-bar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    border-radius: 0;
    background: none;
    font-size: 0.7rem;
    color: var(--faint);
    padding: 4px 2px;
    min-height: 52px;
}

.tab-bar .tab-icon {
    position: relative;
    font-size: 1.15rem;
    line-height: 1;
}

.tab-bar .tab-plus {
    position: absolute;
    top: -4px;
    right: -8px;
    font-size: 0.55rem;
}

.tab-bar .tab-label {
    white-space: nowrap;
}

.tab-bar button[aria-current="page"] {
    color: var(--accent);
    font-weight: 600;
}

/* ----- From tablet width: sidebar instead of tab bar ----- */

@media (min-width: 768px) {

    body {
        grid-template-columns: 200px 1fr;
        grid-template-areas:
            "header header"
            "nav    main";
    }

    .tab-bar {
        position: static;
        grid-area: nav;
        height: auto;
        padding: var(--spacing) 8px;
        grid-template-columns: 1fr;
        align-content: start;
        gap: 4px;
        border-top: none;
        border-right: 1px solid var(--border);
        background: var(--bg);
    }

    .tab-bar button {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        text-align: left;
        font-size: 0.95rem;
        padding: 10px 12px;
        border-radius: var(--radius);
        min-height: 44px;
    }

    .tab-bar .tab-icon {
        font-size: 1rem;
        width: 20px;
        text-align: center;
    }

    .tab-bar button[aria-current="page"] {
        background: var(--accent-soft);
        color: var(--accent);
    }

    #app {
        padding-bottom: var(--spacing);
    }
}
