:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d9e1ea;
  --line-strong: #b8c7d8;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --success: #15803d;
  --warn: #b45309;
  --danger: #be123c;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --font-display: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-code: "Consolas", "Cascadia Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
}

body::before {
  content: none;
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1680px;
  margin: 0 auto;
  padding: 28px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
}

.hero h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.1;
}

.hero-copy {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-badge {
  min-width: 220px;
  padding: 16px 18px;
  align-self: flex-start;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.hero-badge span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.hero-badge strong {
  font-size: 20px;
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.left-panel,
.right-panel {
  display: grid;
  gap: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px 24px 18px;
}

.panel-head h2,
.source-head h3 {
  margin: 0;
  font-size: 20px;
}

.panel-head p,
.source-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.ghost-button {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  box-shadow: none;
}

.ghost-button {
  color: var(--text);
  background: #ffffff;
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: #a9b8c8;
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.domain-input,
.code-box {
  width: calc(100% - 48px);
  margin: 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  color: var(--text);
  resize: vertical;
  outline: none;
}

.domain-input {
  min-height: 220px;
  padding: 18px 20px;
  font-family: var(--font-code);
  line-height: 1.7;
}

.domain-input:focus,
.code-box:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 24px 0;
}

.stat-card {
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 22px;
}

.message-bar {
  margin: 18px 24px 24px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.7;
}

.message-bar.neutral {
  color: #1e3a5f;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.message-bar.success {
  color: #166534;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.message-bar.warn {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}

.message-bar.danger {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

.task-summary {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-dim);
}

.table-panel {
  min-height: 520px;
}

.table-wrap {
  overflow: auto;
  max-height: 760px;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  table-layout: fixed;
}

.col-domain {
  width: 220px;
}

.col-title {
  width: 220px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px;
  text-align: left;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #4b5563;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

thead th:first-child {
  left: 0;
  z-index: 4;
  box-shadow: 1px 0 0 var(--line);
}

tbody td {
  padding: 16px;
  vertical-align: top;
  border-bottom: 1px solid #edf2f7;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #ffffff;
  box-shadow: 1px 0 0 #edf2f7;
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr[data-row-id] {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:hover td:first-child {
  background: #f8fafc;
}

tbody tr.is-selected {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

tbody tr.is-selected td:first-child {
  background: #eff6ff;
}

.domain-button {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.domain-name {
  font-weight: 700;
  color: #111827;
}

.mini-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}

.mini-status.pending {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.mini-status.loading {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}

.mini-status.success {
  color: #166534;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.mini-status.error {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

.cell-placeholder {
  color: #9ca3af;
}

.cell-error {
  color: #b91c1c;
}

.empty-row td {
  padding: 42px 16px;
  text-align: center;
  color: var(--muted);
}

.source-panel {
  min-height: 1000px;
}

.source-group {
  padding: 0 24px 24px;
}

.source-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 0 0 12px;
}

.code-box {
  min-height: 360px;
  padding: 16px 18px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.65;
}

.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;
}

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

  .source-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .hero,
  .panel-head {
    flex-direction: column;
  }

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

  .domain-input,
  .code-box {
    width: calc(100% - 32px);
    margin: 0 16px;
  }

  .message-bar,
  .source-group,
  .stats-grid {
    padding-left: 16px;
    padding-right: 16px;
  }
}
