:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1e293b;
    --gray: #64748b;
    --light-gray: #e2e8f0;
    --bg: #f1f5f9;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 10px;
}

body.dark {
    --primary: #60a5fa;
    --primary-dark: #93c5fd;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    --dark: #f1f5f9;
    --gray: #94a3b8;
    --light-gray: #475569;
    --bg: #0f172a;
    --white: #1e293b;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
}

body.dark input,
body.dark select,
body.dark textarea {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

body.dark input::placeholder,
body.dark textarea::placeholder {
    color: #64748b;
}

body.dark .form-section {
    background: #1e293b;
}

body.dark .modal-content {
    background: #1e293b;
}

body.dark .modal-header {
    border-bottom-color: #475569;
}

body.dark .table-container {
    background: #1e293b;
}

body.dark th {
    background: #334155;
    color: #cbd5e1;
}

body.dark tr {
    border-bottom-color: #334155;
}

body.dark .list-empty {
    color: #94a3b8;
}

body.dark .info-box {
    background: #1e3a5f;
    color: #93c5fd;
}

body.dark .checkbox-item {
    background: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

body.dark .toggle-btn {
    background: #1e293b;
    border-color: #475569;
    color: #94a3b8;
}

body.dark .toggle-btn:hover {
    border-color: #60a5fa;
    color: #60a5fa;
}

body.dark .toggle-btn.active {
    background: #1e3a5f;
    border-color: #60a5fa;
    color: #93c5fd;
}

body.dark label {
    color: #e2e8f0;
}

body.dark small {
    color: #94a3b8;
}

body.dark .card {
    background: #1e293b;
}

body.dark .card-info h3 {
    color: #f1f5f9;
}

body.dark .card-info p {
    color: #94a3b8;
}

body.dark .section-card {
    background: #1e293b;
}

body.dark .section-card h3 {
    color: #f1f5f9;
}

body.dark .ficha-card {
    background: #1e293b;
}

body.dark .ficha-card h4 {
    color: #f1f5f9;
}

body.dark .ficha-meta span {
    color: #94a3b8;
    background: #334155;
}

body.dark .ficha-value label {
    color: #94a3b8;
}

body.dark .ficha-value strong {
    color: #f1f5f9;
}

body.dark .result-label {
    color: #94a3b8;
}

body.dark .result-value {
    color: #f1f5f9;
}

body.dark .ingrediente-row {
    background: #334155;
}

body.dark .ingrediente-custo {
    color: #cbd5e1;
}

body.dark .btn-outline {
    border-color: #475569;
    color: #94a3b8;
}

body.dark .btn-outline:hover {
    border-color: #e2e8f0;
    color: #f1f5f9;
}

body.dark .btn-secondary {
    background: #334155;
    color: #e2e8f0;
}

body.dark .btn-secondary:hover {
    background: #475569;
}

body.dark .ficha-view-header {
    border-bottom-color: #475569;
}

body.dark .ficha-view-header p {
    color: #cbd5e1;
}

body.dark .ficha-view-total {
    background: #334155;
}

/* Cores destacadas na visualização da ficha */
.ficha-view-total.warning {
    background: #fef3c7;
    color: #92400e;
}
.ficha-view-total.success {
    background: #dcfce7;
    color: #166534;
}
body.dark .ficha-view-total.warning {
    background: #78350f;
    color: #fcd34d;
}
body.dark .ficha-view-total.success {
    background: #14532d;
    color: #86efac;
}

body.dark .ficha-view-table th {
    background: #334155;
    color: #e2e8f0;
}

body.dark .ficha-view-table td {
    border-bottom-color: #475569;
    color: #e2e8f0;
}

/* Ajuste de cores dos cards de resultado no tema escuro */
body.dark .result-item.highlight.lucro,
body.dark .result-item.highlight.lucro-total {
    background: #14532d !important;
}
body.dark .result-item.highlight.lucro .result-label,
body.dark .result-item.highlight.lucro-total .result-label {
    color: #86efac !important;
}
body.dark .result-item.highlight.lucro .result-value,
body.dark .result-item.highlight.lucro-total .result-value {
    color: #dcfce7 !important;
}

body.dark .result-item.highlight.margem {
    background: #713f12 !important;
}
body.dark .result-item.highlight.margem .result-label {
    color: #fde047 !important;
}
body.dark .result-item.highlight.margem .result-value {
    color: #fef9c3 !important;
}

body.dark .result-item.highlight.markup {
    background: #1e3a5f !important;
}
body.dark .result-item.highlight.markup .result-label {
    color: #93c5fd !important;
}
body.dark .result-item.highlight.markup .result-value {
    color: #dbeafe !important;
}

/* Ajuste da seção Controle de Clientes no tema escuro */
body.dark .form-section.results[style*="background: #f0f9ff"] {
    background: #1e293b !important;
    border-color: #475569 !important;
}

body.dark .form-section.results[style*="background: #f0f9ff"] h3 {
    color: #f1f5f9 !important;
}

body.dark .form-section.results .form-group label[style*="color: #0c4a6e"] {
    color: #e2e8f0 !important;
}

body.dark .form-section.results .form-group small[style*="color: #0c4a6e"] {
    color: #94a3b8 !important;
}

body.dark .form-section.results input[style*="border-color: #7dd3fc"] {
    border-color: #475569 !important;
    background: #0f172a;
}

body.dark .form-section.results .result-item[style*="background: #e0f2fe"] {
    background: #334155 !important;
}

body.dark .form-section.results .result-item[style*="background: #e0f2fe"] .result-label {
    color: #94a3b8 !important;
}

body.dark .form-section.results .result-item[style*="background: #e0f2fe"] .result-value {
    color: #f1f5f9 !important;
}

body.dark .form-section.results .result-item[style*="background: #dcfce7"] {
    background: #14532d !important;
}

body.dark .form-section.results .result-item[style*="background: #dcfce7"] .result-label {
    color: #86efac !important;
}

body.dark .form-section.results .result-item[style*="background: #dcfce7"] .result-value {
    color: #bbf7d0 !important;
}

/* Dark mode: modal de visualização da ficha (ficha-view-results) */
body.dark .ficha-view-results .result-item[style*="background: #e0f2fe"],
body.dark .ficha-view-results .result-item[style*="background:#e0f2fe"] {
    background: #334155 !important;
}
body.dark .ficha-view-results .result-item[style*="background: #e0f2fe"] .result-label,
body.dark .ficha-view-results .result-item[style*="background: #e0f2fe"] .result-value,
body.dark .ficha-view-results .result-item[style*="background:#e0f2fe"] .result-label,
body.dark .ficha-view-results .result-item[style*="background:#e0f2fe"] .result-value {
    color: #f1f5f9 !important;
}

body.dark .ficha-view-results .result-item[style*="background: #dcfce7"],
body.dark .ficha-view-results .result-item[style*="background:#dcfce7"] {
    background: #14532d !important;
}
body.dark .ficha-view-results .result-item[style*="background: #dcfce7"] .result-label,
body.dark .ficha-view-results .result-item[style*="background: #dcfce7"] .result-value,
body.dark .ficha-view-results .result-item[style*="background:#dcfce7"] .result-label,
body.dark .ficha-view-results .result-item[style*="background:#dcfce7"] .result-value {
    color: #86efac !important;
}

body.dark .ficha-view-results .result-item[style*="background: #eff6ff"],
body.dark .ficha-view-results .result-item[style*="background:#eff6ff"] {
    background: #334155 !important;
}
body.dark .ficha-view-results .result-item[style*="background: #eff6ff"] .result-label,
body.dark .ficha-view-results .result-item[style*="background: #eff6ff"] .result-value,
body.dark .ficha-view-results .result-item[style*="background:#eff6ff"] .result-label,
body.dark .ficha-view-results .result-item[style*="background:#eff6ff"] .result-value {
    color: #f1f5f9 !important;
}

body.dark .ficha-view-results .result-item[style*="background: #ffedd5"],
body.dark .ficha-view-results .result-item[style*="background:#ffedd5"] {
    background: #78350f !important;
}
body.dark .ficha-view-results .result-item[style*="background: #ffedd5"] .result-label,
body.dark .ficha-view-results .result-item[style*="background: #ffedd5"] .result-value,
body.dark .ficha-view-results .result-item[style*="background:#ffedd5"] .result-label,
body.dark .ficha-view-results .result-item[style*="background:#ffedd5"] .result-value {
    color: #fcd34d !important;
}

/* Dark mode: cards de ficha (ficha-value) */
body.dark .ficha-value[style*="background: #dcfce7"],
body.dark .ficha-value[style*="background:#dcfce7"] {
    background: #14532d !important;
}
body.dark .ficha-value[style*="background: #dcfce7"] label,
body.dark .ficha-value[style*="background: #dcfce7"] strong,
body.dark .ficha-value[style*="background:#dcfce7"] label,
body.dark .ficha-value[style*="background:#dcfce7"] strong {
    color: #86efac !important;
}

/* Dark mode: divs coloridas no modal de visualização */
body.dark #view-ficha-conteudo > div > div[style*="background:#fff7ed"] {
    background: #1e293b !important;
    border-color: #9a3412 !important;
}
body.dark #view-ficha-conteudo > div > div[style*="background:#fff7ed"] p,
body.dark #view-ficha-conteudo > div > div[style*="background:#fff7ed"] strong {
    color: #fdba74 !important;
}

/* Dark mode: linhas de extras na tabela de escala */
body.dark #tabela-escala tr[style*="background:#fef3c7"],
body.dark .ficha-view-table tr[style*="background:#fef3c7"] {
    background: #78350f !important;
}
body.dark #tabela-escala tr[style*="background:#fef3c7"] td,
body.dark #tabela-escala tr[style*="background:#fef3c7"] th,
body.dark .ficha-view-table tr[style*="background:#fef3c7"] td,
body.dark .ficha-view-table tr[style*="background:#fef3c7"] th {
    color: #fcd34d !important;
}
body.dark #view-ficha-conteudo > div > div[style*="background:#f0f9ff"] {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
body.dark #view-ficha-conteudo > div > div[style*="background:#f0f9ff"] * {
    color: #e2e8f0 !important;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--dark);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #1e293b;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo i { font-size: 24px; color: #3b82f6; }
.logo h1 { font-size: 18px; font-weight: 600; color: #ffffff; }

.nav-menu {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.nav-item.active {
    background: #3b82f6;
    color: #ffffff;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
}

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

.top-bar h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray);
    background: var(--white);
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray);
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); }

/* Pages */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s; }

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

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--white);
}

.card.info .card-icon { background: var(--info); }
.card.success .card-icon { background: var(--success); }
.card.warning .card-icon { background: var(--warning); }
.card.danger .card-icon { background: var(--danger); }
.card.primary .card-icon { background: var(--primary); }

.card-info h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
}

.card-info p {
    font-size: 13px;
    color: var(--gray);
    margin-top: 2px;
}

/* Sections */
.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.section-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.section-card h3 {
    font-size: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--dark);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover { background: var(--primary-dark); }

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

.btn-secondary:hover { background: #cbd5e1; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--light-gray);
    color: var(--gray);
}

.btn-outline:hover { border-color: var(--gray); color: var(--dark); }

.btn-danger {
    background: #fef2f2;
    color: var(--danger);
}

.btn-danger:hover { background: #fee2e2; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Action Bar */
.action-bar {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}

/* Table */
.table-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

th, td {
    padding: 14px 16px;
    text-align: left;
    font-size: 14px;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--gray);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr { border-bottom: 1px solid var(--light-gray); }
tr:last-child { border-bottom: none; }
td { color: var(--dark); }

/* Fichas Grid */
.fichas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.ficha-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

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

.ficha-card h4 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--dark);
}

.ficha-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.ficha-meta span {
    font-size: 12px;
    color: var(--gray);
    background: var(--bg);
    padding: 4px 10px;
    border-radius: 6px;
}

.ficha-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--light-gray);
}

.ficha-value {
    display: flex;
    flex-direction: column;
}

.ficha-value label {
    font-size: 11px;
    color: var(--gray);
    text-transform: uppercase;
}

.ficha-value strong {
    font-size: 15px;
    color: var(--dark);
    margin-top: 2px;
}

.ficha-value.success strong { color: var(--success); }
.ficha-value.danger strong { color: var(--danger); }

.ficha-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.ficha-card:hover .ficha-actions { opacity: 1; }

/* Painel financeiro simplificado no card da ficha */
.ficha-card-simple {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.ficha-card-simple .big-block {
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--light-gray);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ficha-card-simple .big-block label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
    font-weight: 600;
}

.ficha-card-simple .big-block strong {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

.ficha-card-simple .big-block small {
    font-size: 12px;
    color: var(--gray);
}

/* Cores por tipo */
.ficha-card-simple .big-block.investimento {
    background: #fff1f2;
    border-color: #fecdd3;
}
.ficha-card-simple .big-block.investimento strong,
.ficha-card-simple .big-block.investimento label { color: #be123c; }

.ficha-card-simple .big-block.receita {
    background: #ecfdf5;
    border-color: #a7f3d0;
}
.ficha-card-simple .big-block.receita strong,
.ficha-card-simple .big-block.receita label { color: #047857; }

.ficha-card-simple .big-block.lucro {
    background: #f0fdf4;
    border-color: #86efac;
}
.ficha-card-simple .big-block.lucro strong,
.ficha-card-simple .big-block.lucro label { color: #15803d; }

.ficha-card-simple .big-block.saude.ok {
    background: #eff6ff;
    border-color: #bfdbfe;
}
.ficha-card-simple .big-block.saude.ok strong,
.ficha-card-simple .big-block.saude.ok label { color: #1d4ed8; }

.ficha-card-simple .big-block.saude.ruim {
    background: #fff7ed;
    border-color: #fed7aa;
}
.ficha-card-simple .big-block.saude.ruim strong,
.ficha-card-simple .big-block.saude.ruim label { color: #c2410c; }

.ficha-card-simple .big-block.disabled {
    opacity: 0.6;
    background: var(--light-gray) !important;
}
.ficha-card-simple .big-block.disabled strong,
.ficha-card-simple .big-block.disabled label,
.ficha-card-simple .big-block.disabled small { color: var(--gray) !important; }

/* Dark mode */
body.dark .ficha-card-simple .big-block {
    background: #334155;
    border-color: #475569;
}
body.dark .ficha-card-simple .big-block label { color: #94a3b8; }
body.dark .ficha-card-simple .big-block strong { color: #f1f5f9; }
body.dark .ficha-card-simple .big-block small { color: #94a3b8; }

body.dark .ficha-card-simple .big-block.investimento {
    background: #4c0519;
    border-color: #9f1239;
}
body.dark .ficha-card-simple .big-block.investimento strong,
body.dark .ficha-card-simple .big-block.investimento label { color: #fda4af; }

body.dark .ficha-card-simple .big-block.receita {
    background: #064e3b;
    border-color: #059669;
}
body.dark .ficha-card-simple .big-block.receita strong,
body.dark .ficha-card-simple .big-block.receita label { color: #6ee7b7; }

body.dark .ficha-card-simple .big-block.lucro {
    background: #064e3b;
    border-color: #10b981;
}
body.dark .ficha-card-simple .big-block.lucro strong,
body.dark .ficha-card-simple .big-block.lucro label { color: #86efac; }

body.dark .ficha-card-simple .big-block.saude.ok {
    background: #1e3a8a;
    border-color: #3b82f6;
}
body.dark .ficha-card-simple .big-block.saude.ok strong,
body.dark .ficha-card-simple .big-block.saude.ok label { color: #93c5fd; }

body.dark .ficha-card-simple .big-block.saude.ruim {
    background: #7c2d12;
    border-color: #f97316;
}
body.dark .ficha-card-simple .big-block.saude.ruim strong,
body.dark .ficha-card-simple .big-block.saude.ruim label { color: #fdba74; }

body.dark .ficha-card-simple .big-block.disabled {
    opacity: 0.5;
    background: #1e293b !important;
    border-color: #475569 !important;
}
body.dark .ficha-card-simple .big-block.disabled strong,
body.dark .ficha-card-simple .big-block.disabled label,
body.dark .ficha-card-simple .big-block.disabled small { color: #64748b !important; }

@media (max-width: 600px) {
    .ficha-card-simple { grid-template-columns: 1fr; }
}

.ficha-actions button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: var(--bg);
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ficha-actions button:hover { background: var(--light-gray); color: var(--dark); }

/* Forms */
.form-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.form-section h3 {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.section-header h3 { margin: 0; }

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

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

.form-group.small { max-width: 160px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.ingrediente-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    background: var(--bg);
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.ingrediente-row .form-group { margin-bottom: 0; }

.ingrediente-custo {
    font-size: 13px;
    color: var(--gray);
    padding-bottom: 10px;
}

.btn-remover {
    padding: 10px;
    background: #fef2f2;
    color: var(--danger);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0;
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Results */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.result-item {
    background: var(--bg);
    padding: 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-item.highlight { background: #eff6ff; }
.result-item.highlight.lucro { background: #ecfdf5; }
.result-item.highlight.lucro-total { background: #ecfdf5; }
.result-item.highlight.margem { background: #fffbeb; }
.result-item.highlight.markup { background: #eff6ff; }

.result-label {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

/* Info Box */
.erro-servidor {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: #ef4444;
    color: #fff;
    padding: 16px;
    z-index: 999;
    text-align: center;
    font-family: sans-serif;
    font-size: 14px;
}

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

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid var(--light-gray);
    color: var(--dark);
}

.checkbox-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.checkbox-item:hover {
    border-color: var(--primary);
}

.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.toggle-btn {
    padding: 12px;
    border: 2px solid var(--light-gray);
    border-radius: 10px;
    background: var(--white);
    color: var(--gray);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.toggle-btn.active {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary);
}

.info-box {
    background: #eff6ff;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--primary);
}

/* Empty States */
.list-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray);
}

.list-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.list-empty.small { padding: 24px; }
.list-empty.small i { font-size: 32px; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s;
    scrollbar-width: thin;
    scrollbar-color: var(--light-gray) transparent;
}

.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb { background: var(--light-gray); border-radius: 10px; }

.modal-content.modal-large { max-width: 700px; }
.modal-content.modal-produto { max-width: 640px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--light-gray);
}

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

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray);
    cursor: pointer;
    line-height: 1;
}

.modal form { padding: 24px; }

.modal form .section-divider {
    border-top: 1px solid var(--light-gray);
    margin: 20px 0 16px;
    padding-top: 16px;
}

.modal form .section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.modal form .form-row {
    gap: 14px;
    margin-bottom: 0;
}

.modal form .form-row .form-group {
    margin-bottom: 14px;
}

.modal form input,
.modal form select {
    padding: 11px 14px;
    min-height: 42px;
}

.modal form label {
    font-size: 13px;
    margin-bottom: 5px;
}

.modal form small {
    font-size: 11px;
    margin-top: 4px;
    display: block;
    line-height: 1.4;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
    padding-top: 16px;
    border-top: 1px solid var(--light-gray);
}

/* View Ficha */
.ficha-view-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--light-gray);
}

.ficha-view-header h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.ficha-view-header p {
    color: var(--gray);
    font-size: 14px;
}

.ficha-view-table {
    width: 100%;
    margin-bottom: 20px;
}

.ficha-view-table th,
.ficha-view-table td {
    padding: 10px 12px;
    font-size: 14px;
}

.ficha-view-table th {
    background: var(--bg);
    text-align: left;
    font-weight: 600;
    color: var(--gray);
}

.ficha-view-table td { border-bottom: 1px solid var(--light-gray); }
.ficha-view-table .text-right { text-align: right; }

.ficha-view-total {
    background: #f8fafc;
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.ficha-view-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--dark);
    color: var(--white);
    padding: 14px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 300;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast i { color: var(--success); font-size: 18px; }

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer button {
    width: 100%;
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.sidebar-footer button:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .main-content { margin-left: 0; padding: 16px; }
    .app-container { flex-direction: column; }
    .nav-menu { flex-direction: row; overflow-x: auto; padding: 8px; }
    .nav-item span { display: none; }
    .form-row,
    .ingrediente-row,
    .ficha-view-results {
        grid-template-columns: 1fr;
    }
    .cards-grid { grid-template-columns: 1fr; }
    .fichas-grid { grid-template-columns: 1fr; }
}
