/* Questealer panel — colors in :root, brand text in app.js CONFIG */
:root {
    --bg: #0a0b10;
    --bg-elevated: #10121a;
    --surface: #151822;
    --surface-hover: #1c2030;
    --surface-active: #222638;
    --border: #2a2f42;
    --border-strong: #3d4460;
    --border-focus: #8b5cf6;

    --brand: #8b5cf6;
    --brand-2: #6366f1;
    --brand-3: #22d3ee;
    --brand-glow: rgba(139, 92, 246, 0.35);

    --primary: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #4f46e5 100%);
    --primary-solid: #8b5cf6;
    --primary-fg: #ffffff;
    --link: #a5b4fc;

    --accent: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;
    --violet: #a78bfa;
    --pink: #f472b6;
    --orange: #fb923c;

    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-faint: #64748b;

    --sidebar-w: 220px;
    --header-h: 56px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.12);
    --transition: 0.15s ease;

    --font: 'DM Sans', system-ui, -apple-system, sans-serif;
    --mono: 'IBM Plex Mono', 'Consolas', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: var(--font);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(139, 92, 246, 0.18), transparent),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(34, 211, 238, 0.1), transparent),
        radial-gradient(ellipse 50% 30% at 50% 100%, rgba(99, 102, 241, 0.08), transparent);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

.hidden { display: none !important; }

/* surfaces */
.glass,
.panel {
    background: linear-gradient(165deg, rgba(21, 24, 34, 0.95), rgba(16, 18, 26, 0.98));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel { overflow: hidden; }

.panel-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-head h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.panel-head p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.panel-body { padding: 0; }
.panel-body-pad { padding: 16px; }

@keyframes spin { to { transform: rotate(360deg); } }

.section-enter { animation: none; }

/* login */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: #08090e;
    background-image:
        radial-gradient(circle at 30% 20%, rgba(139, 92, 246, 0.25), transparent 45%),
        radial-gradient(circle at 70% 80%, rgba(34, 211, 238, 0.15), transparent 40%);
    pointer-events: auto;
}

.overlay * { pointer-events: auto; }

.login-shell {
    width: min(340px, 92vw);
}

.login-brand {
    margin-bottom: 24px;
}

.login-logo {
    width: 48px;
    height: 48px;
    margin: 0 0 12px;
    padding: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    box-shadow: 0 8px 24px var(--brand-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0;
    text-transform: none;
}

.login-brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(90deg, #f1f5f9, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: 6px;
}

.login-box {
    padding: 20px;
    box-shadow: none;
}

.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.login-tab {
    flex: 1;
    padding: 0 0 10px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    color: var(--text-muted);
    border-radius: 0;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: color var(--transition), border-color var(--transition);
}

.login-tab:hover { color: var(--text); }

.login-tab.active {
    color: var(--violet);
    border-bottom-color: var(--brand-solid);
    background: transparent;
    box-shadow: none;
}

.input-group { margin-bottom: 14px; }

.input-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input, select, textarea {
    width: 100%;
    padding: 9px 11px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand-solid);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }

select { cursor: pointer; }
select option { background: var(--surface); }

/* buttons */
.btn-primary {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary);
    color: var(--primary-fg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    font-family: inherit;
    box-shadow: 0 4px 14px var(--brand-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
    opacity: 1;
}

.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
    padding: 7px 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    font-family: inherit;
}

.btn-secondary:hover {
    background: rgba(139, 92, 246, 0.08);
    color: var(--violet);
    border-color: rgba(139, 92, 246, 0.35);
}

.btn-ghost {
    padding: 7px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    transition: color var(--transition);
    font-family: inherit;
}

.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }

.btn-danger {
    padding: 7px 12px;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    font-family: inherit;
}

.btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-danger:hover:not(:disabled) {
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.55) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    min-height: 30px;
    line-height: 1.2;
}
.btn-inline { width: auto !important; display: inline-flex; align-items: center; gap: 6px; }

.btn-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
    font-size: 1rem;
}

.btn-icon:hover { color: var(--text); border-color: var(--border-strong); }
.btn-icon.spinning svg { animation: spin 0.8s linear infinite; }

.error-text {
    color: var(--danger);
    font-size: 0.8125rem;
    margin-top: 10px;
}

/* layout */
#main-content {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    height: 100vh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 12px 10px;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(16, 18, 26, 0.98), rgba(10, 11, 16, 0.99));
    z-index: 10;
    overflow: hidden;
}

.sidebar-header {
    padding: 4px 8px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    box-shadow: 0 4px 12px var(--brand-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.8125rem;
    color: #fff;
    flex-shrink: 0;
}

.brand-text h1 {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.brand-text p {
    font-size: 0.6875rem;
    color: var(--text-faint);
    margin-top: 1px;
    font-family: var(--mono);
    text-transform: lowercase;
}

.nav-links {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    margin: 0;
}

.nav-links li {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background var(--transition), color var(--transition);
    user-select: none;
    min-height: 32px;
}

.nav-links li.nav-label {
    padding: 14px 8px 4px;
    margin-top: 2px;
    min-height: auto;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    cursor: default;
    pointer-events: none;
    display: block;
}

.nav-links li.nav-label:first-child { margin-top: 0; padding-top: 2px; }
.nav-links li.nav-label:hover { background: transparent !important; color: var(--text-faint); }

.nav-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    opacity: 0.55;
}

.nav-icon svg {
    width: 16px !important;
    height: 16px !important;
    display: block;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-links li:not(.nav-label):hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-links li:not(.nav-label):hover .nav-icon { opacity: 0.85; }

.nav-links li.active {
    background: rgba(139, 92, 246, 0.12);
    color: var(--violet);
    box-shadow: inset 3px 0 0 var(--brand-solid);
}

.nav-links li.active .nav-icon { opacity: 1; }
.nav-links li.active .nav-icon svg { stroke: var(--violet); }

.sidebar-footer {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
}

.telegram-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    margin-bottom: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

.telegram-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar-footer .btn-secondary { width: 100%; }

.content-area {
    flex: 1 1 auto;
    width: calc(100% - var(--sidebar-w));
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.page-content {
    padding: 20px 24px 32px;
    flex: 1;
    width: 100%;
    min-height: calc(100vh - var(--header-h));
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: rgba(10, 11, 16, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(139, 92, 246, 0.06);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-left h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.topbar-left p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.topbar-left h2,
.topbar-left p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 700;
}

.user-chip span { font-size: 0.75rem; color: var(--text-muted); font-family: var(--mono); }

.role-pill {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--violet);
    border: 1px solid rgba(139, 92, 246, 0.25);
    font-family: var(--mono);
}

.section { display: block; }

/* stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 14px 16px;
    background: linear-gradient(160deg, rgba(21, 24, 34, 0.9), rgba(16, 18, 26, 0.95));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-accent, var(--brand-solid));
    opacity: 0.9;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-accent-0 { --stat-accent: #8b5cf6; }
.stat-accent-1 { --stat-accent: #22d3ee; }
.stat-accent-2 { --stat-accent: #34d399; }
.stat-accent-3 { --stat-accent: #fbbf24; }
.stat-accent-4 { --stat-accent: #f472b6; }
.stat-accent-5 { --stat-accent: #fb923c; }

.stat-card-head { display: block; margin-bottom: 8px; }

.stat-card h3,
.stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-icon { display: none; }

.stat-value {
    font-family: var(--mono);
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--text);
}

.stat-value-sm {
    font-size: 0.8125rem !important;
    font-weight: 400 !important;
    word-break: break-word;
    line-height: 1.45 !important;
}

/* charts */
.charts-row {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 10px;
}

.chart-panel {
    padding: 16px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, rgba(21, 24, 34, 0.95), rgba(16, 18, 26, 0.98));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.chart-panel canvas {
    flex: 1;
    min-height: 210px;
    max-height: 250px;
}

.chart-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.chart-sub {
    font-size: 0.6875rem;
    color: var(--text-faint);
    margin-bottom: 12px;
    font-family: var(--mono);
}

/* actions */
.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.search-wrap {
    flex: 1;
    min-width: 180px;
    position: relative;
}

.search-wrap svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-faint);
    pointer-events: none;
}

.search-input { padding-left: 34px !important; }

.toolbar-select { width: auto; min-width: 130px; }
.key-count-input { width: 64px; text-align: center; font-family: var(--mono); }

.key-nickname-wrap {
    display: inline-flex;
    align-items: center;
}

.key-nickname-wrap.hidden {
    display: none !important;
}

.key-nickname-input {
    width: 96px;
    min-width: 96px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
}

.key-nickname-input:focus {
    outline: none;
    border-color: var(--brand-solid);
}

.keys-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.keys-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.keys-toolbar-options {
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

/* tables */
.table-scroll {
    overflow-x: auto;
    max-height: calc(100vh - 260px);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

thead { position: sticky; top: 0; z-index: 2; }

th {
    padding: 10px 14px;
    background: var(--bg-elevated);
    color: var(--text-faint);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--surface-hover); }

code {
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 2px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
}

.action-cell {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

/* badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.6875rem;
    font-weight: 600;
    font-family: var(--mono);
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-used, .badge-success { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.35); }
.badge-unused, .badge-pending { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.35); }
.badge-danger, .badge-failed { background: rgba(248, 113, 113, 0.15); color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); }
.badge-warn, .badge-running { background: rgba(251, 191, 36, 0.15); color: #fde047; border-color: rgba(251, 191, 36, 0.35); }
.badge-token { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.4); }
.badge-info { background: rgba(99, 102, 241, 0.12); color: #a5b4fc; border-color: rgba(99, 102, 241, 0.3); }
.badge-default { background: rgba(148, 163, 184, 0.08); color: var(--text-muted); border-color: var(--border); }

/* live */
.live-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: var(--mono);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
    50% { opacity: 0.85; box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

.live-status.connected .live-dot {
    background: var(--accent);
    animation: pulse-live 2s ease infinite;
}
.live-status.connected { color: var(--accent); }

.live-feed {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.live-item {
    display: grid;
    grid-template-columns: 140px 90px 90px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
}

.live-item:hover { background: var(--surface-hover); }
.live-item:last-child { border-bottom: none; }

.live-time { font-size: 0.75rem; color: var(--text-faint); font-family: var(--mono); }
.live-preview { font-size: 0.8125rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* intel */
.intel-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.intel-side { max-height: 500px; overflow-y: auto; }

.timeline-list {
    list-style: none;
    padding: 0 14px 14px;
}

.timeline-list li {
    position: relative;
    padding: 10px 0 10px 16px;
    border-left: 1px solid var(--border);
    margin-left: 6px;
    font-size: 0.8125rem;
}

.timeline-list li::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 14px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
}

.timeline-list span {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-faint);
    margin-top: 3px;
    font-family: var(--mono);
}

.hint-text {
    color: var(--text-faint);
    font-size: 0.8125rem;
    padding: 10px 14px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-faint);
}

.empty-state p { font-size: 0.8125rem; }

.loading-row td {
    text-align: center;
    padding: 32px;
    color: var(--text-faint);
    font-family: var(--mono);
    font-size: 0.8125rem;
}

.page-loader {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    pointer-events: all;
}

.page-loader.hidden {
    display: none !important;
    pointer-events: none !important;
}

.loader-ring {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

/* modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
}

.modal {
    width: min(380px, 94vw);
    padding: 20px;
    box-shadow: var(--shadow);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.modal-wide {
    width: min(720px, 96vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.modal h3 { font-size: 0.9375rem; font-weight: 600; }
.modal > p { color: var(--text-muted); font-size: 0.8125rem; margin: 8px 0 16px; }

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.modal-actions button { flex: 1; }

.log-pre {
    flex: 1;
    overflow: auto;
    max-height: 55vh;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--mono);
}

.toast {
    position: fixed;
    bottom: 16px;
    right: 16px;
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(21, 24, 34, 0.98), rgba(30, 27, 50, 0.98));
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: var(--text);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    z-index: 2000;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2);
}

.last-sync {
    font-size: 0.6875rem;
    color: var(--text-faint);
    font-family: var(--mono);
}

.link-btn {
    color: var(--link);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8125rem;
}

.link-btn:hover { color: var(--brand-3); text-decoration: underline; }

.announce-textarea { margin: 10px 0 12px; resize: vertical; min-height: 96px; }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
}

@media (max-width: 600px) {
    .topbar-left p { display: none; }
}

@media (max-width: 1100px) {
    .charts-row, .intel-grid { grid-template-columns: 1fr; }
    .live-item { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 900px) {
    .mobile-menu-btn { display: flex; }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        max-width: 260px;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow);
    }

    .sidebar.open { transform: translateX(0); }
    .content-area { width: 100%; }
    .page-content { padding: 14px; }
    .topbar { padding: 12px 14px; }
}

/* ── Referans panel extras ── */
.col-check { width: 36px; }
.col-check input { width: auto; accent-color: var(--text); }

.drop-zone {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    transition: border-color var(--transition), background var(--transition);
}

.drop-zone.drag-over {
    border-color: var(--text-muted);
    background: var(--surface-hover);
}

.tools-grid {
    display: grid;
    grid-template-columns: minmax(0, 560px);
    gap: 10px;
}

.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-tab {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
}

.modal-tab.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.log-analyze {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 12px;
    font-size: 0.8125rem;
    max-height: 55vh;
    overflow: auto;
}

.analyze-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.analyze-item {
    padding: 10px 12px;
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: var(--radius-sm);
}

.analyze-item strong {
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--violet);
}

.analyze-item span {
    display: block;
    font-size: 0.625rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.analyze-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.search-results {
    max-height: 50vh;
    overflow-y: auto;
    margin-top: 12px;
    padding: 0;
}

.search-hit {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}

.search-hit:hover { background: var(--surface-hover); }
.search-hit:last-child { border-bottom: none; }

.search-hit-meta {
    font-size: 0.6875rem;
    color: var(--text-faint);
    font-family: var(--mono);
    margin-bottom: 4px;
}

.search-hit-line {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cmd-modal {
    width: min(480px, 94vw);
    padding: 0;
    overflow: hidden;
}

.cmd-modal .search-input {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 14px 16px;
}

.cmd-list {
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
}

.cmd-list li {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cmd-list li:hover,
.cmd-list li.active {
    background: var(--surface-hover);
    color: var(--text);
}

.cmd-list kbd {
    font-family: var(--mono);
    font-size: 0.625rem;
    color: var(--text-faint);
    border: 1px solid var(--border);
    padding: 2px 5px;
    border-radius: 3px;
}

.cmd-hint { padding: 8px 14px; margin: 0; }

.ok-text { color: var(--accent) !important; }

.flag-wallet { color: var(--warn); }
.flag-token { color: var(--danger); }

.tier-list { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 0.8125rem; line-height: 1.6; }
.tier-legend { margin-bottom: 14px; }
.account-panel { max-width: 420px; }
.login-customer-hint { padding: 0 0 12px; margin: 0; font-size: 0.75rem; }

.remote-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 1100px) {
    .remote-layout { grid-template-columns: 1fr; }
}

.remote-detail { min-height: 420px; }

.remote-screen-wrap {
    background: #0a0a0a;
    border: 1px solid var(--border);
    border-radius: 6px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    overflow: hidden;
}

.remote-screen {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    display: block;
}

.remote-cmd-output {
    margin-top: 12px;
    padding: 12px;
    background: #0a0a0a;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 0.75rem;
    max-height: 200px;
    overflow: auto;
    white-space: pre-wrap;
    color: var(--text-muted);
}

.remote-actions {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
}

.remote-actions .btn-secondary,
.remote-actions .btn-danger,
.remote-actions .btn-primary {
    width: auto;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.actions-bar .btn-primary.btn-sm {
    width: auto;
}

.agent-row { cursor: pointer; }
.agent-row.selected { background: var(--surface-hover); }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.status-dot.online { background: #4ade80; box-shadow: 0 0 6px rgba(74, 222, 128, 0.5); }
.status-dot.offline { background: #525252; }

.remote-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.remote-tab {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
}
.remote-tab.active {
    color: var(--violet);
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.12);
}
.nav-lock {
    margin-left: auto;
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--violet);
    border: 1px solid rgba(139, 92, 246, 0.25);
    font-weight: 700;
}
#nav-links li:not(.nav-label) { display: flex; align-items: center; gap: 6px; }
#nav-links li.nav-label { display: block; }
#nav-links li.nav-locked { opacity: 0.45; }

/* Light theme */
[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-hover: #eef2ff;
    --surface-active: #e0e7ff;
    --border: #d8dee9;
    --border-strong: #c4cdd9;
    --text: #0f172a;
    --text-muted: #475569;
    --text-faint: #64748b;
    --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}
[data-theme="light"] body {
    background-image:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(139, 92, 246, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(34, 211, 238, 0.08), transparent);
}
[data-theme="light"] .glass,
[data-theme="light"] .panel {
    background: linear-gradient(165deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
}

.map-bars { display: flex; flex-direction: column; gap: 8px; }
.map-bar-row { display: grid; grid-template-columns: 48px 1fr 40px; gap: 10px; align-items: center; }
.map-bar-label { font-weight: 600; font-size: 0.75rem; color: var(--violet); }
.map-bar-track { height: 10px; background: var(--surface-hover); border-radius: 999px; overflow: hidden; }
.map-bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-3)); border-radius: 999px; }
.map-bar-count { font-family: var(--mono); font-size: 0.75rem; color: var(--text-muted); text-align: right; }

.row-pinned { background: rgba(251, 191, 36, 0.08); }
.pin-btn { font-size: 1rem; line-height: 1; padding: 2px 6px; }
.pin-btn.pinned { color: var(--warn); }

.stealer-tab, .stealer-tabs .stealer-tab {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
}
.stealer-tab.active { color: var(--violet); border-color: rgba(139,92,246,0.5); background: rgba(139,92,246,0.12); }
.token-cell { font-size: 0.7rem; max-width: 220px; display: inline-block; overflow: hidden; text-overflow: ellipsis; }

.usage-type-list { display: flex; flex-direction: column; gap: 8px; }
.usage-row { display: flex; justify-content: space-between; padding: 8px 10px; background: var(--surface-hover); border-radius: var(--radius-sm); }
.stat-card-wide { grid-column: span 2; }
@media (max-width: 768px) { .stat-card-wide { grid-column: span 1; } }
