:root {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --line: #dfe4e1;
  --line-soft: #edf0ee;
  --text: #1f2937;
  --muted: #667085;
  --brand: #3f9470;
  --brand-dark: #1f674b;
  --brand-soft: #edf7f1;
  --success: #18794e;
  --warning: #a15c00;
  --danger: #b42318;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

button:disabled,
button:disabled:hover {
  cursor: not-allowed;
  opacity: 0.5;
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface);
}

button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

button.primary:hover {
  background: var(--brand-dark);
  color: #fff;
}

button.secondary {
  background: #f2f4f7;
  border-color: #cfd6e2;
  color: #475467;
}

button.secondary:hover {
  background: #e9edf3;
  border-color: #b8c2d1;
  color: #344054;
}

button.danger {
  color: var(--danger);
  border-color: #f0b8b3;
}

button.ghost {
  border-color: transparent;
  background: transparent;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

select[multiple] {
  min-height: 88px;
}

.readonly-value {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #f8fafc;
  color: var(--muted);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

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

.login-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 12px 32px rgba(31, 41, 55, 0.08);
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
  color: var(--brand-dark);
}

.login-logo {
  display: block;
  width: min(320px, 100%);
  height: auto;
  margin-bottom: 14px;
}

.login-panel p {
  color: var(--muted);
  margin: 0 0 20px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.public-form-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 42px 18px;
  background:
    radial-gradient(circle at top left, rgba(63, 148, 112, 0.13), transparent 34%),
    linear-gradient(180deg, #f7faf8 0%, #eef4f0 100%);
}

.public-form-card {
  width: min(640px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: 0 18px 46px rgba(31, 41, 55, 0.08);
  padding: 30px;
}

.public-form-card-wide {
  width: min(860px, 100%);
}

.public-logo {
  display: block;
  width: min(416px, 70%);
  height: auto;
  margin: 0 auto 22px;
}

.public-form-heading {
  text-align: center;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.public-form-heading h1 {
  margin: 0 0 6px;
  color: var(--brand-dark);
  font-size: 24px;
}

.public-form-card > h1 {
  text-align: center;
  color: var(--brand-dark);
}

.public-form-heading p,
.public-form-card p {
  margin: 0;
  color: var(--muted);
}

.public-form-grid {
  display: grid;
  gap: 16px;
}

.public-agreement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #475467;
  background: var(--brand-soft);
  border: 1px solid #cce7d6;
  border-radius: var(--radius);
  padding: 12px;
}

.public-agreement input {
  width: auto;
  margin-top: 4px;
}

.public-submit {
  width: min(220px, 100%);
  justify-self: start;
}

.loading-text {
  color: var(--muted);
  font-weight: 600;
}

.field label {
  display: block;
  color: #344054;
  font-weight: 600;
  margin-bottom: 6px;
}

.role-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.role-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.role-checkbox input {
  width: auto;
  margin: 0;
}

.role-checkbox:has(input:checked) {
  border-color: #b8dccf;
  background: #f3fbf7;
  color: var(--brand-dark);
  font-weight: 700;
}

.selected-role-summary {
  margin-top: 8px;
  color: var(--brand-dark);
  font-weight: 700;
  line-height: 1.5;
}

.field-badges,
.field-config-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #cce7d6;
  font-size: 12px;
}

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

.check-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}

.check-row input {
  width: auto;
}

.check-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 10px 0 18px;
}

.detail-field {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fbfcfb;
  padding: 10px 12px;
}

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

.detail-field strong {
  display: block;
  color: var(--text);
  word-break: break-word;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 74px 1fr;
}

.platform-topbar {
  background:
    linear-gradient(135deg, #d7efe1 0%, #b9dfcf 45%, #eef7f1 100%);
  border-bottom: 1px solid rgba(45, 116, 84, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 10px 24px rgba(31, 71, 54, 0.08);
}

.platform-left,
.platform-userbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.platform-left {
  flex: 1 1 auto;
}

.platform-logo {
  border: 0;
  background: transparent;
  padding: 0;
  width: 265px;
  height: 52px;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.platform-logo:hover {
  border-color: transparent;
  background: transparent;
}

.platform-logo img {
  display: block;
  max-width: 100%;
  max-height: 48px;
  object-fit: contain;
}

.platform-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.platform-nav button {
  border-color: transparent;
  background: transparent;
  color: #243447;
  font-weight: 800;
  padding: 10px 14px;
  white-space: nowrap;
}

.platform-nav button.active,
.platform-nav button:hover {
  color: #0f5138;
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 16px rgba(31, 71, 54, 0.1);
}

.top-link {
  border-color: transparent;
  background: transparent;
  color: #244236;
  font-weight: 700;
  padding: 9px 12px;
}

.top-link.active,
.top-link:hover {
  color: #0f5138;
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 12px rgba(31, 71, 54, 0.09);
}

.platform-userbar {
  color: var(--muted);
  white-space: nowrap;
}

.user-identity {
  color: var(--muted);
}

.user-name {
  color: #111827;
  font-weight: 700;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef6f7a;
  color: #fff;
  font-size: 12px;
}

.module-shell {
  min-width: 0;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.module-shell.no-sidebar {
  grid-template-columns: 1fr;
}

.sidebar {
  background: #f0f1ef;
  color: var(--text);
  padding: 22px 14px;
  border-right: 1px solid var(--line-soft);
}

.sidebar-section-label {
  color: #7a8595;
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
  margin-bottom: 8px;
}

.workspace-nav {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.workspace-nav button {
  text-align: left;
  background: transparent;
  color: #344054;
  border-color: transparent;
  padding: 11px 12px;
  font-weight: 800;
}

.workspace-nav button.active,
.workspace-nav button:hover {
  background: #fff;
  color: var(--brand-dark);
  border-color: #fff;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
}

.sidebar-divider {
  height: 1px;
  background: var(--line);
  margin: 0 8px 18px;
}

.brand {
  margin-bottom: 8px;
}

.brand img {
  display: block;
  width: 138px;
  max-width: 100%;
  height: auto;
}

.brand-title {
  color: var(--brand-dark);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
}

.module-title {
  color: var(--brand-dark);
  font-size: 17px;
  font-weight: 800;
  padding: 0 10px 4px;
}

.role {
  color: var(--muted);
  font-size: 12px;
  margin: 0 10px 16px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  text-align: left;
  background: transparent;
  color: #3f4754;
  border-color: transparent;
  padding: 10px 12px;
  font-weight: 700;
}

.nav button.active,
.nav button:hover {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 1px 4px rgba(31, 41, 55, 0.04);
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr;
}

.topbar {
  display: none;
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
  color: #101828;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.content {
  padding: 22px 24px;
  overflow: auto;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  width: 180px;
}

.filter-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

.assignment-toolbar > .filters {
  width: 100%;
}

.assignment-action {
  margin-left: 0;
  justify-content: flex-start;
}

.assignment-action select {
  width: min(260px, 100%);
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.03);
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--brand-dark);
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.03);
}

.metric span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 24px;
  color: var(--brand-dark);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.success {
  background: #e8f5ee;
  color: #21664a;
}

.status-pill.warning {
  background: #fff7e6;
  color: #9a5b00;
}

.status-pill.danger {
  background: #fff1f0;
  color: #b42318;
}

.text-success {
  color: #2f6f5b;
}

.text-danger {
  color: #b42318;
}

.notice.compact {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.record-review-tools {
  display: grid;
  grid-template-columns: 80px minmax(160px, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 300px;
}

.record-review-tools .actions {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  position: relative;
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.02);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

th {
  color: #344054;
  background: #f7f8f7;
  font-weight: 700;
}

.course-cell {
  width: 28%;
  min-width: 220px;
}

.course-list {
  display: grid;
  gap: 4px;
  line-height: 1.35;
}

.course-list span {
  display: block;
  overflow-wrap: anywhere;
}

.detail-course {
  display: block;
  line-height: 1.45;
}

tr:last-child td {
  border-bottom: 0;
}

.unread-row {
  background: #f3fbf7;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 600;
}

.badge.high {
  background: #ffeceb;
  color: #b42318;
}

.badge.medium {
  background: #fff4d6;
  color: #8a4b00;
}

.badge.low {
  background: #edf7ed;
  color: #18794e;
}

.badge.unreachable {
  background: #eaf2ff;
  color: #175cd3;
}

.badge.fake {
  background: #f2f4f7;
  color: #667085;
}

.badge.enrolled {
  background: #f4ebff;
  color: #6941c6;
}

.badge.enrolled_unpaid {
  background: #f7efff;
  color: #7a2cb8;
}

.badge.draft,
.badge.pending {
  background: #fff4d6;
  color: #8a4b00;
}

.badge.published {
  background: #edf7ed;
  color: #18794e;
}

.badge.rejected,
.badge.archived {
  background: #f2f4f7;
  color: #667085;
}

.ok-text {
  color: #18794e;
  font-weight: 700;
}

.danger-text {
  color: #b42318;
  font-weight: 700;
}

.tag-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag-chip {
  border: 1px solid #b8dccf;
  background: #f3fbf7;
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 5px 10px;
  line-height: 1.2;
}

.tag-chip.selected {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.chip-remove {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0 0 0 8px;
  font-size: 12px;
}

.chip-remove:hover {
  color: #fff;
  border-color: transparent;
}

.tag-chip.disabled {
  opacity: 0.5;
}

.certificate-sample {
  width: 88px;
  height: 56px;
  object-fit: contain;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fff;
}

.certificate-sample-large {
  display: block;
  max-width: 280px;
  max-height: 160px;
  object-fit: contain;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  margin: 10px 0 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 16px;
}

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

.hidden {
  display: none !important;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.schedule-status {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafc;
  font-weight: 600;
}

.schedule-status.active {
  border-color: #fecdca;
  background: #fff3f2;
  color: var(--danger);
}

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

.tabs button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.ai-tabs {
  margin: 0 0 16px;
}

.compact-tabs {
  margin: 0;
}

.check-cell {
  width: 44px;
  text-align: center;
}

.check-cell input {
  width: auto;
  min-width: 18px;
  height: 18px;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 24, 40, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}

.modal {
  width: min(880px, 100%);
  max-height: 86vh;
  overflow: auto;
  margin: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.28);
  position: relative;
}

.modal-sm {
  width: min(560px, 100%);
}

.wide-modal {
  width: min(1120px, 100%);
}

.modal-wide {
  width: min(1120px, 100%);
}

.contract-preview {
  min-height: 420px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.8;
  font-family: inherit;
}

.surface-watermark {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.surface-watermark span {
  position: absolute;
  color: #063f32;
  font-size: 16px;
  font-weight: 600;
  opacity: 0.055;
  transform: rotate(-24deg);
  white-space: nowrap;
}

.panel > :not(.surface-watermark),
.table-wrap > :not(.surface-watermark),
.modal > :not(.surface-watermark) {
  position: relative;
  z-index: 3;
}

.modal-header,
.modal-footer {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-footer {
  border-bottom: 0;
  border-top: 1px solid var(--line-soft);
  justify-content: flex-end;
}

.modal-body {
  padding: 18px;
}

.modal h3 {
  margin: 0;
  font-size: 18px;
}

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

.detail-list div {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}

.detail-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-list strong {
  font-weight: 600;
}

.lead-summary-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px 24px;
}

.lead-summary-list div {
  min-width: 0;
}

.lead-summary-list strong {
  display: block;
  overflow-wrap: anywhere;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #f0d39d;
  color: var(--warning);
  background: #fff8eb;
  margin-bottom: 14px;
}

.notice.success-notice {
  border-color: #b8dccf;
  color: var(--success);
  background: #eefaf4;
}

.ai-panel {
  border-color: #b8dccf;
  background: #fbfefd;
}

.ai-speech-text {
  border: 1px solid #b8dccf;
  border-radius: 8px;
  background: #f3fbf7;
  color: #12372c;
  padding: 14px;
  margin: 12px 0;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-speech-loading {
  border: 1px solid #b8dccf;
  border-radius: 8px;
  background: #f3fbf7;
  color: #1b5f49;
  padding: 14px;
  margin: 12px 0;
  min-height: 64px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
}

.ai-speech-loading span {
  animation: ai-thinking-pulse 1.1s ease-in-out infinite;
}

@keyframes ai-thinking-pulse {
  0%, 100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.model-choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.model-choice-group button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

.model-choice-group button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.ai-detail-list {
  margin-top: 10px;
}

.ai-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ai-questions span {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #fff;
  color: #344054;
  padding: 5px 10px;
  font-size: 12px;
}

.ai-actions {
  margin-top: 14px;
}

.ai-chat {
  border-top: 1px solid var(--line-soft);
  margin-top: 14px;
  padding-top: 14px;
}

.ai-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-chat-header span {
  color: var(--muted);
  font-size: 12px;
}

.ai-chat-messages {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-chat-message {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.ai-chat-message.user {
  background: #f8fafc;
}

.ai-chat-message-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ai-chat-message span,
.ai-chat-message-head span {
  display: block;
  color: var(--brand-dark);
  font-weight: 700;
}

.ai-chat-copy {
  padding: 4px 8px;
  min-height: 28px;
  font-size: 12px;
}

.compact-select {
  min-height: 38px;
  max-width: 180px;
}

.case-lead-picker {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.case-lead-picker .actions {
  margin: 8px 0;
}

.case-lead-selected {
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
}

.case-form {
  display: grid;
  gap: 16px;
}

.case-form-row {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.case-form-row > label {
  padding-top: 9px;
  color: #344054;
  font-weight: 700;
  line-height: 1.4;
}

.required-mark {
  color: var(--danger);
  margin-left: 4px;
}

.case-form-actions {
  padding-left: 246px;
}

.case-empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 12px;
  background: #f8fafc;
}

.case-lead-summary {
  display: grid;
  gap: 14px;
}

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

.case-info-grid > div {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
}

.case-info-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.case-info-grid strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.case-subsection {
  display: grid;
  gap: 8px;
}

.mini-table table {
  min-width: 640px;
}

.ai-chat-message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-chat-message small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.ai-chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.ai-chat-input textarea {
  min-height: 42px;
  max-height: 82px;
}

.ai-chat-input button {
  justify-self: start;
  min-width: 88px;
}

button.feedback-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
}

.error {
  color: var(--danger);
}

.state-disabled {
  color: var(--danger);
  font-weight: 700;
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.settings-card {
  min-height: 260px;
}

.preview-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
}

.preview-list li {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 9px 10px;
  background: rgba(248, 250, 252, 0.78);
}

.history-link {
  display: flex;
  justify-content: flex-start;
  margin: 8px 0 14px;
}

.history-link button {
  border-color: transparent;
  background: transparent;
  color: var(--brand-dark);
  padding-left: 0;
  font-weight: 700;
}

.history-link button:hover {
  background: transparent;
  color: var(--brand);
}

.profile-layout {
  display: grid;
  gap: 18px;
}

.profile-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
}

.profile-detail-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.module-placeholder {
  min-height: calc(100vh - 118px);
  display: grid;
  place-items: center;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.96));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.module-placeholder span {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-weight: 700;
}

.module-placeholder h3 {
  margin: 0;
  color: #1f2937;
  font-size: 28px;
}

.mobile-menu {
  display: none;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-rows: auto 1fr;
  }

  .platform-topbar {
    padding: 10px 14px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .platform-left,
  .platform-userbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .platform-left {
    gap: 10px;
  }

  .platform-logo {
    width: 220px;
    height: 44px;
  }

  .platform-nav {
    flex: 1 1 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

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

  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(280px, 88vw);
    overflow: auto;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .content {
    padding: 14px;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .case-form-row {
    grid-template-columns: 1fr;
  }

  .profile-detail-list {
    grid-template-columns: 1fr;
  }

  .case-form-actions {
    padding-left: 0;
  }

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

  .filters input,
  .filters select {
    width: 100%;
  }

  .filters,
  .toolbar {
    align-items: stretch;
  }

  .lead-summary-list,
  .detail-list {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 680px;
  }
}
