        /* ========= HISTORY TABLE ========= */
        .history-panel {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            overflow: hidden;
        }
        .history-header {
            padding: 16px 18px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
        }
        .history-header h3 { margin: 0; font-size: 0.9rem; font-weight: 700; color: #fff; }
        .history-filters {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            padding: 10px 16px;
            border-bottom: 1px solid var(--border);
        }
        .history-date-filter {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }
        .history-date-filter input[type="date"] {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text);
            padding: 6px 10px;
            font-size: 0.82rem;
            font-family: inherit;
            outline: none;
            width: 140px;
        }
        .history-date-filter input[type="date"]:focus { border-color: var(--primary); }
        .history-date-filter .date-sep { color: var(--muted); font-size: 0.78rem; }
        .history-date-btns { display: flex; gap: 4px; margin-left: 4px; }
        .history-date-btns .date-btn {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--muted);
            padding: 5px 10px;
            font-size: 0.76rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
            white-space: nowrap;
        }
        .history-date-btns .date-btn:hover { border-color: var(--primary); color: var(--text); }
        .history-date-btns .date-btn.active {
            background: rgba(59,130,246,0.15);
            border-color: var(--primary);
            color: var(--primary);
        }
        .history-search {
            background: var(--surface-alt);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 8px 14px;
            border-radius: 10px;
            font-size: 0.84rem;
            min-width: 260px;
            outline: none;
        }
        .history-search:focus { border-color: var(--primary); }
        .history-search::placeholder { color: var(--muted); }
        .history-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
        .history-table thead tr { background: var(--surface-alt); }
        .history-table th {
            text-align: left;
            padding: 10px 16px;
            color: var(--muted);
            font-weight: 600;
            font-size: 0.78rem;
            cursor: pointer;
            user-select: none;
            white-space: nowrap;
        }
        .history-table th.text-right { text-align: right; }
        .history-table th.text-center { text-align: center; }
        .history-table th .sort-icon { margin-left: 4px; opacity: 0.4; }
        .history-table th.sorted .sort-icon { opacity: 1; color: var(--primary); }
        .history-table tbody tr {
            border-top: 1px solid var(--border);
            transition: background 0.15s;
        }
        .history-table tbody tr:hover { background: var(--surface-alt); }
        .history-table td { padding: 10px 16px; }
        .history-table td.text-right { text-align: right; }
        .history-table td.text-center { text-align: center; }
        .history-table .td-date { white-space: nowrap; line-height: 1.2; }
        .history-table .td-date .date-main { font-size: 0.84rem; color: var(--text); display: block; position: relative; top: -2px; }
        .history-table .td-date .date-time { font-size: 0.70rem; color: var(--muted); display: block; }
        .history-table .td-cpf { font-family: monospace; font-size: 0.80rem; color: var(--muted); }
        .history-table .td-client { color: #fff; font-weight: 600; }
        .history-table .td-product .tag-product {
            font-size: 0.76rem;
            padding: 3px 10px;
            border-radius: 999px;
            font-weight: 600;
            display: inline-block;
        }
        .history-table .td-value { color: var(--success); font-weight: 600; }
        .history-table .td-pdf svg { cursor: pointer; color: var(--primary); }
        .history-empty { padding: 40px; text-align: center; color: var(--muted); }
