:root {
  --bg: #f4efe6;
  --surface: #fffdf8;
  --ink: #241f1a;
  --muted: #5c534a;
  --line: #d7cfc4;
  --teal: #1f4f4a;
  --teal-ink: #fffdf8;
  --clay: #8a3b2d;
  --focus: #1f4f4a;
  --ok: #215c38;
  --shadow: 0 1px 0 rgba(36, 31, 26, 0.06);
  --radius: 8px;
  --font: "Segoe UI", "Liberation Sans", Calibri, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.5;
}

body { min-height: 100%; }

a { color: var(--teal); }

img { max-width: 100%; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 8px;
  top: 8px;
  background: var(--surface);
  padding: 8px 12px;
  z-index: 10;
}

.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
}

.brand-logo {
  width: 48px;
  height: 48px;
  display: block;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: contain;
  background: #000;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

h1, h2, h3 {
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 12px;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 16px; }

.lead { color: var(--muted); font-size: 1.05rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.choice, button, .btn {
  font: inherit;
  cursor: pointer;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 2px solid var(--teal);
  background: var(--teal);
  color: var(--teal-ink);
  text-decoration: none;
  font-weight: 650;
}

button.secondary, .btn.secondary {
  background: var(--surface);
  color: var(--teal);
}

button.danger, .btn.danger {
  background: var(--surface);
  color: var(--clay);
  border-color: var(--clay);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:focus, .btn:focus, a:focus, input:focus, textarea:focus, select:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.choice {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-height: 88px;
}

.choice strong { display: block; font-size: 1.15rem; margin-bottom: 4px; }
.choice span { color: var(--muted); font-weight: 400; }

label {
  display: block;
  font-weight: 650;
  margin-bottom: 6px;
}

input:not([type]),
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
}

textarea { min-height: 140px; resize: vertical; }

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 64px;
  margin: 0 0 8px;
  padding: 14px 18px;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 650;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius);
  border: 2px solid var(--teal);
  background: var(--surface);
  color: var(--teal);
}

.upload-btn {
  width: 100%;
  min-height: 64px;
  font-size: 1.15rem;
}

#file-name {
  min-height: 1.4em;
}

.field { margin-bottom: 4px; }

.notice {
  background: var(--surface);
  border-left: 4px solid var(--teal);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.alert {
  border-left: 4px solid var(--clay);
  background: #fff6f2;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.ok {
  border-left: 4px solid var(--ok);
  background: #f1f7f2;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.muted { color: var(--muted); }
.hidden { display: none !important; }

.checks { list-style: none; padding: 0; margin: 0 0 16px; }
.checks li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.checks input { margin-top: 6px; }

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.bubble {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
  white-space: pre-wrap;
}

.bubble.user {
  border-color: var(--ink);
  background: #efe8dc;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
  border-radius: var(--radius);
}

.metric b {
  display: block;
  font-size: 1.6rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.95rem;
}

th, td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

th { background: #efe8dc; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tabs button[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
}

.file-list, .table-list { display: flex; flex-direction: column; gap: 8px; }

.item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
  border-radius: var(--radius);
}

footer {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

footer p {
  margin: 0 0 6px;
}

footer a.company-link {
  color: inherit;
  text-decoration: underline;
}

.bar {
  height: 12px;
  background: #efe8dc;
  border: 1px solid var(--line);
  margin-top: 6px;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.charts {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 16px 0 20px;
}

.chart-card h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.chart {
  width: 100%;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 0.9rem;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 14px;
  height: 14px;
  border: 1px solid var(--ink);
  flex-shrink: 0;
}

.voice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 16px;
}

.voice-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: auto;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
}

.voice-choice input {
  margin-top: 4px;
}

.voice-choice.is-missing {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  html, body { font-size: 18px; }
  .top { flex-direction: column; }
  button, .btn { width: 100%; }
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 650;
  cursor: pointer;
  width: auto;
  white-space: nowrap;
}

.switch input {
  position: absolute;
  left: 0;
  top: 50%;
  width: 44px;
  height: 26px;
  margin: 0;
  opacity: 0;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 1;
}

.switch-ui {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #d7cfc4;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(36, 31, 26, 0.25);
}

.switch.is-on .switch-ui,
.switch input:checked + .switch-ui {
  background: var(--teal);
}

.switch.is-on .switch-ui::after,
.switch input:checked + .switch-ui::after {
  left: 20px;
}

.switch input:focus-visible + .switch-ui {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.switch.is-locked {
  cursor: not-allowed;
}

.switch.is-locked input {
  cursor: not-allowed;
}

.switch.is-locked .switch-ui {
  background: var(--teal);
}
