:root {
  --font: Inter, "Segoe UI", Arial, sans-serif;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f9fbfd;
  --line: #dfe6ef;
  --text: #172033;
  --muted: #667085;
  --soft: #eef3f8;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #ca8a04;
  --radius: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.sidebar-shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  background: #e7ebf0;
  border-right: 1px solid #cfd6df;
  min-height: 100vh;
  padding: 22px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 42px; margin-bottom: 24px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  border: 1px solid #cfd6df;
  font-size: 11px;
  font-weight: 800;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-mark.has-logo {
  background: transparent;
  border-color: transparent;
}
.brand strong { display: block; font-size: 15px; }
.brand span { display: block; color: #5f6b7d; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 4px; }
.nav a {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 6px;
  color: #344055;
  font-weight: 650;
}
.nav a.active, .nav a:hover { color: #fff; background: #111827; }
.content { min-width: 0; padding: 24px 28px 36px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.topbar h1 { margin: 0; font-size: 24px; line-height: 1.2; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.actions { display: flex; gap: 10px; align-items: center; }
.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: #26364f;
  font-weight: 750;
  cursor: pointer;
}
.btn.primary { color: #fff; background: #111827; border-color: #111827; }
.btn.danger { color: #991b1b; border-color: #fecaca; background: #fff5f5; }
.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}
.grid { display: grid; gap: 16px; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 26px rgba(25, 38, 64, .05);
}
.metric span { color: var(--muted); font-weight: 700; font-size: 12px; }
.metric strong { display: block; font-size: 26px; margin-top: 10px; }
.metric strong span { color: inherit; font-size: inherit; font-weight: inherit; }
.metric small { display: block; color: var(--green); margin-top: 7px; font-weight: 700; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(25, 38, 64, .05);
  min-width: 0;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-header h2 { margin: 0; font-size: 16px; }
.panel-header span { color: var(--muted); font-size: 12px; font-weight: 700; }
.panel-body { padding: 18px; }
.two-columns { grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); }
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th { color: var(--muted); font-size: 12px; font-weight: 800; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.id-cell { color: #475569; font-weight: 800; font-variant-numeric: tabular-nums; }
.login-cell { color: #0f172a; font-weight: 750; }
.clients-table {
  min-width: 1120px;
  table-layout: fixed;
}
.clients-table th:nth-child(1),
.clients-table td:nth-child(1) { width: 74px; }
.clients-table th:nth-child(2),
.clients-table td:nth-child(2) { width: 92px; }
.clients-table th:nth-child(3),
.clients-table td:nth-child(3) { width: 150px; }
.clients-table th:nth-child(4),
.clients-table td:nth-child(4) { width: 190px; }
.clients-table th:nth-child(5),
.clients-table td:nth-child(5) { width: 150px; }
.clients-table th:nth-child(6),
.clients-table td:nth-child(6) { width: 210px; }
.clients-table th:nth-child(7),
.clients-table td:nth-child(7) { width: 118px; }
.clients-table th:nth-child(8),
.clients-table td:nth-child(8) { width: 94px; }
.clients-table th:nth-child(9),
.clients-table td:nth-child(9) { width: 92px; }
.text-clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.text-wrap {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.list-toolbar,
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.list-toolbar {
  flex-wrap: wrap;
}
.pagination-bar { border-top: 1px solid var(--line); border-bottom: 0; }
.list-toolbar span,
.pagination-bar span {
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}
.inline-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}
.inline-form .select { min-width: 98px; }
.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(120px, .45fr);
  gap: 12px;
  align-items: end;
}
.form-grid label,
.form-stack label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.form-grid .full-span { grid-column: 1 / -1; }
.compact-form {
  grid-template-columns: minmax(180px, .9fr) minmax(260px, 1.6fr) minmax(110px, .4fr) auto;
  align-items: center;
}
.compact-form textarea {
  min-height: 72px;
  resize: vertical;
}
.compact-input { max-width: 160px; }
.usage-filter-panel { margin-bottom: 16px; }
.usage-filter-panel .select { min-width: 230px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.client-filter-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.client-filter-form label {
  min-width: 150px;
}
.client-filter-form label:nth-child(1),
.client-filter-form label:nth-child(2) {
  min-width: 240px;
}
.client-filter-form .select {
  width: 100%;
  max-width: 280px;
}
.btn.disabled,
.btn:disabled {
  pointer-events: none;
  opacity: .45;
}
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.status.ok { color: #166534; background: #dcfce7; }
.status.warn { color: #854d0e; background: #fef3c7; }
.status.info { color: #075985; background: #e0f2fe; }
.status.error { color: #991b1b; background: #fee2e2; }
.chart-bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 180px) 1fr 64px; align-items: center; gap: 12px; }
.bar-track { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: #111827; }
.bar-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-grid { margin-top: 16px; }
.report-bar-row { grid-template-columns: minmax(132px, 190px) 1fr minmax(72px, auto); }
.report-bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-main-grid { grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); }
.audience-origin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.origin-chip {
  display: grid;
  gap: 5px;
  min-height: 68px;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}
.origin-chip span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.origin-chip strong {
  font-size: 20px;
}
.live-channels-table {
  min-width: 520px;
  table-layout: fixed;
}
.live-channels-wrap {
  max-height: 540px;
  overflow: auto;
}
.live-channels-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.live-channels-table th:nth-child(1),
.live-channels-table td:nth-child(1) { width: 280px; }
.live-channels-table th:nth-child(2),
.live-channels-table td:nth-child(2) { width: 100px; }
.live-channels-table th:nth-child(3),
.live-channels-table td:nth-child(3) { width: 140px; }
.audience-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.audience-kpis div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}
.audience-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.audience-kpis strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}
.audience-bars {
  display: grid;
  gap: 12px;
}
.audience-bar-row {
  display: grid;
  grid-template-columns: minmax(112px, 160px) 1fr 58px 48px;
  align-items: center;
  gap: 10px;
}
.audience-bar-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audience-programmer-button {
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audience-programmer-button:hover { text-decoration: underline; }
.audience-bar-row strong,
.audience-bar-row small {
  color: #475569;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.audience-status-panel { margin-top: 16px; }
.audience-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px 18px;
}
.audience-status-card {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 6px;
  background: var(--surface-2);
}
.audience-status-card.status-ok { border-left-color: #16a34a; }
.audience-status-card.status-warn { border-left-color: #f59e0b; }
.audience-status-card span,
.audience-status-card small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audience-status-card strong {
  display: block;
  overflow: hidden;
  margin: 7px 0 4px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audience-channel-table {
  table-layout: fixed;
  min-width: 620px;
}
.audience-channel-table th:nth-child(1),
.audience-channel-table td:nth-child(1) { width: 260px; }
.audience-channel-table th:nth-child(2),
.audience-channel-table td:nth-child(2) { width: 170px; }
.audience-channel-table th:nth-child(3),
.audience-channel-table td:nth-child(3) { width: 120px; }
.audience-channel-table th:nth-child(4),
.audience-channel-table td:nth-child(4) { width: 70px; }
.audience-channel-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audience-detail-modal {
  display: flex;
  flex-direction: column;
  max-width: 760px;
  max-height: calc(100vh - 104px);
}
.audience-detail-modal .table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.audience-detail-modal thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.mw-delivery-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.mw-channel-row {
  grid-template-columns: minmax(142px, 210px) 1fr 58px 48px;
}
.mw-table-wrap {
  max-height: 560px;
  overflow: auto;
}
.mw-table-wrap thead th,
.mw-storage-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.mw-problem-table {
  min-width: 760px;
  table-layout: fixed;
}
.mw-problem-table th:nth-child(1),
.mw-problem-table td:nth-child(1) { width: 280px; }
.mw-problem-table th:nth-child(2),
.mw-problem-table td:nth-child(2) { width: 130px; }
.mw-problem-table th:nth-child(3),
.mw-problem-table td:nth-child(3) { width: 80px; }
.mw-problem-table th:nth-child(4),
.mw-problem-table td:nth-child(4) { width: 80px; }
.mw-problem-table th:nth-child(5),
.mw-problem-table td:nth-child(5) { width: 190px; }
.mw-problem-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.mw-edge-grid,
.mw-state-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mw-edge-grid .origin-chip strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mw-storage-table {
  min-width: 520px;
  table-layout: fixed;
}
.mw-storage-table th:nth-child(1),
.mw-storage-table td:nth-child(1) { width: 240px; }
.mw-storage-table th:nth-child(2),
.mw-storage-table td:nth-child(2) { width: 180px; }
.mw-storage-table th:nth-child(3),
.mw-storage-table td:nth-child(3) { width: 100px; }
.mw-notes {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.green-fill { background: #16a34a; }
.report-table { table-layout: fixed; }
.reseller-report-table { min-width: 780px; }
.reseller-report-table th:nth-child(1),
.reseller-report-table td:nth-child(1) { width: 230px; }
.reseller-report-table th:nth-child(2),
.reseller-report-table td:nth-child(2) { width: 140px; }
.reseller-report-table th:nth-child(3),
.reseller-report-table td:nth-child(3) { width: 120px; }
.reseller-report-table th:nth-child(4),
.reseller-report-table td:nth-child(4) { width: 90px; }
.reseller-report-table th:nth-child(5),
.reseller-report-table td:nth-child(5) { width: 130px; }
.reseller-report-table th:nth-child(6),
.reseller-report-table td:nth-child(6) { width: 70px; }
.package-report-table { min-width: 520px; }
.package-report-table th:nth-child(1),
.package-report-table td:nth-child(1) { width: 230px; }
.package-report-table th:nth-child(2),
.package-report-table td:nth-child(2) { width: 82px; }
.package-report-table th:nth-child(3),
.package-report-table td:nth-child(3) { width: 62px; }
.package-report-table th:nth-child(4),
.package-report-table td:nth-child(4) { width: 62px; }
.package-report-table th:nth-child(5),
.package-report-table td:nth-child(5) { width: 104px; }
.compact-snapshot-panel { margin-top: 16px; }
.snapshot-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(280px, 1.4fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
}
.snapshot-title {
  display: grid;
  gap: 3px;
}
.snapshot-title strong { font-size: 14px; }
.snapshot-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.snapshot-select-form {
  justify-content: flex-start;
}
.snapshot-select-form .select {
  min-width: 270px;
  width: 100%;
}
.snapshot-create-form {
  flex-wrap: nowrap;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 52px 24px;
  background: rgba(15, 23, 42, .42);
}
.modal-backdrop[hidden] { display: none; }
.modal-panel {
  width: min(1120px, 100%);
  max-height: calc(100vh - 104px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}
.modal-body {
  max-height: calc(100vh - 184px);
  overflow: auto;
  padding: 16px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 {
  margin: 0;
  font-size: 16px;
}
.modal-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.snapshot-modal .table-wrap {
  max-height: calc(100vh - 184px);
  overflow: auto;
}
.flat-panel {
  box-shadow: none;
}
.alert {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.alert strong {
  font-size: 14px;
}
.alert span {
  color: var(--muted);
  font-weight: 700;
}
.alert code {
  white-space: normal;
  overflow-wrap: anywhere;
  color: #111827;
  font-size: 12px;
}
.alert.warn {
  border-color: #fde68a;
  background: #fffbeb;
}
.alert.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.alert.success strong {
  color: #166534;
}
.alert.error {
  border-color: #fecaca;
  background: #fef2f2;
}
.alert.error strong {
  color: #991b1b;
}
.audience-config-modal {
  width: min(1180px, 100%);
}
.audience-config-table {
  min-width: 980px;
}
.channel-search-box {
  display: grid;
  gap: 10px;
}
.channel-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  align-items: center;
}
.channel-suggestions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #111827;
  cursor: pointer;
  font-weight: 800;
}
.suggestion-chip:hover {
  border-color: #111827;
}
.suggestion-chip small {
  color: var(--muted);
  font-weight: 800;
}
.snapshot-detail-table {
  min-width: 940px;
}
.snapshot-detail-table th:nth-child(1),
.snapshot-detail-table td:nth-child(1) { width: 220px; }
.snapshot-detail-table th:nth-child(2),
.snapshot-detail-table td:nth-child(2) { width: 94px; }
.snapshot-detail-table th:nth-child(3),
.snapshot-detail-table td:nth-child(3) { width: 128px; }
.snapshot-detail-table th:nth-child(4),
.snapshot-detail-table td:nth-child(4) { width: 132px; }
.snapshot-detail-table th:nth-child(5),
.snapshot-detail-table td:nth-child(5) { width: 72px; }
.snapshot-detail-table th:nth-child(6),
.snapshot-detail-table td:nth-child(6) { width: 72px; }
.snapshot-detail-table th:nth-child(7),
.snapshot-detail-table td:nth-child(7) { width: 112px; }
.snapshot-detail-table th:nth-child(8),
.snapshot-detail-table td:nth-child(8) { width: 70px; }
.logs-table {
  min-width: 1060px;
  table-layout: fixed;
}
.logs-table th:nth-child(1),
.logs-table td:nth-child(1) { width: 136px; }
.logs-table th:nth-child(2),
.logs-table td:nth-child(2) { width: 170px; }
.logs-table th:nth-child(3),
.logs-table td:nth-child(3) { width: 110px; }
.logs-table th:nth-child(4),
.logs-table td:nth-child(4) { width: 140px; }
.logs-table th:nth-child(6),
.logs-table td:nth-child(6) { width: 120px; }
.vouchers-table {
  min-width: 1040px;
  table-layout: fixed;
}
.vouchers-table th:nth-child(1),
.vouchers-table td:nth-child(1) { width: 44px; }
.vouchers-table th:nth-child(2),
.vouchers-table td:nth-child(2) { width: 72px; }
.vouchers-table th:nth-child(3),
.vouchers-table td:nth-child(3) { width: 170px; }
.vouchers-table th:nth-child(4),
.vouchers-table td:nth-child(4) { width: 110px; }
.vouchers-table th:nth-child(6),
.vouchers-table td:nth-child(6) { width: 142px; }
.vouchers-table th:nth-child(5),
.vouchers-table td:nth-child(5) { width: 150px; }
.vouchers-table th:nth-child(8),
.vouchers-table td:nth-child(8) { width: 112px; }
.vouchers-table th:nth-child(9),
.vouchers-table td:nth-child(9) { width: 92px; }
.dns-cdn-panel,
.dns-cdn-main-grid {
  margin-top: 16px;
}
.dns-cdn-main-grid {
  align-items: start;
}
.dns-cdn-main-grid > .panel {
  min-width: 0;
}
.dns-cdn-table,
.dns-domain-table,
.dns-rules-table {
  table-layout: fixed;
  width: 100%;
}
.dns-cdn-table {
  min-width: 820px;
}
.dns-domain-table {
  min-width: 0;
}
.dns-rules-table {
  min-width: 940px;
}
.dns-cdn-table th:nth-child(1),
.dns-cdn-table td:nth-child(1) { width: 180px; }
.dns-cdn-table th:nth-child(2),
.dns-cdn-table td:nth-child(2) { width: 220px; }
.dns-cdn-table th:nth-child(3),
.dns-cdn-table td:nth-child(3) { width: 220px; }
.dns-cdn-table th:nth-child(4),
.dns-cdn-table td:nth-child(4) { width: 110px; }
.dns-cdn-table th:nth-child(5),
.dns-cdn-table td:nth-child(5) { width: 80px; }
.dns-rules-table th:nth-child(1),
.dns-rules-table td:nth-child(1) { width: 220px; }
.dns-rules-table th:nth-child(2),
.dns-rules-table td:nth-child(2) { width: 160px; }
.dns-rules-table th:nth-child(4),
.dns-rules-table td:nth-child(4) { width: 160px; }
.dns-rules-table th:nth-child(8),
.dns-rules-table td:nth-child(8) { width: 94px; }
.dns-domain-table th:nth-child(1),
.dns-domain-table td:nth-child(1) { width: 42%; }
.dns-domain-table th:nth-child(2),
.dns-domain-table td:nth-child(2) { width: 30%; }
.dns-domain-table th:nth-child(3),
.dns-domain-table td:nth-child(3) { width: 72px; }
.dns-domain-table th:nth-child(4),
.dns-domain-table td:nth-child(4) { width: 92px; }
.dns-cdn-table td,
.dns-domain-table td,
.dns-rules-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.dns-cdn-table small,
.dns-domain-table small,
.dns-rules-table small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dns-edit-row td {
  background: var(--surface-2);
}
.dns-inline-grid,
.dns-domain-grid,
.dns-rule-grid {
  display: grid;
  gap: 8px;
  align-items: center;
}
.dns-inline-grid {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}
.dns-domain-grid {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}
.dns-rule-grid {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}
.dns-inline-grid .input,
.dns-inline-grid .select,
.dns-domain-grid .input,
.dns-domain-grid .select,
.dns-rule-grid .input,
.dns-rule-grid .select {
  min-width: 0;
  width: 100%;
}
.dns-simulator-form {
  justify-content: flex-start;
}
.dns-simulator-form label {
  min-width: 190px;
}
.dns-config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.dns-config-preview {
  max-height: 520px;
}
.dns-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.dns-comparison-grid {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.dns-comparison-note {
  padding-top: 0;
}
.dns-comparison-note code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.dns-comparison-result small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}
.dns-status-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.dns-status-card span,
.dns-status-card small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dns-status-card strong {
  display: block;
  overflow: hidden;
  margin: 6px 0;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dns-status-table {
  table-layout: fixed;
  width: 100%;
  min-width: 720px;
}
.dns-status-table th:nth-child(1),
.dns-status-table td:nth-child(1) { width: 230px; }
.dns-status-table th:nth-child(2),
.dns-status-table td:nth-child(2) { width: 120px; }
.dns-status-table th:nth-child(4),
.dns-status-table td:nth-child(4),
.dns-status-table th:nth-child(5),
.dns-status-table td:nth-child(5) { width: 110px; }
.dns-status-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.dns-status-table small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dns-event-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto auto;
  gap: 8px;
  align-items: center;
}
.dns-events-table {
  table-layout: fixed;
  width: 100%;
  min-width: 940px;
}
.dns-events-table th:nth-child(1),
.dns-events-table td:nth-child(1) { width: 160px; }
.dns-events-table th:nth-child(2),
.dns-events-table td:nth-child(2) { width: 140px; }
.dns-events-table th:nth-child(3),
.dns-events-table td:nth-child(3) { width: 170px; }
.dns-events-table th:nth-child(5),
.dns-events-table td:nth-child(5) { width: 180px; }
.dns-events-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.dns-events-table small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dns-event-details summary {
  cursor: pointer;
  color: #111827;
  font-weight: 900;
}
.dns-event-details pre {
  max-height: 220px;
  margin: 8px 0 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 11px;
  white-space: pre-wrap;
}
.dns-month-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.dns-month-form .input {
  width: 160px;
}
.dns-report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.dns-month-table {
  table-layout: fixed;
  width: 100%;
  min-width: 760px;
}
.dns-month-table th:nth-child(1),
.dns-month-table td:nth-child(1) { width: 230px; }
.dns-month-table th:nth-child(2),
.dns-month-table td:nth-child(2) { width: 120px; }
.dns-month-table th:nth-child(3),
.dns-month-table td:nth-child(3),
.dns-month-table th:nth-child(4),
.dns-month-table td:nth-child(4),
.dns-month-table th:nth-child(5),
.dns-month-table td:nth-child(5),
.dns-month-table th:nth-child(6),
.dns-month-table td:nth-child(6) { width: 110px; }
.dns-month-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.dns-month-table small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-state {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary-line:last-child { border-bottom: 0; }
.summary-line span { color: var(--muted); }
.security-panel { margin-top: 16px; }
.security-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.security-card {
  display: grid;
  gap: 8px;
  min-height: 122px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}
.security-card span,
.security-checklist h3,
.security-command-grid h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.security-card strong {
  font-size: 20px;
}
.security-card small {
  color: var(--muted);
  line-height: 1.4;
}
.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.security-checklist {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}
.security-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #344055;
  line-height: 1.4;
  font-weight: 700;
}
.security-check input { margin-top: 3px; }
.security-command-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.security-command-grid > div {
  min-width: 0;
}
.command-box {
  overflow-x: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111827;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.6;
}
.form-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-stack label { display: grid; gap: 6px; color: var(--muted); font-weight: 800; font-size: 12px; }
.form-stack button { justify-self: start; }
.form-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.lookup-row { display: flex; gap: 8px; align-items: center; }
.lookup-row .input { flex: 1; min-width: 0; }
.form-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}
.form-hint[data-type="ok"] { color: #166534; }
.form-hint[data-type="warn"] { color: #854d0e; }
.form-hint[data-type="info"] { color: #075985; }
.input, .select {
  height: 38px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 11px;
}
.alert { padding: 12px; border-radius: 6px; color: #991b1b; background: #fee2e2; margin: 14px 0; }
.alert.success { color: #166534; background: #dcfce7; }
.import-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.import-card {
  display: grid;
  align-content: space-between;
  gap: 18px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 16px;
}
.import-card h3 { margin: 10px 0 8px; font-size: 16px; }
.import-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.import-card small { display: block; margin-top: 12px; color: #475569; font-weight: 800; word-break: break-word; }
.import-card form { display: grid; gap: 12px; }
.step-badge {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  font-weight: 900;
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}
.check-row input { margin-top: 2px; }
.import-progress-panel { margin-top: 16px; }
.import-result-panel { margin-top: 16px; }
.result-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.result-pill {
  display: grid;
  gap: 8px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}
.result-pill:hover {
  border-color: #111827;
  background: #fff;
}
.result-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.result-pill strong {
  color: var(--text);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.result-pill.warn strong { color: #854d0e; }
.progress-line {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 14px;
}
.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #111827;
  transition: width .2s ease;
}
.progress-line strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.progress-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.progress-stats span {
  display: inline-flex;
  gap: 5px;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.progress-stats strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.login-body { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 24px; box-shadow: 0 16px 40px rgba(25,38,64,.08); }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card p { color: var(--muted); line-height: 1.5; }
.login-brand { margin-bottom: 18px; }

@media (max-width: 980px) {
  .sidebar-shell, .two-columns { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-direction: column; align-items: stretch; }
  .form-stack { grid-template-columns: 1fr; }
  .lookup-row { align-items: stretch; flex-direction: column; }
  .import-grid { grid-template-columns: 1fr; }
  .result-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .security-summary,
  .security-grid,
  .security-command-grid,
  .snapshot-toolbar,
  .dns-inline-grid,
  .dns-domain-grid,
  .dns-rule-grid,
  .dns-status-grid,
  .dns-comparison-grid,
  .dns-event-filters,
  .dns-report-grid,
  .dashboard-main-grid { grid-template-columns: 1fr; }
  .audience-origin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .snapshot-select-form,
  .snapshot-create-form { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .content { padding: 18px; }
  .metrics { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
  .result-actions { grid-template-columns: 1fr; }
  .audience-origin-grid,
  .audience-kpis { grid-template-columns: 1fr; }
  .audience-bar-row { grid-template-columns: minmax(90px, 120px) 1fr 48px; }
  .audience-bar-row small { display: none; }
}
