*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

input[type="date"],
input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.01em;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #1e293b;
    background: #dde1e7;
}

/* === 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: #f0f2f5;
    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: #f0f2f5;
    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: #f0f2f5;
    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;
}

.btn-receber {
    background: #16a34a;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}
.btn-receber:hover { background: #15803d; }

.btn-nfse {
    background: #7c3aed;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}
.btn-nfse:hover { background: #6d28d9; }

.btn-nfse-ok {
    background: #0ea5e9;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}
.btn-nfse-ok:hover { background: #0284c7; }

/* === 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: #f0f2f5;
}

.form-group input:not([type="password"]):not([type="email"]):not([type="number"]):not([type="date"]):not([type="time"]):not([type="month"]):not([type="color"]):not([type="file"]),
.form-group textarea,
.search-input {
    text-transform: uppercase;
}

.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-reagendar {
    background: #f3e8ff;
    color: #6b21a8;
}

.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;
}

.badge-cartao1 {
    background: #f0fdf4;
    color: #166534;
}

.badge-cartao2 {
    background: #ecfdf5;
    color: #065f46;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.badge-gray {
    background: #f1f5f9;
    color: #475569;
}

.badge-green {
    background: #d1fae5;
    color: #065f46;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

/* === 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: #f0f2f5;
    border-radius: 20px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    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: 1000px;
}

.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;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

.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: #f0f2f5;
    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: #f0f2f5;
    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: #f0f2f5;
    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: #f0f2f5;
    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: #f0f2f5;
    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: #f0f2f5; }

.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); }
}

/* === GRID DE SUMÁRIO DE RELATÓRIO === */
.rel-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* ===== RESPONSIVO ===== */

/* Botão hamburger — escondido no desktop */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: #1e293b;
    transition: background 0.15s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: #f1f5f9; }
.sidebar-toggle svg { width: 22px; height: 22px; fill: currentColor; display: block; }

/* Overlay do sidebar no mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* Wrapper de tabela para scroll horizontal */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* === TABLET (≤1024px) === */
@media (max-width: 1024px) {
    .sidebar { width: 210px; }
    .main-area { margin-left: 210px; }
    .content { padding: 20px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
    .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* === MOBILE (≤768px) === */
@media (max-width: 768px) {
    /* Sidebar off-canvas */
    .sidebar {
        transform: translateX(-260px);
        width: 260px;
        z-index: 200;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
        transition: transform 0.3s ease;
    }
    .sidebar.open { transform: translateX(0); }

    /* Main area full width */
    .main-area { margin-left: 0; }

    /* Topbar */
    .topbar { padding: 0 14px; gap: 10px; }
    .sidebar-toggle { display: flex; }
    .page-title { font-size: 15px; flex: 1; }

    /* Content */
    .content { padding: 12px; }

    /* Stats grid — 2 colunas */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }
    .stat-card { padding: 14px; gap: 10px; border-radius: 12px; }
    .stat-icon { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
    .stat-icon svg { width: 20px; height: 20px; }
    .stat-value { font-size: 17px; }
    .stat-label { font-size: 11px; }

    /* Cards */
    .card { border-radius: 12px; margin-bottom: 14px; }
    .card-header { padding: 12px 14px 10px; flex-wrap: wrap; gap: 8px; }
    .card-body { padding: 12px 14px; }

    /* Formulários — coluna única */
    .form-grid,
    .form-grid-3 { grid-template-columns: 1fr; }
    .form-full { grid-column: 1; }

    /* Search box */
    .search-box { flex: 1; min-width: 0; }
    .search-box input { min-width: unset; width: 100%; }

    /* Modais — sobem da parte inferior da tela */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal {
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        animation: slideUpModal 0.28s ease;
    }
    @keyframes slideUpModal {
        from { transform: translateY(40px); opacity: 0; }
        to   { transform: translateY(0);   opacity: 1; }
    }
    .modal-sm,
    .modal-md,
    .modal-lg { max-width: 100%; width: 100%; }
    .modal-header { padding: 16px 18px 12px; }
    .modal-body { padding: 14px 18px; }
    .modal-footer {
        padding: 12px 18px 24px;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .modal-footer .btn { flex: 1; justify-content: center; min-width: 120px; }

    /* Tabs — scroll horizontal */
    .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
    .tab { white-space: nowrap; flex-shrink: 0; }

    /* grid-2 — coluna única */
    .grid-2 { grid-template-columns: 1fr; }

    /* Assistente */
    .ass-container { height: calc(100vh - 88px); }
    .ass-sugestoes { display: none; }

    /* Toast */
    #toast { bottom: 12px; right: 8px; left: 8px; }
    #toast-inner { min-width: unset !important; }

    /* Tabelas — scroll via .table-scroll (injetado por JS) */
    .table-scroll table { min-width: 520px; }

    /* Botão logout — só ícone em telas pequenas */
    .btn-logout .btn-logout-text { display: none; }
    .btn-logout { padding: 7px 10px; }

    /* Ações do card-header (filtros de data, selects, botões) — quebra linha */
    .card-header .flex { flex-wrap: wrap; width: 100%; }
    .card-header .flex input[type="date"] { flex: 1; min-width: 130px; }
    .card-header .flex .select-custom { flex: 1; min-width: 130px; }
    .card-header .flex input[type="number"].select-custom { flex: 0 0 80px; min-width: 70px; }

    /* Grid de sumário de relatório (Receitas / Deduções / Resultado) */
    .rel-summary-grid { grid-template-columns: 1fr !important; }

    /* Botões maiores para toque confortável */
    .btn { padding: 11px 20px; font-size: 14px; }
    .btn-sm { padding: 5px 10px; font-size: 12px; }
    .btn-receber, .btn-nfse, .btn-nfse-ok { padding: 5px 10px; font-size: 12px; }
    .btn-icon { padding: 10px; min-width: 40px; min-height: 40px; justify-content: center; }
    .btn svg { width: 16px; height: 16px; }

    /* Inputs maiores para toque confortável */
    .form-group input,
    .form-group select,
    .form-group textarea,
    .search-input,
    .select-custom { padding: 11px 14px; font-size: 15px; min-height: 44px; }
    .search-box input { height: 46px; font-size: 14px; }

    /* Espaçamento entre botões de ação em tabelas */
    .flex.gap-1 { gap: 8px; }
    .flex.gap-2 { gap: 10px; }

}

/* === MOBILE PEQUENO (≤480px) === */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 10px 12px; }
    .stat-value { font-size: 15px; }
    .content { padding: 10px; }
    .topbar { height: 52px; padding: 0 10px; }
    .page-title { font-size: 14px; }
    .modal-footer { padding-bottom: 28px; }
}

/* === CARDS DE OS (mobile) === */
.os-card {
    background: #f0f2f5;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
}
.os-card-vencido { background: #fff5f5; border-color: #fecaca; }
.os-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.os-card-num { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.os-card-valor { font-size: 15px; font-weight: 700; color: #1e293b; white-space: nowrap; }
.os-card-cliente { font-size: 13px; color: #374151; margin-bottom: 4px; }
.os-card-desc { font-size: 13px; color: #64748b; margin-bottom: 10px; line-height: 1.4; }
.os-card-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid #f1f5f9; padding-top: 10px; }

/* === 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;
}
