:root {
  --ink: #17242f;
  --muted: #667684;
  --line: #dce6ea;
  --soft: #f5f8f8;
  --paper: #ffffff;
  --navy: #17354d;
  --aqua: #0f8b8d;
  --gold: #e1aa3f;
  --coral: #d85f4f;
  --green: #278965;
  --shadow: 0 18px 48px rgba(23, 53, 77, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
  background:
    radial-gradient(circle at 20% 18%, rgba(225, 170, 63, 0.22), transparent 28%),
    linear-gradient(135deg, #e7f5f7, #f9fbfb 48%, #eef6f3);
}

.login-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.login-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--aqua);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.login-card h1 {
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1;
}

.login-copy,
.login-hint {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 12px;
  margin: 22px 0 12px;
}

.login-form label,
.update-form label,
.staff-chat-form label,
.roster-form label,
.knowledge-editor label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.login-form input,
.update-form input,
.update-form select,
.update-form textarea,
.filters select,
.staff-chat-form input,
.staff-chat-form textarea,
.roster-form input,
.roster-form select,
.roster-form textarea,
.knowledge-editor input,
.knowledge-editor select,
.knowledge-editor textarea,
#knowledgeStatusFilter {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.login-form input,
.update-form input,
.update-form select,
.filters select,
.staff-chat-form input,
.roster-form input,
.roster-form select,
.knowledge-editor input,
.knowledge-editor select,
#knowledgeStatusFilter {
  height: 42px;
  padding: 0 11px;
}

.update-form textarea,
.staff-chat-form textarea,
.roster-form textarea,
.knowledge-editor textarea {
  padding: 10px 11px;
  resize: vertical;
}

.login-form button,
.admin-actions button,
.small-action,
.email-button,
.update-form button,
.email-form button,
.staff-chat-form button,
.roster-form button,
.schedule-actions button,
.live-alert-panel button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--aqua);
  color: white;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.login-error {
  min-height: 22px;
  color: var(--coral);
  font-weight: 720;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(360px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.admin-brand span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-weight: 900;
}

.admin-brand strong,
.admin-brand small {
  display: block;
}

.admin-brand small {
  color: var(--muted);
  font-size: 12px;
}

.admin-nav {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6faf9;
}

.admin-nav button {
  position: relative;
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}

.nav-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid white;
  border-radius: 999px;
  background: #e5483f;
  color: white;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 5px 12px rgba(216, 95, 79, 0.28);
}

.nav-badge[hidden] {
  display: none;
}

.admin-nav button.active {
  background: white;
  color: var(--navy);
  box-shadow: 0 7px 18px rgba(23, 53, 77, 0.08);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.admin-actions button {
  padding: 0 13px;
  background: white;
  color: var(--navy);
  border: 1px solid var(--line);
}

.admin-actions button.alerts-active {
  border-color: rgba(39, 137, 101, 0.28);
  background: #e4f5ed;
  color: var(--green);
}

.admin-main {
  display: grid;
  gap: 22px;
  padding: 28px clamp(18px, 4vw, 48px) 56px;
}

.view-section {
  display: none;
}

.view-section.active {
  display: grid;
  gap: 22px;
}

.page-heading {
  display: grid;
  gap: 4px;
}

.page-heading h1 {
  margin-bottom: 0;
  font-size: 34px;
}

.page-heading p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.live-alert-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid #f0c7be;
  border-radius: 8px;
  background: #fff1ee;
  color: #963a2f;
  box-shadow: var(--shadow);
}

.live-alert-panel[hidden] {
  display: none;
}

.live-alert-panel strong,
.live-alert-panel span {
  display: block;
}

.live-alert-panel span {
  margin-top: 2px;
  color: #7f4a42;
  font-size: 13px;
}

.live-alert-panel button {
  flex: 0 0 auto;
  padding: 0 14px;
  background: var(--coral);
}

.pulse-alert {
  animation: pulseAlert 1.2s ease-out;
}

@keyframes pulseAlert {
  0% {
    box-shadow: 0 0 0 0 rgba(216, 95, 79, 0.35);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(216, 95, 79, 0);
  }
}

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

.metric-grid article,
.schedule-panel,
.pipeline-panel,
.detail-panel,
.reserved-panel,
.knowledge-editor,
.knowledge-library {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.metric-grid article {
  padding: 20px;
}

.metric-grid span {
  display: block;
  margin-bottom: 6px;
  font-size: 34px;
  font-weight: 900;
}

.metric-grid strong {
  color: var(--muted);
  font-size: 13px;
}

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

.dashboard-grid article {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 210px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.dashboard-grid h2 {
  margin-bottom: 0;
}

.dashboard-grid p:not(.eyebrow) {
  color: var(--muted);
}

.dashboard-grid button {
  align-self: end;
  justify-self: start;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--aqua);
  color: white;
  cursor: pointer;
  font-weight: 850;
}

.pipeline-panel,
.schedule-panel,
.detail-panel,
.reserved-panel {
  padding: 20px;
}

.knowledge-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.knowledge-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
}

.knowledge-metrics span {
  min-width: 118px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.knowledge-metrics strong {
  display: block;
  color: var(--navy);
  font-size: 22px;
}

.knowledge-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.knowledge-editor,
.knowledge-library {
  padding: 20px;
}

.knowledge-editor {
  display: grid;
  gap: 16px;
}

.knowledge-editor-heading,
.knowledge-library-heading,
.knowledge-card-heading,
.knowledge-card-actions,
.knowledge-form-actions,
.knowledge-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.knowledge-editor-heading h2,
.knowledge-library-heading h2,
.knowledge-card-heading h3 {
  margin-bottom: 0;
}

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

.knowledge-title-field,
.knowledge-keywords-field,
.knowledge-source-field {
  grid-column: 1 / -1;
}

.knowledge-upload,
.knowledge-content-field {
  display: grid;
  gap: 7px;
}

.knowledge-file-row {
  justify-content: flex-start;
  padding: 10px;
  border: 1px dashed #b8ccd2;
  border-radius: 8px;
  background: #f8fbfb;
}

.knowledge-file-row input {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.knowledge-upload small {
  color: var(--muted);
  font-weight: 600;
}

.knowledge-content-field textarea {
  min-height: 330px;
  line-height: 1.6;
}

.knowledge-form-actions {
  justify-content: flex-end;
}

.knowledge-form-actions button,
.knowledge-editor-heading button,
.knowledge-file-row button,
.knowledge-card-actions button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.knowledge-form-actions button:not(.secondary-control) {
  border: 0;
  background: var(--aqua);
  color: white;
}

.knowledge-library {
  display: grid;
  gap: 14px;
}

.knowledge-library-heading {
  align-items: end;
}

#knowledgeStatusFilter {
  width: auto;
  min-width: 140px;
}

.knowledge-list {
  display: grid;
  gap: 10px;
  max-height: 820px;
  overflow: auto;
  padding-right: 2px;
}

.knowledge-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #a8bac1;
  border-radius: 8px;
  background: #fbfdfd;
}

.knowledge-card.status-published {
  border-left-color: var(--green);
}

.knowledge-card.status-draft {
  border-left-color: var(--gold);
}

.knowledge-card.status-inactive {
  opacity: 0.75;
}

.knowledge-card-meta,
.knowledge-card-preview,
.knowledge-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-card-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  white-space: pre-line;
}

.knowledge-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf2f4;
  color: var(--navy);
  font-size: 11px;
  font-weight: 850;
  text-transform: capitalize;
}

.knowledge-card.status-published .knowledge-status {
  background: #e4f5ed;
  color: var(--green);
}

.knowledge-card.status-draft .knowledge-status {
  background: #fff3d8;
  color: #805c13;
}

.knowledge-card-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.knowledge-card-actions button {
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
}

.knowledge-card-actions button[data-knowledge-action="publish"] {
  border-color: var(--aqua);
  background: var(--aqua);
  color: white;
}

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

.panel-heading h1,
.panel-heading h2 {
  margin-bottom: 0;
}

.filters {
  display: flex;
  gap: 10px;
}

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-tools button {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--navy);
  cursor: pointer;
  font-weight: 800;
}

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

.schedule-actions strong {
  min-width: 190px;
  color: var(--navy);
  text-align: center;
}

.schedule-actions button {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.roster-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.roster-form h2 {
  margin-bottom: 2px;
  font-size: 18px;
}

.time-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.roster-form .full-field,
.roster-form button,
.form-message {
  grid-column: 1 / -1;
}

.form-message {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.roster-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(145px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.schedule-day {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.schedule-day:hover {
  border-color: rgba(15, 139, 141, 0.5);
  box-shadow: 0 12px 24px rgba(23, 53, 77, 0.08);
  transform: translateY(-1px);
}

.schedule-day:focus-visible {
  outline: 3px solid rgba(15, 139, 141, 0.2);
  outline-offset: 2px;
}

.schedule-day.today {
  border-color: rgba(15, 139, 141, 0.48);
  box-shadow: inset 0 3px 0 var(--aqua);
}

.schedule-day.selected {
  border-color: var(--aqua);
  box-shadow: inset 0 3px 0 var(--aqua), 0 14px 30px rgba(15, 139, 141, 0.16);
}

.schedule-day header {
  display: grid;
  gap: 2px;
  min-height: 62px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  background: white;
}

.schedule-day header strong {
  color: var(--navy);
}

.schedule-day header span,
.schedule-day-slots > p {
  color: var(--muted);
  font-size: 12px;
}

.schedule-day-slots {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding: 10px;
  scrollbar-gutter: stable;
}

.schedule-slot {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--aqua);
  border-radius: 8px;
  background: white;
}

.schedule-slot div {
  display: grid;
  gap: 2px;
}

.schedule-slot strong,
.schedule-slot span,
.schedule-slot small {
  display: block;
}

.schedule-slot span,
.schedule-slot small {
  color: var(--muted);
  font-size: 11px;
}

.schedule-slot p {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 780;
}

.schedule-slot button {
  justify-self: start;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--coral);
  cursor: pointer;
  font-size: 11px;
  font-weight: 820;
}

.slot-actions {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px !important;
}

.staff-booking-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(16, 34, 53, 0.24);
}

.staff-booking-dialog::backdrop {
  background: rgba(16, 34, 53, 0.42);
}

.staff-booking-form {
  display: grid;
  gap: 16px;
  padding: 22px;
  overflow-y: auto;
}

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

.dialog-heading h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.icon-close {
  width: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
  font-size: 24px;
}

.staff-booking-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.staff-booking-fields label {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.staff-booking-fields input,
.staff-booking-fields select,
.staff-booking-fields textarea {
  width: 100%;
}

.staff-booking-fields .full-field {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .staff-booking-fields {
    grid-template-columns: 1fr;
  }

  .staff-booking-fields .full-field {
    grid-column: auto;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

.status-booked {
  border-left-color: #8e9aa3;
  background: #eef2f3;
  color: #647481;
}

.status-booked p,
.status-booked strong {
  color: #52616b;
}

.status-booked .booking-meta {
  color: #52616b;
  font-weight: 780;
}

.status-payment-pending {
  border-left-color: var(--gold);
  background: #fffaf0;
}

.status-payment-pending .booking-meta {
  color: #806000;
  font-weight: 780;
}

.status-unavailable {
  border-left-color: var(--coral);
  background: #fff7f4;
}

.lead-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lead-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

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

.lead-table th {
  background: #eef6f4;
  color: var(--navy);
  font-size: 12px;
  text-transform: uppercase;
}

.lead-table tr {
  cursor: pointer;
}

.lead-table .lead-expansion-row,
.lead-table .lead-expansion-row:hover {
  background: #f7fbfb;
  cursor: default;
}

.lead-expansion-row td {
  padding: 0;
}

.lead-table tr:hover,
.selected-row {
  background: #fbf8ee;
}

.live-request-row {
  background: #fff7f4;
}

.lead-table small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.lead-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lead-title-row strong {
  min-width: 0;
}

.delete-lead-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid rgba(216, 95, 79, 0.22);
  border-radius: 50%;
  background: #fff7f4;
  color: var(--coral);
  font-size: 15px;
  line-height: 1;
  opacity: 0.68;
}

.delete-lead-button:hover,
.delete-lead-button:focus-visible {
  border-color: rgba(216, 95, 79, 0.55);
  background: #ffe4df;
  opacity: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 5px 6px 0;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f4;
  color: var(--navy);
  font-size: 12px;
  font-weight: 820;
}

.priority-p1 {
  background: #ffe4df;
  color: #963a2f;
}

.priority-p2 {
  background: #fff4d6;
  color: #806000;
}

.priority-p3 {
  background: #e4f5ed;
  color: var(--green);
}

.due-pill {
  background: #ffe4df;
  color: #963a2f;
}

.muted-pill {
  background: #edf4f3;
  color: var(--muted);
}

.live-pill {
  background: #ffe4df;
  color: #963a2f;
}

.small-action,
.email-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin: 0 6px 6px 0;
  padding: 0 12px;
  font-size: 12px;
}

.link-action,
.email-button {
  background: var(--navy);
}

.secondary-email {
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
}

.lead-alert {
  margin: -2px 0 18px;
  padding: 12px 14px;
  border: 1px solid #f0c7be;
  border-radius: 8px;
  background: #fff1ee;
  color: #963a2f;
  font-weight: 760;
}

.follow-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.follow-alert div {
  min-width: 0;
}

.follow-alert button,
.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--aqua);
  color: white;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.follow-alert button:disabled,
.control-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.secondary-control {
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
}

.resume-control {
  background: var(--green);
}

.lead-focus-highlight {
  position: relative;
  z-index: 1;
  animation: focusLead 3.2s ease-out;
}

@keyframes focusLead {
  0%, 42% {
    outline: 4px solid rgba(216, 95, 79, 0.82);
    outline-offset: -4px;
    background: #ffe9e5;
    box-shadow: 0 0 0 4px rgba(216, 95, 79, 0.16);
  }
  100% {
    outline: 3px solid rgba(216, 95, 79, 0);
    outline-offset: -3px;
    box-shadow: none;
  }
}

.question-preview {
  display: grid;
  gap: 6px;
  max-width: 680px;
}

.question-preview p {
  margin: 0;
  overflow-wrap: anywhere;
}

.question-preview small {
  color: var(--muted);
  font-weight: 760;
}

.booking-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.booking-alert button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--aqua);
  color: white;
  font-weight: 820;
}

.booking-alert button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.booking-confirmed-alert {
  border-color: rgba(39, 137, 101, 0.3);
  background: #e4f5ed;
  color: var(--green);
}

.cancellation-alert {
  border-color: #f0c7be;
  background: #fff1ee;
  color: #963a2f;
}

.live-handoff-alert {
  margin: -2px 0 18px;
  padding: 12px 14px;
  border: 1px solid #f0c7be;
  border-radius: 8px;
  background: #fff1ee;
  color: #963a2f;
  font-weight: 800;
}

.lead-expansion {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.lead-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.lead-summary h2 {
  margin-bottom: 4px;
  font-size: 24px;
}

.lead-summary p {
  margin-bottom: 0;
  color: var(--muted);
}

.live-chat-workbench {
  display: grid;
  gap: 14px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.live-chat-log {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 260px;
  height: clamp(280px, 36vh, 430px);
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  box-shadow: inset 0 -18px 22px rgba(23, 53, 77, 0.035);
}

.live-chat-log::-webkit-scrollbar {
  width: 10px;
}

.live-chat-log::-webkit-scrollbar-track {
  background: #edf4f3;
  border-radius: 999px;
}

.live-chat-log::-webkit-scrollbar-thumb {
  border: 2px solid #edf4f3;
  border-radius: 999px;
  background: rgba(15, 139, 141, 0.38);
}

.live-message {
  width: min(70%, 620px);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.staff-live-message {
  justify-self: end;
  background: #e8f5f2;
  border-color: rgba(15, 139, 141, 0.22);
}

.student-live-message {
  justify-self: start;
}

.bot-live-message {
  justify-self: start;
  background: #f1f6f6;
  color: var(--muted);
}

.system-live-message {
  justify-self: center;
  width: auto;
  max-width: 86%;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.live-message strong,
.live-message small {
  display: block;
}

.live-message p {
  margin: 3px 0;
}

.live-message small {
  color: var(--muted);
  font-size: 11px;
}

.staff-chat-form {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(320px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding-top: 2px;
}

.staff-chat-form .wide {
  min-width: 0;
}

.staff-chat-form button {
  padding: 0 14px;
}

.summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.crm-section {
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.case-controls-section {
  border-color: rgba(15, 139, 141, 0.2);
}

.crm-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  color: var(--navy);
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

.crm-section summary::-webkit-details-marker {
  display: none;
}

.crm-section summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--aqua);
  font-weight: 900;
}

.crm-section[open] summary {
  border-bottom: 1px solid var(--line);
}

.crm-section[open] summary::after {
  content: "-";
}

.case-controls {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fbfdfd;
}

.case-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.case-status-grid article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

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

.case-control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  padding: 16px;
}

.profile-grid p {
  margin-bottom: 0;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(320px, 1.25fr);
  gap: 18px;
}

.detail-grid section,
.update-form,
.question-list,
.email-automation,
.email-history {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.detail-grid p {
  margin-bottom: 8px;
  color: var(--muted);
}

.update-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.update-form h3,
.update-form .wide,
.update-form button,
.email-form .wide,
.email-form button,
.checkbox-row {
  grid-column: 1 / -1;
}

.email-automation {
  display: grid;
  grid-template-columns: minmax(240px, 0.6fr) minmax(320px, 1.4fr);
  gap: 18px;
  margin-top: 0;
  border: 0;
}

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

.email-form {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
}

.email-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.email-form input,
.email-form select,
.email-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.email-form input,
.email-form select {
  height: 42px;
  padding: 0 11px;
}

.email-form textarea {
  padding: 10px 11px;
  resize: vertical;
}

.email-history {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 0;
  border: 0;
}

.email-history article {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.email-history p {
  margin-bottom: 5px;
  color: var(--muted);
}

.email-history small {
  display: block;
  color: var(--muted);
}

.email-history .email-failed {
  color: #963a2f;
}

.email-history .email-error {
  margin-top: 4px;
  color: #963a2f;
  font-weight: 760;
}

.compact-question-list {
  display: grid;
  gap: 8px;
}

.compact-question-list article {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.compact-question-list article:first-child {
  border-top: 0;
}

.compact-question-list p {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.reminder-due {
  color: #963a2f;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
  height: auto;
}

.question-list {
  margin-top: 18px;
}

.compact-question-list {
  margin-top: 0;
  border: 0;
}

.question-list article {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.question-list p {
  margin-bottom: 4px;
}

.question-list small {
  color: var(--muted);
}

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

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

.reserved-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.reserved-grid p {
  color: var(--muted);
}

.pill.readiness-ok {
  background: #e4f5ed;
  color: #1f7658;
}

@media (max-width: 980px) {
  .admin-topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-nav {
    justify-self: stretch;
    overflow-x: auto;
  }

  .admin-nav button {
    flex: 1 0 auto;
  }

  .panel-heading {
    display: grid;
  }

  .metric-grid,
  .dashboard-grid,
  .detail-grid,
  .case-status-grid,
  .email-automation,
  .email-history,
  .profile-grid,
  .schedule-layout,
  .reserved-grid,
  .staff-chat-form,
  .knowledge-workspace {
    grid-template-columns: 1fr;
  }

  .knowledge-list {
    max-height: none;
  }

  .schedule-actions {
    justify-content: flex-start;
  }

  .follow-alert,
  .booking-alert {
    align-items: stretch;
    flex-direction: column;
  }

  .follow-alert button,
  .booking-alert button,
  .case-control-actions .control-button {
    width: 100%;
  }

  .case-control-actions {
    justify-content: stretch;
  }

  .roster-calendar {
    grid-template-columns: repeat(7, minmax(180px, 1fr));
  }

  .live-alert-panel {
    display: grid;
  }

  .lead-summary {
    display: grid;
  }

  .summary-actions {
    justify-content: flex-start;
  }

  .filters,
  .panel-tools,
  .admin-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .update-form,
  .email-form,
  .staff-chat-form,
  .time-fields,
  .knowledge-fields {
    grid-template-columns: 1fr;
  }

  .knowledge-heading,
  .knowledge-file-row {
    align-items: stretch;
    flex-direction: column;
  }

  .knowledge-metrics {
    width: 100%;
  }

  .knowledge-metrics span {
    flex: 1;
  }

  .knowledge-form-actions button {
    flex: 1;
  }

  .live-message {
    width: 100%;
  }
}
