/* =========================================================
   DB PDV · Ferramentas globais do cabeçalho
   Sino de notificações + alternância claro/escuro.
   ========================================================= */
.app-shell-tools {
    position: relative;
    z-index: 240;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.shell-notifications {
    position: relative;
    display: inline-flex;
}

.shell-tool-button {
    position: relative;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: color-mix(in srgb, var(--card) 94%, transparent);
    color: var(--text);
    box-shadow: 0 5px 16px rgba(52, 34, 24, .07);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.shell-tool-button:hover,
.shell-tool-button:focus-visible,
.shell-notifications.is-open .shell-bell-button {
    transform: translateY(-1px);
    border-color: rgba(255, 105, 8, .42);
    background: color-mix(in srgb, var(--card) 84%, var(--orange) 16%);
    box-shadow: 0 8px 20px rgba(52, 34, 24, .11);
    outline: none;
}

.shell-bell-icon {
    position: relative;
    display: block;
    width: 16px;
    height: 17px;
    border: 2px solid currentColor;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom: 0;
    transform: translateY(-1px);
}

.shell-bell-icon::before {
    content: "";
    position: absolute;
    left: -4px;
    right: -4px;
    bottom: -4px;
    height: 5px;
    border: 2px solid currentColor;
    border-top: 0;
    border-radius: 0 0 9px 9px;
}

.shell-bell-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -8px;
    width: 5px;
    height: 3px;
    border-radius: 0 0 5px 5px;
    background: currentColor;
    transform: translateX(-50%);
}

.shell-theme-button span {
    font-size: 20px;
    line-height: 1;
    font-weight: 800;
}

.shell-notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid var(--card);
    border-radius: 999px;
    background: #e7293f;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    font-weight: 850;
    box-shadow: 0 4px 10px rgba(194, 23, 43, .26);
}

.shell-notification-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(390px, calc(100vw - 30px));
    max-height: min(560px, calc(100vh - 105px));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 24px 60px rgba(26, 18, 14, .22);
    z-index: 1000;
}

.shell-notification-panel[hidden] {
    display: none !important;
}

.shell-notification-head {
    min-height: 66px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: color-mix(in srgb, var(--cream) 70%, var(--card));
}

.shell-notification-head > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.shell-notification-head strong {
    font-size: 15px;
    line-height: 1.15;
    font-weight: 650;
}

.shell-notification-head small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 560;
}

.shell-notification-head > a,
.shell-notification-footer {
    color: var(--orange);
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.shell-notification-list {
    max-height: min(410px, calc(100vh - 230px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    scrollbar-width: thin;
}

.shell-notification-item {
    min-width: 0;
    padding: 11px 10px;
    border-radius: 13px;
    display: grid;
    grid-template-columns: 9px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    transition: background .15s ease;
}

.shell-notification-item:hover {
    background: color-mix(in srgb, var(--cream) 68%, transparent);
}

.shell-notification-item > i {
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 50%;
    background: #5485f3;
    box-shadow: 0 0 0 4px rgba(84, 133, 243, .10);
}

.shell-notification-item.critical > i { background: #e42f45; box-shadow: 0 0 0 4px rgba(228, 47, 69, .10); }
.shell-notification-item.warning > i,
.shell-notification-item.attention > i { background: #ed8c16; box-shadow: 0 0 0 4px rgba(237, 140, 22, .11); }
.shell-notification-item.success > i { background: #1b9a55; box-shadow: 0 0 0 4px rgba(27, 154, 85, .11); }
.shell-notification-item.is-read { opacity: .72; }

.shell-notification-item > span {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.shell-notification-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    line-height: 1.2;
    font-weight: 630;
}

.shell-notification-item small {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.38;
    font-weight: 500;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.shell-notification-footer {
    min-height: 42px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--cream) 58%, var(--card));
}

.shell-notification-empty {
    min-height: 150px;
    color: var(--muted);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
}

.shell-notification-empty span {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(32, 164, 91, .12);
    color: #16854a;
    font-weight: 900;
}

.shell-notification-empty p {
    margin: 0;
    font-size: 12px;
}

.pdv-top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    min-width: 0;
}

.app-shell-tools.is-compact .shell-tool-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 12px;
}

@media (max-width: 820px) {
    .bar:not(.pdv-store-header) {
        gap: 10px;
    }

    .shell-tool-button {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .shell-notification-panel {
        position: fixed;
        top: 68px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100vh - 82px);
    }

    .shell-notification-list {
        max-height: calc(100vh - 220px);
    }

    body.pdv-mode .pdv-top-actions > .btn {
        display: none;
    }
}

@media (max-width: 420px) {
    .app-shell-tools { gap: 6px; }
    .shell-theme-button { display: inline-grid; }
}

/* =========================================================
   v80.9 · Controles globais em cabeçalho realmente visível
   ========================================================= */
.shell-tool-svg {
    width: 19px;
    height: 19px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.shell-tool-text {
    display: none;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1;
    font-weight: 680;
}

.shell-theme-sun { display: none; }
:root[data-theme="dark"] .shell-theme-moon { display: none; }
:root[data-theme="dark"] .shell-theme-sun { display: block; }

.page-head-copy {
    min-width: 0;
}

.page-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    overflow: visible;
}

.page-head-shell-tools {
    padding-top: 4px;
    overflow: visible;
}

.page-head-shell-tools .app-shell-tools {
    gap: 8px;
    overflow: visible;
}

.page-head-shell-tools .shell-tool-button {
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    border-radius: 11px;
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 1px;
    box-shadow: 0 3px 10px rgba(52, 34, 24, .055);
}

/* Cabeçalho compacto: os rótulos continuam disponíveis em aria-label/title. */
.page-head-shell-tools .shell-tool-text {
    display: none;
}

.page-head-shell-tools .shell-tool-svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.8;
}

.page-head-shell-tools .shell-notification-badge {
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 9px;
}

body.pdv-mode .app-shell-tools {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.pdv-mode .shell-tool-button {
    display: inline-grid !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (max-width: 900px) {
    .page-head-shell-tools {
        display: none;
    }
}

@media (max-width: 560px) {
    body.pdv-mode .app-shell-tools {
        gap: 6px;
    }

    body.pdv-mode .shell-tool-button {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
}

/* v2026.08 · Cobranças do crediário vencendo hoje */
.shell-notifications.has-critical-notification .shell-bell-button {
    border-color: rgba(220, 38, 55, .48);
    background: color-mix(in srgb, var(--card) 84%, #ef233c 16%);
    color: #c91832;
    box-shadow: 0 0 0 4px rgba(220, 38, 55, .07), 0 8px 20px rgba(137, 22, 38, .14);
    animation: dbpdv-notification-attention 2.4s ease-in-out infinite;
}

.shell-notifications.has-critical-notification .shell-notification-badge {
    background: #d71936;
    box-shadow: 0 0 0 4px rgba(215, 25, 54, .10), 0 5px 12px rgba(172, 16, 40, .30);
}

.shell-notification-item.critical.is-unread {
    background: rgba(231, 41, 63, .055);
}

@keyframes dbpdv-notification-attention {
    0%, 78%, 100% { transform: translateY(0); }
    84% { transform: translateY(-2px) rotate(-3deg); }
    90% { transform: translateY(0) rotate(3deg); }
    96% { transform: translateY(-1px) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
    .shell-notifications.has-critical-notification .shell-bell-button {
        animation: none;
    }
}
