/* ═══════════════════════════════════════════════════════════════
   Futurology EHR — Design System
   Calm healthcare aesthetic with soft neutral tones
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
  --primary: #4A7C7E;
  --primary-light: #6BA3A5;
  --primary-dark: #3A6264;
  --primary-bg: #EDF5F5;
  --secondary: #8B6F5C;
  --secondary-light: #A89080;

  --bg: #F8F6F3;
  --bg-alt: #F0EDEA;
  --card-bg: #FFFFFF;
  --sidebar-bg: #2D3436;
  --sidebar-text: #B2BEC3;
  --sidebar-active: #FFFFFF;

  --text: #2D3436;
  --text-muted: #636E72;
  --text-light: #95A5A6;
  --heading: #1E272E;

  --border: #E8E4E0;
  --border-light: #F0EDEA;

  --success: #27AE60;
  --success-bg: #E8F8EF;
  --warning: #F39C12;
  --warning-bg: #FEF5E7;
  --danger: #E74C3C;
  --danger-bg: #FDECEB;
  --info: #3498DB;
  --info-bg: #EBF5FB;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);

  --transition: all 0.2s ease;
  --transition-slow: all 0.35s ease;

  --sidebar-width: 260px;
  --topbar-height: 70px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--heading);
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  font-size: 1.85rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.2rem;
}

h4 {
  font-size: 1.05rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Utility ── */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: 8px;
}

.gap {
  gap: 16px;
}

.gap-lg {
  gap: 24px;
}

.mt-sm {
  margin-top: 8px;
}

.mt {
  margin-top: 16px;
}

.mt-lg {
  margin-top: 24px;
}

.mb {
  margin-bottom: 16px;
}

.text-center {
  text-align: center;
}

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

.text-sm {
  font-size: 0.85rem;
}

.text-xs {
  font-size: 0.75rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F8F6F3 0%, #EDF5F5 50%, #E8E4E0 100%);
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  animation: fadeInUp 0.5s ease;
}

.login-brand {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo {
  display: inline-flex;
  color: var(--primary);
  margin-bottom: 16px;
}

.login-logo svg {
  width: 56px;
  height: 56px;
}

.login-brand h1 {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

/* ═══════════════════════════════════════════
   APP SHELL - SIDEBAR
   ═══════════════════════════════════════════ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
  color: var(--primary-light);
}

.sidebar-logo svg {
  width: 32px;
  height: 32px;
}

.brand-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 450;
  transition: var(--transition);
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: var(--transition);
}

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

.nav-link:hover svg {
  opacity: 1;
}

.nav-link.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

.nav-link.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: var(--sidebar-text);
  text-transform: capitalize;
}

/* ── Mobile Menu ── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
  color: var(--text);
}

/* ═══════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 600;
}

.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.content-area {
  padding: 28px 32px;
  flex: 1;
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(74, 124, 126, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #219A52;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #C0392B;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.btn-icon:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.btn-group {
  display: flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.btn-group .btn.active {
  background: var(--primary);
  color: white;
}

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card-bg);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-control::placeholder {
  color: var(--text-light);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23636E72' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.form-inline .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
}

.card-body {
  padding: 22px;
}

.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-card .stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-card .stat-icon.teal {
  background: var(--primary-bg);
  color: var(--primary);
}

.stat-card .stat-icon.green {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card .stat-icon.orange {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-card .stat-icon.blue {
  background: var(--info-bg);
  color: var(--info);
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
}

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

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ═══════════════════════════════════════════
   BADGES & STATUS
   ═══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.badge-muted {
  background: var(--bg-alt);
  color: var(--text-muted);
}

.badge-primary {
  background: var(--primary-bg);
  color: var(--primary);
}

/* ═══════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  padding: 20px;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal.modal-lg {
  max-width: 780px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ═══════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
  min-width: 300px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--primary);
}

.toast.toast-success {
  border-left-color: var(--success);
}

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

.toast.toast-warning {
  border-left-color: var(--warning);
}

.toast-message {
  flex: 1;
  font-size: 0.88rem;
}

.toast-close {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 0;
  line-height: 1;
}

/* ═══════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 22px;
}

.dashboard-grid .card.full-width {
  grid-column: 1 / -1;
}

.appt-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.appt-item:last-child {
  border-bottom: none;
}

.appt-time {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 65px;
}

.appt-info {
  flex: 1;
}

.appt-info .appt-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.appt-info .appt-type {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.appt-status {
  margin-left: auto;
}

/* ═══════════════════════════════════════════
   CLIENT LIST
   ═══════════════════════════════════════════ */
.client-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.client-filters .form-control {
  width: auto;
  min-width: 180px;
}

.search-input {
  position: relative;
}

.search-input input {
  padding-left: 38px;
}

.search-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light);
}

/* ═══════════════════════════════════════════
   CALENDAR
   ═══════════════════════════════════════════ */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-nav h3 {
  min-width: 200px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
}

.calendar-day-header {
  padding: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.calendar-day {
  min-height: 110px;
  padding: 8px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  background: var(--card-bg);
  transition: var(--transition);
  cursor: pointer;
}

.calendar-day:nth-child(7n) {
  border-right: none;
}

.calendar-day:hover {
  background: var(--primary-bg);
}

.calendar-day.today {
  background: var(--primary-bg);
}

.calendar-day.other-month {
  background: var(--bg);
  opacity: 0.5;
}

.calendar-day .day-number {
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.calendar-day.today .day-number {
  color: var(--primary);
  font-weight: 700;
}

.cal-event {
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-bottom: 2px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.cal-event:hover {
  background: var(--primary);
  color: white;
}

/* Day/Week view */
.day-view {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.time-slot {
  display: flex;
  min-height: 60px;
  border-bottom: 1px solid var(--border-light);
}

.time-label {
  width: 80px;
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  border-right: 1px solid var(--border-light);
  flex-shrink: 0;
}

.time-content {
  flex: 1;
  padding: 6px 10px;
  position: relative;
  min-height: 60px;
}

.time-slot.occupied .time-content {
  background: var(--primary-bg);
}

.time-slot.buffer .time-content {
  background: repeating-linear-gradient(45deg, transparent, transparent 4px, var(--border-light) 4px, var(--border-light) 8px);
}

.slot-event {
  background: var(--primary);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
}

.slot-event .slot-meta {
  font-size: 0.72rem;
  opacity: 0.85;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════
   SESSION NOTES
   ═══════════════════════════════════════════ */
.note-editor {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.note-editor-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.note-fields {
  padding: 20px;
}

.note-section {
  margin-bottom: 20px;
}

.note-section label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.note-section label .letter {
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.note-locked {
  background: var(--warning-bg);
  color: var(--warning);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.note-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px;
  transition: var(--transition);
  cursor: pointer;
}

.note-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.note-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 10px;
}

.note-card-header h4 {
  font-size: 0.92rem;
}

.note-card .note-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ═══════════════════════════════════════════
   TREATMENT PLANS
   ═══════════════════════════════════════════ */
.goal-item {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  border-left: 4px solid var(--primary);
}

.goal-item.completed {
  border-left-color: var(--success);
}

.goal-item.not-started {
  border-left-color: var(--text-light);
}

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

.goal-header h4 {
  font-size: 0.95rem;
}

.objective-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.85rem;
}

.objective-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.progress-timeline {
  position: relative;
  padding-left: 24px;
}

.progress-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.progress-entry {
  position: relative;
  padding: 10px 0;
  margin-bottom: 8px;
}

.progress-entry::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 14px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--card-bg);
}

.progress-entry .progress-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-entry .progress-text {
  font-size: 0.88rem;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════
   CLIENT PORTAL
   ═══════════════════════════════════════════ */
.portal-welcome {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}

.portal-welcome h2 {
  color: white;
  margin-bottom: 8px;
}

.portal-welcome p {
  opacity: 0.85;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.portal-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.portal-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.portal-card svg {
  width: 40px;
  height: 40px;
  color: var(--primary);
  margin-bottom: 14px;
}

.portal-card h4 {
  margin-bottom: 6px;
}

.portal-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Messages */
.message-list {
  max-height: 400px;
  overflow-y: auto;
}

.message-item {
  padding: 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.message-item:hover {
  background: var(--bg);
}

.message-item.unread {
  background: var(--primary-bg);
}

.chat-area {
  display: flex;
  flex-direction: column;
  height: 500px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.chat-bubble {
  max-width: 70%;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  margin-bottom: 8px;
  line-height: 1.5;
}

.chat-bubble.sent {
  background: var(--primary);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chat-bubble.received {
  background: var(--bg);
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  padding: 12px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
}

/* ═══════════════════════════════════════════
   BILLING
   ═══════════════════════════════════════════ */
.invoice-status {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ═══════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: var(--border);
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-weight: 500;
}

.empty-state p {
  font-size: 0.88rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════ */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

.fade-in-up {
  animation: fadeInUp 0.4s ease;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

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

  .main-content {
    margin-left: 0;
  }

  .content-area {
    padding: 20px;
  }

  .topbar {
    padding: 0 20px 0 72px;
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }

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

  .calendar-day {
    min-height: 80px;
  }
}

@media (max-width: 640px) {
  html {
    font-size: 14px;
  }

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

  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .note-cards-grid {
    grid-template-columns: 1fr;
  }

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

  .calendar-grid {
    font-size: 0.78rem;
  }

  .calendar-day {
    min-height: 60px;
    padding: 4px;
  }

  .login-card {
    padding: 32px 24px;
  }

  .topbar {
    height: auto;
    padding: 14px 20px 14px 72px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 4px;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .table-wrap {
    margin-left: -20px;
    margin-right: -20px;
    padding: 0 20px;
  }
}