:root {
    --gold: #C9A227;
    --gold-light: #E8D48B;
    --gold-dark: #9A7B1A;
    --black: #0A0A0A;
    --text: #1a1a1a;
    --text-muted: #6b7280;
    --bg-page: #f0f0f0;
    --bg-container: #ffffff;
    --bg-sidebar: #ffffff;
    --border: #e5e0d4;
    --border-gold: rgba(201, 162, 39, 0.45);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --accent-blue: #2563eb;
    --accent-green: #059669;
    --accent-red: #dc2626;
    --accent-purple: #7c3aed;
}

body {
    color: var(--text);
}

/* Layout */
.page-bg {
    background: var(--bg-page);
    color: var(--text);
}

.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-gold);
    box-shadow: var(--shadow);
}

.topbar {
    background: var(--bg-container);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Navegação */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: all 0.2s;
}
.nav-link:hover {
    background: rgba(201, 162, 39, 0.12);
    color: var(--gold-dark);
}
.nav-link.active {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.18), rgba(201, 162, 39, 0.06));
    color: var(--gold-dark);
    font-weight: 600;
    border-left: 3px solid var(--gold);
}

/* Containers brancos */
.card {
    background: var(--bg-container);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    color: var(--text);
}

.stat-card {
    background: var(--bg-container);
    border: 1px solid var(--border-gold);
    border-radius: 0.75rem;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.2) 0%, transparent 70%);
}
.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}
.stat-card .stat-value {
    color: var(--text);
}
.stat-card .stat-value-gold {
    color: var(--gold-dark);
}

/* Botões */
.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #fff;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}
.btn-gold:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 16px rgba(201, 162, 39, 0.35);
}

.btn-outline {
    border: 1px solid var(--gold);
    color: var(--gold-dark);
    background: transparent;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    cursor: pointer;
}
.btn-outline:hover {
    background: rgba(201, 162, 39, 0.1);
}

.btn-green {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}
.btn-green:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.35);
}
.btn-green:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Formulários */
.input-field {
    width: 100%;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    color: var(--text);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field:focus {
    outline: none;
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}
.input-field::placeholder {
    color: #9ca3af;
}

.label-field {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold-dark);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Títulos de seção */
.section-title {
    color: var(--gold-dark);
    font-weight: 600;
}

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

.text-gold-accent {
    color: var(--gold-dark);
    font-weight: 600;
}

/* Badges de status — cores de destaque */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-inicio { background: #f3f4f6; color: #4b5563; border: 1px solid #9ca3af; }
.badge-tratamento { background: #dbeafe; color: #1d4ed8; border: 1px solid #60a5fa; }
.badge-aguardando { background: #fef3c7; color: #b45309; border: 1px solid #f59e0b; }
.badge-pago { background: #dcfce7; color: #15803d; border: 1px solid #22c55e; }
.badge-preparacao_envio { background: #e0f2fe; color: #0369a1; border: 1px solid #38bdf8; }
.badge-enviado { background: #ede9fe; color: #6d28d9; border: 1px solid #8b5cf6; }
.badge-entregue { background: #d1fae5; color: #047857; border: 1px solid #059669; }
.badge-cancelado { background: #fee2e2; color: #b91c1c; border: 1px solid #dc2626; }

/* Tabelas */
.table-biotech {
    width: 100%;
    font-size: 0.875rem;
    color: var(--text);
}
.table-biotech thead {
    background: #faf8f3;
    border-bottom: 2px solid var(--border-gold);
}
.table-biotech th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--gold-dark);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}
.table-biotech td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0ebe0;
}
.table-biotech tbody tr:hover {
    background: rgba(201, 162, 39, 0.06);
}

/* Toasts */
.toast {
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow);
}
.toast-success { background: #ecfdf5; color: #047857; border: 1px solid #6ee7b7; }
.toast-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.toast-info { background: #fffbeb; color: var(--gold-dark); border: 1px solid var(--border-gold); }

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

/* Modais */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-content {
    background: var(--bg-container);
    border: 1px solid var(--border-gold);
    border-radius: 0.75rem;
    max-width: 32rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    color: var(--text);
}

/* Alertas */
.alert-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}
.alert-info {
    background: #fffbeb;
    border: 1px solid var(--border-gold);
    color: var(--gold-dark);
}

/* Estoque baixo */
.row-low-stock {
    background: #fef2f2 !important;
}
.stock-low {
    color: var(--accent-red);
    font-weight: 700;
}
.stock-ok {
    color: var(--gold-dark);
    font-weight: 600;
}

/* Logo da empresa */
.brand-logo {
    display: block;
    object-fit: contain;
    max-width: 100%;
    height: auto;
}
.brand-logo--sidebar {
    max-height: 96px;
    max-width: 280px;
}
.brand-logo--topbar {
    max-height: 52px;
    max-width: 200px;
}
.brand-logo--login {
    max-height: 120px;
    max-width: 360px;
}
.brand-logo--preview {
    max-height: 100px;
    max-width: 320px;
}

/* Login */
.login-page {
    background: linear-gradient(160deg, #f5f5f5 0%, #fff 40%, #faf6eb 100%);
}
.login-brand {
    color: var(--gold-dark);
}
.login-card {
    background: var(--bg-container);
    border: 1px solid var(--border-gold);
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Dashboard — gráficos compactos */
.chart-card-compact {
    padding: 0.875rem 1rem !important;
}
.chart-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gold-dark);
    margin-bottom: 0.5rem;
}
.chart-wrap {
    position: relative;
    height: 140px;
    width: 100%;
}
.chart-wrap--donut {
    height: 150px;
}

/* Autocomplete / typeahead */
.search-bar-wrap {
    position: relative;
    width: 100%;
    max-width: 28rem;
}
.search-bar-wrap .typeahead-wrap input {
    padding-left: 2.25rem;
}
.search-bar-wrap::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    z-index: 2;
    opacity: 0.45;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239A7B1A'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") center/contain no-repeat;
    pointer-events: none;
}
.typeahead-wrap {
    position: relative;
    width: 100%;
}
.typeahead-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 50;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-gold);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.typeahead-list.hidden {
    display: none;
}
.typeahead-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.625rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 1px solid #f0ebe0;
    color: var(--text);
}
.typeahead-item:hover,
.typeahead-item:focus {
    background: rgba(201, 162, 39, 0.12);
    outline: none;
}
.typeahead-item:last-child {
    border-bottom: none;
}
.typeahead-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
}
.typeahead-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}
.typeahead-empty {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
}
.typeahead-loading {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: var(--gold-dark);
    text-align: center;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f0f0f0; }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

/* Paginação */
.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0 0;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
}
.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}
.pagination-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}
.pagination-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--bg-container);
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.pagination-btn:hover:not(:disabled):not(.is-active) {
    border-color: var(--gold);
    color: var(--gold-dark);
}
.pagination-btn.is-active {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
    font-weight: 600;
}
.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pagination-ellipsis {
    padding: 0 0.35rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}
