:root {
  --bg: #f4f6f4;
  --panel: #ffffff;
  --ink: #17211d;
  --muted: #61706a;
  --line: #dce3df;
  --accent: #0f7c67;
  --accent-strong: #0a5d4d;
  --warn: #a15c00;
  --bad: #a83a32;
  --good-bg: #e7f4ef;
  --warn-bg: #fff2d8;
  --bad-bg: #ffe8e5;
  --shadow: 0 18px 50px rgba(25, 38, 32, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 124, 103, 0.09), transparent 360px),
    var(--bg);
}

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

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(18px, 4vw, 48px) 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

.brand-name {
  font-size: 22px;
  font-weight: 900;
}

.brand-domain {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.02;
}

h2 {
  font-size: 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
}

.primary-button {
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.icon-button {
  width: 42px;
  color: var(--accent-strong);
  background: #fff;
  border-color: var(--line);
  font-size: 22px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 48px) 42px;
}

.panel,
.status-band,
.metric {
  background: var(--panel);
  border: 1px solid rgba(220, 227, 223, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.controls {
  position: sticky;
  top: 16px;
  align-self: start;
}

.section-heading {
  margin-bottom: 18px;
}

.inline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  margin-top: 2px;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfcfb;
}

textarea {
  min-height: 78px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.4;
}

.wide-label {
  margin-bottom: 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-grid > label {
  min-width: 0;
}

.input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.input-with-unit input {
  border: 0;
  background: transparent;
}

.input-with-unit span {
  padding-right: 12px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.results {
  display: grid;
  gap: 18px;
}

.preview-panel {
  padding-bottom: 16px;
}

.preview-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--good-bg);
  font-size: 12px;
  font-weight: 900;
}

.model-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfcfb, #eef4f1);
  aspect-ratio: 16 / 7.4;
  min-height: 280px;
}

.model-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.explain-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #33433d;
  background: #eef7f3;
  font-size: 13px;
  line-height: 1.5;
}

.status-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
  background: var(--good-bg);
}

.status-band.warn {
  background: var(--warn-bg);
}

.status-band.bad {
  background: var(--bad-bg);
}

.status-band p {
  margin: 0;
  max-width: 520px;
  color: var(--muted);
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.metric {
  padding: 18px;
  box-shadow: none;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 28px;
  line-height: 1;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f7faf8;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr.is-active td {
  background: #e9f6f2;
  font-weight: 800;
}

tr.is-risk td {
  background: #fff0ed;
  color: #6d211b;
  font-weight: 800;
}

.assistant-status {
  min-height: 44px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  background: #f7faf8;
  font-size: 13px;
  line-height: 1.45;
}

.compact-status {
  min-height: 0;
  margin: 0 0 16px;
}

.assistant-status.is-listening {
  color: var(--accent-strong);
  background: var(--good-bg);
}

.secondary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.secondary-button {
  width: 100%;
  margin-bottom: 10px;
}

.note {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  color: #5b4b24;
  background: #fff6df;
  line-height: 1.45;
  font-size: 13px;
}

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

  .controls {
    position: static;
  }
}

@media (max-width: 1560px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  }

  .model-preview {
    min-height: 240px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .controls {
    position: static;
  }

}

@media (max-width: 760px) {
  .app-header,
  .status-band,
  .inline-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }

  .primary-button {
    flex: 1;
  }

  .field-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }
}
