:root {
  color-scheme: dark;
  --ink: #f4f6ff;
  --muted: #b9c0da;
  --line: rgba(255, 255, 255, 0.11);
  --panel: #292d5b;
  --panel-soft: #20254d;
  --bg: #14113a;
  --brand: #007378;
  --brand-strong: #00a0a5;
  --accent: #d84b36;
  --good: #16d66d;
  --warn: #d5a22f;
  --cyan: #20d6ff;
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 115, 120, 0.23), transparent 32%),
    radial-gradient(circle at 92% 12%, rgba(32, 214, 255, 0.12), transparent 26%),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(13, 10, 48, 0.86), rgba(0, 72, 78, 0.76)),
    url("https://upload.wikimedia.org/wikipedia/commons/f/fa/HearingExam.jpg") center/cover;
}

.auth-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 34px;
  align-items: center;
  color: white;
}

.auth-panel h1 {
  margin: 0 0 16px;
  max-width: 720px;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 0.95;
  letter-spacing: 0;
}

.login-form,
.panel,
.metric {
  background: linear-gradient(180deg, rgba(45, 49, 98, 0.98), rgba(36, 40, 83, 0.98));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 18px;
  padding: 28px;
  color: var(--ink);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  padding: 11px 12px;
  background: #171a3d;
  color: var(--ink);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  transform: translateY(-50%);
  background: transparent;
  color: var(--muted);
}

.password-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
  color: white;
}

.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

input:focus,
select:focus {
  outline: 2px solid rgba(0, 115, 120, 0.45);
  border-color: var(--brand-strong);
}

button[type="submit"],
.nav-link.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
}

button[type="submit"] {
  min-height: 46px;
  border-radius: 7px;
  font-weight: 800;
}

.link-button {
  min-height: 32px;
  padding: 0;
  background: transparent;
  color: #67dce0;
  text-align: left;
  font-weight: 800;
}

.link-button:hover {
  color: white;
}

.form-error,
.form-status {
  min-height: 20px;
  margin: 0;
  color: #ff7b84;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 14px 16px;
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 160, 165, 0.16), transparent 28%),
    linear-gradient(180deg, #100d31 0%, #111a39 100%);
  color: white;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar > div:first-child {
  margin: 0 8px 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar h2 {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  color: #67dce0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.auth-panel .muted,
.sidebar .muted {
  color: rgba(255, 255, 255, 0.78);
}

nav {
  display: grid;
  gap: 4px;
}

nav::before {
  content: "Workspace";
  padding: 0 12px 6px;
  color: rgba(185, 192, 218, 0.64);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.nav-link,
.ghost-button {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid transparent;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-link::before {
  content: "";
  width: 3px;
  height: 18px;
  margin-right: 9px;
  border-radius: 99px;
  background: var(--brand-strong);
  opacity: 0;
  transform: scaleY(0.55);
  transition: opacity 160ms ease, transform 160ms ease;
}

.nav-link:hover,
.ghost-button:hover {
  background: rgba(255, 255, 255, 0.055);
  color: white;
}

.nav-link:hover {
  transform: translateX(2px);
}

nav .nav-link.active {
  border-color: rgba(103, 220, 224, 0.2);
  background: linear-gradient(90deg, rgba(0, 115, 120, 0.3), rgba(0, 160, 165, 0.13));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 8px 20px rgba(0, 0, 0, 0.12);
  color: white;
  transform: none;
}

.nav-link.active::before {
  opacity: 1;
  transform: scaleY(1);
}

nav .nav-link.admin-only {
  justify-content: flex-end;
  color: rgba(205, 210, 225, 0.58);
  text-align: right;
}

nav .nav-link.admin-nav-start {
  margin-top: 14px;
}

nav .nav-link.admin-nav-start::after {
  content: "";
  position: absolute;
  top: -8px;
  right: 8px;
  left: 8px;
  height: 1px;
  background: rgba(255, 255, 255, 0.09);
}

nav .nav-link.admin-only::before {
  order: 2;
  margin-right: 0;
  margin-left: 9px;
  background: rgba(205, 210, 225, 0.7);
}

nav .nav-link.admin-only:hover {
  color: rgba(235, 238, 247, 0.82);
}

nav .nav-link.admin-only.active {
  color: rgba(245, 247, 252, 0.9);
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  text-align: center;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-email {
  margin: 0;
  color: rgba(205, 210, 225, 0.72);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 36px;
  letter-spacing: 0;
}

.filters {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(210px, 270px);
  gap: 12px;
}

.view {
  display: none;
}

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

.chat-shell {
  width: min(980px, 100%);
  margin: 0 auto;
}

.chat-toolbar,
.chat-title-row,
.chat-toolbar-actions,
.chat-history-heading,
.chat-input-row,
.chat-composer-meta {
  display: flex;
  align-items: center;
}

.chat-toolbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.chat-title-row {
  gap: 10px;
}

.chat-toolbar h2,
.chat-empty-state h2 {
  margin: 0;
}

.chat-toolbar p,
.chat-empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.chat-readonly-badge {
  padding: 4px 8px;
  border: 1px solid rgba(103, 220, 224, 0.26);
  border-radius: 99px;
  background: rgba(0, 115, 120, 0.18);
  color: #76e4e7;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chat-beta-badge {
  border-color: rgba(255, 190, 92, 0.34);
  background: rgba(183, 112, 20, 0.18);
  color: #ffc978;
}

.chat-toolbar-actions {
  gap: 8px;
}

.chat-primary-button,
.chat-secondary-button,
.chat-icon-button {
  border-radius: 7px;
  color: white;
  font-weight: 800;
}

.chat-primary-button,
.chat-secondary-button {
  min-height: 40px;
  padding: 0 14px;
  font-weight: 400;
}

.chat-primary-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}

.chat-toolbar-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.chat-secondary-button,
.chat-icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.chat-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(37, 42, 86, 0.98), rgba(27, 31, 68, 0.98));
  box-shadow: var(--shadow);
}

.chat-messages {
  min-height: 470px;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  padding: 28px;
  scroll-behavior: smooth;
}

.chat-empty-state {
  width: min(680px, 100%);
  margin: 65px auto 0;
  text-align: center;
}

.chat-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border: 1px solid rgba(103, 220, 224, 0.28);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(0, 115, 120, 0.9), rgba(0, 160, 165, 0.85));
  box-shadow: 0 14px 30px rgba(0, 115, 120, 0.24);
  color: white;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.chat-suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.chat-suggestions button {
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.chat-suggestions button:hover {
  border-color: rgba(103, 220, 224, 0.34);
  background: rgba(0, 115, 120, 0.16);
}

.chat-message {
  display: grid;
  gap: 6px;
  margin: 0 0 22px;
}

.chat-message.user {
  justify-items: end;
}

.chat-message-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat-message-body {
  max-width: min(760px, 88%);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message.user .chat-message-body {
  border-color: rgba(103, 220, 224, 0.25);
  background: rgba(0, 115, 120, 0.23);
}

.chat-message.loading .chat-message-body {
  color: var(--muted);
}

.chat-composer {
  padding: 14px 16px 12px;
  border-top: 1px solid var(--line);
  background: rgba(15, 18, 51, 0.62);
}

.chat-input-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.chat-input-row {
  gap: 10px;
  align-items: flex-end;
}

.chat-input-row textarea {
  width: 100%;
  min-height: 48px;
  max-height: 150px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 13px 14px;
  background: #171a3d;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}

.chat-input-row textarea:focus {
  outline: 2px solid rgba(0, 115, 120, 0.45);
  border-color: var(--brand-strong);
}

.chat-input-row textarea:disabled {
  cursor: wait;
  opacity: 0.72;
}

.chat-input-row button {
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
}

.chat-send-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.chat-stop-icon {
  display: none;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: currentColor;
}

.chat-send-button.thinking .chat-send-icon {
  display: none;
}

.chat-send-button.thinking .chat-stop-icon {
  display: block;
}

.chat-send-button.thinking {
  background: rgba(216, 75, 54, 0.9);
}

.chat-composer-meta {
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  color: rgba(185, 192, 218, 0.74);
  font-size: 11px;
}

.chat-history-drawer {
  position: absolute;
  z-index: 5;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(340px, 90%);
  padding: 18px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(17, 20, 54, 0.98);
  box-shadow: 24px 0 48px rgba(0, 0, 0, 0.34);
}

.chat-history-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

.chat-icon-button {
  width: 34px;
  height: 34px;
  font-size: 20px;
}

.chat-history-list {
  display: grid;
  gap: 8px;
}

.chat-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
}

.chat-history-open,
.chat-history-delete {
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
}

.chat-history-open {
  min-width: 0;
  padding: 10px 11px;
  text-align: left;
}

.chat-history-open strong,
.chat-history-open small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-history-open strong {
  font-weight: 400;
}

.chat-history-open small {
  margin-top: 4px;
  color: var(--muted);
}

.chat-history-delete {
  display: grid;
  place-items: center;
  padding: 0;
}

.chat-history-delete svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.chat-history-open:hover,
.chat-history-delete:hover {
  border-color: rgba(103, 220, 224, 0.22);
  background: rgba(0, 115, 120, 0.16);
}

.chat-history-empty {
  color: var(--muted);
  font-size: 13px;
}

.chat-usage-heading,
.chat-usage-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-usage-heading > div {
  display: grid;
  gap: 5px;
}

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

.chat-usage-summary > div {
  display: grid;
  gap: 6px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.chat-usage-summary span,
.chat-usage-progress-copy {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-usage-summary strong {
  font-size: 24px;
}

.chat-usage-progress-copy {
  margin-top: 2px;
}

.chat-usage-progress {
  height: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.055);
}

.chat-usage-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  transition: width 220ms ease;
}

.chat-usage-progress.warning span {
  background: linear-gradient(90deg, #b8791c, var(--warn));
}

.chat-usage-progress.danger span {
  background: linear-gradient(90deg, #ad3026, var(--accent));
}

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

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

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

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

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

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

.metric {
  min-height: 132px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--cyan));
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  margin: 14px 0 8px;
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.leads-dashboard-grid {
  grid-template-columns: minmax(240px, 0.8fr) minmax(420px, 1.7fr);
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 20px;
}

.panel.wide {
  min-height: 390px;
}

.compact-chart-panel canvas {
  max-height: 170px;
}

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

.panel-heading h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

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

.traffic-pages-table {
  min-width: 900px;
  table-layout: fixed;
}

.traffic-pages-table th:first-child,
.traffic-pages-table td:first-child {
  width: 280px;
  white-space: normal;
  line-height: 1.35;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.045);
}

th:first-child,
td:first-child {
  text-align: left;
}

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

.sort-button {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-button.active-sort {
  color: var(--brand-strong);
}

.table-action {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  background: rgba(0, 115, 120, 0.2);
  color: #67dce0;
  font-weight: 800;
}

.table-action:hover {
  background: rgba(0, 115, 120, 0.34);
  color: white;
}

.icon-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.table-icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(0, 115, 120, 0.2);
  color: #67dce0;
}

.table-icon-button:hover {
  background: rgba(0, 115, 120, 0.34);
  color: white;
}

.table-icon-button.danger {
  background: rgba(216, 75, 54, 0.18);
  color: #ff8d85;
}

.table-icon-button.danger:hover {
  background: rgba(216, 75, 54, 0.32);
  color: white;
}

.table-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.lead-filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 320px));
  gap: 12px;
}

.trend-up {
  color: var(--good);
  font-weight: 800;
}

.trend-down {
  color: var(--accent);
  font-weight: 800;
}

.trend-flat {
  color: var(--warn);
  font-weight: 800;
}

.upload-form,
.event-form,
.user-form,
.settings-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

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

.settings-panel {
  max-width: 780px;
}

.span-2 {
  grid-column: span 2;
}

.file-field {
  min-width: 0;
}

.upload-path-hint {
  grid-column: 1 / -1;
  display: block;
  padding: 2px 2px 0;
  color: var(--muted);
  line-height: 1.45;
}

.ads-paste-field {
  grid-column: 1 / -1;
}

.ads-paste-field textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 13px 14px;
  background: #171a3d;
  color: var(--ink);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.ads-paste-field textarea:focus {
  outline: 2px solid rgba(0, 115, 120, 0.45);
  border-color: var(--brand-strong);
}

.ads-paste-field small {
  color: var(--muted);
  line-height: 1.45;
}

.upload-log {
  height: calc((13px * 1.5 * 10) + 32px);
  margin: 18px 0 0;
  padding: 16px;
  overflow: auto;
  border-radius: 7px;
  background: #121535;
  color: #dce7f5;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.events-list {
  display: grid;
  gap: 10px;
}

.clinic-master-heading,
.clinic-master-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clinic-master-heading {
  justify-content: space-between;
}

.clinic-master-actions input {
  min-width: 280px;
}

.clinic-master-table-wrap {
  max-height: calc(100vh - 260px);
}

.clinic-master-table {
  min-width: 3900px;
}

.clinic-master-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #292d5b;
}

.clinic-master-table th:first-child,
.clinic-master-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 210px;
  background: #292d5b;
}

.clinic-master-table th:last-child,
.clinic-master-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  min-width: 96px;
  background: #292d5b;
}

.clinic-master-table input,
.clinic-master-table textarea {
  width: 100%;
  min-width: 190px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  font: inherit;
}

.clinic-master-table textarea {
  min-height: 64px;
  resize: vertical;
}

.clinic-master-table .clinic-master-save {
  min-width: 72px;
}

.event-item {
  display: grid;
  grid-template-columns: 130px 180px 170px 1fr;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 980px) {
  .app-shell,
  .auth-panel,
  .dashboard-grid,
  .metric-grid,
  .overview-grid,
  .leads-grid,
    .appointments-grid,
    .amplify-appointments-grid,
    .traffic-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    gap: 20px;
  }

  .topbar {
    display: grid;
  }

  .filters,
  .lead-filter-row,
  .upload-form,
  .event-form,
  .user-form,
  .settings-form,
  .clinic-master-heading,
  .clinic-master-actions {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .event-item {
    grid-template-columns: 1fr;
  }

  .chat-usage-summary {
    grid-template-columns: 1fr;
  }

  .chat-toolbar {
    align-items: flex-start;
  }

  .chat-messages {
    min-height: 420px;
    max-height: none;
    padding: 20px 16px;
  }
}

@media (max-width: 620px) {
  .chat-toolbar,
  .chat-composer-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-toolbar-actions,
  .chat-toolbar-actions button {
    flex: 1;
  }

  .chat-suggestions {
    grid-template-columns: 1fr;
  }

  .chat-message-body {
    max-width: 94%;
  }
}
