:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-dark: #101828;
  --border: #e4e7ec;
  --border-strong: #cbd5e1;
  --text: #101828;
  --muted: #667085;
  --muted-2: #98a2b3;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #027a48;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --error: #b42318;
  --error-soft: #fef3f2;
  --working: #175cd3;
  --working-soft: #eff8ff;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
  margin-bottom: 20px;
}

h2 {
  font-size: 1.2rem;
  letter-spacing: 0;
  margin-bottom: 6px;
}

h3 {
  font-size: 0.98rem;
  margin-bottom: 10px;
}

code,
.mono,
.out {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.app-shell {
  min-height: 100vh;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.hero-copy,
.lead {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 690px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.86rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.optional {
  color: #667085;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

.page-locale {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.locale-switch {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  width: max-content;
}

.locale-switch-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0 7px 0 9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.locale-switch-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  min-height: 30px;
  padding: 5px 12px;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}

.locale-switch-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.locale-switch-btn[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Buttons */
.btn {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-weight: 750;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.btn.primary {
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--border-strong);
}

.btn.discord {
  background: #5865F2;
  box-shadow: 0 10px 24px rgba(88, 101, 242, 0.22);
  color: #fff;
}

.btn.discord:hover {
  background: #4752C4;
}

.btn.wide {
  width: 100%;
}

.btn.small-btn {
  min-height: 36px;
  padding: 7px 14px;
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

.back-home {
  color: var(--muted);
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 18px;
  text-decoration: none;
}

.back-home:hover {
  color: var(--primary);
}

.done-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.filter-field {
  min-width: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 48px;
  padding: 20px 22px;
}

.footer-inner {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: var(--max);
}

.footer-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Shared panels/forms */
.panel,
.value-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.panel-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-header p {
  color: var(--muted);
  margin: 0;
}

.stacked-form {
  display: grid;
  gap: 10px;
}

label {
  color: #344054;
  display: block;
  font-size: 0.9rem;
  font-weight: 750;
  margin-top: 10px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  padding: 12px 14px;
  width: 100%;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.notice {
  border-radius: var(--radius-sm);
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  white-space: pre-wrap;
}

.notice.error {
  background: var(--error-soft);
  border: 1px solid #fecdca;
  color: var(--error);
}

.notice.success {
  background: var(--success-soft);
  border: 1px solid #abefc6;
  color: var(--success);
}

.notice.warning {
  background: var(--warning-soft);
  border: 1px solid #fedf89;
  color: var(--warning);
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 10px;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-pill.neutral {
  background: #f2f4f7;
  color: #344054;
}

.status-pill.working {
  background: var(--working-soft);
  color: var(--working);
}

.status-pill.success {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.out {
  background: #0b1020;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  font-size: 0.82rem;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Landing */
.landing-page {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 30rem),
    linear-gradient(180deg, #fff 0%, #f6f7fb 100%);
}

.landing {
  margin: 0 auto;
  max-width: var(--max);
  padding: 76px 22px;
}

.hero {
  max-width: 860px;
  padding: 34px 0 56px;
  position: relative;
}

.hero p {
  margin-bottom: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 30px 0 18px;
}

.hero-flow {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  padding: 10px 18px;
}

.hero-flow-step {
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-flow-arrow {
  color: var(--muted-2);
  font-weight: 700;
}

.hero-context {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.55;
  margin-bottom: 18px;
  max-width: 720px;
}

.hero-copy-cta {
  color: var(--text);
  font-weight: 600;
}

.hero-flow-step.is-starter {
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
}

.hero-flow-step.is-starter::after {
  content: "Starter";
  font-size: 0.68em;
  font-weight: 800;
  margin-left: 6px;
  opacity: 0.85;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.value-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.value-card {
  padding: 24px;
}

.step-dot {
  align-items: center;
  background: var(--primary-soft);
  border-radius: 50%;
  color: var(--primary);
  display: inline-flex;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  margin-bottom: 18px;
  width: 34px;
}

.value-card p {
  color: var(--muted);
  margin-bottom: 0;
}

/* Reporter */
.reporter-page {
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 28rem),
    var(--bg);
}

.report-shell {
  margin: 0 auto;
  max-width: 760px;
  padding: 52px 18px 96px;
}

.report-hero {
  margin-bottom: 26px;
}

.chat-panel {
  padding-bottom: 16px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px 2px 16px;
}

.chat-msg {
  display: flex;
}

.chat-msg.from-user {
  justify-content: flex-end;
}

.chat-msg.from-agent {
  justify-content: flex-start;
}

.bubble {
  border-radius: 18px;
  max-width: min(82%, 560px);
  padding: 12px 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

.from-user .bubble {
  background: var(--primary);
  border-bottom-right-radius: 5px;
  color: #fff;
}

.from-agent .bubble {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  color: var(--text);
}

.question-card {
  display: grid;
  gap: 8px;
}

.question-card ol {
  margin: 0;
  padding-left: 20px;
}

.contact-strip {
  align-items: center;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-top: 12px;
  padding-top: 12px;
}

.contact-strip label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.contact-strip input {
  min-height: 38px;
  padding: 9px 11px;
}

.contact-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.chat-input-row {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chat-input-row textarea {
  flex: 1;
  min-height: 48px;
}

.attach-btn {
  align-items: center;
  background: none;
  border: none;
  color: var(--muted-2);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.5rem;
  font-weight: 300;
  height: 36px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: color 120ms ease;
  width: 28px;
}

.attach-btn:hover {
  color: var(--primary);
}

.image-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 0 2px;
}

.image-preview-thumb {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: inline-flex;
  gap: 6px;
  padding: 6px 10px;
  position: relative;
}

.image-preview-thumb img {
  border-radius: 4px;
  height: 32px;
  object-fit: cover;
  width: 32px;
}

.preview-name {
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-remove {
  background: none;
  border: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 2px 4px;
}

.preview-remove:hover {
  color: var(--error);
}

.preview-warning {
  color: var(--warning);
  font-size: 0.82rem;
  width: 100%;
}

.typing-indicator-wrap {
  align-items: center;
  min-height: 36px;
  padding: 0 4px;
}

.typing-dots {
  align-items: center;
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-bottom-left-radius: 5px;
}

.typing-dot {
  animation: typing-bounce 1.4s infinite ease-in-out;
  background: var(--muted-2);
  border-radius: 50%;
  height: 6px;
  width: 6px;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.done-card {
  align-items: flex-start;
  background: var(--success-soft);
  border: 1px solid #abefc6;
  border-radius: var(--radius);
  color: #054f31;
  display: flex;
  gap: 14px;
  margin-top: 16px;
  padding: 18px;
}

.done-icon {
  align-items: center;
  background: var(--success);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  width: 30px;
}

/* Admin */
.admin-page {
  background: #f8fafc;
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 20px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 1.8rem;
  margin: 0;
}

.topbar .eyebrow {
  margin-bottom: 3px;
}

.topbar-brand {
  min-width: 0;
}

.tab-nav {
  display: flex;
  gap: 4px;
  min-width: 0;
}

.global-project-filter {
  min-width: 190px;
}

.global-project-filter label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin: 0 0 5px;
  text-transform: uppercase;
}

.global-project-filter select {
  min-height: 40px;
  padding: 8px 36px 8px 12px;
}

.tab-btn {
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 750;
  padding: 8px 16px;
  transition: background 120ms ease, color 120ms ease;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.tab-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.topbar-locale .locale-switch {
  background: #fff;
}

.topbar-locale .locale-switch-label {
  display: none;
}

.admin-workspace {
  margin: 0 auto;
  max-width: 1480px;
  padding: 24px;
  width: 100%;
}

.admin-page .panel {
  box-shadow: none;
}

.tab-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
  align-content: start;
}

.filter-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 180px;
  margin-bottom: 14px;
}

.inbox-filter-row {
  grid-template-columns: 180px minmax(220px, 1fr);
}

.empty-state,
.detail-placeholder {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 34px 18px;
  text-align: center;
}

.empty-state strong,
.detail-placeholder h2 {
  color: var(--text);
  margin: 0;
}

.report-list {
  display: grid;
  gap: 10px;
}

.report-list.dense {
  gap: 4px;
}

.report-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: inherit;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 14px;
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}

.report-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.report-card-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.report-card.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.report-card.loading {
  opacity: 0.62;
}

.report-card-open {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
  width: 100%;
}

.report-card-open:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.report-card-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-card-pills,
.report-card-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.report-card-meta {
  justify-content: space-between;
}

.report-card-meta span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-workbench {
  container-type: inline-size;
}

.detail-meta-disclosure {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  padding: 11px 13px;
}

.detail-meta-disclosure > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 0.84rem;
  font-weight: 800;
  justify-content: space-between;
  list-style: none;
}

.detail-meta-disclosure > summary::-webkit-details-marker {
  display: none;
}

.detail-meta-disclosure > summary::after {
  color: var(--muted);
  content: "+";
  font-size: 1rem;
}

.detail-meta-disclosure[open] > summary::after {
  content: "−";
}

.detail-meta-disclosure .meta-grid {
  margin: 12px 0 0;
}

.detail-layout {
  display: grid;
  gap: 18px;
  grid-template-areas:
    "summary"
    "action"
    "review";
}

.detail-summary-column,
.detail-review-column {
  min-width: 0;
}

.detail-summary-column {
  grid-area: summary;
}

.detail-review-column {
  grid-area: review;
}

.detail-action-column {
  align-self: start;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  grid-area: action;
  min-width: 0;
  overflow: hidden;
}

.detail-action-scroll {
  padding: 14px;
}

.detail-action-column .delivery-section {
  background: transparent;
  border: 0;
  padding: 0;
}

.detail-action-column .delivery-header {
  align-items: stretch;
  flex-direction: column;
}

.detail-action-column .delivery-header .btn {
  width: 100%;
}

.decision-panel {
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
  padding: 14px;
}

.admin-note-field label {
  margin-top: 0;
}

.admin-note-field textarea {
  min-height: 72px;
  resize: vertical;
}

.admin-note-field .btn {
  margin-top: 8px;
}

.advanced-tool > summary {
  color: #344054;
}

.advanced-tool-body {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.agent-task-pack-section .out {
  max-height: 360px;
}

.reviewer-checklist-section .out {
  max-height: 240px;
}

.detail-action-column .out:focus-visible,
.consolidate-section .out:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@container (min-width: 700px) {
  .detail-layout {
    align-items: start;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.82fr);
    grid-template-areas:
      "summary action"
      "review action";
  }

  .detail-action-column {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    max-height: calc(100vh - 48px);
    position: sticky;
    top: 24px;
  }

  .detail-action-scroll {
    overflow-y: auto;
  }

  .detail-summary-column .summary-grid {
    grid-template-columns: 1fr;
  }
}

@container (min-width: 1050px) {
  .detail-summary-column .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.meta-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.meta-grid div {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.meta-grid span,
.summary-grid span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.meta-grid strong,
.summary-grid strong {
  word-break: break-word;
}

.ticket-section {
  border-top: 1px solid var(--border);
  padding: 18px 0;
}

.ticket-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.ticket-section summary {
  cursor: pointer;
  font-weight: 850;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-grid > div {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
}

.summary-wide {
  grid-column: 1 / -1;
}

.summary-wide p,
.summary-wide ol,
.summary-wide ul {
  margin-bottom: 0;
}

.warning-box {
  background: var(--warning-soft) !important;
  border-color: #fedf89 !important;
}

.quote-box {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  color: #344054;
  padding: 14px;
  white-space: pre-wrap;
}

.free-form-section {
  margin-bottom: 12px;
}

.free-form-section:last-child {
  margin-bottom: 0;
}

.free-form-section strong {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.attachment-list li {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attachment-img-wrap {
  max-width: 100%;
}

.attachment-meta {
  align-items: center;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-thumb {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: block;
  max-height: 260px;
  max-width: 100%;
}

.conversation-log {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.conv-row {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  white-space: pre-wrap;
}

.section-header-inline {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-back {
  margin-bottom: 4px;
}

.small-btn {
  font-size: 0.78rem;
  min-height: 30px;
  padding: 5px 12px;
}

.inline-title-input {
  background: #fff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 4px var(--primary-soft);
  font: inherit;
  font-size: 1.2rem;
  letter-spacing: 0;
  margin-bottom: 6px;
  outline: none;
  padding: 8px 12px;
}

.type-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.type-tag {
  background: var(--primary-soft);
  border-radius: 999px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 750;
  padding: 4px 10px;
}

.setup-block {
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 18px;
}

.setup-block.first {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.three-col {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.language-config-field {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 18px 0;
  padding: 16px;
}

.language-config-field > summary {
  cursor: pointer;
  font-weight: 750;
  list-style: none;
  padding: 2px 0;
}

.language-config-field > summary::-webkit-details-marker {
  display: none;
}

.language-config-field > summary::before {
  content: "▸ ";
  color: var(--muted);
}

.language-config-field[open] > summary::before {
  content: "▾ ";
}

.language-config-intro {
  margin: 8px 0 14px;
}

.language-config-field h3 {
  margin-bottom: 12px;
}

.language-config-field label {
  margin-top: 0;
}

.ai-config-field {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 18px 0;
  padding: 16px;
}

.ai-config-field label {
  margin-top: 0;
}

.copy-row {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.toast {
  background: var(--surface-dark);
  border-radius: 999px;
  bottom: 22px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
  color: #fff;
  font-weight: 750;
  left: 50%;
  padding: 12px 18px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 50;
}

.btn.danger {
  border-color: #fecdca;
  color: var(--error);
}

.btn.danger:hover {
  background: var(--error-soft);
}

.empty-state.compact {
  padding: 18px;
}

.project-meta {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 10px;
  padding: 10px 12px;
}

.json-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
}

.review-dock {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
  margin-top: 12px;
}

.delivery-section {
  background: #f8fbff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 16px;
}

.delivery-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.delivery-header h3 {
  margin: 4px 0 0 0;
  font-size: 1rem;
}

.agent-task-pack-section,
.reviewer-checklist-section {
  background: #fff;
  border: 1px solid var(--border-strong, #d0d5dd);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 10px;
}

.human-summary-section {
  background: #fff;
  border: 1px solid var(--border-strong, #d0d5dd);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.is-free-plan .ai-workbench-section,
.is-free-plan .ai-workbench-action,
.is-free-plan .ai-config-field {
  display: none !important;
}

.link-list {
  display: grid;
  gap: 10px;
}

.link-card {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 13px;
}

.link-card > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.billing-summary {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
  padding: 16px;
}

.billing-summary strong {
  display: block;
  font-size: 1.8rem;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.plan-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.plan-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.plan-card-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.plan-card h3 {
  margin-bottom: 4px;
}

.plan-card p,
.plan-card ul {
  color: var(--muted);
}

.plan-card ul {
  margin-bottom: 0;
  padding-left: 18px;
}

.billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* Landing page plan comparison */
.plan-compare {
  margin: 0 auto;
  max-width: 960px;
  padding: 48px 18px 64px;
  text-align: center;
}

.plan-compare h2 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  letter-spacing: 0;
}

.plan-cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  text-align: left;
}

.landing-plan-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.landing-plan-card.starter {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.landing-plan-card h3 {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.landing-plan-card strong {
  display: block;
  font-size: 1.6rem;
  letter-spacing: 0;
  margin-bottom: 12px;
}

.landing-plan-card strong {
  color: var(--primary);
}

.landing-plan-card p {
  color: var(--muted);
  margin-bottom: 12px;
}

.landing-plan-card ul {
  color: var(--muted);
  margin-bottom: 16px;
  padding-left: 20px;
}

.landing-plan-card ul li {
  margin-bottom: 6px;
}

.plan-title-starter {
  color: var(--primary);
}

.plan-title-free {
  color: var(--muted);
}

.plan-features-starter {
  list-style: none;
  padding-left: 0;
}

.plan-features-starter li::before {
  color: var(--success);
  content: "\2713";
  font-weight: 700;
  margin-right: 8px;
}

.plan-features-free {
  list-style: none;
  padding-left: 0;
}

.plan-features-free li::before {
  color: var(--muted-2);
  content: "\2022";
  margin-right: 8px;
}

/* Mobile: stack plan cards */
@media (max-width: 640px) {
  .plan-cards {
    grid-template-columns: 1fr;
  }

  .delivery-header {
    flex-direction: column;
    align-items: stretch;
  }

  .delivery-header .inline-actions {
    align-self: stretch;
  }
}

.signin-page {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 30rem),
    linear-gradient(180deg, #fff 0%, #f6f7fb 100%);
}

.signin-shell {
  margin: 0 auto;
  max-width: 520px;
  padding: 72px 18px;
}

.signin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* Responsive */
@media (max-width: 980px) {
  .value-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .billing-summary,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .three-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  h1 {
    font-size: 2.4rem;
  }

  .landing,
  .report-shell {
    padding-top: 34px;
  }

  .panel {
    padding: 18px;
  }

  .panel-header,
  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
    padding: 16px 16px 12px;
  }

  .topbar h1 {
    font-size: 1.65rem;
    letter-spacing: 0;
    line-height: 1.08;
  }

  .topbar-brand {
    width: 100%;
  }

  .tab-nav {
    gap: 8px;
    margin: 0 -16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 16px 4px;
    scroll-padding: 16px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    width: calc(100% + 32px);
  }

  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: #475467;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 16px;
    scroll-snap-align: start;
    text-align: center;
  }

  .tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
    color: #fff;
  }

  .topbar-actions {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    width: 100%;
  }

  .topbar-actions #plan-badge {
    flex: 0 0 auto;
  }

  .topbar-actions #whoami {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions #logout {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 12px;
    white-space: nowrap;
  }

  .topbar-locale {
    flex: 0 0 auto;
  }

  .topbar-locale .locale-switch {
    background: transparent;
    border: 0;
    padding: 0;
  }

  .topbar-locale .locale-switch-btn {
    min-height: 40px;
    padding: 7px 12px;
  }

  .attach-btn {
    height: 44px;
    min-width: 44px;
    width: 44px;
  }

  .preview-remove {
    min-height: 36px;
    min-width: 36px;
    padding: 4px 8px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .hero-flow {
    padding: 8px 14px;
  }

  .admin-workspace {
    padding: 14px;
  }

  .filter-row,
  .inbox-filter-row,
  .meta-grid,
  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

  .contact-strip {
    grid-template-columns: 1fr;
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .contact-strip label,
  .contact-strip span {
    white-space: normal;
  }

  .chat-input-row {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .copy-row {
    align-items: stretch;
    flex-direction: column;
  }

  .bubble {
    max-width: 92%;
  }
}

/* ---------------------------------------------------------------------------
   Inbox selection actions and consolidated repair prompt
   --------------------------------------------------------------------------- */
.selection-actions {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 14px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.selection-actions .inline-actions {
  margin-left: auto;
}

.report-card-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.report-card-selection {
  align-items: center;
  cursor: pointer;
  display: flex;
  flex: 0 0 44px;
  justify-content: center;
  margin: -8px 0 -8px -8px;
  min-height: 44px;
}

.report-card-checkbox {
  flex-shrink: 0;
  cursor: pointer;
  height: 18px;
  margin: 0;
  width: 18px;
}

.status-pill.consolidated {
  background: var(--primary);
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  z-index: 200;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--surface, #fff);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
  max-width: 880px;
  width: 100%;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.consolidate-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.consolidate-sources .source-pill {
  font-size: 0.8rem;
  background: var(--muted-2, #e2e8f0);
  color: var(--text, #0f172a);
  padding: 3px 9px;
  border-radius: 10px;
}

.consolidate-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}

.consolidate-section pre.out {
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 420px;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .selection-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .selection-actions .inline-actions {
    margin-left: 0;
    width: 100%;
  }

  .selection-actions .btn {
    flex: 1 1 100%;
  }

  .modal-overlay {
    padding: 12px 8px;
  }

  .modal-header,
  .modal-body {
    padding: 14px 16px;
  }
}

/* Admin workspace: one context rail, contextual report detail, no dashboard chrome. */
@media (min-width: 1040px) {
  body.admin-page {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: minmax(100vh, auto) auto;
  }

  .admin-page .topbar {
    align-items: stretch;
    align-self: start;
    background: #fff;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    flex-direction: column;
    gap: 20px;
    height: 100vh;
    justify-content: flex-start;
    overflow-y: auto;
    padding: 28px 20px 20px;
    position: sticky;
    top: 0;
  }

  .admin-page .topbar h1 {
    font-size: 1.55rem;
    line-height: 1.05;
  }

  .admin-page .tab-nav {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }

  .admin-page .tab-btn {
    border-radius: 10px;
    padding: 11px 12px;
    text-align: left;
    width: 100%;
  }

  .admin-page .tab-btn.active {
    background: var(--primary);
    color: #fff;
  }

  .admin-page .global-project-filter {
    margin-top: auto;
    min-width: 0;
    width: 100%;
  }

  .admin-page .topbar-actions {
    align-items: stretch;
    display: grid;
    gap: 8px;
    width: 100%;
  }

  .admin-page .topbar-actions #plan-badge {
    justify-self: start;
  }

  .admin-page .topbar-actions #whoami {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-page .topbar-locale .locale-switch,
  .admin-page .topbar-actions .btn {
    justify-content: center;
    width: 100%;
  }

  .admin-page .admin-workspace,
  .admin-page .site-footer {
    grid-column: 2;
  }

  .admin-page .site-footer {
    margin-top: 0;
  }
}

@media (min-width: 1280px) {
  .admin-page.is-projects-open .admin-workspace {
    align-items: start;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}

@media (min-width: 1320px) {
  .admin-page.is-detail-open .admin-workspace {
    align-items: start;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  }

  .admin-page.is-detail-open #tab-inbox .queue-panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
    position: sticky;
    top: 24px;
  }

  .admin-page.is-detail-open #tab-inbox .panel-header {
    margin-bottom: 12px;
  }

  .admin-page.is-detail-open #tab-inbox .panel-header p,
  .admin-page.is-detail-open #selection-hint {
    display: none;
  }

  .admin-page.is-detail-open #tab-inbox .inbox-filter-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-page.is-detail-open #tab-inbox .selection-actions .inline-actions {
    margin-left: 0;
    width: 100%;
  }

  .admin-page.is-detail-open #tab-inbox .selection-actions .btn {
    flex: 1 1 0;
    min-height: 36px;
    padding: 7px 10px;
  }

  .admin-page.is-detail-open #reports-list {
    min-height: 0;
    overflow-y: auto;
    padding-right: 3px;
  }

  .admin-page.is-detail-open .detail-back {
    display: none;
  }
}

@media (max-width: 1319px) {
  .admin-page.is-detail-open #tab-inbox {
    display: none !important;
  }

  .admin-page.is-projects-open .admin-workspace {
    display: grid;
    gap: 20px;
  }
}

@media (min-width: 721px) and (max-width: 1039px) {
  .admin-page .topbar {
    flex-wrap: wrap;
    position: static;
  }

  .admin-page .topbar-brand {
    order: 1;
  }

  .admin-page .global-project-filter {
    margin-left: auto;
    order: 2;
  }

  .admin-page .tab-nav {
    order: 3;
    overflow-x: auto;
    padding-bottom: 3px;
    width: 100%;
  }

  .admin-page .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    order: 4;
    width: 100%;
  }

  .admin-page .topbar-actions #whoami {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  .admin-page .topbar {
    position: static;
  }

  .admin-page .global-project-filter {
    width: 100%;
  }

  .admin-page .section-header-inline {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-page .section-header-inline .btn,
  .admin-page .review-dock .btn {
    width: 100%;
  }

  .admin-page .review-dock {
    grid-template-columns: 1fr;
  }
}
