/* ── Barra inferior mobile + folha "mais" (PLANNER-293) ──────────────
   Só vale em <=600px; acima disso o nav de desktop (nav.css) continua o
   único visível. O nav de desktop é escondido em mobile.css. */
.nav-mobile,
.more-sheet,
.nm-toast,
.back-bar,
.period-seg { display: none; }

@media (max-width: 600px) {
    .nav-mobile {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
        padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom));
        background: var(--bg);
        border-top: 1px solid var(--line);
        transition: transform 0.22s ease;
    }
    .nav-mobile.nm-hidden,
    .nav-mobile.nm-kbd { transform: translateY(110%); }

    .nm-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.15rem;
        min-height: 52px;
        border-radius: var(--radius-lg);
        background: none;
        border: 0;
        color: var(--dim);
        font: inherit;
        font-size: 0.66rem;
        line-height: 1.2;
        text-decoration: none;
        text-transform: lowercase;
        letter-spacing: 0.02em;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .nm-item svg {
        width: 23px;
        height: 23px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .nm-item.on { color: var(--accent); }

    /* O slot do "+" tem a mesma caixa dos outros (mesma linha); só o disco
       sobe, para a barra continuar numa linha só. */
    .nm-plus { color: var(--accent-ink); }
    .nm-disc {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: var(--accent);
        transform: translateY(-10px);
        box-shadow: 0 6px 18px oklch(0 0 0 / 0.45), 0 0 0 5px var(--bg);
    }
    .nm-plus svg { width: 26px; height: 26px; stroke-width: 2.4; }

    /* ── Folha "mais" ── */
    .more-sheet[open] {
        display: block;
        position: fixed;
        inset: auto 0 0 0;
        width: 100%;
        max-width: 100%;
        max-height: 82vh;
        max-height: 82dvh;
        margin: 0;
        overflow-y: auto;
        padding: 0.6rem 1rem calc(1.6rem + env(safe-area-inset-bottom));
        color: var(--txt);
        background: var(--panel);
        border: 0;
        border-top: 1px solid var(--line);
        border-radius: 22px 22px 0 0;
    }
    .more-sheet::backdrop { background: oklch(0 0 0 / 0.55); }

    .ms-grab {
        width: 38px;
        height: 4px;
        margin: 0 auto 0.9rem;
        border-radius: var(--radius-pill);
        background: var(--line);
    }
    .ms-search {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0 0.8rem;
        background: var(--bg);
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
    }
    .ms-search svg {
        width: 18px;
        height: 18px;
        flex: none;
        stroke: var(--dim);
        fill: none;
        stroke-width: 2;
    }
    .ms-search input {
        flex: 1;
        min-width: 0;
        min-height: 44px;
        color: var(--txt);
        background: none;
        border: 0;
        outline: none;
        font: inherit;
        font-size: 0.85rem;
    }
    .more-sheet h3 {
        margin: 1.1rem 0 0.45rem;
        color: var(--accent);
        font-size: 0.66rem;
        font-weight: 600;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }
    .ms-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.45rem;
    }
    .ms-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
    .ms-grid a,
    .ms-chips a {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        min-height: 46px;
        padding: 0 0.25rem;
        color: var(--txt);
        background: var(--bg);
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        font-size: 0.76rem;
        text-align: center;
        text-decoration: none;
        overflow-wrap: anywhere;
    }
    .ms-chips a { padding: 0 0.9rem; border-radius: var(--radius-pill); }
    .ms-chips a.ms-all { color: var(--accent); }
    /* [hidden] perde para o display:flex dos links acima sem isto. */
    .more-sheet [hidden] { display: none !important; }
    .ms-empty { margin-top: 0.8rem; color: var(--dim); font-size: 0.75rem; }

    /* ── "‹ voltar" fixo no topo + seletor dia|sem|mês|ano (PLANNER-295) ── */
    .back-bar {
        display: flex;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9;
        height: 48px;
        padding: 0 0.5rem;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
    }
    .back-bar a {
        display: flex;
        align-items: center;
        gap: 0.2rem;
        min-height: 44px;
        max-width: 100%;
        padding: 0 0.7rem;
        color: var(--accent);
        border-radius: var(--radius-md);
        font-size: 0.88rem;
        text-decoration: none;
    }
    .back-bar a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    main[data-has-back] { padding-top: calc(48px + 1rem); }
    main[data-has-back] .note-breadcrumb { display: none; }

    .period-seg {
        display: flex;
        gap: 3px;
        margin-bottom: 1rem;
        padding: 3px;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
    }
    .period-seg a {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 36px;
        color: var(--dim);
        border-radius: var(--radius-sm);
        font-size: 0.78rem;
        text-decoration: none;
    }
    .period-seg a.on { color: var(--accent-ink); background: var(--accent); font-weight: 600; }

    /* ── Folha de captura "+" (PLANNER-294) ── */
    .capture-sheet .cs-title { margin-top: 0; }
    .capture-sheet textarea {
        width: 100%;
        min-height: 92px;
        margin: 0.3rem 0 0.7rem;
        padding: 0.7rem 0.8rem;
        color: var(--txt);
        background: var(--bg);
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        font: inherit;
        font-size: 0.9rem;
        resize: none;
    }
    .cs-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        min-height: 40px;
        padding: 0 0.9rem;
        color: var(--txt);
        background: var(--bg);
        border: 1px solid var(--line);
        border-radius: var(--radius-pill);
        font: inherit;
        font-size: 0.8rem;
        cursor: pointer;
    }
    .cs-chip.sel { color: var(--accent); border-color: var(--accent); }
    .cs-ctx-row { margin-top: 0.7rem; }
    .cs-chip.cs-ctx { color: var(--accent); border-color: var(--accent); }
    .cs-nolink { margin-top: 0.6rem; color: var(--dim); font-size: 0.75rem; }
    .cs-error { margin-top: 0.7rem; color: var(--danger); font-size: 0.78rem; }
    .cs-save {
        width: 100%;
        min-height: 46px;
        margin-top: 0.9rem;
        color: var(--accent-ink);
        background: var(--accent);
        border: 0;
        border-radius: var(--radius-lg);
        font: inherit;
        font-size: 0.88rem;
        font-weight: 600;
        cursor: pointer;
    }
    .cs-save:disabled { opacity: 0.6; }

    .nm-toast {
        display: block;
        position: fixed;
        left: 50%;
        top: 0.8rem;
        z-index: 40;
        padding: 0.35rem 0.8rem;
        color: var(--bg);
        background: var(--txt);
        border-radius: var(--radius-pill);
        font-size: 0.75rem;
        white-space: nowrap;
        max-width: calc(100vw - 2rem);
        overflow: hidden;
        text-overflow: ellipsis;
        opacity: 0;
        pointer-events: none;
        transform: translate(-50%, -8px);
        transition: opacity 0.2s, transform 0.2s;
    }
    .nm-toast.on { opacity: 1; transform: translate(-50%, 0); }
}

.ms-dot {
    display: inline-block;
    flex: none;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
}

/* /projects/lista (PLANNER-293): lista só de nomes, linha de 46px. */
.pl-with-tasks {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    margin-bottom: 0.6rem;
    padding: 0 0.9rem;
    color: var(--accent);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    font-size: 0.82rem;
    text-decoration: none;
}
.pl-list { list-style: none; }
.pl-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 46px;
    color: var(--txt);
    border-top: 1px solid var(--line);
    text-decoration: none;
}
.pl-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pl-chev { color: var(--dim); }

@media (prefers-reduced-motion: reduce) {
    .nav-mobile { transition: none; }
}
