/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --color-bg:       #f4f6f9;
    --color-sidebar:  #2a3340;
    --color-accent:   #2f80ed;
    --color-accent-h: #1d6ed8;
    --color-success:  #18a957;
    --color-danger:   #dc2626;
    --color-warning:  #d97706;
    --color-white:    #ffffff;
    --color-text:     #1f2937;
    --color-muted:    #6b7280;
    --color-border:   #e5e7eb;
    --sidebar-w:      224px;
    --radius:         8px;
    --shadow:         0 1px 3px rgba(0,0,0,.1);
}
body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px;
       color: var(--color-text); background: var(--color-bg); min-height: 100vh; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--color-sidebar);
    display: flex; flex-direction: column;
    z-index: 100;
}
.main-content {
    margin-left: var(--sidebar-w);
    padding: 28px 32px;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
    min-height: 76px;
}
.sidebar-logo-icon {
    width: 42px; height: 42px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2f80ed 0%, #18a957 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .4px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 8px 18px rgba(47,128,237,.22);
}
.sidebar-logo-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-logo-text {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
    letter-spacing: 0;
}
.sidebar-logo-sub {
    color: #aeb6c2;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .2px;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 13px;
    border-radius: 7px;
    color: #aeb6c2;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(47,128,237,.16); color: #fff; font-weight: 600; text-decoration: none; }
.nav-icon { width: 18px; text-align: center; font-style: normal; }
.badge {
    margin-left: auto;
    background: var(--color-danger);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px; font-weight: 700;
}

.sidebar-langs {
    padding: 4px 16px;
    display: flex;
    gap: 7px;
    flex-shrink: 0;
}
.lang-btn {
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    border: none;
    transition: background .12s, color .12s;
}
.lang-btn.active { background: #fff; color: #2a3340; border: none; }
.lang-btn:not(.active) { background: transparent; border: 1px solid rgba(255,255,255,.16); color: #aeb6c2; }
.lang-btn:hover:not(.active) { background: rgba(255,255,255,.08); color: #fff; }

.sidebar-footer {
    margin-top: auto;
    padding: 14px 16px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
    background: rgba(10,18,30,.16);
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: #18a957;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}
.user-meta {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.user-name { font-size: 13.5px; color: #dfe3ea; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11.5px; color: #aeb6c2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 6px;
    color: #dfe3ea;
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1;
    padding: 7px 9px;
    white-space: nowrap;
    transition: background .12s, color .12s, border-color .12s;
}
.logout-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); color: #fff; }

/* ── Tabs / Panels ───────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Page header ─────────────────────────────────────────── */
.page-header { margin-bottom: 22px; }
.page-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-header p  { color: var(--color-muted); }
.header-actions { margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 700px) {
    .sidebar { display: none; }
    .main-content {
        margin-left: 0;
        padding: 22px 18px 40px;
    }
    .page-header {
        margin-bottom: 18px;
    }
    .page-header h2,
    .chat-topbar h2 {
        font-size: 20px;
    }
    .header-actions {
        align-items: stretch;
    }
    .header-actions .form-input,
    .header-actions .form-select,
    .header-actions .btn {
        width: 100% !important;
    }
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius);
    font-size: 13.5px; font-weight: 500; cursor: pointer;
    border: none; transition: background .15s;
}
.btn-primary   { background: var(--color-accent);  color: #fff; }
.btn-primary:hover   { background: var(--color-accent-h); }
.btn-secondary { background: #e5e7eb; color: var(--color-text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger    { background: var(--color-danger);  color: #fff; }
.btn-danger:hover    { background: #b91c1c; }
.btn-success   { background: var(--color-success); color: #fff; }
.btn-full      { width: 100%; justify-content: center; }
.btn-link      { background: none; border: none; color: var(--color-accent); cursor: pointer; font-size: 13px; }
.btn:disabled  { opacity: .45; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 13px; }
.form-input, .form-select {
    width: 100%; padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: 13.5px;
    background: #fff; color: var(--color-text);
    transition: border-color .15s;
}
.form-input:focus, .form-select:focus {
    outline: none; border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ── Alert ───────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13.5px; }
.alert-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1e40af; }
.alert-warning { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
    min-height: 100vh; background: var(--color-bg);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.1);
    padding: 40px 36px; width: 360px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 36px; }
.login-logo h1 { font-size: 22px; font-weight: 700; margin: 8px 0 4px; }
.login-logo p  { color: var(--color-muted); font-size: 13.5px; }

/* ── Upload zone ─────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    max-width: 540px;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--color-accent);
    background: #eff6ff;
}
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-icon-badge {
    width: 72px;
    height: 48px;
    margin: 0 auto 14px;
    border-radius: 8px;
    background: #2f80ed;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .8px;
    box-shadow: 0 8px 18px rgba(47,128,237,.18);
}
.upload-text { margin-bottom: 8px; line-height: 1.6; }
.upload-hint { color: var(--color-muted); font-size: 12.5px; }

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar {
    max-width: 540px; height: 6px; background: #e5e7eb;
    border-radius: 3px; overflow: hidden; margin: 16px 0 8px;
}
.progress-fill { height: 100%; background: var(--color-accent); width: 0; transition: width .3s; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    background: #f9fafb; padding: 10px 12px;
    text-align: left; font-weight: 600;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--color-border); }
tbody tr:hover { background: #f9fafb; }

/* ── Status chips ────────────────────────────────────────── */
.chip {
    display: inline-block; padding: 2px 9px; border-radius: 12px;
    font-size: 11.5px; font-weight: 600;
}
.chip-pending  { background: #fef3c7; color: #92400e; }
.chip-assigned { background: #dcfce7; color: #166534; }
.chip-rejected { background: #fee2e2; color: #991b1b; }

/* ── Confidence bar ──────────────────────────────────────── */
.conf-bar {
    height: 5px; border-radius: 3px; background: #e5e7eb;
    margin-top: 3px; width: 80px; display: inline-block;
}
.conf-fill { height: 100%; border-radius: 3px; }
.conf-high   { background: var(--color-success); }
.conf-medium { background: var(--color-warning); }
.conf-low    { background: var(--color-danger); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
#assign-modal { z-index: 1100; }
.modal-box {
    background: #fff; border-radius: 12px;
    width: 600px; max-width: 95vw; max-height: 90vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
    padding: 18px 24px; border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { font-size: 18px; cursor: pointer; background: none; border: none; color: var(--color-muted); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 14px 24px; border-top: 1px solid var(--color-border);
    display: flex; justify-content: space-between; gap: 10px;
}

/* ── Payment info card (in modal) ────────────────────────── */
.payment-info-card {
    background: #f9fafb; border: 1px solid var(--color-border);
    border-radius: 8px; padding: 14px 16px; margin-bottom: 18px; font-size: 13px;
}
.payment-info-card .pi-row { margin-bottom: 5px; }
.payment-info-card .pi-label { font-weight: 600; color: var(--color-muted); min-width: 120px; display: inline-block; }
.payment-info-card .pi-amount { font-size: 17px; font-weight: 700; color: var(--color-success); }

/* ── Suggestion chips ────────────────────────────────────── */
.suggestion-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.suggestion-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    border: 2px solid var(--color-border); cursor: pointer;
    transition: border-color .15s, background .15s;
}
.suggestion-item:hover, .suggestion-item.selected {
    border-color: var(--color-accent); background: #eff6ff;
}
.sug-name  { font-weight: 600; flex: 1; }
.sug-conf  { font-size: 12px; color: var(--color-muted); }
.sug-method{ font-size: 11px; background: #e0e7ff; color: #3730a3; padding: 1px 7px; border-radius: 10px; }

/* ── Search dropdown ─────────────────────────────────────── */
.search-dropdown {
    background: #fff; border: 1px solid var(--color-border);
    border-radius: 8px; max-height: 220px; overflow-y: auto;
    position: relative; margin-top: 4px; box-shadow: var(--shadow);
}
.search-dropdown.empty { display: none; }
.dropdown-item {
    padding: 9px 14px; cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: space-between;
}
.dropdown-item:hover { background: #f3f4f6; }
.dropdown-item .di-id   { color: var(--color-muted); font-size: 12px; }
.dropdown-item .di-prog { color: var(--color-muted); font-size: 11.5px; }

/* ── Selected student box ────────────────────────────────── */
.selected-student-card {
    background: #f0fdf4; border: 1px solid #86efac;
    border-radius: 8px; padding: 10px 14px;
    display: flex; align-items: center; gap: 12px;
}
.selected-student-card strong { flex: 1; }

/* ── Debt summary bar ────────────────────────────────────── */
.summary-bar {
    display: flex; gap: 20px; margin-bottom: 16px; flex-wrap: wrap;
}
.summary-item {
    background: #fff; border: 1px solid var(--color-border);
    border-radius: 8px; padding: 12px 18px;
}
.summary-item .s-label { font-size: 12px; color: var(--color-muted); margin-bottom: 3px; }
.summary-item .s-value { font-size: 18px; font-weight: 700; }
.s-outstanding { color: var(--color-danger); }
.s-paid        { color: var(--color-success); }

/* ── Upload result ───────────────────────────────────────── */
.upload-result-header {
    background: #fff; border: 1px solid var(--color-border);
    border-radius: 8px; padding: 14px 18px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 14px;
}
.result-stat { text-align: center; }
.result-stat .rs-num  { font-size: 24px; font-weight: 700; }
.result-stat .rs-label{ font-size: 12px; color: var(--color-muted); }
.result-divider { width: 1px; height: 40px; background: var(--color-border); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    padding: 48px; text-align: center; color: var(--color-muted); font-size: 14px;
}

/* ── Misc ────────────────────────────────────────────────── */
.text-muted { color: var(--color-muted); }
.text-right { text-align: right; }
.text-mono  { font-family: monospace; }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row td { text-align: center; padding: 32px; color: var(--color-muted); }


/* ── Pagination ──────────────────────────────────────────── */
.pagination {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0 4px;
}
.page-info { color: var(--color-muted); font-size: 13px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }

/* ── Student profile modal ───────────────────────────────── */
.modal-box-wide {
    width: 900px;
}
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 680px) {
    .profile-grid { grid-template-columns: 1fr; }
}
.profile-section {
    background: #f9fafb;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 14px 16px;
}
.profile-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-muted);
    margin-bottom: 10px;
}
.profile-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.profile-table th {
    text-align: left; padding: 5px 8px 5px 0;
    color: var(--color-muted); font-weight: 500;
    width: 40%; border: none;
}
.profile-table td { padding: 5px 0; border: none; }

/* ── Clickable student name in debts table ───────────────── */
.student-link { color: var(--color-text); font-weight: 700; }
.student-link:hover { color: var(--color-accent); text-decoration: underline; }

/* ── Student profile payment history ────────────────────── */
.profile-section-full {
    background: #f9fafb;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 14px 16px;
    grid-column: 1 / -1;   /* span full width inside profile-grid */
}
.pay-hist-row {
    display: grid;
    grid-template-columns: 100px 1fr auto auto auto;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background .15s;
}
.pay-hist-row:last-of-type { border-bottom: none; }
.pay-hist-row:hover { background: #eef2ff; }
.pay-hist-row.open  { background: #eef2ff; }
.pay-hist-date  { font-size: 12px; color: var(--color-muted); white-space: nowrap; }
.pay-hist-desc  { font-size: 13px; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-hist-amt   { font-weight: 700; color: var(--color-success); white-space: nowrap; }
.pay-hist-detail {
    display: none;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 12px 14px;
    margin: 0 4px 8px;
    font-size: 13px;
    line-height: 1.7;
}
.pay-hist-detail.open { display: block; }
.pay-hist-detail dl   { display: grid; grid-template-columns: 140px 1fr; gap: 2px 12px; }
.pay-hist-detail dt   { color: var(--color-muted); font-weight: 500; }
.pay-hist-detail dd   { word-break: break-word; }
.pay-hist-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    visibility: hidden;
    white-space: nowrap;
}
.pay-hist-row:hover .pay-hist-row-actions,
.pay-hist-row.open  .pay-hist-row-actions {
    visibility: visible;
}
.profile-payment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}

/* ── AI Chat panel ───────────────────────────────────────── */
.chat-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
    max-width: 860px;
}
.chat-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}
.chat-topbar h2 { font-size: 22px; font-weight: 700; margin-bottom: 3px; }
.chat-topbar p  { color: var(--color-muted); font-size: 13px; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0 8px;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

/* message rows */
.chat-message { display: flex; max-width: 82%; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.ai   { align-self: flex-start; flex-direction: column; }

.bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.6;
}
.chat-message.user .bubble {
    background: var(--color-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-message.ai .bubble {
    background: #fff;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-bottom-left-radius: 4px;
}
.bubble code {
    background: rgba(0,0,0,.07);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

/* typing indicator */
.loading-bubble {
    display: flex; gap: 5px; align-items: center; padding: 12px 16px;
}
.dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--color-muted);
    animation: dotPulse .9s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: .15s; }
.dot:nth-child(3) { animation-delay: .30s; }
@keyframes dotPulse {
    0%,80%,100% { transform: translateY(0); opacity: .5; }
    40%          { transform: translateY(-5px); opacity: 1; }
}

/* SQL query disclosure */
.sql-log { margin-top: 6px; }
.sql-detail {
    font-size: 12px; color: var(--color-muted);
    margin-top: 4px;
}
.sql-detail summary { cursor: pointer; user-select: none; }
.sql-detail summary:hover { color: var(--color-text); }
.sql-code {
    background: #f4f6f9;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 4px;
    font-family: monospace;
    font-size: 11.5px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--color-text);
}
.sql-err { color: var(--color-danger); font-size: 12px; margin-top: 4px; }

/* input row */
.chat-input-area { padding-top: 12px; }
.chat-input-row  { display: flex; gap: 10px; }
.chat-input-row .form-input { flex: 1; }
.chat-hint { margin-top: 6px; font-size: 11.5px; color: var(--color-muted); }

/* ── Chat data preview table ─────────────────────────────── */
.chat-data-preview {
    margin-top: 8px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
}
.chat-data-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 12px;
    background: #f4f6f9;
    border-bottom: 1px solid var(--color-border);
}
.chat-data-count { font-size: 12.5px; font-weight: 600; }
.chat-data-table { font-size: 12px; }
.chat-data-table thead th {
    background: #f0f3f7; padding: 6px 10px;
    font-size: 11.5px; white-space: nowrap;
}
.chat-data-table tbody td {
    padding: 5px 10px; font-size: 12px;
    max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-table-more {
    text-align: center; font-size: 12px; font-style: italic;
    color: var(--color-muted); padding: 8px; background: #f9fafb;
}

/* ── Tuition fee formula badge ───────────────────────────── */
.fee-formula {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 12.5px;
}
.ff-label { font-weight: 700; color: #1e40af; }
.ff-op    { color: #93c5fd; font-weight: 600; }
.ff-val   {
    background: #fff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 1px 9px;
    color: #1e40af;
    font-size: 12px;
}

/* ── Sortable table headers ──────────────────────────────── */
th.th-sort, th.th-sort-active {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.th-sort:hover      { background: rgba(255,255,255,.12); }
th.th-sort-active     { background: rgba(255,255,255,.18); }
.sort-hint            { opacity: .45; font-size: 11px; }

/* ── Debt filter range label ─────────────────────────────── */
.filter-range-label {
    font-size: 13px; font-weight: 500;
    color: var(--color-muted);
    white-space: nowrap;
    align-self: center;
}

/* ── Review table: counterparty name match highlight ─────── */
td.cp-match {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
    border-radius: 4px;
}
