:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fa;
  --ink: #17202a;
  --muted: #6f7b88;
  --line: #e3e7eb;
  --blue: #2867e8;
  --blue-soft: #eaf1ff;
  --green: #179d69;
  --green-soft: #e8f7f0;
  --amber: #b4770b;
  --amber-soft: #fff5de;
  --red: #c84051;
  --red-soft: #fff0f2;
  --sidebar: #111923;
  --sidebar-muted: #8e9bab;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow: 0 20px 55px rgba(24, 35, 48, 0.09);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 140ms;
  --base: 240ms;
  --slow: 380ms;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.login-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, rgba(40, 103, 232, 0.12), transparent 32rem), var(--bg); }
.login-card { width: min(100%, 410px); padding: 34px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); }
.logo-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #3979f3, #1f59cf); box-shadow: 0 8px 20px rgba(40, 103, 232, 0.23); color: #fff; font-weight: 850; }
.login-card .logo-mark { margin-bottom: 24px; }
.login-card h1 { margin: 3px 0 8px; font-size: 29px; letter-spacing: -0.035em; }
.login-card > p:not(.eyebrow) { margin-bottom: 25px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.login-card .button + label { margin-top: 16px; }
.login-card .button + .button { margin-top: 10px; }
.login-card .button { width: 100%; }
.form-error { display: block; min-height: 18px; margin-top: 10px; color: var(--red); font-size: 12px; }

.admin-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; width: 242px; flex-direction: column; padding: 24px 16px 17px; background: var(--sidebar); color: #eef3fa; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.sidebar-brand div { display: flex; flex-direction: column; }
.sidebar-brand strong { font-size: 16px; }
.sidebar-brand div span { margin-top: 2px; color: var(--sidebar-muted); font-size: 11px; }
.sidebar-close { display: none; width: 40px; height: 40px; margin-left: auto; place-items: center; border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 11px; background: rgba(255, 255, 255, 0.04); color: #eef3fa; font-size: 23px; line-height: 1; cursor: pointer; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: grid; grid-template-columns: 23px 1fr auto; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 11px; background: transparent; color: var(--sidebar-muted); text-align: left; cursor: pointer; transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease); }
.nav-item:hover { background: rgba(255, 255, 255, 0.055); color: #dce6f2; }
.nav-item.is-active { background: rgba(73, 126, 238, 0.15); color: #fff; }
.nav-item:active { transform: translateY(1px); }
.nav-icon { color: #8393a6; font-size: 18px; text-align: center; }
.nav-item.is-active .nav-icon { color: #76a0ff; }
.nav-count { min-width: 22px; padding: 2px 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); font-size: 10px; text-align: center; }
.sidebar-footer { display: grid; gap: 13px; margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.server-indicator { display: flex; align-items: center; gap: 10px; }
.server-indicator > span { width: 8px; height: 8px; border-radius: 50%; background: #37ca8b; box-shadow: 0 0 0 4px rgba(55, 202, 139, 0.11); }
.server-indicator div { display: flex; flex-direction: column; }
.server-indicator strong { font-size: 12px; }
.server-indicator small { margin-top: 2px; color: var(--sidebar-muted); font-size: 10px; }
.quiet-button { padding: 7px 0; border: 0; background: transparent; color: var(--sidebar-muted); font-size: 12px; text-align: left; cursor: pointer; }

.content { min-height: 100vh; margin-left: 242px; padding: 30px clamp(22px, 4vw, 54px) 60px; }
.content-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1440px; margin: 0 auto 28px; }
.content-header h1 { margin: 4px 0 0; font-size: 31px; letter-spacing: -0.04em; }
.eyebrow { margin: 0; color: #8a95a1; font-size: 10px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.updated-at { color: var(--muted); font-size: 11px; }
.icon-button, .mobile-menu { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; transition: background var(--fast) var(--ease), transform var(--fast) var(--ease); }
.icon-button:hover, .mobile-menu:hover { background: var(--surface-soft); }
.icon-button:active, .mobile-menu:active { transform: scale(0.97); }
.mobile-menu { display: none; }

.view { display: none; max-width: 1440px; margin: 0 auto; animation: viewIn var(--base) var(--ease-premium); }
.view.is-active { display: block; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 13px; }
.metric-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-top span:first-child { color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 15px; }
.metric-card[data-tone="green"] .metric-icon { background: var(--green-soft); color: var(--green); }
.metric-card[data-tone="amber"] .metric-icon { background: var(--amber-soft); color: var(--amber); }
.metric-card[data-tone="red"] .metric-icon { background: var(--red-soft); color: var(--red); }
.metric-value { display: block; margin-top: 14px; font-size: 29px; line-height: 1; letter-spacing: -0.04em; }
.metric-value { min-width: 0; overflow-wrap: anywhere; }
.system-summary .metric-value { font-size: 20px; line-height: 1.15; letter-spacing: -0.025em; }
.metric-caption { display: block; margin-top: 7px; overflow: hidden; color: #97a1ac; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr); gap: 13px; margin-bottom: 13px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 1px 1px rgba(17, 25, 35, 0.01); }
.activity-panel, .quick-panel, .recent-panel, .form-panel, .history-panel { padding: 21px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -0.025em; }
.live-label { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 11px; font-weight: 720; }
.live-label i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.chart { display: flex; height: 175px; align-items: end; gap: clamp(3px, 0.55vw, 8px); padding-top: 14px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(33.333% - 1px), #eef1f3 33.333%); }
.chart-bar { flex: 1; min-width: 3px; height: var(--height); border-radius: 4px 4px 1px 1px; background: linear-gradient(180deg, #6e9dff, #3572ed); opacity: 0.88; transform-origin: bottom; animation: barIn 500ms var(--ease-premium) both; animation-delay: var(--delay); }
.chart-bar:hover { opacity: 1; }
.chart-axis { display: flex; justify-content: space-between; padding-top: 8px; color: #9ca5af; font-size: 9px; }
.revenue-grid { align-items: stretch; }
.revenue-chart-panel, .revenue-breakdown-panel, .revenue-table-panel { padding: 21px; }
.revenue-chart {
  position: relative;
  display: flex;
  height: 260px;
  align-items: end;
  gap: clamp(4px, 0.6vw, 9px);
  padding: 22px 8px 0;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(40, 103, 232, .07), transparent 65%),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), #edf1f5 25%);
  overflow: hidden;
}
.revenue-line { position: absolute; inset: 18px 8px 0; width: calc(100% - 16px); height: calc(100% - 18px); pointer-events: none; }
.revenue-line polyline { fill: none; stroke: rgba(40,103,232,.62); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.revenue-bar {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 4px;
  height: var(--height);
  border: 0;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, #58a2ff, #2867e8 72%, #164fbd);
  box-shadow: 0 8px 20px rgba(40,103,232,.16);
  transform-origin: bottom;
  animation: barIn 520ms var(--ease-premium) both;
  animation-delay: var(--delay);
  cursor: help;
}
.revenue-bar span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  padding: 4px 7px;
  border-radius: 8px;
  background: #111923;
  color: #fff;
  font-size: 9px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 5px);
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
  pointer-events: none;
}
.revenue-bar:hover span, .revenue-bar:focus-visible span { opacity: 1; transform: translate(-50%, 0); }
.revenue-axis { padding-inline: 8px; }
.breakdown-list { display: grid; gap: 10px; }
.breakdown-item { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); animation: viewIn var(--base) var(--ease-premium) both; animation-delay: var(--delay); }
.breakdown-top, .breakdown-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.breakdown-top strong { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.breakdown-top span { color: var(--blue); font-size: 10px; font-weight: 800; }
.breakdown-bar { height: 7px; margin: 10px 0 8px; overflow: hidden; border-radius: 999px; background: #e7ecf2; }
.breakdown-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2867e8, #56b2ff); }
.breakdown-meta { color: var(--muted); font-size: 10px; }
.revenue-table { min-width: 680px; }
.revenue-row { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(130px, 1fr) minmax(120px, .8fr) minmax(150px, 1fr); align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 11px; }
.revenue-row:last-child { border-bottom: 0; }
.revenue-head { background: var(--surface-soft); color: #89949f; font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.payment-chip { display: inline-flex; width: max-content; align-items: center; padding: 5px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 750; }
.payment-chip.is-bonus { background: var(--amber-soft); color: var(--amber); }
.operations-grid { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .75fr); }
.operations-panel { padding: 21px; }
.audit-timeline { display: grid; gap: 9px; max-height: 680px; overflow: auto; padding-right: 3px; }
.audit-timeline.compact { max-height: 520px; }
.audit-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.audit-item.compact { padding: 10px; }
.audit-dot { width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: #9aa7b5; box-shadow: 0 0 0 4px rgba(154,167,181,.13); }
.audit-item[data-tone="success"] .audit-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(23,157,105,.13); }
.audit-item[data-tone="warning"] .audit-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(180,119,11,.13); }
.audit-item[data-tone="danger"] .audit-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(200,64,81,.13); }
.audit-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.audit-top strong { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.audit-top span { flex: 0 0 auto; color: #97a1ac; font-size: 9px; }
.audit-item p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.audit-item b { align-self: center; padding: 5px 8px; border-radius: 99px; background: #edf1f4; color: #687582; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.audit-item[data-tone="success"] b { background: var(--green-soft); color: var(--green); }
.audit-item[data-tone="warning"] b { background: var(--amber-soft); color: var(--amber); }
.audit-item[data-tone="danger"] b { background: var(--red-soft); color: var(--red); }
.audit-checks { display: grid; gap: 4px; margin-top: 9px; }
.audit-checks span { padding: 6px 8px; border-radius: 9px; background: #fff; color: #6c7784; font-size: 9px; line-height: 1.3; overflow-wrap: anywhere; }
.attention-list, .compact-list, .broadcast-list { display: grid; gap: 8px; }
.attention-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 13px; border-radius: 12px; background: var(--surface-soft); }
.attention-item div { min-width: 0; }
.attention-item strong, .attention-item span { display: block; }
.attention-item strong { margin-bottom: 3px; font-size: 13px; }
.attention-item span { color: var(--muted); font-size: 10px; }
.attention-value { color: var(--amber); font-size: 16px; font-weight: 800; }
.link-button { padding: 5px; border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 700; cursor: pointer; }
.compact-row { display: grid; grid-template-columns: 36px minmax(130px, 1fr) minmax(130px, 1fr) minmax(110px, 0.7fr) auto; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; transition: background var(--fast) var(--ease); }
.compact-row:hover { background: var(--surface-soft); }
.avatar { display: grid; width: 36px; height: 36px; place-items: center; overflow: hidden; border-radius: 11px; background: var(--avatar, #dbe6f8); color: #315177; font-size: 12px; font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.row-primary, .row-secondary { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-primary { font-size: 12px; font-weight: 720; }
.row-secondary { margin-top: 3px; color: var(--muted); font-size: 10px; }
.profile-link { color: var(--blue); font-weight: 750; text-decoration: none; }
.profile-link:hover { text-decoration: underline; }
.status-badge { display: inline-flex; width: max-content; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 99px; background: #edf1f4; color: #687582; font-size: 10px; font-weight: 720; }
.status-badge[data-status="active"], .status-badge[data-status="trial"], .status-badge[data-status="online"] { background: var(--green-soft); color: var(--green); }
.status-badge[data-status="pending"] { background: var(--amber-soft); color: var(--amber); }
.status-badge[data-status="blocked"] { background: var(--red-soft); color: var(--red); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.search { display: flex; width: min(100%, 430px); height: 42px; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: #8e99a5; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.segmented { display: flex; overflow-x: auto; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); scrollbar-width: none; }
.segmented button { padding: 8px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 720; white-space: nowrap; cursor: pointer; }
.segmented button.is-active { background: var(--blue-soft); color: var(--blue); }
.users-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 3px 10px; }
.result-summary { color: var(--muted); font-size: 10px; }
.bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid #cddbf7; border-radius: 14px; background: #f5f8ff; box-shadow: 0 8px 24px rgba(40, 103, 232, 0.07); animation: viewIn var(--base) var(--ease-premium); }
.bulk-bar[hidden] { display: none; }
.bulk-count strong, .bulk-count span { display: block; }
.bulk-count strong { color: #285fca; font-size: 12px; }
.bulk-count span { margin-top: 3px; color: #7a8798; font-size: 9px; }
.bulk-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.bulk-bar.is-busy { opacity: 0.65; pointer-events: none; }
.quiet-link { min-height: 36px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; }
.user-grid { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 11px; }
.user-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; transition: transform var(--base) var(--ease-premium), box-shadow var(--base) var(--ease), border-color var(--fast) var(--ease), background var(--fast) var(--ease); }
.user-card:hover { border-color: #cfd7e0; box-shadow: 0 12px 32px rgba(26, 39, 55, 0.07); transform: translateY(-2px); }
.user-card.is-selected { border-color: #91b1f4; background: #f8faff; box-shadow: 0 0 0 2px rgba(53, 116, 239, 0.08); }
.user-card-top { display: grid; grid-template-columns: 22px 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.user-select { display: grid; width: 22px; height: 42px; place-items: center; cursor: pointer; }
.user-select input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.user-select span { width: 18px; height: 18px; border: 1.5px solid #c4ced9; border-radius: 6px; background: #fff; transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.user-select input:checked + span { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 4px #fff; }
.user-select input:focus-visible + span { box-shadow: 0 0 0 3px rgba(40, 103, 232, 0.16); }
.user-card .avatar { width: 42px; height: 42px; border-radius: 13px; }
.user-card-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.user-card-body span, .user-card-body strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card-body span { margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.user-card-body strong { font-size: 11px; }
.empty-block { padding: 34px; color: var(--muted); font-size: 12px; text-align: center; }

.table-panel { overflow: hidden; border-radius: var(--radius-md); }
.connection-table { min-width: 760px; }
.connection-map-panel { margin-bottom: 16px; overflow: hidden; }
.map-count { padding: 5px 9px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 750; }
.map-stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: -4px 0 14px; }
.map-stat { padding: 10px 12px; border: 1px solid rgba(40,103,232,.11); border-radius: 13px; background: linear-gradient(180deg, #f9fbff, #f2f6ff); }
.map-stat span, .map-stat strong { display: block; }
.map-stat span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.map-stat strong { margin-top: 4px; font-size: 17px; letter-spacing: -.03em; }
.map-shell { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: stretch; }
.connection-map {
  position: relative;
  width: 100%;
  height: clamp(320px, 46vw, 560px);
  min-height: 320px;
  overflow: hidden;
  border-radius: 18px;
  background: #071225;
  box-shadow: inset 0 0 0 1px rgba(109, 154, 240, .2), inset 0 -90px 120px rgba(0,0,0,.18), 0 18px 45px rgba(7,18,37,.14);
  isolation: isolate;
}
.connection-map.leaflet-container { font-family: inherit; background: #071225; }
.connection-map .leaflet-tile { filter: saturate(.84) contrast(1.02) brightness(.93); }
.connection-map .leaflet-control-zoom { overflow: hidden; border: 0; border-radius: 12px; box-shadow: 0 10px 28px rgba(7,18,37,.22); }
.connection-map .leaflet-control-zoom a { width: 34px; height: 34px; border: 0; background: rgba(255,255,255,.94); color: #17202a; font: 700 18px/34px Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.connection-map .leaflet-control-zoom a:hover { background: #fff; color: var(--blue); }
.connection-map .leaflet-control-attribution { border-radius: 10px 0 0 0; background: rgba(255,255,255,.9); color: #66717d; font-size: 9px; }
.connection-map .leaflet-control-attribution a { color: var(--blue); }
.connection-map .leaflet-popup-content-wrapper { border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(7,18,37,.95); box-shadow: 0 18px 40px rgba(0,0,0,.28); color: #eaf2ff; }
.connection-map .leaflet-popup-tip { background: rgba(7,18,37,.95); }
.connection-map .leaflet-popup-content { margin: 10px 12px; }
.map-popup { display: grid; gap: 4px; min-width: 150px; }
.map-popup strong { color: #fff; font-size: 12px; }
.map-popup span, .map-popup small { color: #aebbd1; font-size: 10px; }
.connection-map.is-empty .leaflet-pane { filter: grayscale(.15) brightness(.76); }
.map-side-panel { display: flex; min-height: 260px; flex-direction: column; padding: 16px; border: 1px solid rgba(40,103,232,.1); border-radius: 18px; background: linear-gradient(180deg, #fbfcff, #f3f6fb); }
.map-side-panel h3 { margin: 4px 0 12px; font-size: 16px; letter-spacing: -.02em; }
.map-point-list { display: grid; gap: 8px; overflow: auto; padding-right: 2px; }
.map-point-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.map-point-card.online { border-color: #ccebdc; background: #f4fbf7; }
.map-point-card div { min-width: 0; }
.map-point-card strong, .map-point-card span, .map-point-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-point-card strong { font-size: 11px; }
.map-point-card span, .map-point-card small { color: var(--muted); font-size: 9px; }
.map-point-card b { color: var(--blue); font-size: 13px; }
.map-point-card small { grid-column: 1 / -1; }
.compact-empty { padding: 22px 8px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.map-legend i { width: 8px; height: 8px; border-radius: 50%; background: #5f82ba; box-shadow: 0 0 0 3px rgba(95,130,186,.14); }
.map-legend i.online { background: #2fc47c; box-shadow: 0 0 0 3px rgba(47,196,124,.14); }
.map-empty { position: absolute; z-index: 650; inset: 0; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, rgba(7,18,37,.2), rgba(7,18,37,.58)); color: #d7e6ff; font-size: 12px; text-align: center; pointer-events: none; }
.connection-header, .connection-row { display: grid; grid-template-columns: minmax(170px, 1.1fr) minmax(130px, 0.9fr) minmax(140px, 1fr) minmax(150px, 1fr) 90px; gap: 12px; align-items: center; padding: 11px 15px; }
.connection-header { border-bottom: 1px solid var(--line); background: var(--surface-soft); color: #89949f; font-size: 9px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.connection-row { border-bottom: 1px solid #edf0f2; font-size: 11px; }
.connection-row:last-child { border-bottom: 0; }
.connection-row:hover { background: #fafbfc; }

.form-layout { display: grid; grid-template-columns: minmax(400px, 1fr) minmax(300px, 0.72fr); gap: 13px; }
.form-panel label, dialog label, .login-card label { display: grid; gap: 7px; margin-bottom: 15px; }
.form-panel label > span, dialog label > span, .login-card label > span { color: #5f6c79; font-size: 11px; font-weight: 680; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: #fff; color: var(--ink); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
input, select { height: 42px; padding: 0 12px; }
textarea { min-height: 130px; padding: 11px 12px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: #7aa2f2; box-shadow: 0 0 0 3px rgba(40, 103, 232, 0.1); }
.two-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.button { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 11px; font-weight: 750; cursor: pointer; transition: filter var(--fast) var(--ease), transform var(--fast) var(--ease); }
.button.primary { background: linear-gradient(135deg, #3574ef, #2867e8); box-shadow: 0 8px 22px rgba(40, 103, 232, 0.19); color: #fff; }
.button.secondary { border-color: var(--line); background: var(--surface); color: #44515e; }
.button.danger { background: var(--red-soft); color: var(--red); }
.button:hover { filter: brightness(1.04); }
.button:active { transform: translateY(1px); }
.broadcast-item { padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; }
.broadcast-item strong { display: block; margin-bottom: 4px; font-size: 12px; }
.broadcast-item p { display: -webkit-box; overflow: hidden; margin: 0 0 8px; color: var(--muted); font-size: 10px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.broadcast-meta { display: flex; justify-content: space-between; color: #929ca6; font-size: 9px; }
.settings-form { max-width: 760px; }
.form-actions { display: flex; justify-content: flex-end; }

.scrim { position: fixed; z-index: 40; inset: 0; background: rgba(15, 23, 32, 0.32); opacity: 0; backdrop-filter: blur(2px); transition: opacity var(--base) var(--ease); }
.scrim.is-visible { opacity: 1; }
.drawer { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(100%, 480px); padding: 23px; overflow-y: auto; background: var(--surface); box-shadow: -24px 0 70px rgba(22, 31, 42, 0.15); transform: translateX(102%); transition: transform var(--slow) var(--ease-premium); }
.drawer.is-open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
.drawer-header h2 { margin: 4px 0 0; font-size: 22px; }
.drawer-profile { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 13px; align-items: center; padding: 15px; border-radius: 16px; background: var(--surface-soft); }
.drawer-profile .avatar { width: 54px; height: 54px; border-radius: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 17px 0; }
.detail-card { padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.detail-card span, .detail-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-card span { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.detail-card strong { font-size: 11px; }
.drawer-section { margin-top: 20px; }
.drawer-section h3 { margin: 0 0 9px; font-size: 12px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.device-row:last-child { border-bottom: 0; }
.device-row div { min-width: 0; }
.device-row strong, .device-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-row strong { font-size: 11px; }
.device-row span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.drawer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 22px; }
.drawer-actions .full { grid-column: 1 / -1; }
.device-remove { flex: 0 0 auto; min-height: 32px; padding: 0 10px; border: 1px solid #f0c7c7; border-radius: 9px; background: #fff7f7; color: #a63b3b; font-family: inherit; font-size: 9px; font-weight: 700; cursor: pointer; }
.button.compact { min-height: 38px; padding: 0 14px; white-space: nowrap; }
.system-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.system-list { display: grid; gap: 8px; }
.system-nodes-panel { margin-bottom: 13px; }
.vpn-node-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.vpn-node-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.vpn-node-card[data-status="online"] { border-color: rgba(55, 202, 139, .3); background: rgba(55, 202, 139, .055); }
.vpn-node-card[data-status="offline"] { border-color: rgba(225, 82, 82, .25); background: rgba(225, 82, 82, .045); }
.vpn-node-head { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.vpn-node-head > span { font-size: 25px; }
.vpn-node-head div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.vpn-node-head strong { font-size: 13px; }
.vpn-node-head small { color: var(--muted); font-size: 10px; }
.vpn-node-head b { padding: 5px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 9px; }
.vpn-node-card[data-status="online"] .vpn-node-head b { background: rgba(55, 202, 139, .12); color: #18845a; }
.vpn-node-card[data-status="offline"] .vpn-node-head b { background: rgba(225, 82, 82, .1); color: #b83f3f; }
.vpn-node-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.vpn-node-meta span { min-width: 0; padding: 8px; border-radius: 10px; background: var(--surface); }
.vpn-node-meta small, .vpn-node-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vpn-node-meta small { margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.vpn-node-meta strong { font-size: 10px; }
.system-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.system-item:last-child { border-bottom: 0; }
.system-item strong, .system-item small { display: block; }
.system-item strong { font-size: 11px; }
.system-item small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.system-item b { color: var(--muted); font-size: 9px; }
.system-dot { width: 8px; height: 8px; border-radius: 50%; background: #d75a5a; box-shadow: 0 0 0 4px #fbeaea; }
.system-dot.ok { background: #36a269; box-shadow: 0 0 0 4px #e7f6ed; }
.system-logs { margin-top: 16px; }
.system-logs pre { max-height: 340px; overflow: auto; margin: 0; padding: 14px; border-radius: 12px; background: #111820; color: #d7e1eb; font: 10px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

dialog { width: min(calc(100% - 32px), 420px); padding: 0; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 90px rgba(15, 23, 32, 0.22); }
dialog::backdrop { background: rgba(15, 23, 32, 0.34); backdrop-filter: blur(2px); }
dialog form { padding: 23px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 21px; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 21px; }

.toast { position: fixed; z-index: 80; right: 24px; bottom: 24px; max-width: 380px; padding: 12px 15px; border: 1px solid #cdebdc; border-radius: 12px; background: #f1fbf6; box-shadow: var(--shadow); color: #187a55; font-size: 12px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity var(--base) var(--ease), transform var(--base) var(--ease-premium); }
.toast[data-tone="error"] { border-color: #f1cbd1; background: #fff4f5; color: var(--red); }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes barIn { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 0.88; } }

@media (max-width: 1120px) { .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .user-grid { grid-template-columns: repeat(2, minmax(240px, 1fr)); } }
@media (max-width: 880px) {
  .sidebar { z-index: 60; width: min(82vw, 300px); padding-top: max(20px, env(safe-area-inset-top)); transform: translateX(-102%); box-shadow: none; transition: transform var(--slow) var(--ease-premium), box-shadow var(--slow) var(--ease); will-change: transform; }
  .sidebar.is-open { transform: translateX(0); box-shadow: 24px 0 70px rgba(4, 10, 18, 0.28); }
  .sidebar-close { display: grid; }
  .sidebar nav { gap: 7px; }
  .nav-item { min-height: 48px; color: #b8c3d0; font-size: 14px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  html.nav-open { overflow: hidden; }
  .content { margin-left: 0; padding: 22px 18px 50px; }
  .mobile-menu { display: grid; }
  .content-header > div:first-of-type { margin-right: auto; }
  .dashboard-grid, .form-layout, .operations-grid { grid-template-columns: 1fr; }
  .map-shell { grid-template-columns: 1fr; }
  .map-side-panel { min-height: auto; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .system-summary { grid-template-columns: 1fr 1fr; }
  .vpn-node-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .content-header h1 { font-size: 26px; }
  .updated-at { display: none; }
  .metrics-grid, .user-grid, .two-fields { grid-template-columns: 1fr; }
  .users-summary-row { align-items: flex-start; }
  .bulk-bar { align-items: stretch; flex-direction: column; }
  .bulk-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bulk-buttons .quiet-link { grid-column: 1 / -1; }
  .compact-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .compact-row > :nth-child(3), .compact-row > :nth-child(4) { display: none; }
  .table-panel { overflow-x: auto; }
  .map-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .revenue-chart { height: 220px; }
  .connection-map { height: 300px; min-height: 240px; }
  .drawer { padding: 19px; }
  .drawer-actions { grid-template-columns: 1fr; }
  .drawer-actions .full { grid-column: auto; }
  .toast { right: 16px; bottom: 16px; left: 16px; }
  .audit-item { grid-template-columns: 12px minmax(0, 1fr); }
  .audit-item b { grid-column: 2; width: max-content; }
  .audit-top { align-items: flex-start; flex-direction: column; gap: 3px; }
  .vpn-node-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; } }
