*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #1e293b;
    background: #f1f5f9;
}

/* === LAYOUT === */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #0f1b47 0%, #1a2d6e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.main-area {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: white;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.content {
    padding: 28px;
    flex: 1;
}

/* === SIDEBAR === */
.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1a56db, #3b82f6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(26, 86, 219, 0.45);
}

.sidebar-brand .brand-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.brand-sub {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.nav-section {
    font-size: 9.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.28);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 14px 10px 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: background 0.14s, color 0.14s;
    margin-bottom: 1px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.92);
}

.nav-item.active {
    background: rgba(26, 86, 219, 0.85);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(26, 86, 219, 0.35);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #60a5fa;
    border-radius: 0 3px 3px 0;
}

.nav-item svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    fill: currentColor;
    stroke: none;
    opacity: 0.85;
}

.nav-item.active svg,
.nav-item:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 12px 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.14s;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #1a56db, #3b82f6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(26, 86, 219, 0.3);
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    line-height: 1.3;
}

.user-role {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.38);
    text-transform: capitalize;
    font-weight: 500;
}

/* === TOPBAR === */
.page-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-logout {
    background: none;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 7px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* === CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    transition: transform 0.18s, box-shadow 0.18s;
    border: 1px solid #f1f5f9;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.10);
}

.stat-card-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(26,86,219,0.13);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.stat-icon svg {
    width: 26px;
    height: 26px;
    fill: white;
    stroke: none;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === TABLES === */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.card-body {
    padding: 20px 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    font-size: 13.5px;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #f8fafc;
}

/* === BUTTONS === */
.btn {
    padding: 9px 18px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.btn svg {
    width: 15px;
    height: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, #1a56db, #3b82f6);
    color: white;
    box-shadow: 0 2px 8px rgba(26, 86, 219, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(26, 86, 219, 0.4);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-success {
    background: #f0fdf4;
    color: #16a34a;
}

.btn-success:hover {
    background: #dcfce7;
}

.btn-sm {
    padding: 5px 11px;
    font-size: 12px;
}

.btn-icon {
    padding: 7px;
    border-radius: 8px;
}

/* === FORMS === */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-full {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea,
.search-input,
.select-custom {
    padding: 9px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 9px;
    font-family: inherit;
    font-size: 14px;
    color: #1e293b;
    transition: all 0.15s;
    outline: none;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-input:focus,
.select-custom:focus {
    border-color: #1a56db;
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    padding-left: 36px;
    width: 100%;
    min-width: 250px;
    height: 41px;
    border: 2px solid #e5e7eb;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    transition: all 0.15s;
}

.search-box input:focus {
    border-color: #1a56db;
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: #94a3b8;
    pointer-events: none;
}

/* === STATUS BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-aberta {
    background: #fef3c7;
    color: #92400e;
}

.badge-em_andamento {
    background: #dbeafe;
    color: #1e40af;
}

.badge-concluida {
    background: #d1fae5;
    color: #065f46;
}

.badge-cancelada {
    background: #fee2e2;
    color: #991b1b;
}

.badge-baixo {
    background: #fee2e2;
    color: #991b1b;
}

.badge-ok {
    background: #d1fae5;
    color: #065f46;
}

.badge-dinheiro {
    background: #f0fdf4;
    color: #15803d;
}

.badge-pix {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge-credito {
    background: #fdf4ff;
    color: #7e22ce;
}

.badge-debito {
    background: #fff7ed;
    color: #c2410c;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 27, 71, 0.55);
    backdrop-filter: blur(3px);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-sm {
    max-width: 480px;
}

.modal-md {
    max-width: 640px;
}

.modal-lg {
    max-width: 860px;
}

.modal-header {
    padding: 22px 28px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.modal-close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    font-size: 18px;
    color: #64748b;
}

.modal-close:hover {
    background: #e2e8f0;
}

.modal-body {
    padding: 24px 28px;
}

.modal-footer {
    padding: 18px 28px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #f1f5f9;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    fill: #cbd5e1;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 13px;
}

/* === ALERTS === */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* === TABS === */
.tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tab {
    padding: 7px 16px;
    border-radius: 7px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.tab.active {
    background: white;
    color: #1a56db;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* === MISC === */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.gap-2 {
    gap: 8px;
}

.align-center {
    align-items: center;
}

.actions-cell {
    display: flex;
    gap: 6px;
}

.currency {
    font-weight: 600;
    color: #16a34a;
}

.text-muted {
    color: #94a3b8;
    font-style: italic;
}

.divider {
    height: 1px;
    background: #f1f5f9;
    margin: 20px 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.table-sm {
    font-size: 12px;
}

.table-sm th,
.table-sm td {
    padding: 6px 10px;
}
/* ===== ASSISTENTE FINANCEIRO ===== */

.ass-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 116px);
    max-width: 1100px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    overflow: hidden;
}

.ass-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #0f1b47 0%, #1a56db 100%);
    color: #fff;
    flex-shrink: 0;
}

.ass-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,.18);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ass-avatar svg { width: 24px; height: 24px; fill: #fff; }

.ass-header-text { flex: 1; }
.ass-title { font-size: 15px; font-weight: 700; }
.ass-subtitle { font-size: 12px; opacity: .75; margin-top: 2px; }

.ass-btn-voz {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
}
.ass-btn-voz:hover, .ass-btn-voz.ativo { background: rgba(255,255,255,.3); }
.ass-btn-voz svg { width: 20px; height: 20px; fill: currentColor; }

.ass-sugestoes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ass-sugestoes button {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: #fff;
    font-size: 12px;
    color: #334155;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}
.ass-sugestoes button:hover {
    background: #1a56db;
    color: #fff;
    border-color: #1a56db;
}

.ass-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
}

.ass-msg { display: flex; }
.ass-msg-user { justify-content: flex-end; }
.ass-msg-bot  { justify-content: flex-start; }

.ass-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
}

.ass-msg-user .ass-bubble {
    background: #1a56db;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ass-msg-bot .ass-bubble {
    background: #fff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* Loading dots animation */
.ass-loading {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
}
.ass-loading span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: assDot 1.2s infinite;
}
.ass-loading span:nth-child(2) { animation-delay: .2s; }
.ass-loading span:nth-child(3) { animation-delay: .4s; }

@keyframes assDot {
    0%, 80%, 100% { transform: scale(.8); opacity: .5; }
    40%            { transform: scale(1.2); opacity: 1; }
}

.ass-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ass-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
    background: #f8fafc;
}
.ass-input:focus { border-color: #1a56db; background: #fff; }

.ass-btn-mic,
.ass-btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .2s;
}

.ass-btn-mic {
    background: #f1f5f9;
    color: #64748b;
}
.ass-btn-mic:hover  { background: #e2e8f0; }
.ass-btn-mic.ativo  { background: #fee2e2; color: #dc2626; animation: assPulse 1s infinite; }
.ass-btn-mic svg    { width: 20px; height: 20px; fill: currentColor; }

.ass-btn-send {
    background: #1a56db;
    color: #fff;
}
.ass-btn-send:hover { background: #1547c0; }
.ass-btn-send svg   { width: 20px; height: 20px; fill: #fff; }

@keyframes assPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); }
    50%       { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}

/* === UPLOAD DE IMAGEM DE PRODUTO === */
.img-upload-area {
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.img-upload-preview {
    width: 100%;
    max-width: 260px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    padding: 8px;
}
