:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --line: #dfe5ef;
    --text: #172033;
    --muted: #65738a;
    --primary: #23b7e5;
    --primary-dark: #19a5d1;
    --danger: #f05050;
    --warn: #ff902b;
    --ok: #27c24c;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}
body.layout-boxed { background: #dfe5ef; }
body.panel-body { min-height: 100vh; }
body.panel-body { overflow-x: clip; }
a { color: inherit; text-decoration: none; }
.site-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; }
.site-copy { padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: #10262c; color: #f7fbff; }
.site-copy h1 { max-width: 760px; margin: 0; font-size: 48px; line-height: 1.05; letter-spacing: 0; }
.site-copy p { max-width: 650px; color: #c7d7dc; font-size: 16px; line-height: 1.7; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 32px; }
.metric { border: 1px solid rgba(255,255,255,.16); padding: 16px; border-radius: 8px; }
.metric strong { display: block; font-size: 24px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px; box-shadow: 0 18px 50px rgba(15,35,55,.08); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: #edf2f7; border-radius: 8px; margin-bottom: 18px; }
.tab { text-align: center; border-radius: 6px; padding: 10px; font-weight: 700; color: var(--muted); }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.form-grid { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 10px 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
}
input[type="checkbox"] { width: auto; margin-right: 8px; }
textarea { min-height: 88px; resize: vertical; }
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
}
button:hover, .button:hover { background: var(--primary-dark); }
.button.secondary, button.secondary { color: #515253; background: #edf1f2; border: 1px solid #cfdbe2; }
.button.danger, button.danger { background: var(--danger); }
.help { color: var(--muted); font-size: 13px; line-height: 1.5; }
.alert { border-radius: 4px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); background: #fff; }
.alert.err { border-color: #f4b8b0; color: var(--danger); background: #fff3f1; }
.alert.ok { border-color: #a6e4c7; color: var(--ok); background: #effdf5; }
.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    background: #f5f7fa;
    max-width: 1480px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0,0,0,.08);
}
.sidebar { background: #fff; color: #515253; padding: 0; border-right: 1px solid #e4eaec; box-shadow: 2px 0 6px rgba(0,0,0,.03); z-index: 20; }
.sidebar .brand {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    background: #23b7e5;
    border-bottom: 1px solid #19a5d1;
    margin: 0;
    overflow: hidden;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: rgba(255,255,255,.18);
    color: #fff;
    margin-right: 10px;
    font-size: 13px;
    font-weight: 900;
    flex: 0 0 auto;
}
.brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-copy .brand {
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    margin-bottom: 18px;
}
.nav { padding: 6px 6px 12px; }
.nav-section {
    margin: 0;
    padding: 10px 10px 4px;
    color: #919da8;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: .04em;
}
.nav a, .nav-group-title {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 32px;
    padding: 7px 10px;
    border-left: 3px solid transparent;
    border-radius: 4px;
    color: #515253;
    margin: 1px 0;
    font-weight: 600;
    font-size: 13px;
    background: transparent;
    text-align: left;
}
.nav a:hover, .nav-group-title:hover { background: #f5f7fa; color: #23b7e5; }
.nav a.active { background: #fcfcfc; color: #23b7e5; border-left-color: #23b7e5; }
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border-radius: 3px;
    border: 1px solid #cfdbe2;
    color: #23b7e5;
    font-size: 9px;
    font-weight: 900;
    margin-right: 8px;
    flex: 0 0 auto;
}
.nav-icon::before { content: "•"; }
.fa-home::before { content: "H"; }
.fa-code::before { content: "</>"; font-size: 8px; }
.fa-shield::before { content: "S"; }
.fa-cog::before { content: "C"; }
.fa-sign-out::before { content: "L"; }
.nav-group-title { border: 0; cursor: pointer; }
.nav-group.open .nav-group-title { color: #23b7e5; background: #f5f7fa; }
.nav-caret { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .55; transition: transform .18s ease; }
.nav-group.open .nav-caret { transform: rotate(225deg); }
.subnav { display: none; padding: 2px 0 4px; background: #fafbfc; border-top: 1px solid #edf1f2; border-bottom: 1px solid #edf1f2; }
.nav-group.open .subnav { display: block; }
.subnav a {
    min-height: 28px;
    padding: 6px 8px 6px 36px;
    color: #656565;
    font-size: 12.5px;
    font-weight: 600;
}
.subnav a::before {
    content: ">";
    color: #909fa7;
    margin-right: 8px;
    font-size: 11px;
}
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 60px;
    background: #23b7e5;
    color: #fff;
    border-bottom: 1px solid #19a5d1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.topbar strong { font-size: 14px; }
.topbar .help { color: rgba(255,255,255,.78); }
.topbar-left { display: flex; align-items: center; gap: 16px; font-weight: 700; }
.hamb { width: 36px; height: 36px; padding: 0; border-radius: 4px; background: rgba(255,255,255,.14); font-size: 19px; line-height: 1; }
.hamb:hover { background: rgba(255,255,255,.22); }
.topbar-account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wallet, .buy-link { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 4px; background: rgba(255,255,255,.14); color: #fff; font-size: 12px; font-weight: 800; }
.buy-link { background: #fff; color: #23b7e5; }
.account-name { font-weight: 800; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { color: rgba(255,255,255,.76); font-size: 12px; text-transform: uppercase; }
.content { padding: 0 20px 24px; }
.content-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0 14px;
}
.content-heading {
    margin: 0 -20px 18px;
    padding: 18px 20px;
    background: #fff;
    border-bottom: 1px solid #e4eaec;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.page-title { margin: 0; font-size: 24px; font-weight: 500; color: #515253; }
.breadcrumb { color: #6c757d; font-size: 13px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin: 0 0 14px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feature-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.notice-dark {
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: 4px;
    color: #fff;
    background: #3a3f51;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.notice-dark span { display: block; margin-top: 4px; color: #e4eaec; font-size: 13px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e4eaec;
    border-top: 3px solid #5d9cec;
    border-radius: 4px;
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.kpi-card::after {
    content: "";
    position: absolute;
    right: -18px;
    bottom: -26px;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: rgba(93,156,236,.12);
}
.kpi-card.danger { border-top-color: #f05050; }
.kpi-card.danger::after { background: rgba(240,80,80,.12); }
.kpi-card.success { border-top-color: #27c24c; }
.kpi-card.success::after { background: rgba(39,194,76,.12); }
.kpi-card.info { border-top-color: #23b7e5; }
.kpi-card.info::after { background: rgba(35,183,229,.12); }
.kpi-card span { color: #909fa7; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.kpi-card strong { display: block; margin-top: 8px; color: #515253; font-size: 32px; line-height: 1; }
.kpi-card small { display: block; margin-top: 8px; color: #909fa7; }
.dashboard-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 18px; margin-bottom: 18px; }
.dashboard-grid > *, .grid-2 > *, .cards > *, .kpi-grid > * { min-width: 0; }
.dashboard-grid .wide { grid-column: span 1; }
.chart-card h3, .map-card h3 { color: #515253; }
.hour-chart { height: 210px; display: grid; grid-template-columns: repeat(12, minmax(22px, 1fr)); gap: 9px; align-items: end; padding: 16px; }
.hour-slot { display: grid; grid-template-rows: 1fr auto; gap: 8px; height: 100%; text-align: center; color: #909fa7; font-size: 11px; }
.hour-stack { position: relative; height: 100%; display: flex; align-items: end; justify-content: center; border-bottom: 1px solid #e4eaec; }
.hour-bar { position: absolute; bottom: 0; width: 58%; border-radius: 4px 4px 0 0; transition: height .2s ease; }
.hour-bar.total { background: linear-gradient(180deg, #51c6ea, #23b7e5); opacity: .55; }
.hour-bar.blocked { width: 34%; background: linear-gradient(180deg, #ff7b7b, #f05050); }
.bar-list, .country-list, .source-list { padding: 14px 16px 16px; display: grid; gap: 12px; }
.bar-row { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; min-height: 28px; padding-bottom: 9px; color: #515253; font-size: 13px; }
.bar-row i {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f05050, #ff902b);
}
.country-row { display: grid; grid-template-columns: 42px 1fr 34px; gap: 10px; align-items: center; }
.country-row b { color: #515253; }
.country-row span { height: 8px; border-radius: 999px; background: #edf1f2; overflow: hidden; }
.country-row i { display: block; height: 100%; border-radius: inherit; background: #23b7e5; }
.source-list div { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding-bottom: 9px; border-bottom: 1px solid #edf1f2; }
.source-list div:last-child { border-bottom: 0; }
.source-list span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #515253; }
.source-list b { color: #23b7e5; }
.attack-radar {
    position: relative;
    height: 320px;
    margin: 16px;
    border-radius: 6px;
    overflow: hidden;
    background:
        radial-gradient(circle at center, rgba(35,183,229,.22), transparent 33%),
        linear-gradient(135deg, #243447, #141e30);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.radar-rings {
    position: absolute;
    inset: 38px;
    border-radius: 50%;
    background:
        radial-gradient(circle, transparent 22%, rgba(255,255,255,.14) 23%, transparent 24%),
        radial-gradient(circle, transparent 45%, rgba(255,255,255,.12) 46%, transparent 47%),
        radial-gradient(circle, transparent 68%, rgba(255,255,255,.1) 69%, transparent 70%),
        linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: auto, auto, auto, 34px 34px, 34px 34px;
}
.radar-rings::before, .radar-rings::after {
    content: "";
    position: absolute;
    background: rgba(255,255,255,.12);
}
.radar-rings::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.radar-rings::after { top: 50%; left: 0; right: 0; height: 1px; }
.radar-sweep {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1px;
    height: 42%;
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(38deg);
    background: linear-gradient(0deg, rgba(35,183,229,0), rgba(35,183,229,.9));
    box-shadow: 0 0 22px rgba(35,183,229,.55);
}
.radar-dot {
    position: absolute;
    width: 13px;
    height: 13px;
    margin-left: -6.5px;
    margin-top: -6.5px;
    border-radius: 50%;
    background: #27c24c;
    box-shadow: 0 0 0 4px rgba(39,194,76,.25), 0 0 18px rgba(39,194,76,.9);
}
.radar-dot.hostile { background: #f05050; box-shadow: 0 0 0 4px rgba(240,80,80,.26), 0 0 18px rgba(240,80,80,.95); }
.radar-label {
    position: absolute;
    transform: translate(-50%, -50%);
    color: rgba(255,255,255,.7);
    font-size: 11px;
    font-weight: 900;
}
.radar-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.58);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.origin-list { padding: 14px 16px 16px; display: grid; gap: 13px; }
.origin-row { position: relative; display: grid; gap: 7px; padding-bottom: 11px; border-bottom: 1px solid #edf1f2; }
.origin-row:last-child { border-bottom: 0; }
.origin-main { display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; min-width: 0; }
.origin-main b { color: #23b7e5; font-size: 15px; }
.origin-main span { color: #515253; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.origin-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.origin-meta .badge { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.origin-meta strong { color: #515253; font-size: 16px; }
.origin-row i { display: block; height: 5px; border-radius: 999px; background: linear-gradient(90deg, #23b7e5, #f05050); }
.quick-actions { margin-top: 18px; }
.compact { padding: 8px 0; }
.action-card {
    display: flex;
    min-height: 178px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e4eaec;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    text-align: center;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.profile-card { display: grid; gap: 10px; }
.profile-line { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf1f2; }
.profile-line:last-child { border-bottom: 0; }
.profile-line span { color: #8a96a3; font-weight: 700; }
.profile-line strong { color: #515253; }
.status-card { min-height: 180px; }
.big-metric { font-size: 30px; font-weight: 300; color: #23b7e5; margin: 0; }
.monitor-filter { max-width: none; margin-bottom: 16px; }
.filter-grid { display: grid; grid-template-columns: 1.1fr .8fr .65fr 1.4fr auto; gap: 12px; align-items: end; padding: 16px; }
.filter-grid label { min-width: 0; }
.filter-grid button { min-height: 40px; }
.ua-cell { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.1); border-color: #cfdbe2; }
.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 2px solid currentColor;
    font-size: 20px;
    font-weight: 900;
}
.action-card strong { font-size: 17px; color: #515253; }
.action-card small { color: #909fa7; font-size: 13px; }
.text-danger { color: #f05050; }
.text-success { color: #27c24c; }
.text-warning { color: #ff902b; }
.text-info { color: #23b7e5; }
.text-primary { color: #5d9cec; }
.text-muted { color: #909fa7; }
.card { min-width: 0; background: #fff; border: 1px solid #e4eaec; border-radius: 4px; padding: 0; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card > h3, .card-title { margin: 0; padding: 12px 16px; border-bottom: 1px solid #dee2e6; font-size: 16px; font-weight: 700; }
.card > p, .card > form, .card > .help { margin-left: 16px; margin-right: 16px; }
.card > p:first-of-type, .card > form:first-child { margin-top: 16px; }
.card > p:last-child, .card > form:last-child { margin-bottom: 16px; }
.card > h3 + form, .card > h3 + p { margin-top: 16px; }
.form-card { max-width: 780px; }
.form-grid { padding-bottom: 16px; }
.card .value { font-size: 28px; font-weight: 900; margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: 390px 1fr; gap: 18px; align-items: start; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e4eaec; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.table-title {
    padding: 12px 16px;
    border-bottom: 1px solid #e4eaec;
    color: #515253;
    font-size: 16px;
    font-weight: 700;
    background: #fff;
}
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { border-bottom: 1px solid #dee2e6; padding: 10px 12px; text-align: left; vertical-align: top; }
tbody tr:nth-child(even) { background: #f8f9fa; }
tbody tr:hover { background: #eef5ff; }
th { font-size: 12px; color: #495057; text-transform: uppercase; background: #f1f3f5; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; border-radius: 4px; padding: 4px 7px; font-size: 12px; font-weight: 800; background: #6c757d; color: #fff; }
.badge.ok { background: #198754; color: #fff; }
.badge.err { background: #dc3545; color: #fff; }
.badge.warn { background: #ffc107; color: #212529; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline { display: inline; }
.empty { padding: 22px; color: var(--muted); }
@media (max-width: 980px) {
    .site-shell, .app, .grid-2, .dashboard-grid, .filter-grid { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; transform: translateX(-100%); transition: transform .18s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 10; }
    .app { display: block; }
    .cards, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar-account { display: none; }
    .site-copy { padding: 28px; }
    .site-copy h1 { font-size: 34px; }
}
@media (max-width: 560px) {
    .cards, .metric-row, .kpi-grid, .feature-cards { grid-template-columns: 1fr; }
    .content, .topbar, .auth-panel { padding: 16px; }
    .content-heading { margin: 0 -16px 18px; padding: 16px; }
    .hour-chart { overflow-x: auto; grid-template-columns: repeat(12, 34px); }
    .attack-radar { height: 250px; }
    .topbar { height: auto; min-height: 60px; gap: 10px; }
    .topbar .button { padding: 8px 10px; }
    .profile-line { grid-template-columns: 1fr; gap: 4px; }
}
