:root {
    --primary: #8B7355;
    --primary-light: #C4A882;
    --primary-lighter: #E8DCC8;
    --primary-bg: #F7F3EE;
    --secondary: #5C6B73;
    --success: #4CAF50;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --info: #3498db;
    --dark: #2C3E50;
    --gray: #95a5a6;
    --light-gray: #ecf0f1;
    --card-shadow: 0 2px 10px rgba(0,0,0,0.06);
    --card-radius: 10px;
    --sidebar-width: 260px;
    --header-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-bg);
    color: var(--dark);
    font-size: 14px;
    line-height: 1.5;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid #e8e0d6;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--primary-lighter);
}

.sidebar-logo h2 {
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
}

.sidebar-logo span {
    color: var(--gray);
    font-size: 12px;
}

.sidebar-menu { padding: 10px 0; }

.sidebar-menu .menu-label {
    padding: 8px 20px 4px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray);
    letter-spacing: 1px;
    font-weight: 600;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s;
    gap: 12px;
    font-size: 13px;
}

.sidebar-menu a:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.sidebar-menu a.active {
    background: var(--primary-lighter);
    color: var(--primary);
    font-weight: 600;
    border-right: 3px solid var(--primary);
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.header {
    background: #fff;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid #e8e0d6;
    position: sticky;
    top: 0;
    z-index: 99;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 400px;
}

.header-search input {
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 8px 14px;
    width: 100%;
    font-size: 13px;
    background: var(--primary-bg);
    outline: none;
    transition: border 0.2s;
}

.header-search input:focus {
    border-color: var(--primary-light);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-user .user-info {
    text-align: right;
}

.header-user .user-info .name {
    font-weight: 600;
    font-size: 13px;
}

.header-user .user-info .role {
    font-size: 11px;
    color: var(--gray);
}

.header-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 16px;
}

.content {
    padding: 25px 30px;
}

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

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
}

.page-header .subtitle {
    font-size: 13px;
    color: var(--gray);
    margin-top: 2px;
}

.card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid #f0ebe5;
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0ebe5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.card-body { padding: 20px; }

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid #f0ebe5;
    background: #faf8f6;
}

.card-stat {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.card-stat .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.card-stat .stat-icon.primary {
    background: #f0e6d8;
    color: var(--primary);
}

.card-stat .stat-icon.success {
    background: #e8f5e9;
    color: var(--success);
}

.card-stat .stat-icon.warning {
    background: #fff8e1;
    color: var(--warning);
}

.card-stat .stat-icon.danger {
    background: #fbe9e7;
    color: var(--danger);
}

.card-stat .stat-icon.info {
    background: #e3f2fd;
    color: var(--info);
}

.card-stat .stat-info h3 {
    font-size: 24px;
    font-weight: 700;
}

.card-stat .stat-info span {
    font-size: 12px;
    color: var(--gray);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: #7a644a;
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { background: #388E3C; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #c0392b; }

.btn-warning {
    background: var(--warning);
    color: #333;
}
.btn-warning:hover { background: #f39c12; }

.btn-info {
    background: var(--info);
    color: #fff;
}
.btn-info:hover { background: #2980b9; }

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark);
}
.btn-secondary:hover { background: #d5dbdb; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

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

table thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
    border-bottom: 1px solid #f0ebe5;
    background: #faf8f6;
}

table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0ebe5;
    font-size: 13px;
}

table tbody tr:hover {
    background: #faf8f6;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #fbe9e7; color: #c62828; }
.badge-warning { background: #fff8e1; color: #f57f17; }
.badge-primary { background: #e8eaf6; color: #283593; }
.badge-info { background: #e3f2fd; color: #1565c0; }

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d5d8dc;
    border-radius: 8px;
    font-size: 13px;
    transition: border 0.2s;
    outline: none;
    background: #fff;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

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

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-danger { background: #fbe9e7; color: #c62828; border: 1px solid #ffcdd2; }
.alert-warning { background: #fff8e1; color: #f57f17; border: 1px solid #ffecb3; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

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

@media (max-width: 768px) {
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .header { padding: 0 15px; }
    .content { padding: 15px; }
}

.pdv-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    height: calc(100vh - var(--header-height) - 50px);
}

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

.pdv-produtos .pdv-categorias {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    overflow-x: auto;
    flex-shrink: 0;
}

.pdv-categorias .cat-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #d5d8dc;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.2s;
}

.pdv-categorias .cat-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pdv-categorias .cat-btn:hover:not(.active) {
    background: var(--primary-bg);
}

.pdv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    padding: 5px 0;
}

.pdv-grid .produto-card {
    background: #fff;
    border: 1px solid #f0ebe5;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.pdv-grid .produto-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 12px rgba(139,115,85,0.15);
    transform: translateY(-1px);
}

.produto-card .prod-nome {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.produto-card .prod-preco {
    color: var(--primary);
    font-size: 16px;
    font-weight: 700;
}

.produto-card .prod-estoque {
    font-size: 11px;
    color: var(--gray);
}

.pdv-carrinho {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdv-carrinho .carrinho-header {
    padding: 14px 16px;
    border-bottom: 1px solid #f0ebe5;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdv-carrinho .carrinho-itens {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.carrinho-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--primary-bg);
    border-radius: 8px;
    margin-bottom: 6px;
}

.carrinho-item .item-info {
    flex: 1;
}

.carrinho-item .item-nome {
    font-weight: 600;
    font-size: 13px;
}

.carrinho-item .item-preco {
    font-size: 12px;
    color: var(--gray);
}

.carrinho-item .item-qtd {
    display: flex;
    align-items: center;
    gap: 6px;
}

.carrinho-item .item-qtd button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #d5d8dc;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carrinho-item .item-qtd input {
    width: 40px;
    text-align: center;
    border: 1px solid #d5d8dc;
    border-radius: 4px;
    padding: 2px;
    font-size: 13px;
}

.carrinho-item .item-total {
    font-weight: 700;
    font-size: 14px;
    min-width: 70px;
    text-align: right;
}

.carrinho-item .btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
}

.carrinho-footer {
    padding: 14px 16px;
    border-top: 1px solid #f0ebe5;
    background: #faf8f6;
}

.carrinho-footer .linha-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 13px;
}

.carrinho-footer .total-geral {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.pdv-pagamento {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.pdv-pagamento select, .pdv-pagamento input {
    width: 100%;
    padding: 8px;
    border: 1px solid #d5d8dc;
    border-radius: 6px;
    font-size: 13px;
}

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-bg);
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.08);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-card .logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-card .logo h1 {
    color: var(--primary);
    font-size: 28px;
}

.auth-card .logo p {
    color: var(--gray);
    font-size: 13px;
}

.pesquisa-produto {
    position: relative;
}

.pesquisa-produto .resultados {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e8e0d6;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: none;
}

.pesquisa-produto .resultados.show { display: block; }

.pesquisa-produto .result-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0ebe5;
}

.pesquisa-produto .result-item:hover { background: var(--primary-bg); }
.pesquisa-produto .result-item:last-child { border-bottom: none; }

.result-item .rp-nome { font-weight: 500; font-size: 13px; }
.result-item .rp-preco { color: var(--primary); font-weight: 600; }
.result-item .rp-codigo { font-size: 11px; color: var(--gray); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--gray); }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 10px; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }

.search-box {
    position: relative;
}

.search-box input {
    padding-left: 36px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--gray);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--primary-lighter);
}

.action-bar {
    display: flex;
    gap: 8px;
}

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

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    min-width: 180px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    z-index: 50;
    border: 1px solid #e8e0d6;
}

.dropdown-menu.show { display: block; }

.dropdown-menu a {
    display: block;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--dark);
    font-size: 13px;
}

.dropdown-menu a:hover { background: var(--primary-bg); }

.toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--dark);
}

@media (max-width: 768px) {
    .toggle-sidebar { display: block; }
    .pdv-layout { grid-template-columns: 1fr; height: auto; }
    .pdv-carrinho { max-height: 500px; }
}

.etiqueta-container {
    width: 58mm;
    padding: 4mm;
    font-family: 'Courier New', monospace;
    font-size: 10px;
}

.etiqueta-container .prod-nome {
    font-size: 12px;
    font-weight: bold;
}

.etiqueta-container .prod-preco {
    font-size: 18px;
    font-weight: bold;
    color: #000;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s;
    font-size: 13px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media print {
    .sidebar, .header, .no-print { display: none !important; }
    .main-content { margin: 0 !important; }
}
