:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --secondary: #10b981;
    --secondary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    --danger: #ef4444;
    --danger-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    --bg-body: #f8fafc;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --input-bg: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.06);
}

body.dark-mode {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #a5b4fc;
    --primary-gradient: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    --bg-body: #0b0f19;
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --bg-card: #131c2e;
    --border-color: #1e293b;
    --input-bg: #1e293b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Inter', sans-serif;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.4);
}

body {
    background: var(--bg-body);
    margin: 0;
    padding-bottom: 110px;
    color: var(--text-main);
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2900;
    display: none;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    z-index: 3000;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    color: var(--text-main);
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
    overflow: hidden;
}

.sidebar.open {
    left: 0;
    transform: translateX(0);
}

.sidebar-header {
    padding: 30px 24px;
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-header p {
    margin: 4px 0 0 0;
    font-size: 0.8rem;
    opacity: 0.85;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 8px;
}

.sidebar-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    color: var(--text-sub);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.sidebar-item:hover {
    background: var(--input-bg);
    color: var(--text-main);
}

.sidebar-item:active {
    transform: scale(0.97);
}

.sidebar-item.active {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    font-weight: 600;
}

body.dark-mode .sidebar-item.active {
    background: rgba(129, 140, 248, 0.12);
    color: var(--primary-light);
}

.sidebar-icon {
    width: 24px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.15rem;
}

/* --- SIDEBAR DROPDOWN FOR TOOLS --- */
.sidebar-dropdown {
    display: flex;
    flex-direction: column;
}
.sidebar-dropdown-content {
    display: none;
    flex-direction: column;
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
    margin-left: 24px;
    margin-top: 4px;
    margin-bottom: 8px;
}
.sidebar-dropdown-content.open {
    display: flex !important;
}
.sidebar-dropdown-arrow {
    font-size: 0.8rem;
    margin-left: auto;
    transition: transform 0.2s ease;
}
.sidebar-dropdown-arrow.rotated {
    transform: rotate(180deg);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.tab-content {
    display: none;
    padding: 24px 20px;
    animation: fadein 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
    display: block;
}

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

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

h1 {
    font-size: 1.6rem;
    margin: 0;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.search-container {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 30px;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: all 0.25s ease;
}

.search-input:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.filter-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text-sub);
    transition: all 0.2s ease;
}

.filter-chip:hover {
    border-color: var(--primary-light);
    color: var(--text-main);
}

.filter-chip.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.date-filter-container {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
    background: var(--bg-card);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.date-input {
    flex: 1;
    padding: 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-main);
    min-width: 100px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.date-input:focus {
    border-color: var(--primary);
}

.lista-produtos {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.btn-view {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    outline: none;
}

.btn-view.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

body.dark-mode .btn-view.active {
    background: var(--input-bg);
    color: var(--primary-light);
}

.grid-produtos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
}

@media (min-width: 600px) {
    .grid-produtos {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

.card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s, border-color 0.25s;
}

.card:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.25);
}

.card:active {
    transform: translateY(-2px) scale(0.98);
}

.card-img-wrapper {
    width: 100%;
    padding-top: 100%;
    position: relative;
    background: #e2e8f0;
}

body.dark-mode .card-img-wrapper {
    background: #1e293b;
}

.card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.card:hover .card-img {
    transform: scale(1.05);
}

.stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.quick-stock-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: var(--primary-gradient);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
    z-index: 10;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.quick-stock-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.45);
}

.quick-stock-btn:active {
    transform: scale(0.9);
}

.card-body {
    padding: 16px;
}

.card-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
    color: var(--text-main);
}

.card-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.05rem;
}

.margin-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--secondary-gradient);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.2);
}

.list-container {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.list-item:hover {
    background: rgba(99, 102, 241, 0.02);
}

.list-item:last-child {
    border-bottom: none;
}

.item-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
}

.item-date {
    font-size: 0.75rem;
    color: var(--text-sub);
    margin-top: 4px;
}

.val-entrada {
    color: var(--secondary);
    font-weight: 700;
}

.val-saida {
    color: var(--danger);
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-section-title {
    margin: 32px 0 16px 5px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.dashboard-card {
    background: var(--primary-gradient);
    color: white;
    padding: 24px 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.22);
}

.total-label {
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.total-value {
    font-size: 1.6rem;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: -0.5px;
}

.task-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-left-width: 5px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.task-card.pendente {
    border-left-color: var(--danger);
}

.task-card.em_producao {
    border-left-color: var(--warning);
}

.task-card.feito {
    border-left-color: var(--secondary);
}

.status-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    margin-right: 16px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s ease;
}

.status-btn.pendente {
    border-color: var(--danger);
    color: var(--danger);
}

.status-btn.pendente:hover {
    background: rgba(239, 68, 68, 0.1);
}

.status-btn.em_producao {
    border-color: var(--warning);
    background: var(--warning-gradient);
    color: white;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.status-btn.feito {
    border-color: var(--secondary);
    background: var(--secondary-gradient);
    color: white;
    box-shadow: 0 2px 6px rgba(16, 185, 205, 0.3);
}

.task-content {
    flex: 1;
    overflow: hidden;
}

.task-desc {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-main);
}

.task-meta {
    font-size: 0.8rem;
    color: var(--text-sub);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.whatsapp-btn {
    background: #25D366;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    transition: background 0.2s, transform 0.2s;
}

.whatsapp-btn:hover {
    background: #20ba5a;
    transform: scale(1.02);
}

.compra-card {
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.compra-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.compra-total {
    color: var(--danger);
    font-weight: 700;
}

.btn-add {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.btn-add:active {
    transform: scale(0.96);
}

.btn-full {
    width: 100%;
    padding: 14px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 15px;
    cursor: pointer;
    display: block;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.25);
}

.btn-full:active {
    transform: scale(0.96);
}

.btn-close {
    background: var(--input-bg);
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
    box-shadow: none;
}

.btn-close:hover {
    background: var(--border-color);
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-delete {
    background: #fee2e2;
    color: var(--danger);
    border: 1px solid #fecaca;
    margin-top: 25px;
    font-size: 0.9rem;
    box-shadow: none;
}

.btn-delete:hover {
    background: #fecaca;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.08);
}

body.dark-mode .btn-delete {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

body.dark-mode .btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-history {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    color: var(--text-sub);
    font-weight: 600;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-history:hover {
    border-color: var(--primary-light);
    color: var(--text-main);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.nav-bottom {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: calc(100% - 32px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    justify-content: space-around;
    padding: 12px 8px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
    z-index: 100;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

body.dark-mode .nav-bottom {
    background: rgba(19, 28, 46, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-sub);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

body.dark-mode .nav-item.active {
    color: var(--primary-light);
}

.nav-icon {
    font-size: 1.45rem;
    margin-bottom: 4px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.active .nav-icon {
    transform: translateY(-4px) scale(1.1);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-card);
    width: 92%;
    max-width: 440px;
    padding: 30px 24px;
    border-radius: 24px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    color: var(--text-main);
    transform: scale(0.92) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    border: 1px solid var(--border-color);
}

.modal.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-content-wide {
    max-width: 500px;
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-sub);
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    background: var(--input-bg);
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.custom-select-wrapper {
    position: relative;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-main);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.custom-select-trigger:hover {
    border-color: var(--primary-light);
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-top: 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--shadow-lg);
}

.custom-options.open {
    display: block;
}

.custom-option {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.custom-option:hover {
    background: rgba(99, 102, 241, 0.05);
}

.custom-option:last-child {
    border-bottom: none;
}

.option-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    background: #e2e8f0;
}

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-body);
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    text-align: center;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.user-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.user-card:hover {
    transform: translateY(-1px);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 16px;
}

body.dark-mode .user-avatar {
    background: rgba(129, 140, 248, 0.15);
    color: var(--primary-light);
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-remove {
    color: var(--danger);
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    transition: opacity 0.2s;
}

.cart-remove:hover {
    opacity: 0.8;
}

.chart-container {
    height: 280px;
    width: 100%;
    background: var(--bg-card);
    padding: 16px;
    border-radius: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: var(--shadow-sm);
}

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

@media (min-width: 600px) {
    .chart-grid {
        grid-template-columns: 1fr 1fr;
    }
}

#printableArea {
    position: absolute;
    top: -9999px;
    left: -9999px;
    width: 58mm;
    background: white;
    color: black;
    font-family: 'Courier New', monospace;
    padding: 10px;
}

.recibo-header {
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 2px dashed black;
    padding-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
}

.recibo-item {
    margin-bottom: 8px;
    display: block;
    width: 100%;
    font-size: 12px;
}

.recibo-squares {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.square {
    width: 12px;
    height: 12px;
    border: 2px solid black;
    display: inline-block;
}

.recibo-obs {
    margin-top: 10px;
    border-top: 2px dashed black;
    padding-top: 5px;
    font-size: 11px;
}

#labelPrintArea {
    position: absolute;
    top: -9999px;
    left: -9999px;
    width: 200px;
    height: 200px;
    background: white;
    color: black;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
    border: 2px solid black;
}

.label-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    line-height: 1.1;
}

.label-price {
    font-size: 24px;
    font-weight: bold;
    margin: 5px 0;
}

.check-item-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
}

.check-item-label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

.check-input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--primary);
}

@media (min-width: 1024px) {
    .sidebar-overlay {
        display: none !important;
    }
    .sidebar {
        left: 0 !important;
        transform: none !important;
        border-radius: 0;
        box-shadow: 1px 0 10px rgba(15, 23, 42, 0.04);
        border-right: 1.5px solid var(--border-color);
        z-index: 1000;
    }
    .nav-bottom {
        display: none !important;
    }
    .tab-content {
        margin-left: 280px;
        padding: 40px 60px;
        max-width: 1280px;
        margin-right: auto;
    }
    body {
        padding-bottom: 30px;
    }
    #floatingChatBtn {
        bottom: 24px !important;
        right: 24px !important;
    }
    #floatingChatWindow {
        bottom: 92px !important;
        right: 24px !important;
        width: 380px !important;
        height: 520px !important;
        max-height: 80vh !important;
    }
    
    /* Agrupar grids do Home em 4 colunas */
    #tab-home > .dashboard-grid:nth-of-type(1),
    #tab-home > .dashboard-grid:nth-of-type(2),
    #tab-home > .dashboard-grid:nth-of-type(3),
    #tab-home > .dashboard-grid:nth-of-type(4) {
        display: inline-grid;
        width: calc(50% - 10px);
        vertical-align: top;
    }
    #tab-home > .dashboard-grid:nth-of-type(1),
    #tab-home > .dashboard-grid:nth-of-type(3) {
        margin-right: 20px;
    }
}

@media (max-width: 1023px) {
    .mobile-hidden {
        display: none !important;
    }
}


@media print {
    body > *:not(#printableArea) {
        display: none !important;
    }

    #printableArea {
        position: static !important;
        top: auto !important;
        left: auto !important;
        display: block !important;
        width: 100%;
        margin: 0;
        padding: 0;
    }

/* --- LAYOUT DO PDV / CAIXA RÁPIDA --- */
.pdv-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-top: 15px;
    align-items: start;
}

.pdv-produtos-seccao {
    display: flex;
    flex-direction: column;
}

.pdv-grelha {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    padding-right: 5px;
}

.pdv-card-produto {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 150px;
}

.pdv-card-produto:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pdv-card-produto:active {
    transform: scale(0.96);
}

.pdv-card-img-wrapper {
    width: 100%;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--input-bg);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdv-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdv-card-nome {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-main);
    line-height: 1.25;
    height: 32px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 6px;
}

.pdv-card-preco {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--primary);
}

.pdv-card-stock {
    font-size: 0.72rem;
    color: var(--text-sub);
    margin-top: 4px;
}

.pdv-carrinho-seccao {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
    box-sizing: border-box;
}

.pdv-carrinho-lista {
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
    max-height: 250px;
    border: 1px dashed var(--border-color);
    padding: 10px;
    border-radius: 14px;
    background: var(--bg-body);
    box-sizing: border-box;
}

.pdv-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    gap: 8px;
    box-sizing: border-box;
}

.pdv-cart-item-info {
    flex-grow: 1;
    text-align: left;
}

.pdv-cart-item-nome {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.pdv-cart-item-subtotal {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-main);
}

.pdv-cart-item-preco {
    font-size: 0.72rem;
    color: var(--text-sub);
}

.pdv-cart-controles {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pdv-btn-tátil {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.pdv-btn-tátil:active {
    background: var(--input-bg);
}

.pdv-cart-qtd {
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 24px;
    text-align: center;
}

/* --- MEDIA QUERY RESPONSIVA MÓVEL --- */
@media (max-width: 768px) {
    .pdv-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .pdv-grelha {
        max-height: 250px;
    }
    .pdv-carrinho-seccao {
        max-height: none;
    }
}

/* --- MARKETING IA SPINNER --- */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    animation: spin 1s linear infinite;
}

.marketing-layout-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    padding-top: 10px;
}
@media (max-width: 768px) {
    .marketing-layout-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
}

@page {
    size: auto;
    margin: 0;
}
}
