* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-border: #e6e8ee;
  --text: #101418;
  --muted: #667085;
  --line: #e8ebf0;
  --stroke: #111111;
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.04);
}

body {
  margin: 0;
  background: url("/static/bg.jpg") center / cover no-repeat fixed;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page {
  width: min(1600px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 0 24px;
}

.topbar,
.section-head,
.action-row {
  display: grid;
  gap: 16px;
}

.topbar,
.section-head {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.topbar {
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.topbar-actions .button {
  font-size: 13px;
}

.topbar-actions input {
  font-size: 13px;
}

.brand-logo {
  width: 224px;
  max-width: 100%;
  display: block;
}

.panel,
.flash {
  background: var(--panel);
  border: 1.5px solid var(--stroke);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.panel,
.flash {
  padding: 12px;
}

.compact-panel {
  padding: 10px 12px;
}

.flash {
  margin-bottom: 16px;
  font-size: 14px;
}

.flash-success {
  border-color: #d5eadf;
}

.flash-error {
  border-color: #f0c9c9;
}

.section-kicker,
.eyebrow,
th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard,
.preview-shell,
.stack,
.stack-tight {
  display: grid;
  gap: 10px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}

.dashboard-sidebar {
  position: sticky;
  top: 16px;
}

.dashboard-main {
  display: grid;
  gap: 10px;
}

.stack-tight {
  gap: 6px;
}

.field {
  display: grid;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--stroke);
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #8a93a3;
  font-size: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #111111;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1.5px solid #111111;
  border-radius: 8px;
  padding: 0 12px;
  background: #111111;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.92);
  color: #111111;
  border-color: var(--stroke);
}

.button.danger {
  background: #111111;
  border-color: #111111;
}

.button.tiny {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

h1,
h2 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--text);
}

h2 {
  font-size: 20px;
}

.muted,
.fine-print,
.batch-meta,
.summary-meta,
.summary-side {
  color: var(--muted);
}

.fine-print,
.batch-meta,
.summary-meta,
.summary-side {
  font-size: 12px;
  line-height: 1.5;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.summary-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.tab-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 10px;
  padding: 0 2px;
}

.tab-link {
  color: #7a828e;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.tab-link.active {
  color: #111111;
}

.tab-divider {
  color: #c4cad3;
  font-size: 21px;
  line-height: 1;
}

.batch-title,
.cell-title {
  font-weight: 700;
}

.search-form {
  align-items: start;
}

.search-count-field {
  max-width: 180px;
}

.test-form,
.nav-test-form {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.nav-test-form {
  align-items: center;
}

.nav-test-form input {
  min-width: 0;
  padding: 8px 10px;
  min-height: 30px;
}

.zoho-test-button {
  gap: 8px;
}

.zoho-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #111111;
}

.zoho-dot.pass {
  background: #16a34a;
}

.zoho-dot.fail {
  background: #dc2626;
}

.flat-section {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.flat-head {
  margin: 0 0 14px;
}

.section-title {
  color: #111111;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-row select {
  width: auto;
  min-width: 96px;
  padding: 6px 8px;
}

.field-wide {
  min-width: 0;
}

.big-button {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
}

.button-static {
  cursor: default;
}

.inline-status {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.status-spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(16, 20, 24, 0.15);
  border-top-color: #111111;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.error-status {
  color: #b42318;
}

.button-spinner {
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.32);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: none;
}

.button.working .button-spinner {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

.button.working .button-text {
  opacity: 0.95;
}

.history-list {
  display: grid;
  gap: 8px;
}

.batch-grid {
  display: grid;
  gap: 0;
  border: 1.5px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
}

.batch-grid-head,
.batch-summary {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(90px, 1fr) 70px 70px 70px 70px minmax(220px, auto);
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
}

.batch-grid-head {
  background: #f8f9fb;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.batch-item {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.batch-item:last-child {
  border-bottom: 0;
}

.batch-summary {
  list-style: none;
  cursor: pointer;
}

.batch-summary::-webkit-details-marker {
  display: none;
}

.batch-prompt,
.status-text {
  font-size: 13px;
}

.batch-prompt {
  font-weight: 700;
}

.batch-summary > div:not(.batch-actions) {
  min-width: 0;
}

.status-text {
  color: var(--muted);
}

.batch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.batch-actions form {
  margin: 0;
}

.batch-actions .button.tiny {
  min-height: 26px;
  padding: 0 8px;
}

.batch-actions .button.tiny.ghost {
  border: 0;
  background: transparent;
  padding: 0 6px;
  min-height: 26px;
}

.batch-expand {
  padding: 0 10px 10px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 0 10px;
}

.history-item summary {
  display: grid;
  gap: 4px;
  list-style: none;
  cursor: pointer;
  padding: 10px 0;
}

.history-item summary::-webkit-details-marker {
  display: none;
}

.history-actions {
  padding: 0 0 10px;
}

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

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

.compact-table th,
.compact-table td {
  padding: 7px 6px;
}

th,
td {
  padding: 9px 6px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line);
}

.email-preview {
  border: 1.5px solid var(--stroke);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.login-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  justify-items: center;
}

.login-logo {
  width: min(260px, 100%);
  display: block;
}

.login-form {
  width: min(280px, 100%);
  display: grid;
  gap: 10px;
  justify-items: center;
}

.login-form input {
  width: 100%;
  border-color: rgba(32, 38, 45, 0.28);
}

.login-submit {
  width: 42px;
  height: 34px;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #111111;
  font-weight: 800;
  cursor: pointer;
}

.compact-head {
  gap: 8px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .page {
    width: min(100% - 16px, 1600px);
  }

  .dashboard-shell,
  .action-row,
  .test-form,
  .nav-test-form,
  .topbar,
  .section-head,
  .summary-row {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: static;
  }

  .batch-grid-head {
    display: none;
  }

  .batch-summary {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-logo {
    width: 96px;
  }

  .tab-link,
  .tab-divider {
    font-size: 20px;
  }
}
