:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #5b6475;
  --border: #d9dde5;
  --primary: #2563eb;
  --primary-text: #ffffff;
  --error: #c62828;
  --panel-bg: #111827;
  --panel-text: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
}

header.site-header .brand {
  font-weight: 700;
  color: var(--primary);
  margin-right: 12px;
}

header.site-header a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

header.site-header a:hover {
  color: var(--primary);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 120px;
}

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.filler {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  min-height: 60vh;
  color: var(--muted);
}

.card-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.card-links a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  color: var(--text);
  text-decoration: none;
}

.card-links a:hover {
  border-color: var(--primary);
}

.sales-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.sales-form h3 {
  margin: 0 0 4px;
  font-size: 24px;
}

.stepper {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 16px 0 24px;
}

.stepper li {
  flex: 1;
}

.stepper button {
  width: 100%;
  padding: 10px;
  border: 0;
  border-bottom: 3px solid var(--border);
  background: none;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.stepper li.active button {
  border-color: var(--primary);
  color: var(--text);
  font-weight: 600;
}

.stepper li.done button {
  border-color: var(--text);
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 16px;
}

.field-error,
.submit-error {
  display: block;
  color: var(--error);
  font-size: 13px;
  min-height: 1em;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  font-size: 14px;
}

.test-options {
  margin: 16px 0;
  padding: 12px;
  border: 1px dashed var(--primary);
  border-radius: 4px;
  font-size: 14px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.btn {
  padding: 10px 24px;
  border-radius: 4px;
  border: 1px solid var(--text);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.debug-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  color: var(--panel-text);
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 1000;
}

.debug-panel.collapsed {
  width: auto;
}

.debug-panel.collapsed .debug-body {
  display: none;
}

.debug-toggle {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.debug-body {
  overflow: auto;
  padding: 0 12px 12px;
}

.debug-row {
  margin: 8px 0 4px;
}

.debug-panel pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px;
  border-radius: 4px;
}

.debug-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.debug-actions button {
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  border: 0;
  border-radius: 4px;
  padding: 6px 10px;
  font: inherit;
  cursor: pointer;
}

.debug-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.debug-log .log-head {
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 2px;
}

.debug-log .empty {
  color: #9ca3af;
}
