/* Dashboard — Analytics style (black) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #000000;
  --sidebar: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #1f1f1f;
  --text: #ffffff;
  --muted: #888888;
  --accent: #10b981;
  --accent-dim: rgba(16,185,129,0.12);
  --green: #10b981;
  --yellow: #eab308;
  --red: #ef4444;
  --radius: 12px;
  --sidebar-w: 220px;
}

body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(16, 185, 129, 0.18), transparent 55%),
    var(--bg);
}

.auth-gate[hidden] { display: none !important; }

.auth-gate__card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.75rem;
  text-align: center;
}

.auth-gate__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.auth-gate__title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 1.75rem;
  letter-spacing: -0.02em;
}

.auth-gate__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  margin-top: 0.5rem;
}

.app { display: flex; min-height: 100vh; }
body.is-auth-locked .app { visibility: hidden; pointer-events: none; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.75rem;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 1.5rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.sidebar__icon { color: var(--accent); }

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}

.sidebar__link:hover { background: var(--surface); color: var(--text); }
.sidebar__link.active { background: var(--accent-dim); color: var(--accent); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 1.5rem 2rem 3rem;
  min-width: 0;
}

.view { display: none; }
.view--active { display: block; }

/* Analytics header */
.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.analytics-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.period-pills {
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.25rem;
}

.period-pill {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.period-pill:hover { color: var(--text); }
.period-pill.active { background: var(--surface2); color: var(--text); }

.period-pill--custom {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.analytics-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.analytics-tab {
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.analytics-tab:hover { color: var(--text); }
.analytics-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  position: relative;
  min-height: 120px;
  overflow: hidden;
}

.kpi-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.kpi-card__label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.kpi-change {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.kpi-change--up { background: rgba(16,185,129,0.15); color: var(--green); }
.kpi-change--down { background: rgba(239,68,68,0.15); color: var(--red); }

.kpi-card__value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.15rem;
}

.kpi-card__avg {
  font-size: 0.75rem;
  color: var(--muted);
}

.kpi-spark {
  position: absolute;
  right: 0.5rem;
  bottom: 0.4rem;
  width: 90px;
  height: 36px;
  opacity: 0.9;
}

/* Bottom: chart + countries */
.analytics-bottom {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 0.85rem;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.panel__head h2 { font-size: 0.95rem; font-weight: 600; }
.panel__sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; }

.chart-panel__head { align-items: center; }

.metric-pills {
  display: flex;
  gap: 0.2rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.2rem;
  flex-shrink: 0;
}

.metric-pill {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}

.metric-pill.active { background: var(--surface2); color: var(--text); }

.chart-wrap {
  padding: 1rem 1rem 0.75rem;
  position: relative;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 260px !important;
  display: block;
}

/* Locations */
.locations-panel { max-height: 420px; display: flex; flex-direction: column; }

.locations-table-wrap {
  overflow-y: auto;
  flex: 1;
}

.locations-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.locations-table th {
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.locations-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.locations-table tr:last-child td { border-bottom: none; }

.locations-table--simple th:last-child,
.locations-table--simple td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.locations-table--simple .loc-name {
  font-weight: 500;
  color: var(--text);
}

.locations-table--simple .loc-count {
  color: var(--muted);
}

.loc-country {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.loc-flag {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  overflow: hidden;
}

.loc-flag-img {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.notif-card__country {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.notif-card__ip {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.loc-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  width: 56px;
  overflow: hidden;
}

.loc-bar__fill {
  height: 100%;
  background: #555;
  border-radius: 2px;
}

.loc-pct { color: var(--muted); font-variant-numeric: tabular-nums; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); }

/* Shared UI (domains / tools) */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
}

.topbar__title { font-size: 1.5rem; font-weight: 700; }
.topbar__sub { color: var(--muted); font-size: 0.875rem; margin-top: 0.15rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stats--4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.stat-card__label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
}

.stat-card--green .stat-card__value { color: var(--green); }
.stat-card--yellow .stat-card__value { color: var(--yellow); }
.stat-card--red .stat-card__value { color: var(--red); }

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
}

.search input {
  flex: 1;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.65rem 0;
  outline: none;
}

.select {
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.select--full { width: 100%; margin-bottom: 0.75rem; }

.table-wrap { overflow-x: auto; }

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

.table th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover { background: rgba(255,255,255,0.02); }
.table tbody tr:last-child td { border-bottom: none; }

.table-footer {
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.status--active { background: rgba(16,185,129,0.15); color: var(--green); }
.status--pending, .status--expiring { background: rgba(234,179,8,0.15); color: var(--yellow); }
.status--suspended, .status--expired { background: rgba(239,68,68,0.15); color: var(--red); }

.mono { font-family: "JetBrains Mono", monospace; font-size: 0.85rem; }
.ssl-yes { color: var(--green); font-weight: 700; }
.ssl-no { color: var(--muted); }

.row-actions { display: flex; gap: 0.35rem; }

.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); }
.icon-btn--danger:hover { color: var(--red); border-color: rgba(239,68,68,0.3); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn--primary { background: var(--accent); color: #000; }
.btn--primary:hover { opacity: 0.9; }
.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn--ghost:hover { color: var(--text); }
.btn--sm { padding: 0.45rem 0.85rem; font-size: 0.8rem; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.tool-card--wide { grid-column: 1 / -1; }
.tool-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.tool-card__desc { font-size: 0.8rem; color: var(--muted); margin-bottom: 1rem; }

.tool-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }

.tool-output {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  outline: none;
}

.tool-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  resize: vertical;
  outline: none;
  margin-bottom: 0.5rem;
}

.tool-textarea--out { color: var(--muted); }
.tool-actions { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }

.tool-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.tool-range {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.tool-range input[type="range"] { width: 100%; accent-color: var(--accent); }

.quick-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.quick-links a {
  padding: 0.45rem 0.85rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}

.quick-links a:hover { border-color: rgba(16,185,129,0.3); color: var(--accent); }

.field { margin-bottom: 1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(16,185,129,0.4);
}

.design-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.design-picker__empty {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.design-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.design-card:hover {
  border-color: rgba(16,185,129,0.35);
}

.design-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(16,185,129,0.35);
}

.design-card__preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0d0d0d;
}

.design-card__preview--frame {
  position: relative;
  overflow: hidden;
  pointer-events: none;
  background: #0a0a0a;
}

.design-card__preview--frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  transform: scale(0.22);
  transform-origin: top left;
  background: #fff;
}

.design-card__preview--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.design-card__meta {
  padding: 0 0.65rem 0.65rem;
}

.design-card__name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}

.design-card__desc {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
  line-height: 1.35;
}

.domain-card__design {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(90vh, 820px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal__close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal__body { padding: 1.5rem; }

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.875rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  z-index: 300;
}

.toast[hidden] { display: none; }
.toast--success { border-color: rgba(16,185,129,0.4); color: var(--accent); }
.toast--error { border-color: rgba(239,68,68,0.4); color: var(--red); }

.domains-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  max-width: 720px;
  line-height: 1.55;
}

.domains-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.domains-toolbar .input {
  flex: 1;
  min-width: 180px;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
}

.domains-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.domains-empty, .domains-count {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

.domain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}

.domain-card__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.domain-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.domain-card__status {
  font-size: 0.8rem;
  font-weight: 500;
}

.domain-card__status.is-active { color: var(--green); }
.domain-card__status.is-pending { color: var(--yellow); }
.domain-card__status.is-checking { color: #38bdf8; }

.ns-waiting-label {
  font-size: 0.82rem;
  color: #38bdf8;
  font-weight: 500;
}

.ns-row--all {
  gap: 0.5rem;
}

.domain-card__link {
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
}

.domain-card__link:hover { text-decoration: underline; }

.ns-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.ns-box__title, .ns-success, .ns-note, .modal-lead {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.ns-success strong { color: var(--text); }

.ns-list { display: flex; flex-direction: column; gap: 0.35rem; }

.ns-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0;
  flex-wrap: wrap;
}

.ns-row--all {
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.ns-row .btn-copy-ns {
  flex-shrink: 0;
  white-space: nowrap;
}

.notif-filter {
  position: relative;
}

#btn-notif-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.notif-filter__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: min(320px, 86vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.notif-filter__dropdown[hidden] { display: none; }

.notif-filter__section {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.notif-filter__title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.notif-filter__domain {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.notif-filter__domain .select { width: 100%; }

.notif-prefs,
.notif-send-row,
.notif-settings,
.notif-pane,
.notif-view-tabs { /* legacy cleaned */ }

.notif-pref {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.notif-pref input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.notif-settings__hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.notif-card__time {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
}

.ns-row__label {
  min-width: 42px;
  font-size: 0.75rem;
  color: var(--muted);
}

.ns-row__value {
  flex: 1;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ns-empty { font-size: 0.85rem; color: var(--muted); }

.form-error {
  color: var(--red);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}

.btn--sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.soon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  color: var(--muted);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1100px) {
  .analytics-bottom { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar__brand span:not(.sidebar__icon),
  .sidebar__link span { display: none; }
  .sidebar__link { justify-content: center; padding: 0.75rem; }
  .main { margin-left: 64px; padding: 1rem; }
  .stats, .stats--4 { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: 1fr; }
  .period-pills { flex-wrap: wrap; }
  .sidebar__tg { display: none; }
  .nav-badge { margin-left: 0; }
}

/* Phone: bottom nav + full-width content */
@media (max-width: 768px) {
  .sidebar {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: stretch;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 0.4rem 0.35rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
    background: #0a0a0a;
    z-index: 200;
  }

  .sidebar__brand { display: none; }

  .sidebar__nav {
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
    gap: 0.15rem;
    flex: 1;
  }

  .sidebar__link {
    position: relative;
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.2rem;
    padding: 0.45rem 0.2rem;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    border-radius: 10px;
    min-width: 0;
  }

  .sidebar__brand span:not(.sidebar__icon),
  .sidebar__link span {
    display: block !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar__link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .sidebar__link .nav-badge {
    position: absolute;
    top: 0.15rem;
    right: calc(50% - 1.35rem);
    margin-left: 0;
    min-width: 1rem;
    height: 1rem;
    font-size: 0.62rem;
    padding: 0 0.28rem;
  }

  .main {
    margin-left: 0;
    margin-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    padding: 1rem 0.85rem 1.5rem;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .analytics-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .analytics-title,
  .topbar__title {
    font-size: 1.35rem;
  }

  .period-pills {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .period-pills::-webkit-scrollbar { display: none; }

  .period-pill {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .kpi-card {
    min-height: 0;
    padding: 0.9rem 1rem;
  }

  .kpi-card__value { font-size: 1.45rem; }

  .analytics-bottom {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .chart-panel__head,
  .panel__head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .metric-pills {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .metric-pill { flex: 0 0 auto; white-space: nowrap; }

  .chart-wrap {
    padding: 0.75rem 0.5rem 0.5rem;
  }

  .chart-wrap canvas {
    height: 200px !important;
  }

  .locations-panel {
    max-height: none;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 1.1rem;
  }

  .topbar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  .topbar__actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .notif-card {
    padding: 0.85rem 0.9rem;
  }

  .notif-card__head {
    gap: 0.5rem;
    align-items: flex-start;
  }

  .notif-card__title {
    font-size: 0.92rem;
    line-height: 1.3;
    word-break: break-word;
  }

  .notif-card__country,
  .notif-card__ip {
    font-size: 0.85rem;
    flex-wrap: wrap;
  }

  .notif-card__domain {
    word-break: break-all;
  }

  .notif-settings {
    padding: 0.85rem;
  }

  .domain-card {
    padding: 0.9rem;
  }

  .domain-card__head {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .ns-row__value {
    font-size: 0.72rem;
  }

  .modal {
    padding: 0.5rem;
    align-items: flex-end;
  }

  .modal__dialog {
    width: 100%;
    max-height: min(92vh, 920px);
    border-radius: 14px 14px 0 0;
  }

  .modal__head,
  .modal__body {
    padding: 1rem 1rem;
  }

  .modal__foot {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .modal__foot .btn {
    flex: 1 1 auto;
  }

  .design-picker {
    grid-template-columns: 1fr;
  }

  .stats, .stats--4 {
    grid-template-columns: 1fr;
  }

  .empty {
    padding: 2rem 1rem;
  }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.sidebar__tg { display: none; }

.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.nav-badge[hidden],
.nav-badge--empty {
  display: none !important;
}

.nav-badge--zero {
  background: rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}

.nav-badge--hot {
  background: var(--accent);
  color: #000;
  animation: notif-badge-pop 0.35s ease;
}

@keyframes notif-badge-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.topbar__sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-family: inherit;
  font-size: 0.85rem;
}

.tg-link-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin: 0.5rem 0 1rem;
}

.tg-link-box__label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tg-link-box__code {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  color: var(--text);
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.notif-day {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.35rem 0 0.15rem;
}

.notif-day__badge {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  user-select: none;
}

.notif-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.notif-card--unread {
  border-color: rgba(16, 185, 129, 0.45);
  background: #0d1411;
}

.notif-card__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.35rem;
}

.notif-card__type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.notif-card__title {
  font-size: 1rem;
  font-weight: 600;
}

.notif-card__time {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0.85;
  align-self: flex-start;
  padding-top: 0.15rem;
}

.notif-card__msg {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.notif-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.78rem;
}

.notif-card__domain {
  color: var(--accent);
}

.notif-card__tg { color: var(--muted); }

.mono { font-family: "JetBrains Mono", monospace; }
