:root {
  --bg: #f4f7f6;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-soft: #eef4f2;
  --border: #dbe6e0;
  --border-strong: #bfd3c7;
  --text: #1f2a26;
  --muted: #61716a;
  --primary: #0d7a63;
  --primary-strong: #085746;
  --primary-soft: #d8f3eb;
  --accent: #f4a261;
  --danger: #e76f51;
  --warning: #f2c14e;
  --shadow: 0 18px 60px rgba(15, 40, 33, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(13, 122, 99, 0.16), transparent 25%),
    radial-gradient(circle at bottom right, rgba(242, 193, 78, 0.15), transparent 25%),
    var(--bg);
  color: var(--text);
}

.environment-banner {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.2rem;
  background: linear-gradient(90deg, #7f1d1d 0%, #9a3412 100%);
  color: #fff7ed;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 30px rgba(127, 29, 29, 0.18);
}

.environment-banner strong {
  color: #ffffff;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  padding: 24px 18px;
  border-right: 1px solid rgba(191, 211, 199, 0.6);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 8px 18px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #19a782);
  color: white;
  font-weight: 800;
  font-size: 1.4rem;
  box-shadow: 0 12px 30px rgba(13, 122, 99, 0.26);
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 800;
}

.brand-subtitle,
.group-label,
.section-kicker,
.muted,
.table-subtext,
.eyebrow {
  color: var(--muted);
}

.group-label,
.section-kicker,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
}

.sidebar-nav,
.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 13px 14px;
  border-radius: 14px;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(135deg, rgba(216, 243, 235, 0.95), rgba(255, 255, 255, 0.92));
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px rgba(13, 122, 99, 0.1);
}

.inline-link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: var(--primary-strong);
}

.inline-link-btn:hover {
  text-decoration: underline;
}

.nav-item.subtle {
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-chip {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.mini-card {
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(242, 248, 245, 0.94));
  border: 1px solid var(--border);
}

.mini-card-title {
  font-weight: 700;
}

.mini-card-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.main-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 30px 10px;
}

.search {
  width: min(480px, 100%);
}

.search input {
  width: 100%;
  border: 1px solid rgba(191, 211, 199, 0.8);
  background: rgba(255, 255, 255, 0.84);
  border-radius: 999px;
  padding: 16px 20px;
  color: var(--text);
  outline: none;
  box-shadow: 0 6px 18px rgba(15, 40, 33, 0.04);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(191, 211, 199, 0.8);
  box-shadow: 0 6px 18px rgba(15, 40, 33, 0.04);
}

.hidden {
  display: none !important;
}

.role-option {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.role-option.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.icon-btn,
.primary-pill,
.reward-pill,
.ghost-btn,
.solid-btn,
.tag,
.switcher button,
.tab-btn,
.chip-btn,
.stat-badge {
  border: 0;
  border-radius: 999px;
  font-weight: 700;
}

.icon-btn {
  width: 48px;
  height: 48px;
  background: var(--surface-solid);
  color: var(--primary);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.primary-pill {
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--primary), #14977a);
  color: white;
  cursor: pointer;
}

.reward-pill {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(231, 111, 81, 0.28);
  color: #9b5a28;
}

.profile-chip {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow);
}

.profile-chip img,
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.view {
  display: none;
  padding: 10px 30px 34px;
}

.view.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 0 22px;
}

.page-title {
  font-size: clamp(2rem, 4vw, 3.3rem);
  margin: 0;
  letter-spacing: -0.04em;
}

.page-subtitle {
  margin-top: 8px;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.6;
}

.hero-panel,
.panel,
.stat-card,
.table-card,
.list-card,
.profile-card,
.marketing-hero,
.settings-shell,
.calendar-shell {
  background: var(--surface);
  border: 1px solid rgba(219, 230, 224, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-panel {
  padding: 24px;
  border-radius: var(--radius-xl);
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  gap: 20px;
}

.hero-title {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.hero-actions,
.button-row,
.filter-row,
.tab-row,
.card-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.solid-btn,
.ghost-btn,
.chip-btn,
.tab-btn,
.switcher button {
  padding: 11px 16px;
  cursor: pointer;
}

.solid-btn {
  background: linear-gradient(135deg, var(--primary), #14977a);
  color: #fff;
}

.ghost-btn,
.chip-btn,
.tab-btn,
.switcher button {
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  border: 1px solid rgba(191, 211, 199, 0.85);
}

.ghost-btn.active,
.chip-btn.active,
.tab-btn.active,
.switcher button.active {
  background: var(--primary-soft);
  border-color: rgba(13, 122, 99, 0.22);
  color: var(--primary-strong);
}

.insight-grid,
.stats-grid,
.analytics-grid,
.split-grid,
.marketing-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.stat-card,
.panel,
.table-card,
.list-card,
.profile-card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-label {
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  margin-top: 10px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stat-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress {
  margin-top: 16px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8efeb;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #57c7a5);
}

.analytics-grid {
  grid-template-columns: 1.5fr 1fr;
}

.split-grid {
  grid-template-columns: 1.3fr 0.9fr;
}

.panel-title-row,
.table-toolbar,
.settings-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-title,
.table-title {
  margin: 0;
  font-size: 1.2rem;
}

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 16px 10px;
  border-top: 1px solid rgba(219, 230, 224, 0.82);
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-primary {
  color: var(--primary-strong);
  font-weight: 700;
}

.table-subtext {
  margin-top: 6px;
  font-size: 0.87rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill.good {
  background: rgba(88, 201, 137, 0.18);
  color: #1d7d46;
}

.status-pill.warn {
  background: rgba(242, 193, 78, 0.22);
  color: #8a6514;
}

.status-pill.soft {
  background: rgba(13, 122, 99, 0.1);
  color: var(--primary-strong);
}

.calendar-shell {
  border-radius: var(--radius-xl);
  padding: 20px;
}

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

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

.weekday {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calendar-day {
  min-height: 168px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(219, 230, 224, 0.86);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-day.calendar-drop-target {
  border-color: rgba(13, 122, 99, 0.9);
  box-shadow: inset 0 0 0 2px rgba(13, 122, 99, 0.18);
}

.calendar-day.muted {
  opacity: 0.48;
}

.calendar-date {
  font-weight: 800;
  color: var(--text);
}

.event-chip {
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: grab;
}

.event-chip.session {
  background: rgba(13, 122, 99, 0.12);
  color: var(--primary-strong);
}

.event-chip.intake {
  background: rgba(244, 162, 97, 0.18);
  color: #8b501a;
}

.event-chip.admin {
  background: rgba(97, 113, 106, 0.15);
  color: #44514c;
}

.client-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-soft);
  flex-shrink: 0;
}

.metrics-list,
.activity-list,
.settings-list,
.task-list {
  display: grid;
  gap: 14px;
}

.metric-row,
.activity-item,
.settings-item,
.task-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid rgba(219, 230, 224, 0.76);
}

.metric-row:first-child,
.activity-item:first-child,
.settings-item:first-child,
.task-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.spark-bars {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 120px;
  margin-top: 18px;
}

.spark-bars span {
  flex: 1;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, #96d6c3, var(--primary));
}

.donut {
  width: 170px;
  aspect-ratio: 1;
  margin: 10px auto 0;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0 78%, #dce8e3 78% 100%);
  display: grid;
  place-items: center;
}

.donut::after {
  content: attr(data-label);
  width: 108px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: white;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
  white-space: pre-line;
}

.marketing-grid {
  grid-template-columns: 1.2fr 0.8fr;
}

.profile-strength {
  display: grid;
  gap: 10px;
}

.check-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.check-list div {
  display: flex;
  gap: 10px;
  align-items: center;
}

.check-list div::before {
  content: "✓";
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(13, 122, 99, 0.12);
  color: var(--primary);
  font-weight: 800;
}

.settings-shell {
  border-radius: var(--radius-xl);
  padding: 18px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.settings-nav {
  padding: 12px;
  border-radius: 22px;
  background: rgba(244, 247, 246, 0.9);
  border: 1px solid rgba(219, 230, 224, 0.9);
}

.settings-group {
  margin-bottom: 18px;
}

.settings-group button {
  width: 100%;
  margin-top: 8px;
}

.settings-panel {
  padding: 10px 6px 10px 2px;
}

.toggle {
  position: relative;
  width: 54px;
  height: 30px;
  border-radius: 999px;
  background: #d9e6e0;
  border: 0;
  cursor: pointer;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 10px rgba(15, 40, 33, 0.14);
  transition: 180ms ease;
}

.toggle.on {
  background: linear-gradient(135deg, var(--primary), #2cb28d);
}

.toggle.on::after {
  left: 28px;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

.stack {
  display: grid;
  gap: 18px;
}

.callout {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(216, 243, 235, 0.85), rgba(255, 250, 243, 0.8));
  border: 1px solid rgba(13, 122, 99, 0.14);
}

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

#modalRoot:empty {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 28, 24, 0.42);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(219, 230, 224, 0.9);
  box-shadow: 0 28px 80px rgba(15, 40, 33, 0.18);
  padding: 24px;
  z-index: 1001;
}

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

.modal-title {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.close-btn {
  border: 0;
  background: rgba(239, 245, 242, 0.95);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.helper-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 10px;
}

.helper-tile {
  padding: 14px;
  border-radius: 18px;
  background: rgba(244, 247, 246, 0.95);
  border: 1px solid var(--border);
}

.helper-tile strong {
  display: block;
  font-size: 1.05rem;
}

.helper-tile span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.portal-shell {
  min-height: 100vh;
  padding: 48px;
  background:
    radial-gradient(circle at top left, rgba(13, 122, 99, 0.14), transparent 28%),
    linear-gradient(180deg, #f5faf7 0%, #eef6f2 100%);
}

.portal-panel,
.portal-topbar {
  max-width: 1180px;
  margin: 0 auto 24px;
}

.attachment-preview-shell {
  padding: 8px 0 4px;
}

.attachment-preview-image,
.attachment-preview-frame {
  width: 100%;
  min-height: 420px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #f6fbf8;
}

.attachment-preview-image {
  object-fit: contain;
  max-height: 70vh;
}

.attachment-preview-text {
  margin: 0;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #f6fbf8;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
}

.danger-btn {
  padding: 11px 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(231, 111, 81, 0.12);
  color: #a84d36;
  font-weight: 700;
  cursor: pointer;
}

.note-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
}

.note-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 0 12px;
}

@media (max-width: 1180px) {
  .stats-grid,
  .analytics-grid,
  .split-grid,
  .marketing-grid,
  .hero-panel,
  .settings-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-right: 0;
    border-bottom: 1px solid rgba(191, 211, 199, 0.6);
  }

  .sidebar-nav,
  .sidebar-group {
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    padding: 18px 16px 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .view {
    padding: 10px 16px 26px;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .weekday {
    display: none;
  }

  .calendar-day {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .topbar-actions {
    flex-wrap: wrap;
  }

  .role-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .stats-grid,
  .form-grid,
  .helper-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }

  .page-title {
    font-size: 2.2rem;
  }
}
