﻿:root {
    color-scheme: dark;
    --bg: #07111f;
    --surface: #0d1b2d;
    --surface-alt: #12243a;
    --line: #233952;
    --text: #eaf2fb;
    --muted: #91a5bb;
    --primary: #4da3ff;
    --success: #2dcf8f;
    --warning: #ffb84d;
    --danger: #ff637d;
    font-family: Inter, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at top left, #112844 0, var(--bg) 42%); color: var(--text); }
body { min-width: 320px; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; }
.topbar { height: 72px; padding: 0 max(20px, calc((100vw - 1500px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(7,17,31,.86); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, #2787ed, #61b8ff); color: white; font-weight: 800; box-shadow: 0 8px 25px rgba(39,135,237,.32); }
.brand strong, .brand small { display: block; }
.brand small, .topbar-note { color: var(--muted); }
.content { max-width: 1500px; margin: 0 auto; padding: 32px 20px 70px; }

.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(30px, 4vw, 46px); }
h2 { margin-bottom: 5px; font-size: 20px; }
.eyebrow { color: var(--primary); letter-spacing: .14em; font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.subtitle, .panel-header p { color: var(--muted); margin-bottom: 0; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card, .panel { border: 1px solid var(--line); background: linear-gradient(160deg, rgba(18,36,58,.96), rgba(10,25,43,.97)); box-shadow: 0 18px 45px rgba(0,0,0,.18); }
.metric-card { border-radius: 16px; padding: 18px; }
.metric-card span { color: var(--muted); display: block; margin-bottom: 8px; }
.metric-card strong { font-size: 27px; }
.metric-time { font-size: 21px !important; }
.success-text { color: var(--success); }
.danger-text { color: var(--danger); }

.dashboard-grid { display: grid; grid-template-columns: 340px minmax(0,1fr); gap: 18px; align-items: start; }
.panel { border-radius: 18px; overflow: hidden; }
.panel-header { min-height: 80px; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0 0 4px; }

.agent-list { padding: 9px; display: grid; gap: 7px; }
.agent-row { border: 1px solid transparent; background: transparent; color: var(--text); width: 100%; cursor: pointer; display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 12px; text-align: left; border-radius: 13px; padding: 14px 12px; }
.agent-row:hover, .agent-row.selected { background: var(--surface-alt); border-color: #315170; }
.agent-main strong, .agent-main small, .agent-stats b, .agent-stats small { display: block; }
.agent-main small, .agent-stats small { color: var(--muted); margin-top: 4px; }
.agent-stats { text-align: right; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,.03); }
.status-dot.online { background: var(--success); box-shadow: 0 0 13px rgba(45,207,143,.65); }
.status-dot.offline { background: var(--danger); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; background: rgba(7,17,31,.42); }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 4px; }
.service-error { display: block; margin-top: 6px; color: var(--danger); font-size: 12px; }

.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; }
.pill.success { color: #79ebbd; background: rgba(45,207,143,.12); border: 1px solid rgba(45,207,143,.28); }
.pill.warning { color: #ffd08a; background: rgba(255,184,77,.12); border: 1px solid rgba(255,184,77,.28); }
.pill.danger { color: #ff9aaa; background: rgba(255,99,125,.12); border: 1px solid rgba(255,99,125,.28); }

.button { border: 1px solid #315170; border-radius: 10px; background: #17314f; color: var(--text); padding: 10px 14px; cursor: pointer; font-weight: 700; }
.button:hover:not(:disabled) { filter: brightness(1.14); }
.button:disabled { opacity: .45; cursor: wait; }
.button.secondary { background: transparent; }
.button.primary { background: #176ec7; border-color: #2787ed; }
.button.warning { background: #5a3e18; border-color: #8a6228; }
.button.mini { padding: 7px 9px; font-size: 12px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.loading, .empty-state { min-height: 180px; display: grid; place-items: center; padding: 25px; color: var(--muted); text-align: center; }
.alert { padding: 13px 15px; border-radius: 12px; margin-bottom: 16px; }
.alert.error { background: rgba(255,99,125,.1); border: 1px solid rgba(255,99,125,.35); color: #ffacb9; }
.toast { position: fixed; right: 22px; bottom: 22px; width: min(430px, calc(100vw - 44px)); background: #123d32; border: 1px solid rgba(45,207,143,.4); padding: 15px 17px; border-radius: 13px; box-shadow: 0 18px 50px rgba(0,0,0,.4); z-index: 20; }
.toast-error { background: #4b2029; border-color: rgba(255,99,125,.5); }
#blazor-error-ui { display: none; }

@media (max-width: 1050px) {
    .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .content { padding: 24px 12px 60px; }
    .topbar { padding: 0 14px; }
    .topbar-note { display: none; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
    .metric-card { padding: 14px; }
    .metric-card strong { font-size: 22px; }
}

.topnav { display: flex; align-items: center; gap: 8px; }
.topnav a { color: var(--muted); padding: 9px 12px; border-radius: 9px; font-weight: 700; }
.topnav a:hover { color: var(--text); background: var(--surface-alt); }
.result-cell { max-width: 440px; white-space: normal; color: var(--muted); }

.login-shell { min-height: calc(100vh - 150px); display: grid; place-items: center; padding: 30px 15px; }
.login-card { width: min(440px, 100%); padding: 30px; border-radius: 20px; background: linear-gradient(160deg, rgba(18,36,58,.98), rgba(10,25,43,.98)); border: 1px solid var(--line); box-shadow: 0 25px 70px rgba(0,0,0,.35); }
.login-brand { margin-bottom: 30px; }
.login-card h1 { font-size: 34px; }
.login-card label { display: block; color: var(--muted); font-weight: 700; margin: 18px 0 7px; }
.login-card input { width: 100%; background: #081525; color: var(--text); border: 1px solid #315170; border-radius: 10px; padding: 12px 13px; outline: none; }
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(77,163,255,.13); }
.login-button { width: 100%; margin-top: 22px; }
.user-label { color: var(--muted); padding: 0 8px; font-size: 13px; }

.admin-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.admin-form { padding: 20px; }
.admin-form label { display: block; color: var(--muted); font-weight: 700; margin: 0 0 7px; }
.admin-form input[type="text"] { width: 100%; background: #081525; color: var(--text); border: 1px solid #315170; border-radius: 10px; padding: 12px 13px; margin-bottom: 18px; outline: none; }
.admin-form input[type="text"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(77,163,255,.13); }
.checkbox-row { display: flex !important; align-items: center; gap: 9px; margin: 2px 0 20px !important; }
.checkbox-row input { width: 18px; height: 18px; }
.form-actions { margin-top: 8px; }
.success-alert { background: rgba(45,207,143,.1); border: 1px solid rgba(45,207,143,.35); color: #79ebbd; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }

.admin-agent-list { display: grid; gap: 10px; padding: 12px; }
.admin-agent-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(7,17,31,.25); }
.admin-agent-summary { width: 100%; display: grid; grid-template-columns: 14px minmax(0,1fr) auto 28px; gap: 12px; align-items: center; padding: 15px; color: var(--text); background: transparent; border: 0; text-align: left; cursor: pointer; }
.admin-agent-summary:hover { background: var(--surface-alt); }
.expand-indicator { font-size: 24px; color: var(--primary); text-align: center; }
.admin-agent-editor { border-top: 1px solid var(--line); padding: 18px; }
.admin-agent-editor label { display: block; color: var(--muted); font-weight: 700; margin: 0 0 7px; }
.admin-agent-editor input, .admin-agent-editor select, .admin-agent-editor textarea { width: 100%; background: #081525; color: var(--text); border: 1px solid #315170; border-radius: 10px; padding: 11px 12px; outline: none; }
.admin-agent-editor textarea { min-height: 95px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } .admin-agent-summary { grid-template-columns: 14px minmax(0,1fr) 28px; } .admin-agent-summary .agent-stats { display: none; } }

.users-admin-grid { grid-template-columns: minmax(310px, 390px) minmax(0, 1fr); }
.admin-form select { width: 100%; background: #081525; color: var(--text); border: 1px solid #315170; border-radius: 10px; padding: 12px 13px; margin-bottom: 18px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(2,8,16,.76); display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(470px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 25px 80px rgba(0,0,0,.55); }
.modal-card label { display: block; color: var(--muted); font-weight: 700; margin: 18px 0 7px; }
.modal-card input { width: 100%; background: #081525; color: var(--text); border: 1px solid #315170; border-radius: 10px; padding: 12px 13px; }
@media (max-width: 1000px) { .users-admin-grid { grid-template-columns: 1fr; } }

.computer-accordion { padding: 12px; display: grid; gap: 10px; }
.computer-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(7,17,31,.26); }
.computer-card.expanded { border-color: #315170; }
.computer-summary { width: 100%; display: grid; grid-template-columns: 14px minmax(0,1fr) 54px 100px 28px; gap: 12px; align-items: center; padding: 15px; color: var(--text); background: transparent; border: 0; text-align: left; cursor: pointer; }
.computer-summary:hover { background: var(--surface-alt); }
.computer-country { color: var(--primary); font-weight: 800; text-align: center; }
.computer-services { border-top: 1px solid var(--line); }
.service-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; background: rgba(7,17,31,.38); }
.compact-loading { min-height: 100px; }
.field-help { display: block; color: var(--muted); margin-top: -12px; margin-bottom: 18px; }
@media (max-width: 760px) {
    .computer-summary { grid-template-columns: 14px minmax(0,1fr) 28px; }
    .computer-summary .computer-country, .computer-summary .agent-stats { display: none; }
}

.country-check-list {
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 18px;
    padding: 10px;
    border: 1px solid #315170;
    border-radius: 10px;
    background: #081525;
}

.country-check-row {
    margin: 0 !important;
    padding: 7px 5px;
}

.agent-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.agent-facts > div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(7,17,31,.35);
}
.agent-facts span, .agent-facts strong { display: block; }
.agent-facts span { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.service-toolbar small { display: block; color: var(--muted); margin-top: 4px; }
@media (max-width: 900px) { .agent-facts { grid-template-columns: 1fr 1fr; } }

.dashboard-search {
    margin: 0 0 18px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(7, 17, 31, .35);
}

.dashboard-search label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-weight: 700;
}

.dashboard-search-row {
    display: flex;
    gap: 10px;
}

.dashboard-search-row input {
    flex: 1;
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid #315170;
    border-radius: 10px;
    outline: none;
    background: #081525;
    color: var(--text);
}

.dashboard-search-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(77, 163, 255, .13);
}

.dashboard-search small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

@media (max-width: 600px) {
    .dashboard-search-row {
        align-items: stretch;
        flex-direction: column;
    }
}