@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --primary: #5a2ca0;
    --primary-strong: #4b2487;
    --primary-dark: #351a62;
    --secondary: #ffffff;
    --surface: #faf7ff;
    --bg-soft: #f4efff;
    --text: #24173f;
    --text-muted: #635582;
    --danger: #d94343;
    --success: #2e8b57;
    --border: #e0d3f6;
    --topbar-rail-width: 214px;
    --topbar-rail-width-compact: 78px;
    --topbar-current-width: var(--topbar-rail-width);
    --topbar-top-strip-height: 44px;
    --topbar-top-strip-offset: 0px;
    --topbar-rail-top-offset: 44px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 14% 8%, #eee4ff 0%, transparent 36%),
        radial-gradient(circle at 90% 20%, #f6eaff 0%, transparent 30%),
        linear-gradient(180deg, #f8f5ff 0%, #f1ebff 100%);
    min-height: 100vh;
    /* Suporte a safe-area para iPhones com notch */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

body,
.topbar,
.topbar-main,
.top-nav,
.top-actions,
.top-info-thin,
.container,
.user-menu-panel,
.brand-logo {
    transition: all 0.28s ease;
}

.fade-in {
    animation: fadeIn 0.45s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.2) 0%, transparent 34%),
        radial-gradient(circle at 82% 14%, rgba(255, 255, 255, 0.14) 0%, transparent 30%),
        linear-gradient(145deg, #5e2ca8 0%, #351a62 100%);
}

.login-container {
    width: 100%;
    max-width: 430px;
    text-align: center;
}

.login-logo {
    max-width: 260px;
    width: 100%;
    height: auto;
    margin: 0 auto 10px;
    display: block;
}

.login-container .card {
    text-align: left;
}

@media (max-width: 480px) {
    .login-page {
        padding: 16px;
        align-items: flex-start;
        padding-top: max(32px, 10vh);
    }

    .login-logo {
        max-width: 200px;
        margin-bottom: 16px;
    }

    .login-container .card {
        padding: 20px 16px;
    }
}

h1,
h2,
h3 {
    margin: 0 0 12px;
}

.subtitle {
    margin: 0 0 20px;
    color: #e7dbff;
}

.card {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 18px 36px rgba(59, 28, 109, 0.08);
    backdrop-filter: blur(8px);
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

input,
select {
    width: 100%;
    font: inherit;
    font-size: 16px; /* Evita zoom automático no iOS */
    border-radius: 10px;
    border: 1px solid #d8cff1;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: #fff;
}

input:focus,
select:focus {
    outline: none;
    border-color: #8f66d4;
    box-shadow: 0 0 0 3px rgba(116, 69, 197, 0.18);
}

button {
    border: 0;
    cursor: pointer;
    padding: 10px 14px;
    font: inherit;
    border-radius: 10px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
}

.btn-primary,
.btn-light,
.btn-danger,
.btn-success,
.btn-warning {
    min-height: 40px;
    width: auto;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 8px 18px rgba(65, 31, 119, 0.3);
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-light {
    background: #f5eeff;
    color: var(--primary-dark);
    border: 1px solid #d8cff1;
}

.btn-light:hover {
    background: #eee2ff;
}

.btn-danger {
    background: linear-gradient(160deg, #e35f5f 0%, #ba2f2f 100%);
    color: #fff;
}

.btn-success {
    background: #22c55e;
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-mini {
    width: auto;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 13px;
}

.sale-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sale-status-active {
    background: #dcfce7;
    color: #15803d;
}

.sale-status-canceled {
    background: #fee2e2;
    color: #b42318;
}

.client-status-credit {
    background: #dcfce7;
    color: #15803d;
}

.client-status-debt {
    background: #fee2e2;
    color: #b42318;
}

.client-status-mixed {
    background: #f3e8ff;
    color: #7c3aed;
}

.client-status-balanced {
    background: #e0f2fe;
    color: #075985;
}

.client-list-primary {
    font-weight: 700;
    color: var(--text-main);
}

.client-list-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
}

.client-list-amount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.client-list-amount-positive {
    background: #f4fff7;
    border-color: #b7e2c9;
    color: #1d7b4e;
}

.client-list-amount-negative {
    background: #fff7f7;
    border-color: #f1c5c5;
    color: #b43c3c;
}

.client-list-amount-neutral {
    background: #faf8ff;
    border-color: #d8cff1;
    color: #4a3187;
}

.sale-actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.message {
    min-height: 20px;
    margin-top: 10px;
    color: var(--text-muted);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(120deg, #5e2ca8 0%, #3d1e70 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 24px rgba(39, 19, 73, 0.28);
}

.topbar-main {
    display: grid;
    grid-template-columns: 190px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 12px 20px 10px;
    min-height: 78px;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand-logo {
    width: 150px;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(18, 8, 35, 0.35));
}

.top-nav {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.top-nav-inline-info {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    color: #efe7ff;
}

.topbar-role-colaborador .top-nav-inline-info {
    display: flex;
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.topbar-role-colaborador .top-nav {
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.top-nav-empty {
    display: none;
}

.top-nav a {
    text-decoration: none;
    color: #f3ebff;
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 92px;
    text-align: center;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.top-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.top-nav a:hover {
    background: rgba(255, 255, 255, 0.14);
}

.top-nav a.active {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.32);
    color: #ffffff;
}

.top-info {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-self: end;
    color: #efe7ff;
}

.top-info-thin {
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    justify-self: stretch;
    padding: 7px 20px;
    min-height: 34px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(31, 14, 58, 0.2);
    font-size: 13px;
}

.top-info strong {
    color: #ffffff;
}

body:not(.topbar-collapsed) .topbar-role-colaborador .top-info-thin {
    display: none;
}

.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.sidebar-collapse-btn {
    display: none;
    width: 36px;
    height: 36px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-radius: 0;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.top-subinfo {
    color: #e2d5ff;
    font-size: 13px;
    white-space: nowrap;
}

.top-session-user {
    color: #efe7ff;
    white-space: nowrap;
    margin-left: auto;
    text-align: right;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(27, 13, 52, 0.22);
}

.user-menu-trigger svg {
    width: 15px;
    height: 15px;
}

.user-menu-trigger:hover,
.user-menu-trigger[aria-expanded='true'] {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.38);
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    display: grid;
    gap: 6px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(216, 207, 241, 0.9);
    background: #ffffff;
    box-shadow: 0 18px 34px rgba(27, 13, 52, 0.24);
}

.user-menu-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.user-menu-name {
    color: var(--text);
    font-size: 16px;
}

.user-menu-action {
    width: 100%;
    margin-top: 6px;
    border: 1px solid #e5d8fa;
    background: #f7f1ff;
    color: var(--primary-dark);
    text-align: left;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.user-menu-action:hover {
    background: #efe3ff;
}

.user-menu-action-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.user-menu-layout-toggle[aria-pressed='true'] .user-menu-action-icon {
    transform: rotate(-90deg);
}

.badge {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge.open {
    background: #e6f7ee;
    color: #277c4e;
}

.badge.closed {
    background: #fde9e9;
    color: #a83737;
}

.container {
    max-width: 1200px;
    width: min(1200px, calc(100% - 28px));
    margin: 22px auto;
    padding: 0 14px 24px;
    display: grid;
    gap: 16px;
}

.history-page .container {
    max-width: 1280px;
    width: min(1280px, calc(100% - 28px));
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 901px) {
    .topbar-collapsed {
        --topbar-current-width: var(--topbar-rail-width);
    }

    .topbar-collapsed.topbar-compact {
        --topbar-current-width: var(--topbar-rail-width-compact);
    }

    .topbar-collapsed .topbar {
        position: fixed;
        top: var(--topbar-rail-top-offset);
        left: 16px;
        bottom: 16px;
        width: var(--topbar-current-width);
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        border: 1px solid rgba(255, 255, 255, 0.24);
        border-radius: 0;
        border-bottom-color: rgba(255, 255, 255, 0.24);
        box-shadow: 0 22px 46px rgba(39, 19, 73, 0.32);
        overflow: visible;
    }

    .topbar-collapsed .topbar-main {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 18px;
        min-height: 0;
        padding: 18px 10px 14px;
    }

    .topbar-collapsed .brand {
        justify-content: space-between;
        align-items: center;
        padding: 0 8px 2px;
    }

    .topbar-collapsed .brand-logo {
        width: 84px;
    }

    .topbar-collapsed .sidebar-collapse-btn {
        display: inline-flex;
        flex-shrink: 0;
    }

    .topbar-collapsed .top-nav {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 6px;
        flex-wrap: nowrap;
        padding: 4px 0;
    }

    .topbar-collapsed .top-nav-inline-info {
        display: none;
    }

    .topbar-collapsed .top-nav a {
        min-width: 0;
        padding: 10px 12px;
        border-radius: 0;
        background: transparent;
        text-align: left;
        font-weight: 500;
        justify-content: flex-start;
        gap: 10px;
        min-height: 44px;
    }

    .topbar-collapsed .top-nav a:hover,
    .topbar-collapsed .top-nav a.active {
        background: rgba(255, 255, 255, 0.14);
    }

    .topbar-collapsed .top-nav-icon {
        width: 16px;
        height: 16px;
    }

    .topbar-collapsed .top-nav-label {
        font-size: 14px;
    }

    .topbar-collapsed .top-actions {
        width: 100%;
        margin-top: auto;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        gap: 12px;
        padding: 10px 0 2px;
    }

    .topbar-collapsed .top-actions .icon-btn {
        width: calc(100% - 20px);
        justify-content: center;
        border-radius: 0;
    }

    .topbar-collapsed .user-menu {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        padding-left: 12px;
    }

    .topbar-collapsed .user-menu-trigger {
        width: 42px;
        height: 42px;
        border-radius: 999px;
        margin: 0;
    }

    .topbar-collapsed .user-menu-panel {
        top: auto;
        right: auto;
        left: calc(100% + 12px);
        bottom: 0;
    }

    .topbar-collapsed .top-info-thin {
        position: fixed;
        top: var(--topbar-top-strip-offset);
        left: calc(var(--topbar-current-width) + 16px);
        right: 0;
        z-index: 18;
        display: flex;
        gap: 10px;
        padding: 8px 18px;
        min-height: var(--topbar-top-strip-height);
        border-top: 0;
        border-bottom: 1px solid rgba(84, 51, 145, 0.08);
        background: rgba(248, 245, 255, 0.88);
        backdrop-filter: blur(14px);
        align-items: center;
        justify-content: flex-start;
        color: var(--text);
    }

    .topbar-collapsed .top-info strong {
        color: var(--text);
    }

    .topbar-collapsed .top-subinfo,
    .topbar-collapsed .top-session-user {
        color: var(--text-muted);
        white-space: nowrap;
    }

    .topbar-collapsed .top-session-user {
        margin-left: auto;
        text-align: right;
    }

    .topbar-collapsed .container {
        width: min(1280px, calc(100vw - var(--topbar-current-width) - 52px));
        margin: calc(var(--topbar-top-strip-height) + var(--topbar-top-strip-offset) + 16px) 20px 24px calc(var(--topbar-current-width) + 28px);
    }

    .topbar-collapsed .cash-layout {
        min-height: calc(100vh - var(--topbar-top-strip-height) - var(--topbar-top-strip-offset) - 36px);
        height: auto;
        overflow: visible;
    }

    .topbar-collapsed .topbar-main {
        min-height: calc(100vh - var(--topbar-rail-top-offset) - 32px);
    }

    .topbar-collapsed .cash-grid,
    .topbar-collapsed .cash-products-card,
    .topbar-collapsed .order-card,
    .topbar-collapsed .cash-products-scroll,
    .topbar-collapsed .order-table-wrap {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .topbar-collapsed.topbar-compact .brand {
        justify-content: center;
    }

    .topbar-collapsed.topbar-compact .brand-logo {
        display: none;
    }

    .topbar-collapsed.topbar-compact .top-nav a {
        justify-content: center;
        padding-inline: 0;
    }

    .topbar-collapsed.topbar-compact .top-nav-label,
    .topbar-collapsed.topbar-compact .top-actions .icon-btn {
        display: none;
    }

    .topbar-collapsed.topbar-compact .top-actions {
        gap: 8px;
    }

    .topbar-collapsed.topbar-compact .user-menu-trigger {
        width: 42px;
        height: 42px;
        margin: 0 auto;
    }

    .topbar-collapsed.topbar-compact .sidebar-collapse-btn {
        margin: 0 auto;
    }

    .topbar-collapsed.topbar-compact .sidebar-collapse-btn svg {
        transform: rotate(180deg);
    }
}

.history-layout {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
}

.history-report-card {
    grid-column: 1 / -1;
}

.history-filter-card {
    grid-column: span 5;
}

.history-cash-card,
.history-sales-card {
    grid-column: 1 / -1;
}

.period-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, #fbf8ff 0%, #f4edff 100%);
    border: 1px solid #e6dcfa;
    color: #51456f;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.section-head h2 {
    margin-bottom: 4px;
}

.section-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.modal-form-grid {
    margin-bottom: 8px;
}

.user-modal-card {
    width: min(720px, 100%);
}

.user-modal-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: stretch;
    gap: 10px;
}

.user-modal-actions button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    white-space: nowrap;
}

.user-modal-actions .hidden {
    display: none;
}

.icon-btn {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cash-control-status-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    min-height: 34px;
    background: #fde9e9;
    color: #a83737;
}

.cash-control-status-btn.open {
    background: #e6f7ee;
    color: #277c4e;
}

.cash-control-status-btn.closed {
    background: #fde9e9;
    color: #a83737;
}

.cash-control-status-btn:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
}

.cash-control-status-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(22, 16, 44, 0.45);
    display: grid;
    place-items: center;
    padding: 16px;
    overflow-y: auto;
}

.modal-card {
    width: min(680px, 100%);
    max-height: calc(100vh - 32px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 18px 36px rgba(30, 16, 70, 0.3);
    padding: 18px;
    overflow-y: auto;
}

.modal-card-small {
    width: min(460px, 100%);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.modal-card h3 {
    margin: 0;
}

.modal-close {
    width: auto;
    border: 1px solid #d8cff1;
    background: #f4f0ff;
    color: var(--primary);
    font-size: 22px;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 10px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.modal-actions button,
.modal-card .row button {
    width: auto;
}

.modal-card .row input {
    margin-bottom: 0;
}

.success-line {
    background: #e6f7ee;
    border: 1px solid #b8e7cc;
    color: #1e6e44;
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 600;
}

.toast-container {
    position: fixed;
    right: 16px;
    bottom: 22px;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: min(420px, calc(100vw - 24px));
}

.toast-item {
    background: #2f2450;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 14px 28px rgba(23, 14, 42, 0.35);
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #1f7a45;
}

.toast-error {
    background: #b43a3a;
}

.toast-info {
    background: #3b2d67;
}

.actions-dropdown {
    display: inline-block;
    position: relative;
}

.actions-cell {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.table-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.actions-trigger {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #d8cff1;
    background: #ffffff;
    color: var(--primary);
    font-size: 20px;
    line-height: 1;
}

.actions-trigger:hover {
    background: #f4f0ff;
}

.actions-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 150px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(40, 24, 85, 0.2);
    padding: 6px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.actions-menu.actions-menu-floating {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    margin: 0;
    z-index: 20000;
}

.actions-dropdown.open-up .actions-menu {
    top: auto;
    bottom: calc(100% + 6px);
}

.actions-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #fff;
    color: #372c57;
    border: 0;
    border-radius: 8px;
    padding: 8px 10px;
    font-weight: 500;
    white-space: nowrap;
}

.actions-item:hover {
    background: #f3edff;
}

.actions-item.delete-btn {
    color: #a83737;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.cash-page {
    overflow-x: hidden;
    overflow-y: auto;
}

.cash-layout {
    height: calc(100vh - 138px);
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
}

.cash-grid {
    height: 100%;
    min-height: 0;
    align-items: stretch;
}

.cash-products-card,
.order-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.cash-products-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.cash-products-search {
    margin: 0 0 10px;
}

.cash-products-search input {
    width: 100%;
    margin: 0;
    background: #faf8ff;
    border: 1px solid #e6ddfa;
    color: #554778;
}

.cash-products-search input::placeholder {
    color: #9588b7;
}

.cash-products-scroll .products-grid {
    align-content: start;
    grid-template-columns: 1fr;
}

.order-card .table-wrap {
    flex: 1;
    min-height: 0;
}

.order-table-wrap {
    overflow-y: auto;
    overflow-x: auto;
}

.order-checkout-box {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: 0;
    padding-top: 14px;
    padding-bottom: 2px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, #ffffff 18%);
}

.order-card .message {
    margin-top: 8px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1px;
}

.product-card {
    border: 0;
    border-radius: 12px;
    padding: 8px;
    display: block;
    background: #fff;
}

.product-row {
    display: grid;
    grid-template-columns: 1fr auto;
    min-height: 62px;
    border: 1px solid #e8e0fa;
    border-radius: 10px;
    overflow: hidden;
    align-items: stretch;
}

.product-info {
    display: grid;
    align-content: center;
    gap: 3px;
    padding: 8px 10px;
    min-width: 0;
}

.product-info > strong {
    font-size: 15px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
    color: #5b4e7f;
}

.product-row .btn-mini {
    align-self: stretch;
    min-height: 100%;
    min-width: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    border-radius: 0;
    padding: 0 18px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #eee5ff;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid #eee8ff;
    padding: 10px 8px;
    text-align: left;
    white-space: nowrap;
}

th {
    color: #5a4f7d;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: rgba(246, 239, 255, 0.72);
}

.cash-history-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clickable-row:hover {
    background: rgba(245, 240, 255, 0.82);
}

.clickable-row:focus-visible {
    outline: 2px solid #8c6ed8;
    outline-offset: -2px;
}

.cash-history-row:hover {
    background: rgba(245, 240, 255, 0.82);
}

.cash-history-row:focus-visible {
    outline: 2px solid #8c6ed8;
    outline-offset: -2px;
}

.cash-history-amount {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.01em;
}

.cash-history-amount-open {
    background: #efe8ff;
    color: #4f3894;
    border: 1px solid #d5c5ff;
}

.cash-history-amount-closed {
    background: #ddfbf6;
    color: #0f766e;
    border: 1px solid #9de8d9;
}

.row {
    display: flex;
    align-items: center;
}

.gap {
    gap: 10px;
}

.checkout-box {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.checkout-box .row {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.checkout-bottom-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.checkout-bottom-row select {
    margin-bottom: 0;
    max-width: 240px;
}

.checkout-bottom-row .btn-primary {
    justify-content: flex-end;
    margin-left: auto;
}

.summary {
    margin-top: 10px;
    background: linear-gradient(180deg, #fbf9ff 0%, #f6f1ff 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    line-height: 1.4;
}

.cash-modal-actions {
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

#cashControlModal .modal-card {
    width: min(620px, 100%);
}

#cashControlModal .summary {
    padding: 12px;
}

#cashControlModal .modal-actions {
    margin-top: 10px;
}

#closeCashBox {
    justify-content: flex-end;
    flex-wrap: wrap;
}

#openCashActions {
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
}

#openCashActions.hidden {
    display: none;
}

#openCashActions .btn-primary {
    min-width: 160px;
}

#closeCashBox .btn-danger {
    min-width: 190px;
}

.cash-summary-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.cash-summary-head p {
    margin: 4px 0 0;
    color: #5b4f7a;
    font-size: 13px;
}

.cash-sales-count {
    background: #ece3ff;
    color: #4e348c;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.cash-kpis-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.cash-kpi-card {
    border: 1px solid #ddd1f7;
    border-radius: 10px;
    background: #fff;
    padding: 10px;
}

.cash-kpi-card span {
    display: block;
    font-size: 12px;
    color: #645887;
    margin-bottom: 4px;
}

.cash-kpi-card strong {
    color: #3d2f67;
    font-size: 16px;
}

.cash-totals-grid {
    display: grid;
    gap: 8px;
}

.cash-total-box {
    border: 1px solid #ddd1f7;
    border-radius: 10px;
    background: #fff;
    padding: 10px;
}

.cash-total-box span {
    display: block;
    color: #645887;
    font-size: 12px;
    margin-bottom: 4px;
}

.cash-total-box strong {
    font-size: 18px;
    color: #3d2f67;
}

.cash-total-box.highlight {
    border-color: #8c6ed8;
    background: #efe8ff;
}

.cash-total-box.highlight strong {
    color: #2f2160;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    align-items: end;
}

.grid-form > label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 0;
}

.grid-form > label input,
.grid-form > label select,
.grid-form > input,
.grid-form > select {
    margin-bottom: 0;
}

.grid-form > button {
    justify-self: stretch;
    align-self: end;
    min-height: 44px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #faf8ff;
}

.stat-card span {
    display: block;
    font-size: 13px;
    color: #5a4f7d;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 20px;
    color: var(--primary);
}

.hidden {
    display: none;
}

.suggestion-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 4px;
}

.suggestion-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.suggestion-row strong {
    font-size: 15px;
    color: var(--text);
}

.suggestion-diff {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.text-success {
    color: #22c55e;
}

.text-danger {
    color: var(--danger);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.cash-movements-section {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.cash-movements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cash-movements-header strong {
    font-size: 13px;
    color: var(--text);
}

.movements-totals {
    display: flex;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

.movements-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.movement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.movement-type-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-success {
    background: #dcfce7;
    color: #16a34a;
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

.movement-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.movement-desc {
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.movement-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.movement-amount {
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cash-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 12px;
    margin-bottom: 10px;
}

.cash-details-modal-card {
    width: min(1180px, 100%);
}

.sale-details-modal-card {
    width: min(1040px, 100%);
}

.cash-details-grid div {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}

.cash-details-title {
    margin: 14px 0 8px;
    color: #3d2f67;
}


.cash-report-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cash-report-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid #ddd1f7;
    background: linear-gradient(135deg, #ffffff 0%, #f6f1ff 100%);
}

.cash-report-eyebrow,
.cash-report-section-label {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7862ab;
}

.cash-report-heading,
.cash-report-summary-head h5,
.cash-report-table-head h5,
.cash-report-balance-card h5 {
    margin: 0;
    font-size: 20px;
    color: #2f2160;
}

.cash-report-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.cash-report-badge,
.cash-report-total-sales,
.cash-report-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid #d7caf5;
    background: #efe8ff;
    color: #4a3187;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 12px;
}

.cash-report-badge.soft {
    background: #f8f5ff;
    color: #6a5895;
}


.cash-details-highlight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.cash-details-highlight-card {
    border: 1px solid #ddd1f7;
    border-radius: 16px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 12px 24px rgba(72, 44, 130, 0.08);
}

.cash-details-highlight-card span {
    display: block;
    font-size: 11px;
    color: #645887;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.cash-details-highlight-card strong {
    display: block;
    font-size: 28px;
    line-height: 1.1;
    color: #3d2f67;
}

.cash-details-highlight-card small {
    display: block;
    margin-top: 10px;
    color: #6c6190;
    font-size: 12px;
    line-height: 1.45;
}

.cash-details-highlight-card strong.text-success,
.cash-details-highlight-card strong.is-positive {
    color: #1e8e5a;
}

.cash-details-highlight-card strong.text-danger,
.cash-details-highlight-card strong.is-negative {
    color: var(--danger);
}

.cash-details-highlight-card.tone-neutral {
    background: linear-gradient(180deg, #ffffff 0%, #faf7ff 100%);
}

.cash-details-highlight-card.tone-primary {
    border-color: #cfc2f5;
    background: linear-gradient(180deg, #f8f4ff 0%, #efe7ff 100%);
}

.cash-details-highlight-card.tone-soft {
    border-color: #d9d7fb;
    background: linear-gradient(180deg, #fbfbff 0%, #eef2ff 100%);
}

.cash-details-highlight-card.tone-expected {
    border-color: #aa93ea;
    background: linear-gradient(180deg, #f5efff 0%, #ece2ff 100%);
}

.cash-details-highlight-card.tone-external {
    border-color: #b8d2f3;
    background: linear-gradient(180deg, #f3f8ff 0%, #e7f0ff 100%);
}

.cash-details-highlight-card.tone-external strong {
    color: #2b5f97;
}

.cash-details-highlight-card.tone-is-positive {
    border-color: #bfe9d0;
    background: linear-gradient(180deg, #f6fff9 0%, #e7f8ee 100%);
}

.cash-details-highlight-card.tone-is-negative {
    border-color: #f1c0c0;
    background: linear-gradient(180deg, #fff8f8 0%, #ffe9e9 100%);
}

.cash-details-highlight-card.tone-is-neutral {
    background: linear-gradient(180deg, #fffefe 0%, #f7f3ff 100%);
}

.cash-report-summary-card,
.cash-report-table-card,
.cash-report-balance-card {
    border: 1px solid #ddd1f7;
    border-radius: 16px;
    background: #fff;
    padding: 16px 18px;
}

.cash-report-summary-head,
.cash-report-table-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.cash-report-summary-text {
    margin: 0;
    color: #4b426c;
    font-size: 15px;
    line-height: 1.7;
}

.cash-report-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.cash-report-pill.is-positive,
.cash-report-balance-card.is-positive {
    border-color: #b7e2c9;
    background: #f4fff7;
    color: #1d7b4e;
}

.cash-report-pill.is-negative,
.cash-report-balance-card.is-negative {
    border-color: #f1c5c5;
    background: #fff7f7;
    color: #b43c3c;
}

.cash-report-pill.is-balanced,
.cash-report-balance-card.is-balanced {
    border-color: #d8cff1;
    background: #faf8ff;
    color: #4a3187;
}

.cash-report-support-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.cash-report-support-card {
    border: 1px solid #e4daf9;
    border-radius: 14px;
    background: #fcfbff;
    padding: 14px;
}

.cash-report-support-card span,
.cash-report-balance-values span {
    display: block;
    margin-bottom: 6px;
    color: #756795;
    font-size: 12px;
}

.cash-report-support-card strong,
.cash-report-balance-values strong {
    color: #30245e;
    font-size: 15px;
    line-height: 1.35;
}

.cash-report-balance-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cash-report-balance-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.cash-report-balance-values div {
    border: 1px solid rgba(109, 88, 162, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    padding: 12px;
}

.cash-report-balance-note {
    margin: 0;
    color: #5f537f;
    font-size: 14px;
    line-height: 1.5;
}

.cash-report-table-card .table-wrap {
    margin-top: 6px;
    border: 1px solid #ebe3fb;
    border-radius: 14px;
    overflow: hidden;
    background: #fcfbff;
}

.cash-report-table-card table {
    margin: 0;
}

.cash-report-table-card thead th {
    background: linear-gradient(180deg, #f7f2ff 0%, #efe8ff 100%);
    color: #4f3c82;
    font-weight: 700;
    padding-top: 14px;
    padding-bottom: 14px;
}

.cash-report-table-card tbody td {
    padding-top: 14px;
    padding-bottom: 14px;
}

.cash-report-table-card tbody tr:nth-child(even) {
    background: rgba(247, 243, 255, 0.55);
}

.cash-report-table-card tbody tr:hover {
    background: rgba(236, 228, 255, 0.7);
}

.is-positive {
    color: #1e8e5a;
}

.is-negative {
    color: var(--danger);
}

.is-neutral {
    color: #4e4380;
}

.is-balanced {
    color: #3d2f67;
}

.no-movements {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 0;
    margin: 0;
}

@media (max-width: 900px) {
    .topbar-collapsed .topbar {
        position: sticky;
        inset: auto;
        width: auto;
        border-radius: 0;
    }

    .cash-page {
        overflow: auto;
    }

    .cash-layout {
        height: auto;
        overflow: visible;
    }

    .cash-grid {
        height: auto;
    }

    .cash-products-card,
    .order-card {
        height: auto;
        overflow: visible;
    }

    .cash-products-scroll,
    .order-table-wrap {
        overflow: visible;
        padding-right: 0;
    }

    .order-checkout-box {
        position: sticky;
        bottom: 0;
        margin-top: auto;
    }

    .container {
        width: min(100%, calc(100% - 20px));
        margin: 14px auto;
        padding: 0 10px 20px;
        gap: 12px;
    }

    .history-layout {
        grid-template-columns: 1fr;
    }

    .history-report-card,
    .history-filter-card,
    .history-cash-card,
    .history-sales-card {
        grid-column: auto;
    }

    .card {
        padding: 16px;
        border-radius: 18px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* ── Topbar: layout de 2 linhas no mobile ── */
    .topbar {
        min-height: auto;
    }

    .topbar-main {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "brand actions"
            "nav   nav";
        align-items: center;
        gap: 0;
        padding: 10px 14px 0;
        min-height: auto;
    }

    .brand {
        grid-area: brand;
        align-items: center;
    }

    .top-nav {
        grid-area: nav;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 6px 0 8px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

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

    .top-nav a {
        min-width: max-content;
        min-height: 44px;
        padding: 10px 14px;
    }

    .top-nav-inline-info {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 4px 12px;
        padding: 4px 0 2px;
    }

    .top-nav-label {
        white-space: nowrap;
    }

    .top-actions {
        grid-area: actions;
        justify-content: flex-end;
        width: auto;
        gap: 8px;
    }

    .top-info-thin {
        align-items: flex-start;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 4px 14px;
        padding: 8px 14px 10px;
    }

    .brand-logo {
        width: 130px;
    }

    .top-session-user,
    .top-subinfo,
    .badge {
        white-space: normal;
    }

    .user-menu-panel {
        right: 0;
        left: auto;
        min-width: 200px;
    }

    /* ── Formulários mobile ── */
    .grid-form {
        grid-template-columns: 1fr;
    }

    .grid-form button {
        width: 100%;
        justify-self: stretch;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-card {
        min-height: 100%;
    }

    /* ── Botões com touch target adequado ── */
    .btn-primary,
    .btn-light,
    .btn-danger,
    .btn-success,
    .btn-warning {
        min-height: 44px;
    }

    .actions-trigger {
        width: 38px;
        height: 38px;
    }

    .checkout-box .row {
        justify-content: stretch;
    }

    .checkout-box .row select,
    .checkout-box .row button {
        width: 100%;
    }

    .checkout-bottom-row select {
        max-width: none;
    }

    .checkout-bottom-row .btn-primary {
        width: 100%;
        margin-left: 0;
    }

    .toast-container {
        right: 12px;
        left: 12px;
        bottom: 16px;
        max-width: none;
    }

    .modal-backdrop {
        place-items: start center;
        padding: 10px;
    }

    .modal-card {
        width: min(100%, 560px);
        max-height: calc(100vh - 20px);
        border-radius: 14px;
        padding: 14px;
        overscroll-behavior: contain;
    }

    .cash-details-modal-card {
        width: 100%;
    }

    .sale-details-modal-card {
        width: 100%;
    }

    .modal-card h3 {
        font-size: 18px;
    }

    .modal-header {
        margin-bottom: 10px;
    }

    .modal-actions {
        gap: 8px;
    }

    #cashControlModal .modal-card {
        width: 100%;
    }

    #cashControlModal .row.gap,
    #cashControlModal #closeCashBox {
        flex-wrap: wrap;
    }

    #cashControlModal .row.gap input,
    #cashControlModal .row.gap button,
    #cashControlModal #closeCashBox button {
        width: 100%;
    }

    #cashControlModal #closeCashBox .btn-danger {
        min-width: 0;
    }

    #cashControlModal .cash-summary-head,
    #cashControlModal .cash-movements-header,
    #cashControlModal .suggestion-row,
    #cashControlModal .suggestion-diff,
    #cashControlModal .movement-item {
        align-items: flex-start;
        flex-direction: column;
    }

    #cashControlModal .cash-kpis-grid {
        grid-template-columns: 1fr;
    }

    #cashControlModal .cash-sales-count,
    #cashControlModal .movements-totals,
    #cashControlModal .movement-amount,
    #cashControlModal .movement-type-badge {
        white-space: normal;
    }

    #cashControlModal .movements-list {
        max-height: 160px;
    }
}

@media (max-width: 760px) {
    .table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap th,
    .table-wrap td {
        display: block;
        width: 100%;
    }

    .table-wrap thead {
        display: none;
    }

    .table-wrap tbody {
        display: grid;
        gap: 10px;
    }

    .table-wrap tr {
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid #ece2ff;
        border-radius: 16px;
        padding: 10px 12px;
        box-shadow: 0 10px 24px rgba(46, 24, 89, 0.08);
    }

    .table-wrap td {
        display: grid;
        grid-template-columns: minmax(96px, 42%) minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 7px 0;
        border-bottom: 1px solid #f2ebff;
        white-space: normal;
    }

    .table-wrap td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .table-wrap td::before {
        content: attr(data-label);
        color: #78689a;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    .table-wrap td[colspan] {
        display: block;
        padding: 4px 0;
        text-align: center;
        border-bottom: 0;
    }

    .table-wrap td[colspan]::before {
        content: none;
    }

    .actions-cell,
    .table-actions {
        justify-content: flex-start;
    }

    .actions-dropdown {
        width: 100%;
    }

    .actions-trigger {
        width: 100%;
        height: 40px;
        border-radius: 8px;
        justify-content: center;
    }

    .period-summary {
        width: 100%;
        justify-content: space-between;
        border-radius: 16px;
    }

    .cash-details-grid {
        grid-template-columns: 1fr;
    }

    .cash-details-highlight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cash-report-head,
    .cash-report-summary-head,
    .cash-report-table-head {
        flex-direction: column;
    }

    .cash-report-badges {
        justify-content: flex-start;
    }

    .movement-desc {
        white-space: normal;
    }

    /* ── Ações em modal: botões empilhados no mobile ── */
    .user-modal-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .user-modal-actions button {
        flex: none;
        width: 100%;
    }

    .section-head {
        gap: 10px;
    }
}

@media (max-width: 560px) {
    .topbar-main {
        padding: 10px 12px 0;
    }

    .top-info-thin {
        gap: 6px 10px;
        padding: 8px 12px 10px;
    }

    .brand-logo {
        width: 120px;
    }

    h2 {
        font-size: 18px;
    }

    h3 {
        font-size: 16px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .modal-backdrop {
        padding: 8px;
    }

    .modal-card {
        max-height: calc(100vh - 16px);
        padding: 12px;
    }

    .modal-close {
        padding: 2px 9px;
        font-size: 20px;
    }

    .cash-details-highlight-grid {
        grid-template-columns: 1fr;
    }

    .cash-report-support-grid,
    .cash-report-balance-values {
        grid-template-columns: 1fr;
    }

    .modal-actions button {
        width: 100%;
    }

    .close-cash-final-total {
        font-size: 34px;
        letter-spacing: -0.5px;
    }

    .user-menu-trigger {
        width: 40px;
        height: 40px;
    }

    .top-session-user {
        width: 100%;
        text-align: left;
        margin-left: 0;
    }

    .table-wrap tr {
        padding: 10px;
    }

    .table-wrap td {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .table-wrap td::before {
        font-size: 10px;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-head > button,
    .section-head > a {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    #cashControlModal .summary,
    #cashControlModal .cash-kpi-card,
    #cashControlModal .cash-total-box,
    #cashControlModal .suggestion-box,
    #cashControlModal .movement-item {
        padding: 10px;
    }

    #cashControlModal .cash-kpi-card strong,
    #cashControlModal .cash-total-box strong {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 10px auto;
        padding: 0 8px 16px;
    }

    .card {
        padding: 14px;
        border-radius: 16px;
    }

    .topbar-main {
        padding: 8px 12px 0;
    }

    .brand-logo {
        width: 110px;
    }

    .top-nav a {
        padding: 8px 12px;
        font-size: 14px;
    }

    .btn-primary,
    .btn-light,
    .btn-danger,
    .btn-success,
    .btn-warning {
        font-size: 14px;
    }

    .cash-kpis-grid {
        grid-template-columns: 1fr;
    }

    .close-cash-breakdown {
        gap: 14px;
    }

    .close-cash-final-total {
        font-size: 28px;
    }

    .modal-card h3 {
        font-size: 16px;
    }

    .user-menu-panel {
        min-width: 180px;
    }

    .stat-card strong {
        font-size: 18px;
    }

    .grid-form {
        gap: 8px;
    }
}

.close-cash-final-total {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary, #4a2d9c);
    line-height: 1.1;
    margin: 8px 0 16px;
    letter-spacing: -1px;
}

.close-cash-breakdown {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.close-cash-breakdown-item {
    text-align: center;
}

.close-cash-breakdown-item span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.close-cash-breakdown-item strong {
    font-size: 16px;
    color: var(--text);
}

/* Ultima modal de fechamento: botoes centralizados e lado a lado */
#finalCloseCashModal .modal-actions {
    justify-content: center;
    flex-wrap: nowrap;
}

#finalCloseCashModal .modal-actions button {
    width: auto;
    min-width: 0;
}
