:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #182033;
  --muted: #637083;
  --line: #dfe5ef;
  --accent: #19479f;
  --accent-soft: #e8fffe;
  --good: #0f9f6e;
  --warn: #c47f12;
}

* {
  box-sizing: border-box;
}

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

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  padding: 10px 14px;
}

button {
  background: var(--accent);
  color: #ffffff;
}

input,
select {
  background: #ffffff;
  color: var(--ink);
}

textarea {
  background: #ffffff;
  color: var(--ink);
  min-height: 42px;
  resize: vertical;
}

button:hover {
  filter: brightness(0.95);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 42px;
  background: linear-gradient(135deg, #101828, #1d4ed8);
  color: #ffffff;
}

.hero h1,
.hero-title {
  font-size: 56px;
  line-height: 1;
  margin: 6px 0 12px;
}

.hero-title {
  align-items: center;
  display: flex;
  font-weight: 300;
  gap: 18px;
  letter-spacing: -0.03em;
}

.hero-logo {
  display: block;
  flex-shrink: 0;
  height: auto;
  width: clamp(52px, 7vw, 72px);
}

.hero-brand-accent {
  color: #10e3ff;
  font-weight: 400;
}

.hero p {
  max-width: 780px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin: 0;
  text-transform: uppercase;
}

.hero .eyebrow,
.hero small {
  color: #10e3ff;
}

.status-card {
  align-self: end;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  padding: 20px;
}

.status-card strong,
.status-card small {
  display: block;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--warn);
}

.dot.ok {
  background: var(--good);
}

main {
  display: grid;
  gap: 20px;
  margin: 0 auto;
  max-width: 1280px;
  padding: 24px;
}

.nav {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.nav a {
  background: var(--accent-soft);
  border-radius: 999px;
  color: #19479f;
  font-weight: 700;
  padding: 8px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.nav a.active {
  background: var(--accent);
  color: #ffffff;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.two-col.page.active {
  display: grid;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 30px rgba(20, 31, 52, 0.06);
  padding: 24px;
}

.section-title {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 4px 0 0;
}

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

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

.field,
.card,
.event,
.message-box {
  background: #f9fbff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.field span,
.card span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}

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

.chip {
  background: var(--accent-soft);
  border-radius: 999px;
  color: #19479f;
  padding: 8px 12px;
}

.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card h3 {
  margin: 0 0 8px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.risk {
  color: var(--warn);
  font-weight: 700;
}

.score {
  background: var(--accent);
  border-radius: 999px;
  color: #ffffff;
  display: inline-block;
  font-weight: 800;
  padding: 6px 10px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.entity-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.entity-form button {
  min-height: 42px;
}

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

.detail-field {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  grid-template-columns: 190px minmax(0, 1fr);
}

.detail-field > span {
  color: var(--muted);
  font-weight: 700;
  padding-top: 10px;
}

.detail-field small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  margin-top: 4px;
}

.detail-field input,
.detail-field select,
.detail-field textarea {
  width: 100%;
}

.readonly-field {
  background: #f5f7fb;
  color: var(--ink);
  cursor: not-allowed;
}

.field-lock-note {
  color: #8a6a12;
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 4px;
}

.checkbox-field {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  min-height: 42px;
  padding: 10px 14px;
}

.checkbox-group {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.checkbox-field input {
  flex: 0 0 auto;
  cursor: pointer;
  width: auto;
}

.checkbox-field span {
  color: var(--ink);
}

.checkbox-field small,
.create-field small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  margin-top: 3px;
}

.create-field {
  display: grid;
  gap: 6px;
}

.create-field-wide {
  grid-column: 1 / -1;
}

.create-field-half {
  grid-column: span 1;
}

.create-field-spacer {
  grid-column: span 1;
}

.create-field > label {
  color: var(--muted);
  font-weight: 700;
}

.create-field textarea {
  width: 100%;
}

.create-field-days {
  align-items: center;
  display: grid;
  grid-template-columns: 260px minmax(120px, 220px) auto;
}

.create-field-days > label {
  padding-top: 0;
}

.create-field-days > small {
  display: none;
}

.input-suffix {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.input-suffix span {
  color: var(--muted);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr.clickable-row {
  cursor: pointer;
}

tbody tr.clickable-row:hover {
  background: var(--accent-soft);
}

.stage-select {
  min-width: 170px;
}

.related-section {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 22px;
}

.workflow-section {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 22px;
}

.workflow-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.workflow-actions button {
  flex: 0 0 auto;
}

.workflow-result {
  background: #f9fbff;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
}

.workflow-result h3,
.workflow-result h4 {
  margin: 0;
}

.workflow-result pre {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0;
  overflow-x: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.workflow-result button {
  justify-self: start;
}

.workflow-list {
  margin: 0;
  padding-left: 20px;
}

.workflow-list li {
  margin: 6px 0;
}

.nav-logout {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
}

.nav-session {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.nav-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
  max-width: 220px;
  text-align: right;
}

.nav-user-name {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.nav-user-email {
  color: var(--muted);
  font-size: 11px;
}

.nav-authenticated {
  align-items: center;
}

.auth-page {
  min-height: 420px;
}

.page.auth-page.active {
  align-items: center;
  display: grid;
  justify-items: center;
}

.auth-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-form label {
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.auth-form input {
  width: 100%;
}

.auth-error {
  color: #a53454;
}

.manager-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 180px;
  white-space: nowrap;
}

.manager-row-editing input[type="email"],
.manager-row-editing input[type="text"] {
  min-width: 120px;
  width: 100%;
}

.manager-checkbox-cell {
  text-align: center;
}

.manager-checkbox {
  align-items: center;
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  justify-content: center;
}

.section-lead {
  margin: 6px 0 0;
  max-width: 640px;
}

.procurement-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 280px;
}

.progress-step {
  background: #f5f7fb;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.progress-step.done {
  background: #eef8f4;
  border-color: #b8e6cc;
  color: #1e6f42;
}

.progress-step.current {
  background: #eef3ff;
  border-color: #19479f;
  box-shadow: 0 0 0 1px #19479f inset;
  color: #19479f;
}

.progress-step.escalated {
  background: #fff8e6;
  border-color: #f0dfa8;
  color: #8a6a12;
}

.procurement-progress-status {
  display: block;
  margin-top: 6px;
}

.workflow-progress {
  margin-bottom: 16px;
}

.workflow-progress .procurement-progress {
  min-width: 0;
}

#vendor-email-section {
  display: none;
}

.communications-filters {
  display: grid;
  gap: 12px 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 16px;
}

.communications-filters label {
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.communications-filters select {
  width: 100%;
}

.communications-inbox {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  grid-template-columns: minmax(300px, 34%) minmax(0, 1fr);
  min-height: 560px;
  overflow: hidden;
}

.communications-thread-list {
  background: #f8fafc;
  border-right: 1px solid var(--line);
  max-height: 72vh;
  overflow-y: auto;
}

.communications-thread-item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: block;
  padding: 14px 16px;
  text-align: left;
  width: 100%;
}

.communications-thread-item:hover {
  background: #ffffff;
}

.communications-thread-item.active {
  background: #ffffff;
  box-shadow: inset 3px 0 0 #19479f;
}

.communications-thread-item-top {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.communications-thread-subject {
  color: var(--ink);
  display: block;
  font-size: 14px;
  line-height: 1.35;
}

.communications-thread-date {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 11px;
  white-space: nowrap;
}

.communications-thread-parties {
  color: #19479f;
  font-size: 12px;
  font-weight: 700;
  margin: 6px 0 4px;
}

.communications-thread-preview {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 0 0 8px;
}

.communications-thread-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.communications-channel-badge {
  background: var(--accent-soft);
  border-radius: 999px;
  color: #19479f;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
}

.communications-thread-view {
  background: #ffffff;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: 72vh;
  min-height: 560px;
}

.communications-reading-header {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 18px 20px 14px;
}

.communications-reading-title h3 {
  margin: 4px 0 0;
}

.communications-reading-badges {
  align-items: start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.communications-messages {
  display: grid;
  gap: 14px;
  overflow-y: auto;
  padding: 18px 20px 24px;
}

.communications-message-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.communications-message-route {
  margin: 4px 0 8px;
}

.communications-empty {
  padding: 24px 20px;
}

@media (max-width: 960px) {
  .communications-inbox {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .communications-thread-list,
  .communications-thread-view {
    max-height: none;
    min-height: 320px;
  }
}

.table-link {
  color: #19479f;
  font-weight: 700;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.thread-procurement-link a {
  color: #19479f;
  font-weight: 700;
  text-decoration: none;
}

.thread-procurement-link a:hover {
  text-decoration: underline;
}

.workflow-step-next {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 14px;
}

.rfq-preview-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 12px;
}

.rfq-preview-block {
  display: grid;
  gap: 8px;
}

.rfq-preview-lang {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workflow-rfq-send {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.rfq-channel-picker {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.rfq-channel-picker-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.rfq-channel-option {
  align-items: center;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  padding: 8px 14px;
}

.rfq-channel-option input {
  margin: 0;
}

.rfq-channel-empty {
  margin: 0;
}

.consolidated-section {
  margin-top: 18px;
}

.consolidated-table-wrap {
  margin-top: 12px;
}

.consolidated-table {
  min-width: 1180px;
}

.consolidated-table td,
.consolidated-table th {
  font-size: 13px;
  max-width: 220px;
  white-space: normal;
}

.consolidated-docs {
  min-width: 180px;
}

.consolidated-actions {
  min-width: 148px;
  text-align: right;
  white-space: nowrap;
}

.consolidated-actions button {
  font-size: 12px;
  padding: 6px 10px;
}

.invoice-request-sent {
  display: inline-block;
  font-weight: 700;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.admin-tab {
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  color: #19479f;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
}

.admin-tab.active {
  background: #19479f;
  color: #ffffff;
}

.admin-panel {
  margin-top: 8px;
}

.admin-form {
  max-width: 920px;
}

.admin-form-grid {
  display: grid;
  gap: 12px 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-form-wide {
  grid-column: 1 / -1;
}

.admin-form-grid label,
.admin-task-form label {
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.admin-form-grid input,
.admin-form-grid select,
.admin-task-form input,
.admin-task-form select,
.admin-task-form textarea {
  width: 100%;
}

.admin-checkbox {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  gap: 8px;
}

.admin-inline-form {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 16px;
  padding: 16px;
}

.admin-subsection-title {
  margin-top: 0;
}

.admin-task-list {
  display: grid;
  gap: 14px;
}

.admin-task-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

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

.admin-task-head h3 {
  margin: 0 0 4px;
}

.admin-task-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 14px;
  margin-top: 12px;
}

.admin-task-card-editing {
  background: #f8fafc;
}

.admin-table td,
.admin-table th {
  font-size: 13px;
  vertical-align: top;
}

.doc-chip {
  border-radius: 6px;
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  margin: 0 3px 3px 0;
  padding: 3px 6px;
  white-space: nowrap;
}

.doc-chip.yes {
  background: #e8f8ef;
  border: 1px solid #b8e6cc;
  color: #1e6f42;
}

.doc-chip.promised {
  background: #fff8e6;
  border: 1px solid #f0dfa8;
  color: #8a6a12;
}

.doc-chip.no {
  background: #fdecef;
  border: 1px solid #f5c6d0;
  color: #a53454;
}

.doc-chip.unknown {
  background: #eef3ff;
  border: 1px solid #cfe0ff;
  color: #19479f;
}

.doc-chip.na {
  background: #f5f7fb;
  border: 1px solid var(--line);
  color: var(--muted);
}

.email-threads {
  display: grid;
  gap: 12px;
}

.email-thread {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.email-thread-header {
  align-items: start;
  cursor: pointer;
  display: grid;
  gap: 12px 16px;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 38%) auto;
  list-style: none;
}

.email-thread-summary-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.thread-field-preview {
  align-content: start;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 5px;
}

.thread-field-chip {
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  padding: 3px 6px;
  white-space: nowrap;
}

.thread-field-chip.collected {
  background: #e8f8ef;
  border: 1px solid #b8e6cc;
  color: #1e6f42;
}

.thread-field-chip.missing {
  background: #fdecef;
  border: 1px solid #f5c6d0;
  color: #a53454;
}

.thread-field-chip.promised {
  background: #fff8e6;
  border: 1px solid #f0dfa8;
  color: #8a6a12;
}

@media (max-width: 720px) {
  .email-thread-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .thread-field-preview {
    grid-column: 1 / -1;
  }
}

.email-thread-header::-webkit-details-marker {
  display: none;
}

.email-vendor-identity {
  align-items: center;
  display: flex;
  gap: 12px;
}

.email-country-badge {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid #cfe0ff;
  border-radius: 14px;
  display: grid;
  min-width: 92px;
  padding: 8px 10px;
  text-align: center;
}

.email-flag-image {
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(20, 31, 52, 0.16);
  display: block;
  height: 26px;
  margin: 0 auto 5px;
  object-fit: cover;
  width: 40px;
}

.email-flag-fallback {
  color: var(--ink);
  display: block;
  font-size: 13px;
  font-weight: 900;
  line-height: 26px;
  margin: 0 0 5px;
}

.email-country-badge small {
  color: #19479f;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.email-vendor-name {
  color: var(--ink);
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.email-vendor-email {
  color: #19479f;
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
}

.email-thread-header h4 {
  margin: 0;
}

.thread-status-summary {
  margin-top: 2px;
}

.email-thread-toggle {
  background: var(--accent-soft);
  border-radius: 999px;
  color: #19479f;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.email-thread[open] .email-thread-toggle {
  background: #eef8f4;
  color: var(--good);
}

.email-thread[open] .email-thread-toggle::before {
  content: "Свернуть";
}

.email-thread[open] .email-thread-toggle {
  font-size: 0;
}

.email-thread[open] .email-thread-toggle::before {
  font-size: 12px;
}

.email-thread-header > span,
.email-message span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.email-messages {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.thread-analysis {
  background: #ffffff;
  border: 1px dashed var(--line);
  border-radius: 12px;
  display: grid;
  gap: 6px;
  padding: 12px;
}

.thread-analysis > div,
.thread-analysis-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.thread-analysis-actions .email-reanalyze-btn {
  font-size: 12px;
  margin-left: auto;
  padding: 6px 10px;
}

.thread-analysis span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.analysis-badge {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
}

.analysis-badge.complete {
  background: #eef8f4;
  color: var(--good);
}

.analysis-badge.missing,
.analysis-badge.no_reply {
  background: #fff7e8;
  color: var(--warn);
}

.analysis-badge.pending {
  background: var(--accent-soft);
  color: #19479f;
}

.analysis-badge.waiting {
  background: #f3f4f6;
  color: #475467;
}

.analysis-badge.ai-badge {
  background: #f4ebff;
  color: #6941c6;
}

.thread-analysis-waiting .waiting-message {
  font-weight: 700;
  margin: 0;
}

.missing-fields {
  color: var(--warn);
  margin: 0;
}

.email-message {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px;
}

.email-message.inbound {
  border-left-color: var(--good);
}

.email-message.follow-up-draft {
  background: #fffdf5;
  border-left-color: var(--warn);
}

.follow-up-composer {
  background: #fffdf5;
  border: 1px solid #f0df9a;
  border-radius: 12px;
  display: grid;
  gap: 12px;
  margin: 12px 0 16px;
  padding: 16px;
}

.follow-up-composer-sent {
  background: #f8fbff;
  border-color: var(--line);
}

.follow-up-composer-header h4 {
  margin: 0 0 4px;
}

.follow-up-field {
  display: grid;
  gap: 6px;
}

.follow-up-field-wide {
  grid-column: 1 / -1;
}

.follow-up-field span {
  color: var(--muted);
  font-size: 0.85rem;
}

.follow-up-field input,
.follow-up-field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  padding: 10px 12px;
  width: 100%;
}

.follow-up-field textarea {
  min-height: 220px;
  resize: vertical;
}

.follow-up-composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.follow-up-edited-note {
  color: var(--warn);
}

.follow-up-field.is-hidden {
  display: none;
}

.follow-up-composer-sent .follow-up-composer-actions {
  margin-top: 0.75rem;
}

.email-thread-follow-up > summary {
  border-left: 3px solid var(--warn);
}

.email-message pre {
  background: #f9fbff;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 8px 0 0;
  overflow-x: auto;
  padding: 10px;
  white-space: pre-wrap;
}

.email-attachments {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.email-attachment-badge {
  background: #eef4ff;
  border: 1px solid #c7d7fe;
  border-radius: 999px;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
}

.email-attachment-item {
  align-items: center;
  background: #f9fbff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
}

.email-attachment-name {
  font-size: 13px;
  font-weight: 700;
}

.email-attachment-item a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.email-attachment-item a:hover {
  text-decoration: underline;
}

.event pre,
.message-box pre {
  overflow-x: auto;
  white-space: pre-wrap;
}

.modal {
  align-items: center;
  background: rgba(16, 24, 40, 0.55);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 20;
}

.modal.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.28);
  max-height: 90vh;
  max-width: 980px;
  overflow: auto;
  padding: 24px;
  width: 100%;
}

.form-actions {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.secondary {
  background: #ffffff;
  color: var(--ink);
}

@media (max-width: 860px) {
  .hero,
  .two-col {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 28px;
  }
}
