:root {
  --sidebar: #5b2d90;
  --sidebar-hover: #4a2375;
  --accent: #8bc53f;
  --accent-dark: #76b12e;
  --page-bg: #f4f5f7;
  --card: #ffffff;
  --border: #d9dde3;
  --text: #2f3a4a;
  --muted: #6e7785;
  --blue: #3b82f6;
  --orange: #f97316;
  --danger: #ef4444;
  --shadow: 0 16px 40px rgba(30, 41, 59, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: var(--page-bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    linear-gradient(180deg, var(--sidebar) 0%, #472272 100%);
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 6px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar {
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-weight: 800;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-copy {
  min-width: 0;
}

.brand-tagline {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
}

.brand-title,
.metric-value,
.section-heading,
.modal-title,
.card-title {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  text-align: left;
  transition: background 160ms ease, transform 160ms ease;
  font-weight: 700;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--sidebar-hover);
  border-color: rgba(255, 255, 255, 0.08);
  transform: none;
}

.main-panel {
  padding: 18px 22px 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 2px 0 18px;
}

#page-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
}

.clinic-label {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-meta,
.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge.success {
  background: rgba(139, 197, 63, 0.16);
  color: #547b22;
}

.badge.warning {
  background: rgba(249, 115, 22, 0.14);
  color: #b45309;
}

.badge.info {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

.badge.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.badge.neutral {
  background: #eef2f7;
  color: #5c6675;
}

.user-card {
  background: #fff;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.avatar {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--sidebar), #7c48be);
  color: #fff;
}

.user-card p,
.data-points p,
.card-copy,
.empty-state p,
.helper {
  margin: 4px 0 0;
  color: var(--muted);
}

.page-content {
  display: grid;
  gap: 18px;
}

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

.is-hidden {
  display: none;
}

.alert {
  background: #edf7e3;
  border: 1px solid rgba(139, 197, 63, 0.35);
  color: #426215;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.panel,
.stat-card,
.note-card,
.program-card,
.session-card,
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.panel {
  padding: 18px 20px;
}

.panel-header,
.subsection-header,
.split-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.section-heading {
  font-size: 1.15rem;
}

.section-subcopy {
  margin: 4px 0 0;
  color: var(--muted);
}

.metric-grid,
.data-grid,
.client-data-grid,
.session-groups {
  display: grid;
  gap: 18px;
}

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

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

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

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

.stat-card,
.note-card,
.program-card,
.session-card {
  padding: 16px;
}

.metric-label,
.data-points strong,
.mini-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-value {
  font-size: 1.8rem;
  margin-top: 8px;
}

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

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

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid #eef1f4;
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #fbfcfd;
}

tbody tr:hover {
  background: #fafbfc;
}

.actions,
.tab-strip,
.field-grid,
.modal-actions,
.counter-controls,
.duration-actions,
.program-actions,
.toolbar,
.master-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 13px;
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(139, 197, 63, 0.22);
}

.btn-secondary {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
  border-color: rgba(59, 130, 246, 0.18);
}

.btn-ghost {
  background: #f7f8fb;
  color: var(--text);
  border-color: var(--border);
}

.btn-warning {
  background: rgba(249, 115, 22, 0.12);
  color: #c25b0b;
  border-color: rgba(249, 115, 22, 0.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.14);
}

.btn-small {
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 0.82rem;
}

.appointment-panel {
  padding-top: 12px;
}

.appointment-card {
  overflow: hidden;
}

.appointment-card .table-wrap {
  overflow-x: visible;
}

.appointment-table {
  min-width: 0;
  table-layout: fixed;
}

.appointment-table th,
.appointment-table td {
  padding: 13px 8px;
}

.appointment-table th:nth-child(1),
.appointment-table td:nth-child(1) {
  width: 56px;
}

.appointment-table th:nth-child(3),
.appointment-table td:nth-child(3) {
  width: 90px;
}

.appointment-table th:nth-child(6),
.appointment-table td:nth-child(6) {
  width: 88px;
}

.appointment-table th:nth-child(8),
.appointment-table td:nth-child(8) {
  width: 118px;
}

.appointment-table th:nth-child(9),
.appointment-table td:nth-child(9) {
  width: 102px;
}

.appointment-table th:last-child,
.appointment-table td:last-child {
  width: 170px;
}

.problem-cell {
  width: 220px;
}

.problem-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appointment-actions {
  gap: 8px;
  justify-content: flex-start;
}

.appointment-actions .btn {
  white-space: nowrap;
}

.master-toolbar {
  justify-content: space-between;
  align-items: end;
  margin-bottom: 18px;
}

.master-search {
  flex: 1 1 320px;
}

.context-summary-grid,
.action-card-grid {
  display: grid;
  gap: 18px;
}

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

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

.workspace-tab-row {
  margin-bottom: 14px;
}

.workspace-tab-row .tab {
  min-height: 42px;
}

.workspace-action-shell {
  position: relative;
  margin-bottom: 18px;
}

.workspace-action-row {
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

.client-data-dropdown-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.client-data-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 154px;
  flex: 0 0 auto;
}

.client-data-trigger .tab-caret {
  font-size: 0.8rem;
  line-height: 1;
  transform: translateY(-1px);
}

.client-data-trigger.is-active .tab-caret {
  color: var(--sidebar);
}

.client-data-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 12;
  width: max-content;
  min-width: 260px;
  max-width: 340px;
  margin-bottom: 0;
  border-radius: 14px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.workspace-action-row .tab {
  width: auto;
  flex: 0 0 auto;
  min-height: 42px;
  height: auto;
}

.client-data-dropdown-menu .client-data-submenu-list {
  display: grid;
}

.client-data-dropdown-menu .client-data-submenu-item {
  border-top: 1px solid #edf1f5;
  padding: 12px 14px;
}

.client-data-dropdown-menu .client-data-submenu-item:first-child {
  border-top: 0;
}

.custom-notes-panel {
  display: grid;
  gap: 18px;
}

.custom-notes-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.custom-notes-add {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(139, 197, 63, 0.22);
  flex: 0 0 auto;
  margin-top: 2px;
}

.custom-notes-toolbar-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.custom-notes-table {
  min-width: 0;
}

.custom-notes-table th:nth-child(1),
.custom-notes-table td:nth-child(1) {
  width: 240px;
}

.custom-notes-table th:nth-child(3),
.custom-notes-table td:nth-child(3) {
  width: 220px;
}

.custom-note-type {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(91, 45, 144, 0.08);
  color: var(--sidebar);
  font-size: 0.8rem;
  font-weight: 700;
}

.custom-notes-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.custom-notes-actions .btn {
  white-space: nowrap;
}

.custom-note-modal {
  width: min(720px, 100%);
}

.custom-note-form-grid {
  margin-top: 18px;
}

.custom-note-options {
  margin: 0 24px 18px;
  padding: 18px;
  border: 1px solid #e5eaf0;
  border-radius: 18px;
  background: #fbfcfe;
}

.custom-note-option-list {
  display: grid;
  gap: 12px;
}

.custom-note-option-row {
  gap: 8px;
  align-items: end;
}

.custom-note-option-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.custom-note-option-controls input {
  flex: 1;
  min-width: 180px;
}

.custom-note-checkbox-group {
  display: grid;
  gap: 10px;
  padding: 6px 0 2px;
}

.custom-note-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.custom-note-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-dark);
}

.custom-note-checkbox span {
  color: var(--text);
}

.empty-state.compact {
  padding: 18px;
}

@media (max-width: 900px) {
  .custom-notes-toolbar {
    flex-direction: column;
  }

  .custom-notes-add {
    margin-top: 0;
  }

  .custom-note-options {
    margin-left: 18px;
    margin-right: 18px;
  }

  .custom-note-option-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .custom-note-option-controls input {
    min-width: 0;
  }

  .session-notes-header,
  .session-note-detail-head {
    flex-direction: column;
  }

  .session-notes-meta,
  .session-note-detail-grid {
    grid-template-columns: 1fr;
  }

  .session-note-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .session-note-row-meta {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 680px) {
  .custom-notes-table-wrap {
    overflow-x: auto;
  }

  .custom-notes-actions {
    gap: 8px;
  }

  .custom-notes-actions .btn {
    width: 100%;
  }

  .custom-note-modal {
    width: min(100%, 720px);
  }

  .custom-note-options {
    margin-left: 0;
    margin-right: 0;
    padding: 14px;
  }

  .custom-note-option-row {
    gap: 6px;
  }
}

.client-data-submenu {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.client-data-submenu-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #edf1f5;
}

.client-data-submenu-head .card-copy {
  margin: 6px 0 0;
}

.client-data-submenu-list,
.client-data-list {
  display: grid;
}

.client-data-submenu-item,
.client-data-list-item {
  border: 0;
  border-top: 1px solid #edf1f5;
  background: #fff;
  color: var(--text);
  padding: 13px 16px;
  text-align: left;
  font-weight: 600;
  transition: background 150ms ease, color 150ms ease;
}

.client-data-submenu-item:first-child,
.client-data-list-item:first-child {
  border-top: 0;
}

.client-data-submenu-item:hover,
.client-data-list-item:hover {
  background: #f8fafc;
}

.client-data-submenu-item.is-active,
.client-data-list-item.is-active {
  background: #f1f7e8;
  color: #47681e;
}

.client-data-focus-panel {
  margin-top: 4px;
}

.client-context-card {
  height: auto;
  min-height: 0;
  padding: 20px;
  align-self: start;
}

.info-list {
  display: grid;
  gap: 12px;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf1f5;
}

.info-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-list strong {
  color: var(--muted);
  font-size: 0.85rem;
}

.info-list span {
  text-align: right;
}

.metric-value.small {
  font-size: 1.2rem;
}

.toggle-field {
  align-content: end;
}

.toggle-row {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

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

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

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

.field label,
.note-card h4,
.program-card h4,
.session-card h4 {
  margin: 0;
  font-size: 0.9rem;
}

.field input,
.field select,
.field textarea,
.search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.field input::placeholder,
.field textarea::placeholder,
.search-input::placeholder {
  color: #97a0ad;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  outline: none;
  border-color: rgba(91, 45, 144, 0.35);
  box-shadow:
    0 0 0 4px rgba(139, 197, 63, 0.12),
    0 10px 24px rgba(15, 23, 42, 0.05);
}

.tab-strip {
  margin-bottom: 16px;
}

.tab {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  color: var(--muted);
}

.tab.is-active {
  background: #efe8f9;
  color: var(--sidebar);
  border-color: rgba(91, 45, 144, 0.16);
}

.program-meta,
.data-points {
  display: grid;
  gap: 10px;
}

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

.empty-state {
  padding: 30px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
}

.session-lock {
  border: 1px dashed rgba(91, 45, 144, 0.22);
  background: rgba(91, 45, 144, 0.04);
  padding: 20px 22px;
  border-radius: 18px;
  color: #5a4478;
}

.program-row-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.progress-bar {
  height: 10px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sidebar) 0%, #8d59cf 100%);
}

.program-list {
  display: grid;
  gap: 16px;
}

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

.signature-box {
  min-height: 156px;
  border: 1px dashed rgba(91, 45, 144, 0.22);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background:
    linear-gradient(180deg, rgba(91, 45, 144, 0.03), rgba(139, 197, 63, 0.04)),
    #fbfcfe;
}

.signature-content {
  display: grid;
  gap: 8px;
  text-align: center;
  padding: 16px;
}

.signature-content strong {
  color: var(--text);
}

.signature-content span {
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  width: min(920px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 0;
  border-radius: 22px;
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.22);
}

.modal-card.narrow {
  width: min(760px, 100%);
}

.modal-card > .field,
.modal-card > .field-grid,
.modal-card > .table-wrap,
.modal-card > .note-card {
  margin: 18px 24px 0;
}

.modal-card > .modal-actions {
  padding: 20px 24px 24px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 0;
  padding: 22px 24px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfe 100%);
  border-bottom: 1px solid #edf1f5;
  position: sticky;
  top: 0;
  z-index: 2;
}

.close-x {
  border: 1px solid #e5eaf0;
  background: #fff;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1.2rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.counter-display,
.timer-display,
.trial-count {
  font-size: 2rem;
  font-weight: 800;
}

.counter-controls button,
.duration-entry button,
.score-pill,
.step-select {
  border-radius: 12px;
}

.counter-controls button {
  width: 52px;
  height: 52px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1.4rem;
}

.scoreboard,
.duration-entry-list,
.target-list,
.step-list {
  display: grid;
  gap: 12px;
}

.scoreboard {
  padding: 22px 24px 24px;
}

.duration-entry,
.target-item,
.step-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfcfe;
}

.score-pill {
  min-width: 40px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 9px 10px;
  text-align: center;
  font-weight: 700;
}

.archive-tag {
  color: var(--orange);
  font-weight: 700;
}

.start-session-context,
.start-session-form-panel,
.session-notes-panel {
  position: relative;
}

.start-session-form-panel,
.session-notes-panel {
  overflow: hidden;
}

.start-session-form-panel::before,
.session-notes-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--sidebar) 0%, var(--accent) 100%);
  opacity: 0.85;
}

.session-meta-grid {
  margin-top: 6px;
}

.session-note-card {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}

.session-note-card h4 {
  margin-bottom: 10px;
  color: var(--text);
}

.session-note-card input,
.session-note-card textarea {
  min-height: 52px;
}

.session-note-card textarea {
  min-height: 156px;
}

.session-notes-page {
  display: grid;
  gap: 16px;
}

.session-notes-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.session-notes-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.session-notes-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #e6ebf1;
  border-radius: 16px;
  background: #fbfcfe;
}

.session-notes-meta div {
  display: grid;
  gap: 5px;
}

.session-notes-meta strong,
.session-note-detail-item h5 {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0;
}

.session-notes-meta span,
.session-note-detail-item p {
  color: var(--text);
  margin: 0;
}

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

.session-note-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 14px 16px;
  text-align: left;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.session-note-row:hover {
  background: #fafbfc;
}

.session-note-row.is-active {
  border-color: rgba(91, 45, 144, 0.24);
  background: rgba(91, 45, 144, 0.04);
}

.session-note-row-main,
.session-note-row-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.session-note-row-main {
  flex-wrap: wrap;
}

.session-note-row-meta {
  color: var(--muted);
  font-weight: 700;
}

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

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

.session-note-chevron {
  color: var(--sidebar);
  font-size: 1.1rem;
}

.session-note-detail-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #e6ebf1;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.session-note-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

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

.session-note-detail-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e6ebf1;
  border-radius: 14px;
  background: #fff;
}

.session-note-detail-item[data-wide="true"] {
  grid-column: 1 / -1;
}

.session-note-detail-item p {
  line-height: 1.55;
  white-space: pre-wrap;
}

.session-note-signature {
  min-height: 86px;
  border: 1px dashed rgba(91, 45, 144, 0.22);
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(91, 45, 144, 0.03), rgba(139, 197, 63, 0.04));
  color: var(--text);
  font-weight: 700;
  text-align: center;
  padding: 14px;
}

.session-notes-empty {
  margin-top: 4px;
}

.signature-card {
  display: grid;
  align-content: start;
}

.session-groups {
  margin-top: 4px;
  align-items: start;
}

.session-groups .panel {
  padding: 20px;
}

.session-groups .panel-header {
  margin-bottom: 16px;
}

.program-card {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.program-row-header {
  margin-bottom: 14px;
}

.program-actions {
  margin-top: 14px;
  justify-content: flex-end;
}

.program-card .helper {
  font-size: 0.88rem;
}

.info-modal {
  max-height: min(82vh, 860px);
}

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

.info-item {
  padding: 16px 18px;
  border: 1px solid #e9edf2;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
}

.info-item h4 {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.info-item .card-copy {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.info-modal .modal-actions {
  padding: 0 24px 24px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), #fff 34%);
}

@media (max-width: 1100px) {
  .metric-grid,
  .client-data-grid,
  .session-groups,
  .data-grid,
  .field-grid,
  .session-note-grid,
  .context-summary-grid,
  .action-card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .context-summary-grid.compact {
    grid-template-columns: 1fr;
  }

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

  .appointment-table th,
  .appointment-table td {
    padding: 12px 6px;
    font-size: 0.84rem;
  }

  .appointment-table th {
    font-size: 0.72rem;
  }

  .appointment-table .btn-small {
    padding: 7px 9px;
    font-size: 0.76rem;
  }

  .problem-cell {
    width: 180px;
  }

  .appointment-table th:last-child,
  .appointment-table td:last-child {
    width: 152px;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .brand {
    border-bottom: 0;
    padding-bottom: 0;
  }
}

@media (max-width: 680px) {
  .main-panel {
    padding: 18px;
  }

  .metric-grid,
  .client-data-grid,
  .session-groups,
  .data-grid,
  .field-grid,
  .session-note-grid,
  .context-summary-grid,
  .action-card-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .stat-card,
  .note-card,
  .program-card,
  .session-card,
  .modal-card {
    padding: 16px;
  }

  .modal-card {
    padding: 0;
  }

  .modal-head,
  .scoreboard,
  .info-grid,
  .info-modal .modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .modal-card > .field,
  .modal-card > .field-grid,
  .modal-card > .table-wrap,
  .modal-card > .note-card {
    margin-left: 16px;
    margin-right: 16px;
  }

  .modal-card > .modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .appointment-card .table-wrap {
    overflow: visible;
  }

  .appointment-table,
  .appointment-table thead,
  .appointment-table tbody,
  .appointment-table tr,
  .appointment-table th,
  .appointment-table td {
    display: block;
    width: 100%;
  }

  .appointment-table {
    min-width: 0;
  }

  .appointment-table thead {
    display: none;
  }

  .appointment-table tbody {
    display: grid;
    gap: 12px;
  }

  .appointment-table .appointment-row {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    overflow: hidden;
  }

  .appointment-table td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 10px 14px;
    border-bottom: 1px solid #eef1f4;
    font-size: 0.88rem;
  }

  .appointment-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .appointment-table td:last-child {
    border-bottom: 0;
  }

  .problem-cell,
  .appointment-table th:last-child,
  .appointment-table td:last-child,
  .appointment-table th:nth-child(1),
  .appointment-table td:nth-child(1),
  .appointment-table th:nth-child(3),
  .appointment-table td:nth-child(3),
  .appointment-table th:nth-child(6),
  .appointment-table td:nth-child(6),
  .appointment-table th:nth-child(8),
  .appointment-table td:nth-child(8),
  .appointment-table th:nth-child(9),
  .appointment-table td:nth-child(9) {
    width: auto;
  }

  .problem-text {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .appointment-actions-cell {
    grid-template-columns: 1fr;
  }

  .appointment-actions-cell::before {
    margin-bottom: 4px;
  }

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

  .appointment-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .master-toolbar,
  .info-list div {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .info-list span {
    text-align: left;
  }
}
