:root {
  color-scheme: light;
  --navy: #0b2d52;
  --green: #2fa84f;
  --green-dark: #2e7d45;
  --green-light: #8bcb8a;
  --green-wash: #edf7ee;
  --page: #f8faf8;
  --text: #1f2937;
  --muted: #66736b;
  --border: #dce6dd;
  --surface: #ffffff;
  font-family: "Lato", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; background: var(--page); }

a { color: var(--green-dark); }

.site-header {
  height: 68px;
  display: flex;
  align-items: center;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 36px;
}

.brand {
  display: flex;
  width: 184px;
  height: 54px;
  align-items: center;
  overflow: hidden;
  text-decoration: none;
}
.brand img { display: block; width: 184px; height: 92px; object-fit: contain; }

.site-nav { display: flex; align-self: stretch; gap: 6px; }
.user-menu { margin-left: auto; min-width: 32px; }
.site-nav a {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.site-nav a:hover, .site-nav a.active { color: var(--green-dark); border-bottom-color: var(--green); }

.container { max-width: 1120px; margin: 0 auto; padding: 56px 24px; }
.auth-page { display: grid; grid-template-columns: 1fr minmax(320px, 420px); align-items: start; gap: 72px; max-width: 920px; margin: 24px auto; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.heading-actions, .detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1 { margin: 4px 0 8px; color: var(--navy); font-size: clamp(30px, 4vw, 42px); letter-spacing: -.04em; }
h2 { margin: 12px 0 6px; }
.eyebrow { margin: 0; color: var(--green-dark); font-size: 13px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.subtitle { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.6; }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.dashboard-section { margin-top: 44px; }
.dashboard-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 620px;
  margin-top: 36px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 7px 24px rgba(11, 45, 82, .06);
}
.dashboard-tabs a {
  position: relative;
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 22px;
  color: var(--muted);
  border-radius: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  transition: color .18s ease, background-color .18s ease;
}
.dashboard-tabs a::after {
  position: absolute;
  right: 22px;
  bottom: 0;
  left: 22px;
  height: 3px;
  background: var(--green);
  border-radius: 3px 3px 0 0;
  content: "";
  opacity: 0;
  transform: scaleX(.55);
  transition: opacity .18s ease, transform .18s ease;
}
.dashboard-tabs a:hover { color: var(--navy); background: #f7faf7; }
.dashboard-tabs a.active { color: var(--navy); background: var(--green-wash); }
.dashboard-tabs a.active::after { opacity: 1; transform: scaleX(1); }
.dashboard-tabs .tab-count {
  min-width: 25px;
  padding: 3px 7px;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid #d5e9d8;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}
.dashboard-tabs + .dashboard-section { margin-top: 32px; }
.table-filters { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.filter-field { min-width: 190px; }
.filter-field.filter-search { width: min(420px, 100%); }
.filter-field label { margin: 0 0 7px; }
.clear-filter { min-height: 36px; display: inline-flex; align-items: center; padding: 0 6px; font-size: 14px; font-weight: 700; }
.dashboard-table code { color: #526158; font-size: 12px; overflow-wrap: anywhere; }
.compact-empty { padding: 36px 24px; }
.compact-empty p { margin: 0; }
.pagination { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.pagination-links { display: flex; align-items: center; gap: 12px; }
.access-grid { align-items: start; }
.pending-admins { margin-top: 20px; }
.stat-card {
  display: flex;
  min-height: 210px;
  padding: 28px;
  flex-direction: column;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(24, 35, 62, .05);
  text-decoration: none;
}
.stat-card > span { color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-card strong { margin: 18px 0; font-size: 64px; line-height: 1; letter-spacing: -.06em; }
.stat-card small { margin-top: auto; color: var(--muted); font-size: 14px; }
a.stat-card:hover { border-color: var(--green-light); box-shadow: 0 12px 34px rgba(46, 125, 69, .12); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--green);
  border-radius: 9px;
  color: #fff;
  background: var(--green);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: var(--green-dark); border-color: var(--green-dark); }
.button.secondary { color: #344054; background: #fff; border-color: #d8dce6; }
.button.danger { color: #fff; background: #b42318; border-color: #b42318; }
.button.danger:hover { background: #912018; }

.channel-options { max-width: 620px; }
.channel-option { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 22px; }
.channel-option form { grid-column: 2; }
.channel-option .field-hint { grid-column: 2; }
.channel-icon { display: grid; width: 64px; height: 64px; place-items: center; color: var(--green-dark); background: var(--green-wash); border: 1px solid #cde6d1; border-radius: 14px; font-size: 28px; }
.channels-section { margin-top: 12px; }
.channel-inbox-form { display: flex; align-items: end; gap: 12px; margin-top: 24px; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.channel-inbox-form > div { flex: 1; }
.channel-inbox-form label { margin-top: 0; }
.channel-inbox-form .button { flex: 0 0 auto; }
.mailbox-page { max-width: 940px; margin: 0 auto; }
.mailbox-heading { align-items: center; }
.mailbox-table-wrap { overflow-x: auto; }
.mailbox-table { min-width: 760px; table-layout: fixed; }
.mailbox-table tbody tr:hover { background: #f7faf7; }
.mailbox-table th, .mailbox-table td { padding: 15px 16px; vertical-align: middle; }
.mailbox-sender-column { width: 245px; }
.mailbox-event-column { width: 175px; }
.mailbox-date-column { width: 118px; }
.message-avatar { display: grid; width: 44px; height: 44px; place-items: center; color: var(--green-dark); background: var(--green-wash); border-radius: 50%; font-weight: 800; }
.mailbox-correspondent { display: flex; min-width: 0; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.mailbox-correspondent > span:last-child, .mailbox-subject { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.mailbox-correspondent strong, .mailbox-correspondent small, .mailbox-subject strong, .mailbox-subject small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-correspondent strong { text-transform: capitalize; }
.mailbox-correspondent small, .mailbox-subject small, .mailbox-date { color: var(--muted); font-size: 13px; }
.mailbox-subject { color: var(--text); text-decoration: none; }
.mailbox-subject strong { color: var(--navy); }
.mailbox-correspondent:hover strong, .mailbox-subject:hover strong { color: var(--green-dark); }
.thread-count { display: inline-flex; min-width: 21px; margin-left: 5px; padding: 1px 6px; justify-content: center; color: var(--muted); background: #edf1ed; border-radius: 999px; font-size: 11px; }
.event-label { display: inline-flex; max-width: 100%; padding: 5px 9px; overflow: hidden; color: var(--green-dark); background: var(--green-wash); border: 1px solid #cde6d1; border-radius: 999px; font-size: 12px; font-weight: 750; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.no-event { color: var(--muted); }
.thread-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.thread-timeline { display: flex; flex-direction: column; gap: 16px; }
.thread-message { padding: 24px; }
.thread-message.outbound { margin-left: 46px; border-left: 4px solid var(--green); }
.thread-message.inbound { margin-right: 46px; }
.thread-message-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
.thread-message-header div { display: flex; flex-direction: column; gap: 3px; }
.thread-message-header span, .thread-message-header time { color: var(--muted); font-size: 13px; }
.thread-message .letter-body { padding-top: 18px; }
.thread-reply-card { margin-top: 24px; }
.thread-reply-card h2 { margin: 6px 0; color: var(--navy); }
.thread-reply-notice { margin-top: 24px; margin-bottom: 0; }
.direction-pill { display: inline-flex; padding: 4px 8px; color: var(--green-dark); background: var(--green-wash); border-radius: 999px; font-size: 12px; font-weight: 750; }
.direction-pill.outbound { color: var(--navy); background: #eef3f8; }
.compose-body { min-height: 220px; }
.letter-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.letter-addresses { margin: 28px 0; padding: 18px 0; border-block: 1px solid var(--border); }
.letter-addresses div { display: grid; grid-template-columns: 60px 1fr; padding: 4px 0; }
.letter-addresses dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.letter-addresses dd { margin: 0; overflow-wrap: anywhere; }
.letter-body { line-height: 1.7; }

.step-label { margin: 28px 0 8px; color: var(--green-dark); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.mapping-grid { display: grid; grid-template-columns: minmax(140px, .8fr) minmax(0, 1fr) 110px; align-items: center; gap: 12px; margin-bottom: 10px; }
.source-path { min-width: 0; overflow-wrap: anywhere; }
.mapping-heading { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.check-label { display: flex; align-items: center; gap: 7px; margin: 0; }
.check-label input { width: auto; }
.credential-reveal { margin: 24px 0; padding: 20px; color: #174629; background: var(--green-wash); border: 1px solid var(--green-light); border-radius: 12px; }
.credential-reveal p { margin: 6px 0 12px; }.credential-reveal code { display: block; padding: 12px; overflow-wrap: anywhere; background: #fff; border-radius: 8px; }
.detail-card { padding: 24px; }.detail-card pre { overflow: auto; white-space: pre-wrap; }.detail-card dl { margin-bottom: 0; }.detail-card dt { margin-top: 14px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }.detail-card dd { margin: 4px 0; }
.status-pill { display: inline-flex; padding: 5px 9px; color: var(--navy); background: #eef3f8; border-radius: 999px; font-size: 12px; font-weight: 800; }.status-pill.success { color: #17663a; background: #eaf8f0; }.status-pill.failed { color: #912018; background: #fff1f0; }
.inline-form { display: flex; gap: 10px; }.inline-form input { flex: 1; }.error-text { color: #912018; }
.compact-button { min-height: 34px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
.schema-catalog { width: 100%; }
.schema-object-section + .schema-object-section { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--border); }
.schema-object-section h3 { color: var(--navy); }
.schema-modal { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 80px rgba(11, 45, 82, .25); }
.schema-modal::backdrop { background: rgba(11, 45, 82, .48); backdrop-filter: blur(2px); }
.schema-modal-card { padding: 28px; }
.schema-modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.schema-modal-heading h2 { margin-top: 4px; color: var(--navy); }
.modal-close { width: 36px; height: 36px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 8px; font-size: 28px; cursor: pointer; }
.modal-close:hover { color: var(--navy); background: var(--green-wash); }

.card, .form-card {
  overflow: hidden;
  border: 1px solid #e2e5ed;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(24, 35, 62, .05);
}

.notice, .errors {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 9px;
}

.notice { color: #17663a; background: #eaf8f0; border: 1px solid #bee8cf; }
.errors { color: #912018; background: #fff1f0; border: 1px solid #fac9c5; }
.errors ul { margin-bottom: 0; padding-left: 20px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 17px 20px; text-align: left; border-bottom: 1px solid #eceef3; }
th { color: #697386; background: #fafbfc; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.organization-name { color: #172033; font-weight: 700; }

.organization-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  background: #fff;
}

.organization-card {
  display: flex;
  min-width: 0;
  padding: 28px;
  align-items: flex-start;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e2e5ed;
  border-bottom: 1px solid #e2e5ed;
}

.organization-card h2 {
  margin: 18px 0 24px;
  overflow-wrap: anywhere;
  font-size: 20px;
  letter-spacing: -.02em;
}

.organization-card .button { width: 100%; margin-top: auto; }

.organization-logo {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 1px solid #e2e5ed;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
}

.organization-logo.fallback {
  display: grid;
  place-items: center;
  color: var(--green-dark);
  background: var(--green-wash);
  border-color: #cde6d1;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.empty-state { padding: 72px 24px; text-align: center; }
.empty-state p { margin: 0 0 24px; color: #697386; }
.empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--green-dark);
  background: var(--green-wash);
  font-weight: 800;
}

.form-page { max-width: 650px; margin: 0 auto; }
.detail-page { max-width: 760px; margin: 0 auto; }
.detail-page.contacts-page { max-width: 980px; }
.select-column { width: 44px; }
.table-secondary { color: #697386; font-size: 13px; }
.timeline { position: relative; }
.timeline-item { display: grid; grid-template-columns: 20px 1fr; gap: 14px; position: relative; padding-bottom: 22px; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 2px; background: #dce8de; }
.timeline-marker { width: 14px; height: 14px; margin-top: 5px; border-radius: 50%; background: #2fa84f; position: relative; z-index: 1; }
.timeline-content { padding: 0 0 4px; }
.timeline-content h3 { margin: 3px 0 8px; font-size: 18px; }
.timeline-content p { margin: 6px 0; }
.timeline-date { color: #697386; font-size: 13px; }
.back-link { display: inline-block; margin-bottom: 20px; color: #596274; text-decoration: none; }
.form-card { padding: 36px; }
.form-card form { margin-top: 28px; }
label { display: block; margin: 18px 0 7px; font-size: 14px; font-weight: 700; }
.optional { color: #838b9b; font-weight: 500; }
.field-hint { margin: 7px 0 0; color: #697386; font-size: 13px; line-height: 1.5; }
input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid #cfd4df;
  border-radius: 8px;
  color: #172033;
  background: #fff;
  font: inherit;
}
textarea {
  width: 100%;
  min-height: 112px;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid #cfd4df;
  border-radius: 8px;
  color: #172033;
  background: #fff;
  font: inherit;
}
input:focus, textarea:focus { outline: 3px solid #d7ecd9; border-color: var(--green); }
select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #cfd4df; border-radius: 8px; background: #fff; font: inherit; }
select:focus { outline: 3px solid #d7ecd9; border-color: var(--green); }
@media (max-width: 720px) { .auth-page { grid-template-columns: 1fr; gap: 32px; } .site-header { gap: 12px; } }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 30px; }
.details { margin: 30px 0 0; }
.details div { padding: 18px 0; border-bottom: 1px solid #eceef3; }
.details dt { color: #697386; font-size: 13px; font-weight: 700; text-transform: uppercase; }
.details dd { margin: 7px 0 0; font-size: 17px; }
.detail-identity { display: flex; align-items: center; gap: 18px; min-width: 0; }
.detail-identity h1 { overflow-wrap: anywhere; }
.detail-logo { width: 72px; height: 72px; flex-basis: 72px; }
.url-value { overflow-wrap: anywhere; }
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 32px;
  padding: 20px;
  border: 1px solid #fac9c5;
  border-radius: 10px;
  background: #fff8f7;
}
.danger-zone p { margin: 5px 0 0; color: #697386; font-size: 14px; }
.intakes-section { margin-top: 36px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 5px 0 0; font-size: 24px; }
.copy-field { display: flex; align-items: center; gap: 10px; }
.copy-field code { color: #344054; overflow-wrap: anywhere; word-break: break-all; }
.intake-description { margin: 10px 0 0; color: #697386; line-height: 1.5; }
.intake-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.request-count {
  padding: 6px 10px;
  flex: 0 0 auto;
  color: var(--green-dark);
  background: var(--green-wash);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}
.intake-actions { display: flex; gap: 8px; margin-top: 18px; }
.intake-actions form { margin: 0; }
.button.compact { min-height: 36px; padding: 0 12px; font-size: 13px; }
.token-panel, .requests-panel { margin-top: 28px; }
.token-errors { margin: 16px 0 0; }
.token-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
  padding: 20px;
  background: #fff;
  border: 1px solid #e2e5ed;
  border-radius: 12px;
}
.token-form label { margin-top: 0; }
.copy-button {
  padding: 7px 10px;
  flex: 0 0 auto;
  color: var(--green-dark);
  background: var(--green-wash);
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.empty-inline { padding: 24px; color: #697386; background: #fff; border: 1px dashed #cfd4df; border-radius: 12px; }
.empty-inline p { margin: 0; }
.request-link {
  padding: 0;
  color: var(--green-dark);
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 750;
  text-decoration: underline;
  cursor: pointer;
}
.status-pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  color: #596274;
  background: #f0f1f5;
  font-size: 12px;
  font-weight: 750;
}
.status-pill.stored { color: #17663a; background: #eaf8f0; }
.status-pill.failed { color: #912018; background: #fff1f0; }
.status-pill.processed, .status-pill.active, .status-pill.completed { color: #17663a; background: #eaf8f0; }
.status-pill.published { color: #17663a; background: #eaf8f0; }
.status-pill.draft { color: #8a4b08; background: #fff4df; }
.status-pill.awaiting_mapping, .status-pill.mapping_review_required, .status-pill.testing { color: #8a4b08; background: #fff4df; }
.mapping-page { max-width: 1320px; margin: 0 auto; }
.mapping-form { display: grid; gap: 20px; }
.mapping-form .form-card { padding: 24px; }
.mapping-table { margin: 20px 0; }
.mapping-table th, .mapping-table td { padding: 13px 12px; }
.mapping-table code, .fingerprint { overflow-wrap: anywhere; font: 12px/1.5 ui-monospace, monospace; }
.example-value { max-width: 180px; overflow-wrap: anywhere; color: #596274; font-size: 13px; }
input.checkbox { width: 18px; height: 18px; }
.defaults-card h2 { margin-top: 0; }
.default-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.workflow-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.workflow-actions form { margin: 0; }
.workflow-actions button:disabled { opacity: .45; cursor: not-allowed; }
.publish-workflow { margin-top: 24px; }
.publish-workflow .workflow-actions { margin-bottom: 0; }
.publish-checklist { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 18px 0 0; padding-left: 22px; color: #6b7280; }
.publish-checklist .complete { color: #17663a; }
.result-panel { margin-top: 24px; }
.json-panel { overflow: auto; padding: 20px; color: #f3f8f4; background: var(--navy); border-radius: 10px; font: 13px/1.6 ui-monospace, monospace; white-space: pre-wrap; }
.result-counts { display: flex; flex-wrap: wrap; gap: 16px; margin: 18px 0; }
.result-counts > * { padding: 10px 14px; background: var(--green-wash); border-radius: 8px; }
.schema-page { max-width: 1050px; margin: 0 auto; }
.schema-fields { display: grid; gap: 12px; }
.schema-field { padding: 0; }
.schema-field summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; cursor: pointer; }
.schema-field summary span { display: flex; align-items: center; gap: 14px; }
.schema-field summary code { color: #596274; font-size: 13px; }
.schema-field-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; padding: 0 24px 24px; border-top: 1px solid #eceef3; }
.schema-field-form fieldset { grid-column: 1 / -1; margin-top: 18px; padding: 14px; border: 1px solid #e2e5ed; border-radius: 9px; }
.schema-field-form legend { padding: 0 6px; font-size: 14px; font-weight: 700; }
.schema-field-form .form-actions { grid-column: 1 / -1; }
.schema-checkbox { display: flex; align-items: center; gap: 8px; }
.schema-checkbox input { width: 18px; height: 18px; }
.transformation-options { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.transformation-options .schema-checkbox { margin: 4px 0; font-weight: 500; }
.field-delete-form { padding: 0 24px 24px; }
.field-details { display: flex; gap: 40px; margin: 0; padding: 0 24px 24px; }
.field-details dt { color: #697386; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.field-details dd { margin: 4px 0 0; }
.add-field-card { margin-top: 24px; }
.add-field-card h2 { margin-top: 0; }
.add-field-card .schema-field-form { padding: 0; border: 0; }
.schema-version-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.schema-version-actions form { margin: 0; }
.request-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  color: var(--text);
  background: #fff;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(23, 32, 51, .3);
}
.request-modal::backdrop { background: rgba(11, 45, 82, .55); }
.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px;
  border-bottom: 1px solid #e2e5ed;
}
.modal-heading h2 { margin: 5px 0 0; }
.modal-close {
  width: 38px;
  height: 38px;
  color: #596274;
  background: #f0f1f5;
  border: 0;
  border-radius: 50%;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.modal-content { padding: 26px; overflow: auto; }
.modal-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0 0 24px; }
.modal-details div { padding: 14px; background: #f8f9fb; border-radius: 9px; }
.modal-details dt { color: #697386; font-size: 12px; font-weight: 750; text-transform: uppercase; }
.modal-details dd { margin: 5px 0 0; overflow-wrap: anywhere; }
.modal-content h3 { margin: 0 0 10px; font-size: 14px; }
.modal-content pre {
  max-height: 380px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: #e8edf7;
  background: var(--navy);
  border-radius: 10px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 680px) {
  .site-header { height: 60px; padding: 0 16px; }
  .site-header { gap: 12px; }
  .brand { width: 142px; height: 48px; }
  .brand img { width: 142px; height: 71px; }
  .site-nav { margin-left: auto; }
  .site-nav a { padding: 0 7px; font-size: 13px; }
  .container { padding: 36px 16px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .heading-actions { align-items: stretch; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  tbody tr {
    padding: 8px 18px;
    border-bottom: 1px solid #e2e5ed;
  }
  tbody tr:last-child { border-bottom: 0; }
  td, tbody tr:last-child td {
    display: grid;
    grid-template-columns: minmax(90px, .65fr) minmax(0, 1.35fr);
    gap: 12px;
    padding: 11px 0;
    overflow-wrap: anywhere;
    border-bottom: 1px solid #f0f1f5;
  }
  td:last-child, tbody tr:last-child td:last-child { border-bottom: 0; }
  td::before {
    content: attr(data-label);
    color: #697386;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .05em;
    text-transform: uppercase;
  }
  .form-card { padding: 24px; }
  .detail-heading { align-items: stretch; flex-direction: column; }
  .detail-heading .button,
  .detail-heading form,
  .detail-heading form .button { width: 100%; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone .button { width: 100%; }
  .organization-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .dashboard-tabs { max-width: none; margin-top: 28px; }
  .dashboard-tabs a { min-height: 50px; padding-inline: 10px; }
  .dashboard-tabs a::after { right: 12px; left: 12px; }
  .table-filters { align-items: stretch; flex-direction: column; }
  .filter-field, .filter-field.filter-search { width: 100%; }
  .table-filters .button { width: 100%; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination-links { justify-content: space-between; }
  .stat-card { min-height: 170px; }
  .stat-card strong { font-size: 52px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading .button { width: 100%; }
  .token-form { grid-template-columns: 1fr; }
  .token-form .button { width: 100%; }
  .intake-summary { align-items: flex-start; flex-direction: column; }
  .modal-details { grid-template-columns: 1fr; }
  .schema-field-form { grid-template-columns: 1fr; }
  .schema-field-form fieldset, .schema-field-form .form-actions { grid-column: 1; }
  .schema-field summary, .schema-field summary span { align-items: flex-start; flex-direction: column; }
  .organization-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 0 16px;
    padding: 20px;
    border-right: 0;
  }
  .organization-card:last-child { border-bottom: 0; }
  .organization-card .organization-logo { grid-row: 1 / span 2; width: 56px; height: 56px; flex-basis: 56px; }
  .organization-card h2 { margin: 2px 0 14px; font-size: 18px; }
  .organization-card .button { grid-column: 2; width: auto; justify-self: start; min-height: 40px; }
  .channel-inbox-form { align-items: stretch; flex-direction: column; }
  .channel-inbox-form .button { width: 100%; }
  .mailbox-table { min-width: 0; table-layout: auto; }
  .mailbox-table colgroup, .mailbox-table thead { display: none; }
  .mailbox-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; }
  .mailbox-table td, .mailbox-table tbody tr:last-child td { display: block; padding: 4px 0; border: 0; }
  .mailbox-table td::before { display: none; }
  .mailbox-table td:nth-child(1), .mailbox-table td:nth-child(2) { grid-column: 1 / -1; }
  .mailbox-table td:nth-child(3) { grid-column: 1; }
  .mailbox-table td:nth-child(4) { grid-column: 2; align-self: center; }
  .mailbox-table .message-avatar { width: 38px; height: 38px; }
  .thread-heading { align-items: flex-start; flex-direction: column; }
  .thread-message.outbound, .thread-message.inbound { margin-inline: 0; }
  .thread-message-header { flex-direction: column; }
}

@media (max-width: 440px) {
  .container { padding-top: 28px; }
  h1 { font-size: 32px; }
  .form-card { padding: 22px 18px; }
  .detail-identity { align-items: flex-start; }
  .detail-logo { width: 56px; height: 56px; flex-basis: 56px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .details dd { overflow-wrap: anywhere; }
  .brand { width: 42px; }
  .brand img { width: 142px; max-width: none; object-position: left center; }
}

/* Brand-wide neutral and surface treatment. */
.card, .form-card, .organization-card, .token-form { border-color: var(--border); background: var(--surface); }
.organization-grid { background: var(--surface); }
.organization-name, input, textarea { color: var(--text); }
.button.secondary { color: var(--navy); border-color: var(--border); background: var(--surface); }
.button.secondary:hover { color: var(--green-dark); border-color: var(--green-light); background: var(--green-wash); }
th { color: var(--muted); background: #f3f7f3; }
th, td, .details div, .schema-field-form { border-color: #e6ede7; }
.empty-state p, .field-hint, .intake-description, .danger-zone p,
.details dt, .field-details dt, .modal-details dt { color: var(--muted); }
.back-link, .example-value, .schema-field summary code, .copy-field code { color: #526158; }
input, textarea, select { border-color: #cbd8cd; }
.status-pill.stored, .status-pill.processed, .status-pill.active,
.status-pill.completed, .status-pill.published { color: var(--green-dark); background: var(--green-wash); }
