/* =============================================================
   FLOWLY — APP SHELL
   Sidebar: aberta (fixa) ou recolhida em trilho de ícones com tooltip.
   Não abre no hover — antes empurrava a página toda (2026-09-28).
   Depende de: _tokens.css, _reset.css
   ============================================================= */

/* ----------------------------------------------------------------
   GRID PRINCIPAL
   Sidebar ocupa uma coluna fixa. Conteúdo ocupa o resto.
   Aberta: alarga a margem do conteúdo via transition.
----------------------------------------------------------------- */
.app-shell {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ----------------------------------------------------------------
   APP MAIN
   Padding simétrico — sem compensação de sidebar.
   O grid cuida do espaço. Centrar fica por conta de cada view
   via max-width + margin: 0 auto.
----------------------------------------------------------------- */
.app-main {
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    margin-left: var(--flowly-sidebar-icon-width);
    padding: var(--flowly-space-6) clamp(var(--flowly-space-4), 2.5vw, var(--flowly-space-8));
    transition: margin-left 0.24s var(--flowly-ease-out);
}

body.sidebar-pinned .app-main {
    margin-left: var(--flowly-sidebar-width);
}

/* ----------------------------------------------------------------
   SIDEBAR DESKTOP
   - position: sticky — fica no grid, cola no topo no scroll
   - Padrão: 56px (só ícones, coluna do grid = 56px)
   - Pinned: coluna do grid vira 216px — sidebar não transborda
----------------------------------------------------------------- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: var(--flowly-sidebar-icon-width);
    overflow: hidden;
    background: var(--flowly-bg-sidebar, rgba(10, 11, 15, 0.98));
    border-right: 1px solid var(--flowly-border-muted);
    backdrop-filter: blur(var(--flowly-blur-panel));
    -webkit-backdrop-filter: blur(var(--flowly-blur-panel));
    z-index: var(--flowly-z-sidebar);
    transition: width 0.22s var(--flowly-ease-out),
                box-shadow 0.22s var(--flowly-ease-out),
                border-color 0.22s;
}

/* .hidden-mobile { display: block } (mais abaixo neste arquivo) tem a mesma
   especificidade e venceria o display:flex acima por ordem — o que quebra o
   layout em coluna: o nav para de rolar e o footer (Ajustes) cai pra fora da
   tela em janelas baixas. Esta regra (0,2,0) restaura o flex no desktop.
   No mobile a sidebar continua display:none !important (@media abaixo). */
.app-sidebar.hidden-mobile { display: flex; }

.app-sidebar::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 13px;
    width: 30px;
    height: 30px;
    border-radius: calc(8px * var(--flowly-radius-k));
    background: url('../flowly-logo.png') center / 30px 30px no-repeat;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 1;
}

/* Pinned: expande sem sombra (layout já ajustou via padding-left) */
body.sidebar-pinned .app-sidebar {
    width: var(--flowly-sidebar-width);
    box-shadow: none;
}

body.sidebar-pinned .app-sidebar::before {
    opacity: 0;
}

/* ----------------------------------------------------------------
   SIDEBAR TOPO: brand + toggle
----------------------------------------------------------------- */
.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: var(--flowly-space-1);
    align-items: center;
    padding: 16px 0 12px;
    flex-shrink: 0;
}

.sidebar-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    gap: 8px;
    padding: 0;
    min-height: 36px;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 4px;
    border-radius: var(--flowly-radius-md);
    opacity: 0;
    pointer-events: none;
    transition: background var(--flowly-duration-fast), opacity 0.12s ease;
}

.sidebar-brand:hover {
    background: var(--flowly-bg-glass);
}

.sidebar-brand-mark {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: calc(8px * var(--flowly-radius-k));
    flex-shrink: 0;
}

/* O PNG já é o quadrado branco arredondado — sem container por fora (moldura dupla). */
.sidebar-brand-mark svg,
.sidebar-brand-mark img {
    width: 30px;
    height: 30px;
    border-radius: calc(8px * var(--flowly-radius-k));
    object-fit: contain;
}

body.sidebar-pinned .app-sidebar .sidebar-top {
    align-items: stretch;
    padding: 16px 10px 10px;
}

body.sidebar-pinned .app-sidebar .sidebar-header-row {
    justify-content: space-between;
}

body.sidebar-pinned .app-sidebar .sidebar-brand {
    justify-content: flex-start;
    gap: 12px;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: auto;
    padding: var(--flowly-space-1);
    opacity: 1;
    pointer-events: auto;
}

.sidebar-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    /* Transição de opacidade para entrada suave */
    opacity: 0;
    max-width: 0;
    transition: opacity 0.14s ease 0.06s,
                max-width 0.22s var(--flowly-ease-out);
}

body.sidebar-pinned .app-sidebar .sidebar-brand-copy {
    opacity: 1;
    max-width: 112px;
}

.sidebar-brand-copy strong {
    font-size: calc(15px * var(--flowly-text-k));
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--flowly-text-primary);
    white-space: nowrap;
}

.sidebar-brand-copy span {
    font-size: calc(9px * var(--flowly-text-k));
    color: var(--flowly-text-tertiary);
    font-family: var(--flowly-font-mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Toggle (pin) button — só visível quando sidebar expandida */
.sidebar-toggle {
    flex: 0 0 auto;
    margin-left: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease 0.06s;
}

body.sidebar-pinned .app-sidebar .sidebar-toggle {
    opacity: 1;
    pointer-events: auto;
}

/* Search nav button — separado visualmente dos itens de view */
.sidebar-nav-btn--search {
    color: var(--flowly-text-tertiary);
    margin-bottom: 2px;
    border: 1px dashed transparent;
}
.sidebar-nav-btn--search:hover {
    color: var(--flowly-text-primary);
    border-color: var(--flowly-border, rgba(255, 255, 255, 0.08));
}

/* ----------------------------------------------------------------
   SIDEBAR NAVEGAÇÃO
----------------------------------------------------------------- */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--flowly-space-2) 8px;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

/* Rótulo de seção (Dia a dia / Trabalho / Pessoal). Recolhida: vira um traço curto. */
.sidebar-nav-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    margin: 8px 0 2px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-nav-section::before {
    content: '';
    width: 14px;
    height: 1px;
    background: var(--flowly-border-muted);
}
.sidebar-nav-section span {
    display: none;
    font-size: calc(10px * var(--flowly-text-k));
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--flowly-text-tertiary);
    opacity: 0.8;
}
body.sidebar-pinned .app-sidebar .sidebar-nav-section {
    justify-content: flex-start;
    padding: 0 10px;
    margin: 10px 0 2px;
}
body.sidebar-pinned .app-sidebar .sidebar-nav-section::before { display: none; }
body.sidebar-pinned .app-sidebar .sidebar-nav-section span { display: inline; }

.sidebar-nav-btn {
    display: flex;
    align-items: center;
    /* Icon-only default: centralizado na sidebar de 56px */
    justify-content: center;
    gap: 0;
    padding: 7px 6px;
    border-radius: calc(10px * var(--flowly-radius-k));
    color: var(--flowly-text-secondary);
    font-size: calc(13px * var(--flowly-text-k));
    font-weight: 500;
    transition: background 140ms ease, color 140ms ease, opacity 140ms ease, transform 0.14s ease;
    min-height: 36px;
    width: 100%;
    white-space: nowrap;
    position: relative;
}

.sidebar-nav-btn:hover {
    background: var(--flowly-bg-glass);
    color: var(--flowly-text-primary);
    transform: translateX(2px);
}

.sidebar-nav-btn.active {
    background: rgb(var(--flowly-accent-primary-rgb) / 0.075);
    color: var(--flowly-text-primary);
    font-weight: 600;
}

/* Borda esquerda sutil no item ativo (alinha com dot indicator) */
.sidebar-nav-btn.active::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 999px;
    background: var(--flowly-accent-primary);
    opacity: 0;
    transition: opacity 0.22s, height 0.22s var(--flowly-ease-out);
}

/* Mostra dot só quando icon-only (não expandida) */
.sidebar-nav-btn.active::before {
    opacity: 1;
}

/* Na sidebar expandida: o dot vira pill mais alto e largo, integrado ao item */
body.sidebar-pinned .app-sidebar .sidebar-nav-btn.active::before {
    height: 20px;
    opacity: 0.9;
}

.sidebar-nav-btn i {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.sidebar-nav-btn span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Entrada suave */
    opacity: 0;
    max-width: 0;
    transition: opacity 0.14s ease 0.04s,
                max-width 0.22s var(--flowly-ease-out);
}

/* Expanded: alinha à esquerda com gap e padding */
body.sidebar-pinned .app-sidebar .sidebar-nav-btn {
    justify-content: flex-start;
    gap: 10px;
    padding: 7px 10px;
}

body.sidebar-pinned .app-sidebar .sidebar-nav-btn i {
    width: 20px;
    height: 20px;
}

body.sidebar-pinned .app-sidebar .sidebar-nav-btn span {
    opacity: 1;
    max-width: 138px;
    text-align: left;
}

.sidebar-nav-btn--ghost {
    opacity: 0.6;
}

/* ----------------------------------------------------------------
   SIDEBAR SUB-NAVIGATION — grupos com sub-páginas (Notion-style)
----------------------------------------------------------------- */

/* Wrapper do grupo (item + toggle + filhos) */
.sidebar-nav-group {
    display: flex;
    flex-direction: column;
}

/* Linha do item do grupo */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    min-width: 0;
}

.sidebar-nav-item .sidebar-nav-btn {
    flex: 1;
    min-width: 0;
}

/* Container dos filhos — animação via grid-template-rows. Expandido, ganha uma
   linha-guia à esquerda alinhada sob o ícone do pai (páginas "dentro" da aba). */
.sidebar-nav-children {
    list-style: none;
    margin: 0;
    padding: 0 0 0 8px;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.22s var(--flowly-ease-out);
    overflow: hidden;
    pointer-events: none;
}

/* Inner wrapper — min-height: 0 garante que grid 0fr colapsa totalmente.
   Padding aplica só quando grupo expande (regra abaixo). */
.sidebar-nav-children__inner {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0;
    min-height: 0;
    pointer-events: all;
}

/* Padding interno só com a barra aberta — evita peek de 4px no collapsed */
body.sidebar-pinned .app-sidebar .sidebar-nav-children__inner {
    padding: 2px 0 4px 8px;
    margin-left: 12px;
    border-left: 1px solid var(--flowly-border-muted);
}

.sidebar-nav-children[hidden] { display: none; }

/* Sub-lista sempre aberta com a barra aberta (não recolhe mais) */
body.sidebar-pinned .app-sidebar .sidebar-nav-children:not([hidden]) {
    grid-template-rows: 1fr;
}

/* Botão de sub-página */
.sidebar-nav-sub {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 8px;
    border-radius: calc(6px * var(--flowly-radius-k));
    width: 100%;
    font-size: calc(12px * var(--flowly-text-k));
    font-weight: 500;
    color: var(--flowly-text-tertiary);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 100ms, color 100ms;
    min-width: 0;
    min-height: 30px;
}

.sidebar-nav-sub:hover {
    background: var(--flowly-bg-glass);
    color: var(--flowly-text-secondary);
}

/* Ativo: texto na cor de destaque (a linha-guia do grupo já situa a hierarquia). */
.sidebar-nav-sub.active {
    color: var(--flowly-accent-primary);
    background: rgb(var(--flowly-accent-primary-rgb) / 0.08);
    font-weight: 600;
}

/* Projetos da sub-lista: ponto na cor do projeto, nome e, à direita,
   "atraso" (laranja) ou o % feito. Mesmas cores do kanban (projects.css). */
.sidebar-nav-sub__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav-sub__meta {
    flex-shrink: 0;
    font-size: calc(10.5px * var(--flowly-text-k));
    font-weight: 600;
    color: var(--flowly-text-tertiary);
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}
.sidebar-nav-sub__meta.is-alert { color: var(--flowly-accent-warning, #FF9F0A); opacity: 1; }
.sidebar-nav-sub__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--proj-accent, var(--flowly-accent-info));
}
.sidebar-nav-sub[data-project-color="blue"]   { --proj-accent: var(--flowly-accent-info); }
.sidebar-nav-sub[data-project-color="purple"] { --proj-accent: var(--flowly-accent-purple); }
.sidebar-nav-sub[data-project-color="pink"]   { --proj-accent: #FF375F; }
.sidebar-nav-sub[data-project-color="green"]  { --proj-accent: var(--flowly-accent-success); }
.sidebar-nav-sub[data-project-color="amber"]  { --proj-accent: var(--flowly-accent-warning); }
.sidebar-nav-sub[data-project-color="red"]    { --proj-accent: var(--flowly-accent-danger); }
.sidebar-nav-sub[data-project-color="cyan"]   { --proj-accent: #64D2FF; }
.sidebar-nav-sub[data-project-color="slate"]  { --proj-accent: #8E8E93; }

.sidebar-nav-sub--project {
    font-weight: 450;
    font-size: calc(12px * var(--flowly-text-k));
    min-height: 28px;
    color: var(--flowly-text-tertiary);
}
.sidebar-nav-sub--project:hover { color: var(--flowly-text-primary); }
.sidebar-nav-sub--more {
    font-size: calc(11.5px * var(--flowly-text-k));
    min-height: 26px;
    padding-left: 21px;
    color: var(--flowly-text-tertiary);
    opacity: 0.75;
}

/* ----------------------------------------------------------------
   CONTADORES VIVOS (sidebar.js → renderBadges)
   Aberta: número discreto à direita (atenção em laranja; treino = ponto).
   Recolhida: só os de atenção viram um ponto no canto do ícone.
----------------------------------------------------------------- */
.sidebar-nav-badge {
    display: none;
    flex-shrink: 0;
    margin-left: auto;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-style: normal;
    font-size: calc(11px * var(--flowly-text-k));
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    color: var(--flowly-text-tertiary);
    font-variant-numeric: tabular-nums;
}
.sidebar-nav-badge[hidden] { display: none !important; }
body.sidebar-pinned .app-sidebar .sidebar-nav-badge { display: inline-block; }
body.sidebar-pinned .app-sidebar .sidebar-nav-badge.is-alert {
    color: var(--flowly-accent-warning, #FF9F0A);
    background: rgb(255 159 10 / 0.12);
}
body.sidebar-pinned .app-sidebar .sidebar-nav-badge.is-dot {
    min-width: 0;
    width: 7px;
    height: 7px;
    padding: 0;
    margin-right: 6px;
    background: var(--flowly-accent-warning, #FF9F0A);
}
body:not(.sidebar-pinned) .app-sidebar .sidebar-nav-badge.is-alert {
    display: block;
    position: absolute;
    top: 6px;
    left: calc(50% + 5px);
    width: 7px;
    height: 7px;
    min-width: 0;
    padding: 0;
    font-size: 0;
    background: var(--flowly-accent-warning, #FF9F0A);
    box-shadow: 0 0 0 2px var(--flowly-bg-body, #08090e);
}

/* ----------------------------------------------------------------
   RECOLHIDA = trilho de ícones (sem abrir no hover, sem empurrar a página).
   O botão de abrir fica por cima do logo e aparece ao passar o mouse nele.
----------------------------------------------------------------- */
body:not(.sidebar-pinned) .app-sidebar .sidebar-toggle {
    position: absolute;
    top: 15px;
    left: 10px;
    width: 36px;
    height: 36px;
    margin: 0;
    display: grid;
    place-items: center;
    border-radius: calc(10px * var(--flowly-radius-k));
    z-index: 2;
    opacity: 0;
    pointer-events: auto;
}
body:not(.sidebar-pinned) .app-sidebar .sidebar-toggle:hover,
body:not(.sidebar-pinned) .app-sidebar .sidebar-toggle:focus-visible {
    opacity: 1;
    background: var(--flowly-bg-glass);
}
body:not(.sidebar-pinned) .app-sidebar:has(.sidebar-toggle:hover)::before,
body:not(.sidebar-pinned) .app-sidebar:has(.sidebar-toggle:focus-visible)::before { opacity: 0; }

/* Tooltip ao lado do trilho: nome · contador · atalho */
.sidebar-tip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: calc(var(--flowly-z-sidebar) + 5);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 10px;
    border-radius: calc(8px * var(--flowly-radius-k));
    background: linear-gradient(var(--flowly-bg-elevated, rgba(14, 15, 20, 0.78)), var(--flowly-bg-elevated, rgba(14, 15, 20, 0.78))), var(--flowly-bg-body, #08090e);
    border: 1px solid var(--flowly-border, rgba(255, 255, 255, 0.08));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    font-size: calc(12.5px * var(--flowly-text-k));
    font-weight: 500;
    color: var(--flowly-text-primary);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.sidebar-tip.is-open { opacity: 1; }
.sidebar-tip__meta { color: var(--flowly-text-tertiary); font-size: calc(11.5px * var(--flowly-text-k)); }
.sidebar-tip kbd {
    font-family: inherit;
    font-size: calc(10.5px * var(--flowly-text-k));
    font-weight: 600;
    color: var(--flowly-text-tertiary);
    padding: 1px 5px;
    border-radius: calc(5px * var(--flowly-radius-k));
    border: 1px solid var(--flowly-border-muted, rgba(255, 255, 255, 0.08));
}

/* ----------------------------------------------------------------
   SIDEBAR FOOTER
----------------------------------------------------------------- */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: var(--flowly-space-1);
    padding: var(--flowly-space-2) 8px var(--flowly-space-4);
    border-top: 1px solid var(--flowly-border-muted);
    flex-shrink: 0;
}

/* Rodapé: Ajustes e o toggle de tema na MESMA linha (recolhida: empilhados,
   centralizados). O pin/recolher mora no topo, ao lado da marca. */
.sidebar-footer-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
}
body.sidebar-pinned .app-sidebar .sidebar-footer-row {
    flex-direction: row;
    align-items: center;
}
.sidebar-footer-row .sidebar-nav-btn { flex: 1; min-width: 0; }

/* Botão utilitário sempre visível (tema): ícone só, mesmo tamanho dos itens recolhidos. */
.sidebar-util-btn {
    display: inline-grid;
    place-items: center;
    width: 100%;
    min-height: 36px;
    border-radius: calc(10px * var(--flowly-radius-k));
    background: transparent;
    border: none;
    color: var(--flowly-text-tertiary);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}
.sidebar-util-btn i,
.sidebar-util-btn svg { width: 20px; height: 20px; }
.sidebar-util-btn:hover {
    background: var(--flowly-bg-glass);
    color: var(--flowly-text-primary);
}
body.sidebar-pinned .app-sidebar .sidebar-util-btn {
    width: 36px;
    flex: 0 0 36px;
}

/* Sync status indicator (sidebar footer chip) */
.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin: 0 4px 4px;
    background: var(--flowly-bg-glass, rgba(255, 255, 255, 0.025));
    border: 1px solid var(--flowly-border, rgba(255, 255, 255, 0.06));
    border-radius: calc(8px * var(--flowly-radius-k));
    font-size: calc(11px * var(--flowly-text-k));
    color: var(--flowly-text-tertiary);
    min-height: 26px;
    cursor: default;
    transition: opacity 140ms ease, background 200ms ease, border-color 200ms ease;
    overflow: hidden;
}
.sync-status:hover {
    background: var(--flowly-bg-glass, rgba(255, 255, 255, 0.04));
    border-color: var(--flowly-border-strong, rgba(255, 255, 255, 0.1));
}
.sync-status.hidden { display: none; }
.sync-status__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--flowly-text-tertiary);
    flex-shrink: 0;
    box-shadow: 0 0 0 0 currentColor;
    transition: background 140ms, box-shadow 140ms;
}
.sync-status__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0;
    max-width: 0;
    transition: opacity 0.14s ease 0.04s, max-width 0.18s var(--flowly-ease-out);
}
body.sidebar-pinned .app-sidebar .sync-status__text {
    opacity: 1;
    max-width: 140px;
}

/* States */
.sync-status[data-state="saved"] .sync-status__dot,
.sync-status[data-state="idle"] .sync-status__dot {
    background: var(--flowly-accent-success, #22c55e);
    box-shadow: 0 0 6px rgb(var(--flowly-accent-success-rgb) / 0.5);
}
.sync-status[data-state="saved"] .sync-status__text {
    color: var(--flowly-accent-success-soft, #86efac);
}
.sync-status[data-state="syncing"] .sync-status__dot {
    background: var(--flowly-accent-info, #0A84FF);
    box-shadow: 0 0 8px rgb(var(--flowly-accent-info-rgb) / 0.6);
    animation: sync-pulse 1.2s ease-in-out infinite;
    position: relative;
}
.sync-status[data-state="syncing"] .sync-status__dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid rgb(var(--flowly-accent-info-rgb) / 0.6);
    animation: sync-halo 1.2s ease-out infinite;
}
.sync-status[data-state="syncing"] .sync-status__text {
    color: var(--flowly-accent-info, #0A84FF);
}

@keyframes sync-halo {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}
.sync-status[data-state="offline"] .sync-status__dot {
    background: var(--flowly-accent-warning, #FF9F0A);
}
.sync-status[data-state="offline"] .sync-status__text {
    color: var(--flowly-accent-warning, #FF9F0A);
}
.sync-status[data-state="error"] {
    background: rgba(255, 92, 77, 0.08);
    border-color: rgba(255, 92, 77, 0.2);
}
.sync-status[data-state="error"] .sync-status__dot {
    background: var(--flowly-accent-danger, #FF5C4D);
}
.sync-status[data-state="error"] .sync-status__text {
    color: var(--flowly-accent-danger, #FF5C4D);
}

/* Saved flash: pisca brevemente o bg verde quando sync termina */
.sync-status[data-state="saved"] {
    animation: sync-saved-flash 0.6s ease-out;
}

@keyframes sync-saved-flash {
    0% { background: rgb(var(--flowly-accent-success-rgb) / 0.15); }
    100% { background: rgba(255, 255, 255, 0.025); }
}

@keyframes sync-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.5); }
    50%      { box-shadow: 0 0 0 5px rgba(10, 132, 255, 0); }
}

@keyframes view-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.view-fade-in {
    animation: view-fade-in var(--flowly-duration-base, 220ms) var(--flowly-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}
@media (prefers-reduced-motion: reduce) {
    .view-fade-in { animation: none; }
}

/* ----------------------------------------------------------------
   UTILITY BUTTON (toggle sidebar, semana nav, etc.)
----------------------------------------------------------------- */
.utility-btn {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--flowly-radius-md);
    background: transparent;
    color: var(--flowly-text-tertiary);
    transition: background 120ms ease, color 120ms ease;
    flex-shrink: 0;
}

.utility-btn:hover {
    background: var(--flowly-bg-glass);
    color: var(--flowly-text-primary);
}

/* ----------------------------------------------------------------
   MOBILE BOTTOM NAV
----------------------------------------------------------------- */
.hidden-mobile { display: block; }

/* Mostra nav mobile, esconde sidebar, ajusta padding */
@media (max-width: 768px) {
    .hidden-mobile { display: none; }

    .app-shell {
        display: block;
        transition: none;
    }

    .app-sidebar {
        display: none !important;
    }

    .app-main {
        margin-left: 0;
        padding: var(--flowly-space-4) var(--flowly-space-3);
        padding-left: var(--flowly-space-3);
        padding-bottom: calc(var(--flowly-mobile-nav-height) + var(--flowly-space-5));
        max-width: 100%;
    }

    /* Exibe a bottom nav (por padrão fica display:none em _components.css) */
    .flowly-bottom-nav {
        display: block;
    }
}

/* Botões da bottom nav */
.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 48px;
    color: var(--flowly-text-tertiary);
    transition: background var(--flowly-duration-fast) var(--flowly-ease-out),
                color var(--flowly-duration-fast) var(--flowly-ease-out),
                transform var(--flowly-duration-fast) var(--flowly-ease-out);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: var(--flowly-radius-lg);
}

.mobile-nav-btn i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mobile-nav-btn span {
    font-size: calc(10px * var(--flowly-text-k));
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    margin-top: 4px;
    color: inherit;
}

.mobile-nav-btn:hover,
.mobile-nav-btn.active {
    color: var(--flowly-accent-primary);
}

.mobile-nav-btn.active {
    background: rgb(var(--flowly-accent-primary-rgb) / 0.12);
    transform: translateY(-1px);
}

.mobile-nav-btn.active i {
    filter: drop-shadow(0 0 6px rgb(var(--flowly-accent-primary-rgb) / 0.4));
}

/* ----------------------------------------------------------------
   WEEK VIEW — full width, sem padding lateral do app-main
   :has() suportado Chrome 105+, Safari 15.4+, Firefox 121+
----------------------------------------------------------------- */
.app-main:has(#weekGrid.week-grid:not(.hidden)) {
    padding-inline: 0;
    padding-top: 0;
}

/* #weekNav ganha seu próprio padding horizontal */
#weekNav:not(.hidden) {
    padding: 20px 28px 16px;
    border-bottom: 1px solid var(--flowly-border-subtle, rgba(255, 255, 255, 0.04));
    margin-bottom: 0;
}

/* Garante que o weekNav dentro do app-main sem padding fique ok */
#weekNav.flowly-page-header {
    margin-bottom: 0;
    padding-bottom: 14px;
}

/* ----------------------------------------------------------------
   CONTENT AREA
----------------------------------------------------------------- */
#contentArea { width: 100%; }

/* ----------------------------------------------------------------
   TODAY STRIP
----------------------------------------------------------------- */

/* =============================================================
   VIEW TRANSITIONS (fade entre views)
   ============================================================= */
.flowly-view-content--in {
    animation: view-content-in 380ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes view-content-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .flowly-view-content--in { animation: none; }
}

/* =============================================================
   SPLASH SCREEN (loading inicial)
   ============================================================= */
.flowly-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: radial-gradient(ellipse at center, #131518 0%, #0a0b0d 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    opacity: 1;
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
.flowly-splash--hidden {
    opacity: 0;
    pointer-events: none;
}
.flowly-splash__art {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.flowly-splash__logo {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.25));
    animation: flowly-splash-pulse 1.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.flowly-splash__logo svg { width: 100%; height: 100%; }
.flowly-splash__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.flowly-splash__title {
    font-family: var(--flowly-font-display);
    font-size: calc(32px * var(--flowly-text-k));
    font-weight: 700;
    color: var(--flowly-text-primary);
    letter-spacing: -0.02em;
}
.flowly-splash__tag {
    font-size: calc(13px * var(--flowly-text-k));
    color: var(--flowly-text-tertiary);
    letter-spacing: 0.02em;
}
.flowly-splash__progress {
    width: 200px;
    height: 3px;
    background: var(--flowly-bg-glass, rgba(255, 255, 255, 0.06));
    border-radius: calc(2px * var(--flowly-radius-k));
    overflow: hidden;
    position: relative;
}
.flowly-splash__bar {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #ffffff, rgba(255, 255, 255, 0.55));
    border-radius: calc(2px * var(--flowly-radius-k));
    transform: translateX(-100%);
    animation: flowly-splash-progress 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.18);
}
@keyframes flowly-splash-progress {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}
@keyframes flowly-splash-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.25)); }
    50% { transform: scale(1.06); filter: drop-shadow(0 0 36px rgba(255, 255, 255, 0.45)); }
}
@media (prefers-reduced-motion: reduce) {
    .flowly-splash__logo { animation: none; }
    .flowly-splash__bar { animation-duration: 3s; }
}

/* ----------------------------------------------------------------
   "Só a lista" (Hoje): barra lateral escondida, revelada ao encostar
   o ponteiro na borda esquerda (.sidebar-edge-zone). Por cima do conteúdo,
   sem deslocar a página. Só desktop — no mobile a sidebar já não existe.
----------------------------------------------------------------- */
.sidebar-edge-zone { display: none; }
@media (min-width: 769px) {
    body.sidebar-autohide .sidebar-edge-zone {
        display: block;
        position: fixed;
        top: 0; bottom: 0; left: 0;
        width: 6px;
        z-index: calc(var(--flowly-z-sidebar) + 1);
    }
    body.sidebar-autohide.sidebar-peek .sidebar-edge-zone { display: none; }
    body.sidebar-autohide .app-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        transition: transform var(--flowly-duration-base) var(--flowly-ease-out),
                    width 0.22s var(--flowly-ease-out),
                    box-shadow 0.22s var(--flowly-ease-out);
    }
    body.sidebar-autohide.sidebar-peek .app-sidebar {
        transform: none;
        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.34), 1px 0 0 rgba(255, 255, 255, 0.05);
    }
    /* Conteúdo usa a largura toda e não pula quando a barra aparece por cima
       (vence o margin do pinned, que tem mais especificidade). */
    body.sidebar-autohide .app-main { margin-left: 0 !important; }
}
