/* =========================================================
   1SEN History Page
========================================================= */

.history-page,
.history-page *,
.history-page *::before,
.history-page *::after {
    box-sizing: border-box;
}

.history-page {
    width: 100%;
    color: var(--app-text);
}

.history-shell {
    width: 100%;
}

.history-header {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background:
        radial-gradient(circle at 10% 10%, rgba(var(--app-primary-rgb), .14), transparent 42%),
        var(--app-surface);
}

.history-eyebrow {
    display: inline-block;
    color: var(--app-secondary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.history-header h1 {
    margin: 6px 0 0;
    font-size: clamp(22px, 4.2vw, 30px);
    font-weight: 900;
    line-height: 1.2;
}

.history-header p {
    margin: 8px 0 0;
    color: var(--app-text-soft);
    font-size: 13px;
    line-height: 1.55;
}

.history-summary-grid {
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.history-summary-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: var(--app-surface);
}

.history-summary-card small,
.history-summary-card strong {
    display: block;
}

.history-summary-card small {
    color: var(--app-text-muted);
    font-size: 10px;
}

.history-summary-card strong {
    margin-top: 4px;
    font-size: 14px;
    font-weight: 850;
    color: var(--app-text);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.history-table-card {
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: var(--app-surface);
    overflow: hidden;
}

.history-toolbar {
    padding: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, .7fr) minmax(130px, .45fr);
    gap: 8px;
    border-bottom: 1px solid var(--app-border);
    background: rgba(var(--app-primary-rgb), .05);
}

.history-toolbar-title h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 850;
    line-height: 1.2;
}

.history-toolbar select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--app-border-strong);
    border-radius: 10px;
    background: var(--app-surface-solid);
    color: var(--app-text);
    font-size: 12px;
    font-weight: 600;
}

.history-loading {
    padding: 14px;
    text-align: center;
    color: var(--app-text-soft);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.history-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    min-width: 840px;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--app-border);
    text-align: left;
    vertical-align: middle;
    font-size: 12px;
}

.history-table th {
    color: var(--app-text-soft);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.history-table td {
    color: var(--app-text);
}

.history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid transparent;
}

.history-badge[class*="category-"] {
    background: rgba(var(--app-primary-rgb), .12);
    border-color: rgba(var(--app-primary-rgb), .25);
    color: var(--app-text);
}

.history-badge[class*="status-"] {
    background: rgba(var(--app-secondary-rgb), .12);
    border-color: rgba(var(--app-secondary-rgb), .25);
    color: var(--app-text);
}

.history-badge.status-completed,
.history-badge.status-claimed,
.history-badge.status-available,
.history-badge.status-active,
.history-badge.status-approved,
.history-badge.status-processing {
    background: rgba(49, 176, 96, .18);
    border-color: rgba(49, 176, 96, .3);
    color: #8df4b1;
}

.history-badge.status-cancelled,
.history-badge.status-failed,
.history-badge.status-rejected {
    background: rgba(220, 75, 75, .18);
    border-color: rgba(220, 75, 75, .3);
    color: #ff9999;
}

.history-ref {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    color: var(--app-text-soft);
}

.history-link {
    color: var(--app-secondary);
    font-size: 11px;
    font-weight: 700;
}

.history-link:hover {
    color: var(--app-secondary-light);
}

.history-empty-tx {
    color: var(--app-text-muted);
}

.history-pagination {
    padding: 12px;
}

.history-pagination .pagination {
    margin-bottom: 0;
}

.history-empty {
    padding: 28px 14px;
    text-align: center;
}

.history-empty i {
    font-size: 20px;
    color: var(--app-text-muted);
}

.history-empty h3 {
    margin: 10px 0 0;
    font-size: 16px;
    font-weight: 800;
}

.history-empty p {
    margin: 6px 0 0;
    color: var(--app-text-soft);
    font-size: 12px;
}

@media (max-width: 992px) {
    .history-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .history-toolbar-title {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .history-summary-grid {
        grid-template-columns: 1fr;
    }

    .history-toolbar {
        grid-template-columns: 1fr;
    }
}