/* BLO — BINLook Online — 2026 Pro Dark Theme */
:root {
    --bg: #09090b;
    --surface: #111114;
    --surface2: #16161a;
    --surface3: #1c1c22;
    --border: #222228;
    --border-hover: #333340;
    --text: #e4e4e7;
    --text-secondary: #a1a1aa;
    --muted: #52525b;
    --accent: #2563eb;
    --accent-hover: #3b82f6;
    --accent-soft: #172554;
    --green: #22c55e;
    --green-bg: #052e16;
    --green-border: #166534;
    --red: #ef4444;
    --red-bg: #2a0a0a;
    --red-border: #991b1b;
    --yellow: #f59e0b;
    --yellow-bg: #422006;
    --yellow-border: #854d0e;
    --purple: #7c3aed;
    --purple-bg: #1a1730;
    --purple-border: #7c3aed;
    --orange: #f97316;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --font: 'Segoe UI Variable', 'Segoe UI', 'Inter', system-ui, sans-serif;
    --mono: 'Cascadia Code', 'Consolas', 'JetBrains Mono', monospace;
    --sidebar-w: 260px;
    --topbar-h: 48px;
    --statusbar-h: 28px;
    --toolbar-h: 38px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
    --shadow-xl: 0 16px 64px rgba(0,0,0,0.7);
    --transition-fast: 0.12s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; overflow: hidden; -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent-soft); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3f3f46; }
input, select, textarea, button { font-family: inherit; }
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; }
.main { display: flex; flex: 1; overflow: hidden; }

/* ── Top Bar ────────────────────────────────────────── */
.topbar {
    display: flex; align-items: center; gap: 8px; padding: 0 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    height: var(--topbar-h); min-height: var(--topbar-h); flex-shrink: 0;
    z-index: 50;
}
.topbar .logo {
    color: var(--accent); font-weight: 800; font-size: 18px;
    letter-spacing: -0.5px; user-select: none; display: flex; align-items: center; gap: 6px;
}
.topbar .logo .logo-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--green);
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.topbar .nav { display: flex; gap: 2px; margin-left: 16px; }
.topbar .nav a {
    padding: 6px 14px; border-radius: 6px; color: var(--text-secondary);
    text-decoration: none; font-size: 12px; font-weight: 600;
    transition: all var(--transition-fast); cursor: pointer;
    min-height: 32px; display: flex; align-items: center; gap: 5px;
}
.topbar .nav a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.topbar .nav a.active { background: var(--accent-soft); color: var(--accent-hover); }
.topbar .nav a .nav-icon { font-size: 14px; }

.spacer { flex: 1; }

.topbar .user-section {
    display: flex; align-items: center; gap: 10px;
}
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent-hover);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; user-select: none;
    border: 2px solid var(--accent); flex-shrink: 0;
}
.user-name {
    color: var(--text-secondary); font-size: 11px; font-weight: 600;
}
.user-role-badge {
    padding: 1px 6px; border-radius: 3px; font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.user-role-badge.admin { background: var(--purple-bg); color: #a78bfa; border: 1px solid var(--purple-border); }
.user-role-badge.user { background: var(--surface3); color: var(--muted); border: 1px solid var(--border); }

.topbar-actions {
    display: flex; align-items: center; gap: 4px;
}

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--surface);
    border-right: 1px solid var(--border); padding: 10px;
    overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
    flex-shrink: 0; transition: width var(--transition-normal), min-width var(--transition-normal);
}
.sidebar-group {
    margin-top: 4px;
}
.sidebar-group-title {
    color: var(--muted); font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px; padding: 8px 4px 4px;
    display: flex; align-items: center; gap: 6px;
}
.sidebar-group-title::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.sidebar input, .sidebar select {
    width: 100%; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); font-size: 12px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 34px;
}
.sidebar input:focus, .sidebar select:focus {
    border-color: var(--accent); outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.sidebar input::placeholder { color: var(--muted); }

.sidebar-btn-group {
    display: flex; gap: 4px; margin-top: 4px;
}
.sidebar-btn-group .btn { flex: 1; }

/* AI Search Bar */
.ai-search-wrap {
    display: flex; gap: 4px; margin-bottom: 2px;
}
.ai-search-wrap input {
    flex: 1; border-radius: var(--radius) 0 0 var(--radius);
}
.ai-search-wrap .btn-ai {
    padding: 8px 12px; border-radius: 0 var(--radius) var(--radius) 0;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff; border: none; font-weight: 700; font-size: 11px;
    cursor: pointer; transition: opacity var(--transition-fast);
    white-space: nowrap; min-height: 34px;
}
.ai-search-wrap .btn-ai:hover { opacity: 0.9; }
.ai-search-wrap .btn-ai:disabled { opacity: 0.5; cursor: not-allowed; }

/* Search Button */
.btn-search {
    width: 100%; padding: 10px; background: linear-gradient(135deg, var(--accent), #1d4ed8);
    color: #fff; border: none; border-radius: var(--radius); font-size: 13px;
    font-weight: 700; cursor: pointer; margin-top: 6px;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    min-height: 40px; letter-spacing: 0.3px;
}
.btn-search:hover { opacity: 0.92; }
.btn-search:active { transform: scale(0.98); }
.btn-search:disabled { background: #1e293b; color: #64748b; cursor: not-allowed; transform: none; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
    padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface2); color: var(--text-secondary); font-size: 11px;
    font-weight: 600; cursor: pointer; transition: all var(--transition-fast);
    white-space: nowrap; display: inline-flex; align-items: center; gap: 5px;
    min-height: 30px; justify-content: center;
}
.btn:hover { border-color: var(--accent); color: var(--text); background: var(--surface); }
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 4px 10px; font-size: 10px; min-height: 26px; }
.btn-xs { padding: 3px 8px; font-size: 9px; min-height: 24px; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-green { background: var(--green-bg); color: #86efac; border-color: var(--green-border); }
.btn-green:hover { background: #0f3d24; border-color: var(--green); }
.btn-red { background: var(--red-bg); color: #fca5a5; border-color: var(--red-border); }
.btn-red:hover { background: #3b0a0a; border-color: var(--red); }
.btn-purple { background: var(--purple-bg); color: #a78bfa; border-color: var(--purple-border); font-weight: 700; }
.btn-purple:hover { background: #2e1065; border-color: #a78bfa; color: #c4b5fd; }
.btn-yellow { background: var(--yellow-bg); color: #fcd34d; border-color: var(--yellow-border); }
.btn-yellow:hover { background: #4a2c04; border-color: var(--yellow); }
.btn-icon { padding: 4px 6px; min-width: 28px; min-height: 28px; font-size: 14px; }

/* ── Content Area ───────────────────────────────────── */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

/* ── Toolbar Row ────────────────────────────────────── */
.toolbar-row {
    display: flex; align-items: center; gap: 6px; padding: 4px 10px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    min-height: var(--toolbar-h); flex-shrink: 0; flex-wrap: wrap;
}
.toolbar-row .btn { font-size: 10px; padding: 4px 10px; }
.toolbar-row .toolbar-sep {
    width: 1px; height: 20px; background: var(--border); margin: 0 2px;
}
.toolbar-row select {
    padding: 3px 8px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text); font-size: 10px; min-height: 26px;
}

/* ── Table ──────────────────────────────────────────── */
.table-wrap { flex: 1; overflow: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
thead th {
    position: sticky; top: 0; background: var(--surface); color: var(--muted);
    border-bottom: 2px solid var(--border); padding: 6px 8px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    text-align: left; white-space: nowrap; z-index: 10; cursor: pointer; user-select: none;
    transition: color var(--transition-fast);
}
thead th:hover { color: var(--text-secondary); background: var(--surface2); }
thead th.sorted-asc::after { content: ' \u25B2'; font-size: 8px; color: var(--accent); }
thead th.sorted-desc::after { content: ' \u25BC'; font-size: 8px; color: var(--accent); }
thead th .resize-handle {
    position: absolute; right: 0; top: 0; bottom: 0; width: 4px;
    cursor: col-resize; background: transparent;
    transition: background var(--transition-fast);
}
thead th .resize-handle:hover,
thead th .resize-handle.active { background: var(--accent); }

tbody td {
    padding: 4px 8px; border-bottom: 1px solid #131316; color: var(--text-secondary);
    white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis;
    transition: background var(--transition-fast);
}
tbody tr { transition: background 0.06s; }
tbody tr:nth-child(even) td { background: rgba(255,255,255,0.01); }
tbody tr:hover td { background: #111118; color: var(--text); }
tbody tr.selected td { background: var(--accent-soft); color: #fff; }
tbody tr.checked td { border-left: 3px solid var(--green); }
tbody tr.favorited td:first-child { position: relative; }
tbody tr.favorited td:first-child::before {
    content: '\2605'; position: absolute; left: -2px; top: 50%; transform: translateY(-50%);
    color: var(--yellow); font-size: 10px;
}
tbody tr .row-actions {
    display: none; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    gap: 2px; z-index: 5;
}
tbody tr:hover .row-actions { display: inline-flex; }
.row-action-btn {
    width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--border);
    background: var(--surface2); color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 10px;
    transition: all var(--transition-fast);
}
.row-action-btn:hover { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent); }

/* Skeleton Loading */
.skeleton-row td {
    position: relative; overflow: hidden;
}
.skeleton-row td::after {
    content: ''; display: block; height: 12px; border-radius: 4px;
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Status Bar ─────────────────────────────────────── */
.statusbar {
    display: flex; align-items: center; gap: 10px; padding: 3px 16px;
    background: var(--surface); border-top: 1px solid var(--border);
    font-size: 11px; color: var(--muted); height: var(--statusbar-h);
    min-height: var(--statusbar-h); flex-shrink: 0;
}
.statusbar .badge {
    padding: 1px 8px; border-radius: 4px; font-size: 10px; font-weight: 600;
}
.badge-blue { background: var(--accent-soft); color: var(--accent-hover); }
.badge-green { background: var(--green-bg); color: #86efac; }
.badge-yellow { background: var(--yellow-bg); color: #fcd34d; }
.badge-red { background: var(--red-bg); color: #fca5a5; }
.badge-purple { background: var(--purple-bg); color: #a78bfa; }

.selection-badge {
    padding: 2px 10px; border-radius: 4px; font-size: 10px; font-weight: 700;
    background: var(--accent); color: #fff; display: none;
}
.selection-badge.visible { display: inline-block; }

.connection-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--green); flex-shrink: 0;
}
.connection-dot.offline { background: var(--red); }

/* ── Toast System ───────────────────────────────────── */
.toast-container {
    position: fixed; top: 12px; right: 12px; z-index: 9999;
    display: flex; flex-direction: column; gap: 6px; pointer-events: none;
    max-width: 420px;
}
.toast {
    padding: 10px 18px; border-radius: 10px; font-size: 12px; font-weight: 500;
    animation: toastSlideIn 0.3s ease; box-shadow: var(--shadow-lg);
    pointer-events: auto; position: relative; overflow: hidden;
}
.toast-success { background: var(--green-bg); color: #86efac; border: 1px solid var(--green-border); }
.toast-error { background: var(--red-bg); color: #fca5a5; border: 1px solid var(--red-border); }
.toast-info { background: var(--accent-soft); color: #93c5fd; border: 1px solid #1d4ed8; }
.toast-warn { background: var(--yellow-bg); color: #fcd34d; border: 1px solid var(--yellow-border); }
.toast .toast-progress {
    position: absolute; bottom: 0; left: 0; height: 2px;
    background: currentColor; opacity: 0.3;
    animation: toastProgress 3s linear forwards;
}
@keyframes toastSlideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastSlideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(120%); opacity: 0; } }
@keyframes toastProgress { from { width: 100%; } to { width: 0; } }

/* ── Chips ──────────────────────────────────────────── */
.chip {
    display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 4px;
    font-size: 10px; font-weight: 600; margin: 1px; font-family: var(--font);
    white-space: nowrap; gap: 3px;
}
.chip-crypto { background: var(--purple-bg); color: #a78bfa; }
.chip-neobank { background: var(--green-bg); color: #86efac; }
.chip-fintech { background: var(--accent-soft); color: #93c5fd; }
.chip-pm { background: #1c1917; color: #fdba74; }
.chip-exchange { background: #1c0a2e; color: #c084fc; }
.chip-bnpl { background: #1a0a2e; color: #e879f9; }
.chip-emoney { background: #0a1628; color: #67e8f9; }
.chip-source { background: var(--surface3); color: var(--text-secondary); font-size: 9px; }
.chip-source.src-owndb { background: var(--accent-soft); color: #93c5fd; }
.chip-source.src-sbart { background: var(--green-bg); color: #86efac; }
.chip-source.src-binup { background: var(--yellow-bg); color: #fcd34d; }

/* ── Context Menu ───────────────────────────────────── */
.ctx-menu {
    position: fixed; z-index: 300; background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 4px; min-width: 220px;
    box-shadow: var(--shadow-xl); backdrop-filter: blur(12px);
    animation: ctxFadeIn 0.12s ease;
}
@keyframes ctxFadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.ctx-item {
    padding: 7px 12px; border-radius: 6px; cursor: pointer; font-size: 11px;
    color: var(--text-secondary); display: flex; align-items: center; gap: 8px;
    transition: background 0.06s; min-height: 32px;
}
.ctx-item:hover { background: var(--accent-soft); color: #fff; }
.ctx-item .ctx-icon { font-size: 13px; width: 18px; text-align: center; flex-shrink: 0; }
.ctx-item .shortcut { margin-left: auto; font-size: 9px; color: var(--muted); font-family: var(--mono); }
.ctx-group {
    padding: 5px 12px; font-size: 9px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.ctx-sep { height: 1px; background: var(--border); margin: 3px 8px; }
.ctx-sub { position: relative; }
.ctx-sub > .ctx-submenu {
    display: none; position: absolute; left: 100%; top: -4px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 4px; min-width: 180px;
    box-shadow: var(--shadow-xl);
}
.ctx-sub:hover > .ctx-submenu { display: block; }

/* ── Modal ──────────────────────────────────────────── */
.modal-bg {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 200; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn var(--transition-fast);
}
.modal-bg.active { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 24px; width: 560px; max-width: calc(100vw - 32px); max-height: 85vh; overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn var(--transition-normal);
}
.modal-wide { width: 820px; }
.modal-header {
    display: flex; align-items: center; margin-bottom: 16px; gap: 10px;
}
.modal-header h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 700; }
.modal-header .btn-close {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface2); color: var(--muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; transition: all var(--transition-fast);
}
.modal-header .btn-close:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }

.modal h3 { font-size: 12px; color: var(--text-secondary); margin: 16px 0 6px; font-weight: 600; }
.modal pre {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    padding: 12px; font-size: 11px; color: var(--text-secondary); overflow-x: auto;
    white-space: pre-wrap; word-break: break-all; max-height: 400px; overflow-y: auto;
}
.modal .form-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.modal .form-row label { color: var(--text-secondary); font-size: 11px; font-weight: 600; min-width: 80px; }
.modal .form-row input, .modal .form-row select {
    flex: 1; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); font-size: 12px; min-height: 34px;
}
.modal .form-row input:focus, .modal .form-row select:focus {
    border-color: var(--accent); outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.modal .btn-row { display: flex; gap: 6px; margin-top: 16px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideIn { from { transform: translateY(-20px) scale(0.97); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

/* ── Checkbox Labels ────────────────────────────────── */
.cb-label {
    font-size: 10px; color: var(--text-secondary); display: flex;
    align-items: center; gap: 3px; cursor: pointer; padding: 2px 0;
    min-height: 24px;
}
.cb-label:hover { color: var(--text); }
.cb-label input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

/* ── Level Switcher ─────────────────────────────────── */
.level-select {
    background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 6px;
    color: #93c5fd; font-size: 11px; font-weight: 600; padding: 4px 10px;
    min-height: 28px;
}
.level-select option {
    background: var(--surface); color: var(--text); padding: 4px 8px;
}

/* ── Stat Cards ─────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.stat-card {
    background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
    padding: 14px; text-align: center; transition: border-color var(--transition-fast);
}
.stat-card:hover { border-color: var(--border-hover); }
.stat-card .stat-value { font-size: 22px; font-weight: 800; color: var(--text); font-family: var(--mono); }
.stat-card .stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* ── Admin Tables ───────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; font-family: var(--font); }
.admin-table th {
    text-align: left; padding: 8px 10px; background: var(--surface2); color: var(--muted);
    font-size: 10px; font-weight: 700; text-transform: uppercase; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1;
}
.admin-table td {
    padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--text-secondary);
}
.admin-table tr:hover td { background: var(--surface2); }

/* ── Admin History Panel ────────────────────────────── */
.admin-filters {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-bottom: 12px; padding: 10px; background: var(--surface2);
    border-radius: var(--radius); border: 1px solid var(--border);
}
.admin-filters label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.admin-filters input, .admin-filters select {
    padding: 5px 8px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 11px; min-height: 28px;
}
.admin-filters input:focus, .admin-filters select:focus { border-color: var(--accent); outline: none; }

/* ── Page Sections ──────────────────────────────────── */
.page-section { padding: 20px; overflow-y: auto; flex: 1; }

/* ── Tab System ─────────────────────────────────────── */
.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab-bar .tab {
    padding: 8px 16px; font-size: 11px; font-weight: 600; color: var(--muted);
    cursor: pointer; border-bottom: 2px solid transparent; transition: all var(--transition-fast);
    min-height: 36px; display: flex; align-items: center;
}
.tab-bar .tab:hover { color: var(--text-secondary); }
.tab-bar .tab.active { color: var(--accent-hover); border-bottom-color: var(--accent); }

/* ── Issuer List ────────────────────────────────────── */
.issuer-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; }
.issuer-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
    font-size: 11px; transition: border-color var(--transition-fast); min-height: 38px;
}
.issuer-item:hover { border-color: var(--border-hover); }
.issuer-item .issuer-name { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Progress Indicator ─────────────────────────────── */
.progress-bar {
    height: 3px; background: var(--border); border-radius: 2px; overflow: hidden;
    position: absolute; top: 0; left: 0; right: 0; z-index: 15;
}
.progress-bar .progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 2px; animation: progressPulse 1.5s ease-in-out infinite; width: 30%;
}
@keyframes progressPulse { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }

/* ── Result Count Badge ─────────────────────────────── */
.result-count-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 6px;
    background: var(--accent-soft); color: var(--accent-hover);
    font-size: 11px; font-weight: 700; font-family: var(--mono);
}
.result-count-badge .query-time {
    color: var(--muted); font-size: 9px; font-weight: 500;
}

/* ── Mobile Bottom Drawer ───────────────────────────── */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 90; backdrop-filter: blur(2px);
}
.sidebar-toggle {
    display: none; position: fixed; bottom: calc(var(--statusbar-h) + 8px);
    left: 50%; transform: translateX(-50%); z-index: 95;
    padding: 8px 20px; border-radius: 20px;
    background: var(--accent); color: #fff; border: none;
    font-weight: 700; font-size: 12px; cursor: pointer;
    box-shadow: var(--shadow-lg);
}

/* ── Responsive: Tablet (768-1024px) ────────────────── */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 60px; min-width: 60px; padding: 8px 4px;
        overflow: visible;
    }
    .sidebar.expanded { width: var(--sidebar-w); min-width: var(--sidebar-w); padding: 10px; }
    .sidebar:not(.expanded) .sidebar-group-title span,
    .sidebar:not(.expanded) .ai-search-wrap,
    .sidebar:not(.expanded) input,
    .sidebar:not(.expanded) select,
    .sidebar:not(.expanded) .cb-label span,
    .sidebar:not(.expanded) .sidebar-btn-group .btn span { display: none; }
    .sidebar:not(.expanded) .btn-search { font-size: 0; padding: 10px 4px; }
    .sidebar:not(.expanded) .btn-search::after { content: '\1F50D'; font-size: 16px; }
    .topbar .nav a span { display: none; }
}

/* ── Responsive: Phone (<768px) ─────────────────────── */
@media (max-width: 768px) {
    :root {
        --topbar-h: 44px;
        --statusbar-h: 24px;
    }
    body { font-size: 12px; }

    .topbar { padding: 0 10px; gap: 4px; }
    .topbar .logo { font-size: 15px; }
    .topbar .nav { gap: 1px; margin-left: 6px; }
    .topbar .nav a { font-size: 10px; padding: 5px 8px; min-height: 34px; }
    .topbar .nav a .nav-icon { display: none; }
    .topbar .user-section .user-name { display: none; }
    .topbar .user-section .user-role-badge { display: none; }

    .main { flex-direction: column; }

    .sidebar {
        position: fixed; bottom: var(--statusbar-h); left: 0; right: 0;
        width: 100%; min-width: 100%; max-height: 55vh;
        border-right: none; border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0; z-index: 91;
        transform: translateY(100%); transition: transform var(--transition-slow);
        box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    }
    .sidebar.open { transform: translateY(0); }
    .sidebar-overlay.visible { display: block; }
    .sidebar-toggle { display: block; }

    .content { flex: 1; }
    .table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 600px; }

    .toolbar-row { padding: 4px 6px; gap: 4px; overflow-x: auto; flex-wrap: nowrap; }
    .toolbar-row .btn { font-size: 9px; padding: 4px 8px; min-height: 28px; }

    .modal { width: calc(100vw - 24px); padding: 16px; max-height: 80vh; border-radius: 12px; }

    .statusbar { padding: 2px 10px; font-size: 10px; }

    .ctx-menu { min-width: 180px; }
    .ctx-item { padding: 10px 12px; min-height: 40px; }

    .stat-grid { grid-template-columns: repeat(2, 1fr); }

    .admin-filters { flex-direction: column; align-items: stretch; }
}

/* ── Responsive: Very small (<400px) ────────────────── */
@media (max-width: 400px) {
    .topbar .nav a { font-size: 9px; padding: 4px 6px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .modal { padding: 12px; }
}

/* ── Drag selection ─────────────────────────────────── */
.drag-selecting tbody tr { cursor: crosshair; }
.drag-selecting tbody tr:hover td { background: rgba(37,99,235,0.08); }

/* ── Print/Accessibility ────────────────────────────── */
@media print {
    .topbar, .sidebar, .statusbar, .toolbar-row { display: none !important; }
    .content { overflow: visible !important; }
    .table-wrap { overflow: visible !important; }
    table { font-size: 9px; }
}

/* ── Focus Visible ──────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
