:root {
  --background: var(--bg, #f8fafc);
  --surface: var(--surface-strong, #ffffff);
  --surface-soft: var(--card-bg, #f8fafc);
  --text-primary: var(--text, #0f172a);
  --text-secondary: var(--subtext, #475569);
  --border: var(--card-border, #d8dee7);
  --accent: var(--btn-bg, #155eef);
  --dmarc-sidebar: #08223a;
  --dmarc-sidebar-strong: #0d3a74;
  --pass: #16914f;
  --fail: #dc2f2f;
  --warning: #f59e0b;
  --known-bg: #dff8ed;
  --known-text: #087044;
  --ip-bg: #e8f1ff;
  --ip-text: #155eef;
  --muted-bg: #eef2f7;
}

[data-theme="dark"] {
  --background: var(--bg, #08110d);
  --surface: var(--surface-strong, #0e1520);
  --surface-soft: var(--card-bg, #121c2a);
  --text-primary: var(--text, #e6edf3);
  --text-secondary: var(--subtext, #9aa8b7);
  --border: var(--card-border, rgba(148, 163, 184, 0.22));
  --accent: var(--btn-bg, #58a6ff);
  --dmarc-sidebar: #03111f;
  --dmarc-sidebar-strong: #103a66;
  --known-bg: rgba(20, 184, 166, 0.16);
  --known-text: #5eead4;
  --ip-bg: rgba(96, 165, 250, 0.16);
  --ip-text: #93c5fd;
  --muted-bg: rgba(148, 163, 184, 0.12);
}

.dmarc-body {
  background: var(--background);
}

.dmarc-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  color: var(--text-primary);
}

.dmarc-sidebar {
  container-type: inline-size;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.22), transparent 28%),
    linear-gradient(180deg, var(--dmarc-sidebar), #04182b);
  color: #f8fafc;
  padding: 20px 8px 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.sidebar-nav,
.sidebar-bottom {
  display: grid;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 4px;
}

.sidebar-nav {
  min-height: 0;
  overflow: hidden;
}

.sidebar-nav a,
.sidebar-nav button,
.sidebar-bottom a,
.admin-button {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 0.93rem;
  font-weight: 700;
  background: transparent;
  box-shadow: none;
}

.sidebar-nav a,
.sidebar-nav button {
  min-height: 40px;
}

.sidebar-nav a.active {
  min-height: 46px;
}

.sidebar-nav a span,
.sidebar-nav button span,
.sidebar-bottom a span,
.admin-button span {
  width: 20px;
  text-align: center;
  opacity: 0.95;
}

.sidebar-nav .nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
  height: 20px;
}

.sidebar-nav .nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav a.active .nav-icon svg,
.sidebar-nav a:hover .nav-icon svg,
.sidebar-nav button:hover .nav-icon svg {
  stroke-width: 2.05;
}

.sidebar-nav a.active,
.sidebar-nav a:hover,
.sidebar-nav button:hover,
.sidebar-bottom a:hover,
.admin-button:hover {
  background: linear-gradient(135deg, #1f64d6, var(--dmarc-sidebar-strong));
  transform: none;
}

.sidebar-bottom {
  align-self: end;
}

.admin-button {
  border: 0;
  justify-content: flex-start;
  cursor: pointer;
}

.sidebar-nav button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.dmarc-page {
  min-width: 0;
  background: var(--background);
}

.dmarc-topbar {
  height: 70px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  color: var(--text-primary);
  backdrop-filter: blur(14px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 310px;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.portal-back-link {
  display: inline-flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  gap: clamp(4px, 3cqw, 8px);
  min-width: 0;
  padding: 0 clamp(8px, 5cqw, 12px) 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.74);
  font-size: clamp(0.66rem, 6.4cqw, 0.78rem);
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}

.portal-back-link:hover {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
}

.brand-block h1 {
  font-family: "Manrope", sans-serif;
  font-size: 1.18rem;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-copy p {
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.2;
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
}

.top-control {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.top-control select,
.aggregate-control select,
.show-control select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-primary);
  padding: 0 42px 0 14px;
  font: inherit;
}

.domain-top-control select {
  min-width: 236px;
}

.topbar-spacer {
  flex: 1;
}

.date-button,
.refresh-link,
.theme-button,
.export-button,
.pager button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: none;
  padding: 0 14px;
  font-weight: 700;
}

.date-button {
  display: grid;
  grid-template-columns: auto minmax(0, max-content) auto;
  align-items: center;
  column-gap: 14px;
  min-width: 0;
  width: max-content;
  max-width: min(340px, 100%);
  padding: 0 18px;
  text-align: left;
}

.date-button-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 1.8px solid var(--text-secondary);
  border-radius: 4px;
}

.date-button-icon::before {
  content: "";
  position: absolute;
  left: -1.8px;
  right: -1.8px;
  top: 4px;
  border-top: 1.8px solid var(--text-secondary);
}

.date-button-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: -4px;
  height: 5px;
  border-left: 1.8px solid var(--text-secondary);
  border-right: 1.8px solid var(--text-secondary);
}

.date-button-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: translateY(-2px) rotate(45deg);
}

#date-range-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-picker {
  position: relative;
}

.date-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 330px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

[data-theme="dark"] .date-menu {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.date-menu button {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  padding: 0 10px;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.date-menu button:hover {
  background: var(--surface-soft);
}

.calendar-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-head strong {
  text-align: center;
  font-size: 0.9rem;
}

.date-menu .calendar-nav {
  width: 36px;
  min-height: 36px;
  padding: 0;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-grid {
  gap: 3px 0;
}

.date-menu .calendar-day {
  position: relative;
  min-height: 36px;
  border-radius: 0;
  padding: 0;
  text-align: center;
  font-size: 0.82rem;
}

.date-menu .calendar-day:hover {
  background: var(--surface-soft);
}

.calendar-day.muted {
  color: var(--text-secondary);
  opacity: 0.48;
}

.calendar-day.in-range {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--text-primary);
}

.calendar-day.range-start,
.calendar-day.range-end {
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.calendar-selected {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.calendar-selected span {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refresh-link {
  color: var(--accent);
  border-color: transparent;
  background: transparent;
}

.theme-button {
  width: 38px;
  padding: 0;
}

.dmarc-content {
  max-width: none;
  margin: 0;
  padding: 22px 32px 36px;
  display: grid;
  gap: 15px;
  animation: none;
}

.domain-summary {
  display: grid;
  gap: 6px;
}

.domain-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.domain-title-row h2 {
  font-family: "Manrope", sans-serif;
  font-size: 1.45rem;
  line-height: 1.1;
}

.status-badge {
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--known-text);
  background: var(--known-bg);
  font-size: 0.82rem;
  font-weight: 800;
}

.last-report-line {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-strip {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.9rem;
}

.status-strip.info {
  background: var(--status-info-bg);
  color: var(--status-info-text);
}

.status-strip.error {
  background: var(--status-error-bg);
  color: var(--status-error-text);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card,
.dmarc-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .kpi-card,
[data-theme="dark"] .dmarc-panel {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.kpi-card {
  min-height: 112px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
}

.kpi-icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.kpi-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-pass .kpi-icon { color: var(--pass); background: rgba(22, 145, 79, 0.13); }
.kpi-messages .kpi-icon { color: #155eef; background: rgba(21, 94, 239, 0.11); }
.kpi-unknown .kpi-icon { color: #4f46e5; background: rgba(79, 70, 229, 0.12); }
.kpi-policy .kpi-icon { color: var(--warning); background: rgba(245, 158, 11, 0.15); }

.kpi-card span {
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 900;
}

.kpi-card strong {
  display: block;
  margin-top: 4px;
  font-family: "Manrope", sans-serif;
  font-size: 1.72rem;
  line-height: 1;
}

.kpi-pass strong { color: var(--pass); }
.kpi-messages strong { color: #155eef; }
.kpi-unknown strong { color: #4f46e5; }
.kpi-policy strong { color: var(--warning); text-transform: lowercase; }

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 14px;
}

.main-column,
.side-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.dmarc-panel {
  padding: 14px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title-row h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Manrope", sans-serif;
  font-size: 0.98rem;
  font-weight: 900;
}

.panel-heading-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  flex: 0 0 22px;
}

.panel-heading-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.alerts-heading-icon {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.14);
}

.panel-title-row a,
.record-link,
.manage-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
}

.info-dot {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid #94a3b8;
  color: #64748b;
  font-size: 0.62rem;
  font-family: sans-serif;
  cursor: help;
  outline: none;
}

.info-tooltip {
  position: fixed;
  z-index: 120;
  width: min(260px, 70vw);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-primary);
  padding: 9px 10px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.35;
  pointer-events: none;
  text-align: left;
  white-space: normal;
}

[data-theme="dark"] .info-tooltip {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
}

.aggregate-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 10px;
}

.chart-legend i {
  display: inline-block;
  width: 26px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
}

.chart-legend i::after {
  content: "";
  position: absolute;
  left: 10px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.legend-pass { color: var(--pass); background: var(--pass); }
.legend-fail { color: var(--fail); background: var(--fail); }
.legend-volume { color: #9ca3af; border-top: 2px dashed #9ca3af; background: transparent; }

.trend-chart {
  min-height: 296px;
  overflow: hidden;
  position: relative;
}

.trend-chart svg {
  width: 100%;
  height: 296px;
  display: block;
}

.grid-line {
  stroke: color-mix(in srgb, var(--border) 72%, transparent);
  stroke-width: 1;
}

.axis-label,
.axis-tick,
.x-labels text {
  fill: var(--text-secondary);
  font-size: 12px;
}

.axis-tick {
  dominant-baseline: middle;
}

.axis-tick-left {
  text-anchor: end;
}

.axis-tick-right {
  text-anchor: start;
}

.pass-line,
.pass-carried-line,
.fail-line,
.volume-line {
  fill: none;
  stroke-width: 2;
}

.pass-line { stroke: var(--pass); }
.pass-carried-line {
  stroke: var(--pass);
  stroke-dasharray: 5 5;
  opacity: 0.48;
}
.fail-line { stroke: var(--fail); }
.volume-line { stroke: #a8adb7; stroke-dasharray: 5 4; }
.pass-dot { fill: var(--pass); }
.carried-dot {
  opacity: 0.58;
}
.fail-dot { fill: var(--fail); }
.volume-dot { fill: #a8adb7; }
.trend-dot {
  cursor: crosshair;
  outline: none;
}

.trend-dot:hover,
.trend-dot:focus {
  r: 7px;
  stroke: var(--surface);
  stroke-width: 2;
}

.trend-tooltip {
  position: fixed;
  z-index: 90;
  width: 206px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-primary);
  padding: 10px 12px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  pointer-events: none;
}

[data-theme="dark"] .trend-tooltip {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
}

.trend-tooltip strong,
.trend-tooltip span {
  display: block;
  font-size: 0.78rem;
  line-height: 1.45;
}

.trend-tooltip strong {
  margin-bottom: 4px;
  font-weight: 900;
}

.trend-tooltip span {
  color: var(--text-secondary);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 930px;
}

th,
td {
  text-align: left;
  padding: 12px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  vertical-align: middle;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  background: color-mix(in srgb, var(--surface-soft) 75%, var(--surface));
  color: var(--text-primary);
  font-size: 0.73rem;
  font-weight: 900;
}

.source-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.source-logo {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  line-height: 1;
}

.ms-icon {
  background:
    linear-gradient(#f25022 0 0) 0 0 / 8px 8px no-repeat,
    linear-gradient(#7fba00 0 0) 10px 0 / 8px 8px no-repeat,
    linear-gradient(#00a4ef 0 0) 0 10px / 8px 8px no-repeat,
    linear-gradient(#ffb900 0 0) 10px 10px / 8px 8px no-repeat;
}

.google-icon {
  border-radius: 999px;
  background: #fff;
  color: #4285f4;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
  font-size: 0.78rem;
  font-weight: 900;
}

.aws-icon {
  width: 28px;
  color: #ff9900;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.vendor-icon {
  border-radius: 5px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 4px 10px rgba(2, 6, 23, 0.16);
}

.hubspot-icon {
  background: linear-gradient(135deg, #ff7a59, #ff5c35);
}

.sendgrid-icon {
  background: linear-gradient(135deg, #1a82e2, #00b3e6);
}

.mailchimp-icon {
  background: linear-gradient(135deg, #ffe01b, #f7b801);
  color: #1f2933;
}

.type-badge,
.result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.type-badge.known { background: var(--known-bg); color: var(--known-text); }
.type-badge.ip { background: var(--ip-bg); color: var(--ip-text); }
.result-badge.pass { background: rgba(22, 145, 79, 0.12); color: var(--pass); }
.result-badge.fail { background: rgba(220, 47, 47, 0.12); color: var(--fail); }
.result-badge.neutral { background: var(--muted-bg); color: var(--text-secondary); }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 16px 2px 0;
}

.show-control,
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
}

.show-control select {
  min-width: 62px;
  padding: 0 24px 0 10px;
}

.pager button {
  width: 34px;
  padding: 0;
}

.pager button.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.alerts-panel,
.record-panel {
  padding: 16px;
}

.alerts-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.alert-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.alert-card:last-child {
  border-bottom: 0;
}

.alert-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.alert-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.alert-card.success .alert-icon {
  color: var(--pass);
  background: rgba(22, 145, 79, 0.13);
}

.alert-card.info .alert-icon,
.alert-card.warning .alert-icon {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.14);
}

.alert-detail-card.success .alert-icon {
  color: var(--pass);
  background: rgba(22, 145, 79, 0.13);
}

.alert-detail-card.info .alert-icon,
.alert-detail-card.warning .alert-icon {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.14);
}

.alert-card h4 {
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.alert-card p {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.alert-card time {
  display: block;
  color: var(--text-secondary);
  margin-top: 10px;
  font-size: 0.78rem;
}

.manage-link {
  display: block;
  text-align: right;
  margin-top: 10px;
}

.record-table {
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.record-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  min-height: 31px;
  border-bottom: 1px solid var(--border);
}

.record-row:last-child {
  border-bottom: 0;
}

.record-row span,
.record-row strong {
  padding: 8px 12px;
  font-size: 0.78rem;
  min-width: 0;
}

.record-row span {
  border-right: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 900;
}

.record-row strong {
  color: var(--text-secondary);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.record-link {
  display: inline-block;
  margin-top: 10px;
}

.panel-link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.audit-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.audit-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.audit-event:last-child {
  border-bottom: 0;
}

.audit-event h4 {
  margin-bottom: 5px;
  font-size: 0.88rem;
  font-weight: 900;
}

.audit-event p,
.audit-event small,
.audit-event time {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.45;
}

.audit-event small {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.audit-event time {
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.62);
}

.record-modal {
  width: min(680px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.alerts-modal {
  width: min(820px, 100%);
}

.settings-modal {
  width: min(520px, 100%);
}

.record-modal-header,
.record-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.record-modal-footer {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.record-modal-header h2 {
  font-family: "Manrope", sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
}

.record-modal-header p,
.record-modal-footer span {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.record-full-text-wrap {
  margin: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.record-full-text {
  display: block;
  padding: 14px;
  color: var(--text-primary);
  font-size: 0.86rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.alerts-modal-list {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
}

.alerts-modal-footer {
  padding: 0 20px 18px;
}

.settings-body {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
}

.settings-field {
  display: grid;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 900;
}

.settings-field select {
  width: 100%;
}

.settings-preview {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.alert-detail-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.alert-detail-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-detail-head h3 {
  margin-bottom: 4px;
  font-size: 0.94rem;
  font-weight: 900;
}

.alert-detail-head time,
.alert-detail-card p,
.alert-reason span,
.alert-report-grid dd {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.45;
}

.alert-detail-card p {
  margin-top: 10px;
}

.alert-reason {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  border-left: 3px solid var(--warning);
  padding-left: 10px;
}

.alert-reason strong,
.alert-report-grid dt {
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.alert-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 14px;
}

.alert-report-grid div {
  min-width: 0;
}

.alert-report-grid .wide {
  grid-column: 1 / -1;
}

.alert-report-grid dd {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.record-modal-fields {
  display: grid;
  margin: 0 20px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.record-modal-field {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  border-bottom: 1px solid var(--border);
}

.record-modal-field:last-child {
  border-bottom: 0;
}

.record-modal-field span,
.record-modal-field strong {
  padding: 10px 12px;
  font-size: 0.82rem;
}

.record-modal-field span {
  border-right: 1px solid var(--border);
  font-weight: 900;
}

.record-modal-field strong {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.empty-state,
.empty-table {
  color: var(--text-secondary);
  padding: 16px;
}

@media (max-width: 1180px) {
  .dmarc-shell {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .portal-back-link {
    display: none;
  }

  .sidebar-nav a,
  .sidebar-nav button,
  .sidebar-bottom a,
  .admin-button {
    justify-content: center;
    padding: 0;
  }

  .sidebar-nav a:not(.active),
  .sidebar-nav button,
  .sidebar-bottom a,
  .admin-button {
    font-size: 0;
  }

  .dashboard-layout,
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .side-column {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .dmarc-shell,
  .dashboard-layout,
  .kpi-grid,
  .side-column {
    grid-template-columns: 1fr;
  }

  .dmarc-sidebar {
    display: none;
  }

  .dmarc-topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 14px;
  }

  .brand-block {
    min-width: 100%;
  }

  .dmarc-content {
    padding: 16px;
  }
}
