:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-soft: #d1fae5;
    --accent: #0ea5e9;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 0.925rem;
}

/* ====== Layout ====== */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #cbd5e1;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.brand-name {
    font-weight: 700;
    color: #fff;
    font-size: 1.02rem;
    letter-spacing: 0.2px;
}

.brand-sub {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar .menu-label {
    padding: 18px 20px 6px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 2px 10px;
    border-radius: 10px;
    color: #cbd5e1;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar .nav-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.sidebar .sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.75rem;
    color: #64748b;
    margin-top: auto;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar .topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.topbar .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 50px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.app-content {
    padding: 28px;
    flex: 1;
}

@media (max-width: 991.98px) {
    .sidebar-static { display: none; }
    .app-content { padding: 20px 16px; }
}

/* ====== Cards ====== */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.stat-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--surface);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #fff;
    flex-shrink: 0;
    line-height: 1;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.bg-grad-emerald { background: linear-gradient(135deg, #10b981, #059669); }
.bg-grad-sky { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.bg-grad-violet { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-grad-amber { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* ====== Botões ====== */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-sm { border-radius: 8px; }
.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
}
.btn-success:hover { background: linear-gradient(135deg, #059669, #047857); }
.btn-outline-success { --bs-btn-color: var(--primary-dark); --bs-btn-border-color: #6ee7b7; }
.btn-outline-success:hover { background: var(--primary); border-color: var(--primary); }

/* Painel administrativo (dev): azul-escuro/navy para leitura confortável */
.btn-admin {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: none;
    color: #fff;
}
.btn-admin:hover {
    background: linear-gradient(135deg, #0f172a, #020617);
    color: #fff;
}

/* ====== Tabelas / DataTables ====== */
.table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table tbody tr { transition: background 0.1s ease; }

/* Substitui o preto do Bootstrap (table-dark / bg-dark) pelas cores da paleta */
.table-dark {
    --bs-table-color: #334155;
    --bs-table-bg: #f8fafc;
    --bs-table-border-color: var(--border);
    --bs-table-hover-color: #334155;
    --bs-table-hover-bg: #f1f5f9;
}

.bg-dark {
    background-color: #0f172a !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: 0.85rem;
    color: var(--muted);
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    margin-left: 6px;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    gap: 4px;
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .page-item {
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .page-link {
    border: 1px solid var(--border);
    border-radius: 8px !important;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    background: var(--surface);
    min-width: 30px;
    text-align: center;
    box-shadow: none;
    transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .page-link:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    background: #f8fafc;
    border-color: var(--border);
    color: #cbd5e1;
    opacity: 1;
}

.badge { border-radius: 50px; font-weight: 600; padding: 5px 10px; }

/* ====== Botões de ação em ícone ====== */
.btn-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    transition: all 0.15s ease;
    font-size: 1rem;
    line-height: 1;
    vertical-align: middle;
}

.btn-ico:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.btn-ico-info:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0369a1;
}

.btn-ico-success:hover {
    background: var(--primary-soft);
    border-color: #6ee7b7;
    color: var(--primary-dark);
}

.btn-ico-pdf:hover {
    background: #fce7f3;
    border-color: #f9a8d4;
    color: #be185d;
}

.btn-ico-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

/* ====== Login ====== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #064e3b 100%);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    padding: 40px 36px;
}

.login-card .brand-icon {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
    margin: 0 auto 18px;
}

.login-card h4 { font-weight: 800; }

.login-card .form-control {
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    border: 1px solid var(--border);
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

/* ====== Dropzone ====== */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
    transition: all 0.2s ease;
    cursor: pointer;
    padding: 40px 20px;
    text-align: center;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.dropzone .dz-icon {
    font-size: 2.6rem;
    color: var(--primary);
}

/* ====== Detalhe venda ====== */
.info-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.info-box .info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    font-weight: 600;
}

.info-box .info-value {
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 2px;
    word-break: break-all;
}

/* ====== Links ====== */
a { text-decoration: none; }

/* ====== Utilitários ====== */
.text-muted { color: var(--muted) !important; }
