@font-face {
  font-family: "Test American Grotesk";
  src: url("/fonts/test-american-grotesk-regular.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Test American Grotesk";
  src: url("/fonts/test-american-grotesk-medium.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 500 900;
}

:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #697586;
  --line: #d8dee8;
  --accent: #71d8f0;
  --accent-dark: #50c7e2;
  --warning: #9a5b00;
  --danger: #9d2433;
  --ok: #236b38;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Test American Grotesk", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
  min-height: 40px;
  padding: 0 16px;
}

.primary {
  background: var(--accent);
  color: #000000;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  background: var(--accent);
  color: #000000;
}

.ghost {
  background: var(--accent);
  color: #000000;
  border: 1px solid var(--line);
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

label input,
label textarea {
  color: var(--text);
  font-weight: 500;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
}

legend {
  color: var(--muted);
  font-weight: 800;
  padding: 0 6px;
}

.choice {
  align-items: center;
  color: var(--text);
  display: flex;
  gap: 10px;
  font-weight: 700;
}

.choice input {
  width: auto;
}

.topbar {
  align-items: center;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 22px clamp(18px, 4vw, 48px);
}

.top-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.tab-link {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--accent);
  color: #000000;
  display: inline-flex;
  font-weight: 800;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
}

.tab-link.active {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #000000;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

h2 {
  font-size: 1.05rem;
}

h3 {
  font-size: 1rem;
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title-mark {
  align-items: center;
  display: flex;
  gap: 7px;
}

.title-mark img {
  display: block;
  height: 28px;
  width: auto;
}

.layout {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1240px;
  padding: 24px 18px 48px;
}

.notice,
.alert {
  background: #fff7e6;
  border: 1px solid #f1d38d;
  border-radius: 7px;
  color: #6f4500;
  padding: 12px 14px;
}

.auth-panel .alert {
  background: #fff0f2;
  border-color: #e59aa5;
  color: var(--danger);
  font-weight: 800;
}

.metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics article {
  padding: 16px;
}

.metrics span {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
}

.metrics p {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.75fr);
}

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

.panel {
  padding: 18px;
}

.panel-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.settings-panel,
.stack {
  display: grid;
  gap: 14px;
}

.tools-panel {
  display: grid;
  gap: 18px;
}

.demo-form {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.connected-profile {
  align-items: center;
  background: #f4f7f8;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 12px;
  grid-template-columns: 56px minmax(0, 1fr);
  padding: 12px;
}

.connected-profile img,
.profile-fallback {
  border-radius: 50%;
  height: 56px;
  width: 56px;
}

.connected-profile img {
  display: block;
  object-fit: cover;
}

.profile-fallback {
  align-items: center;
  background: var(--accent);
  color: #000000;
  display: flex;
  font-weight: 900;
  justify-content: center;
}

.connected-profile p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 3px;
}

.connected-profile code {
  display: block;
  font-size: 0.78rem;
  margin-top: 6px;
}

.webhook-box {
  background: #f4f7f8;
  border-radius: 7px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.diagnostic-posts {
  display: grid;
  gap: 10px;
}

.diagnostic-section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.diagnostic-section > div:first-child p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  margin-top: 4px;
}

.diagnostic-post {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.diagnostic-post p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  margin-top: 4px;
}

.diagnostic-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.diagnostic-counts span {
  background: #edf1f3;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  padding: 4px 8px;
}

.diagnostic-post a {
  color: var(--text);
  font-weight: 800;
}

code {
  color: var(--accent-dark);
  overflow-wrap: anywhere;
}

.comment-list,
.log-list {
  display: grid;
  gap: 12px;
}

.comment-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 8px;
  padding: 16px;
}

.status-suggested {
  border-left-color: var(--warning);
}

.status-approved,
.status-auto_replied {
  border-left-color: var(--ok);
}

.status-manual_review,
.status-rejected {
  border-left-color: var(--danger);
}

.comment-main,
.reply-form {
  display: grid;
  gap: 12px;
}

.comment-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.comment-meta span {
  background: #edf1f3;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  padding: 4px 8px;
  text-transform: uppercase;
}

time {
  color: var(--muted);
  font-size: 0.82rem;
}

.comment-text {
  font-size: 1.02rem;
  line-height: 1.5;
}

.reason {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.empty {
  color: var(--muted);
}

.log-list p {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding-top: 10px;
}

.auth-page {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.auth-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

@media (max-width: 900px) {
  .metrics,
  .grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 640px) {
  .topbar,
  .panel-heading,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: stretch;
  }

  .tab-link,
  .top-actions form,
  .top-actions button {
    width: 100%;
  }

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