* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --green: #3fb950;
  --blue: #58a6ff;
  --orange: #d29922;
  --red: #f85149;
  --gray: #484f58;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

h1 {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

#refresh-btn {
  background: var(--border);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

#refresh-btn:hover { background: var(--gray); }
#refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auto-toggle {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.auto-toggle input { accent-color: var(--blue); }

/* Summary bar */
.summary {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

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

.progress-bar {
  flex: 1;
  min-width: 120px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Main content */
main { padding: 20px; }

section { margin-bottom: 28px; }

h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

td {
  padding: 10px 14px;
  white-space: nowrap;
}

td.domain { font-weight: 500; }
td.ip { font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace; font-size: 12px; }
td.expected { color: var(--text-dim); font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace; font-size: 12px; }
td.ttl { color: var(--text-dim); font-size: 12px; }

/* Domain links */
.domain-link {
  color: inherit;
  text-decoration: none;
}

.domain-link:hover {
  color: var(--blue);
}

.domain-link:hover .domain-root {
  color: var(--blue);
  opacity: 0.6;
}

/* Subdomain hierarchy */
.domain-prefix {
  font-weight: 500;
}

.domain-root {
  color: var(--text-dim);
  font-weight: 400;
}

tr.subdomain td.domain {
  padding-left: 34px;
  position: relative;
}

tr.subdomain td.domain::before {
  content: '\2514';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 12px;
  line-height: 1;
}

/* Group separators */
tr.group-start td {
  border-top: 2px solid var(--gray);
}

/* Expected column note */
.note {
  font-size: 11px;
  font-style: italic;
  font-family: inherit;
  color: var(--text-dim);
  opacity: 0.7;
}

/* Status */
.status-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green { background: var(--green); box-shadow: 0 0 6px rgba(63,185,80,0.4); }
.status-dot.blue { background: var(--blue); box-shadow: 0 0 6px rgba(88,166,255,0.4); }
.status-dot.orange { background: var(--orange); box-shadow: 0 0 6px rgba(210,153,34,0.4); }
.status-dot.red { background: var(--red); box-shadow: 0 0 6px rgba(248,81,73,0.4); }
.status-dot.gray { background: var(--gray); }

.status-label { font-size: 12px; }

/* Loading shimmer */
.loading td {
  color: var(--text-dim);
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.loading .status-dot {
  background: var(--gray);
  animation: pulse 1.2s ease-in-out infinite;
}

/* Footer */
footer {
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

.shortcut-hint {
  opacity: 0.5;
}

kbd {
  background: var(--border);
  border: 1px solid var(--gray);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 11px;
}

/* Responsive */
@media (max-width: 600px) {
  header { padding: 12px 14px; }
  main { padding: 14px; }
  h1 { font-size: 16px; }
  table { font-size: 12px; }
  td, thead th { padding: 8px 10px; }
  tr.subdomain td.domain { padding-left: 28px; }
  tr.subdomain td.domain::before { left: 12px; }
  .summary { gap: 10px; }
  .shortcut-hint { display: none; }
}
