:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #17212b;
  --muted: #5e6b76;
  --line: #d8e0e7;
  --green: #0f766e;
  --green-dark: #0b5d58;
  --blue: #315b9c;
  --amber: #9a6514;
  --shadow: 0 18px 40px rgba(21, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.18;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.status-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e8f3f1;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
}

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
  gap: 18px;
  align-items: start;
  margin-top: 12px;
}

.question-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
  resize: vertical;
  padding: 12px;
}

textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

#preparedPrompt {
  background: #f7faf9;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.quick-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: #344553;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 700;
}

.quick-row button:hover {
  border-color: #b8c6d1;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: var(--green);
  color: #fff;
  padding: 0 16px;
}

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

.secondary-button,
.icon-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  padding: 0 13px;
}

.icon-button {
  width: 42px;
  padding: 0;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.result-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.result-box strong {
  display: block;
  margin-bottom: 6px;
}

.result-box p {
  margin: 0;
  color: var(--muted);
}

.fallback-open {
  display: none;
  margin-top: 12px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
}

.fallback-open.show {
  display: inline-flex;
}

.scope-strip {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.scope-strip div {
  min-height: 86px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1f2d38;
  color: #fff;
  padding: 14px;
}

.scope-strip strong,
.scope-strip span {
  display: block;
}

.scope-strip strong {
  margin-bottom: 6px;
}

.scope-strip span {
  color: #d5e0e8;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: #17212b;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

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

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  h1 {
    font-size: 22px;
  }

  .action-row,
  .action-row button {
    width: 100%;
  }
}
