/* Skeleton de carregamento — navegação e telas de login */
.csg-main-skel {
    position: relative;
    min-height: 120px;
}
.csg-main-skel.is-loading {
    pointer-events: none;
}
.csg-main-skel-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    padding: 1.25rem 1.5rem;
    background: color-mix(in srgb, var(--csg-skel-bg, #faf8f5) 92%, transparent);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: csgSkelIn .18s ease;
}
html[data-theme="dark"] .csg-main-skel-overlay {
    --csg-skel-bg: #0f1115;
    background: color-mix(in srgb, #0f1115 94%, transparent);
}
@keyframes csgSkelIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.csg-skel-bar {
    height: 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #e8e2d8 25%, #f4f0ea 50%, #e8e2d8 75%);
    background-size: 200% 100%;
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
html[data-theme="dark"] .csg-skel-bar {
    background: linear-gradient(90deg, #1e2430 25%, #2a3140 50%, #1e2430 75%);
    background-size: 200% 100%;
}
.csg-skel-bar.w40 { width: 40%; }
.csg-skel-bar.w55 { width: 55%; }
.csg-skel-bar.w70 { width: 70%; }
.csg-skel-bar.w100 { width: 100%; }
.csg-skel-bar.h20 { height: 20px; margin-bottom: 18px; }
.csg-skel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.csg-skel-card {
    height: 88px;
    border-radius: 14px;
    background: linear-gradient(90deg, #e8e2d8 25%, #f4f0ea 50%, #e8e2d8 75%);
    background-size: 200% 100%;
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
html[data-theme="dark"] .csg-skel-card {
    background: linear-gradient(90deg, #1e2430 25%, #2a3140 50%, #1e2430 75%);
    background-size: 200% 100%;
}
.csg-skel-rows { margin-top: 4px; }
.csg-skel-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid color-mix(in srgb, #e8e2d8 70%, transparent);
}
html[data-theme="dark"] .csg-skel-row {
    border-bottom-color: #252b38;
}
.csg-skel-cell {
    height: 12px;
    border-radius: 6px;
    flex: 1;
    background: linear-gradient(90deg, #e8e2d8 25%, #f4f0ea 50%, #e8e2d8 75%);
    background-size: 200% 100%;
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
html[data-theme="dark"] .csg-skel-cell {
    background: linear-gradient(90deg, #1e2430 25%, #2a3140 50%, #1e2430 75%);
    background-size: 200% 100%;
}
.csg-skel-cell.sm { max-width: 48px; flex: 0 0 48px; }
.csg-skel-cell.md { max-width: 140px; }
/* Navegação: esconde conteúdo antigo enquanto o loader cobre a tela */
body.csg-navigating .main-content {
    visibility: hidden;
    pointer-events: none;
}
html.csg-nav-pending body {
    overflow: hidden;
}
@keyframes csgSkelPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
/* Barra fina no topo durante navegação */
.csg-nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 2147483646;
    background: linear-gradient(90deg, #e85d00, #f97316);
    transition: width .25s ease;
    pointer-events: none;
}
.csg-nav-progress.is-active {
    width: 72%;
    transition: width 8s cubic-bezier(.1, .5, .1, 1);
}
.csg-nav-progress.is-done {
    width: 100%;
    transition: width .15s ease;
    opacity: 0;
}

/* ── Skeleton boot pedido.php (espelha top-nav + categorias + cards) ── */
#pedido-boot-skel.csg-pedido-boot {
    padding: 0;
    display: flex;
    flex-direction: column;
    background: var(--csg-skel-page-bg, #f8f9fa);
}
html[data-theme="dark"] #pedido-boot-skel.csg-pedido-boot {
    --csg-skel-page-bg: #0f1115;
}
.csg-skel-topnav {
    height: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: linear-gradient(90deg, #e85d00, #f97316);
}
.csg-skel-topnav__back {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .22);
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
.csg-skel-topnav__title {
    flex: 1;
    height: 14px;
    max-width: 120px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .35);
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
.csg-skel-topnav__search {
    width: 120px;
    height: 32px;
    border-radius: 999px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, .15);
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
.csg-skel-catnav {
    flex-shrink: 0;
    padding: 8px 12px 6px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 8px;
    overflow: hidden;
}
html[data-theme="dark"] .csg-skel-catnav {
    background: #1b1e24;
    border-bottom-color: #2a2f38;
}
.csg-skel-catpill {
    height: 34px;
    width: 88px;
    border-radius: 999px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #e8e2d8 25%, #f4f0ea 50%, #e8e2d8 75%);
    background-size: 200% 100%;
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
html[data-theme="dark"] .csg-skel-catpill {
    background: linear-gradient(90deg, #1e2430 25%, #2a3140 50%, #1e2430 75%);
    background-size: 200% 100%;
}
.csg-skel-catpill--wide { width: 104px; }
.csg-skel-pedido-body {
    flex: 1;
    overflow: hidden;
    padding: 12px 14px 0;
}
.csg-skel-grupo-title {
    height: 18px;
    width: 42%;
    border-radius: 6px;
    margin-bottom: 12px;
    border-left: 3px solid #f97316;
    padding-left: 10px;
    box-sizing: content-box;
    background: linear-gradient(90deg, #e8e2d8 25%, #f4f0ea 50%, #e8e2d8 75%);
    background-size: 200% 100%;
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
html[data-theme="dark"] .csg-skel-grupo-title {
    background: linear-gradient(90deg, #1e2430 25%, #2a3140 50%, #1e2430 75%);
    background-size: 200% 100%;
}
.csg-skel-prod-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.csg-skel-prod-card {
    display: flex;
    align-items: stretch;
    min-height: 96px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, #e8e2d8 80%, transparent);
    background: #fff;
}
html[data-theme="dark"] .csg-skel-prod-card {
    background: #1b1e24;
    border-color: #2a2f38;
}
.csg-skel-prod-thumb {
    width: 88px;
    flex-shrink: 0;
    margin: 8px;
    border-radius: 14px;
    background: linear-gradient(90deg, #e8e2d8 25%, #f4f0ea 50%, #e8e2d8 75%);
    background-size: 200% 100%;
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
html[data-theme="dark"] .csg-skel-prod-thumb {
    background: linear-gradient(90deg, #1e2430 25%, #2a3140 50%, #1e2430 75%);
    background-size: 200% 100%;
}
.csg-skel-prod-body {
    flex: 1;
    padding: 14px 12px 14px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}
.csg-skel-prod-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #e8e2d8 25%, #f4f0ea 50%, #e8e2d8 75%);
    background-size: 200% 100%;
    animation: csgSkelPulse 1.15s ease-in-out infinite;
}
html[data-theme="dark"] .csg-skel-prod-line {
    background: linear-gradient(90deg, #1e2430 25%, #2a3140 50%, #1e2430 75%);
    background-size: 200% 100%;
}
.csg-skel-prod-line.w80 { width: 80%; }
.csg-skel-prod-line.w45 { width: 45%; }
.csg-skel-prod-line.w30 { width: 30%; }

/* Formulário de login/admin aguardando snapshot */
.csg-form-skel-wrap {
    position: relative;
}
.csg-form-skel-wrap.is-syncing .card-form {
    visibility: hidden;
    min-height: 220px;
}
.csg-form-skel-wrap .csg-form-skel {
    display: none;
    position: absolute;
    inset: 0;
    padding: 0 0 8px;
}
.csg-form-skel-wrap.is-syncing .csg-form-skel {
    display: block;
}
