/* ============================================================
   CoCo Admin — plain CSS, no framework
   ============================================================ */

/* Tokens */
:root {
  --forest-950: #0E2218;
  --forest-800: #1C4029;
  --forest-700: #245235;
  --forest-600: #2E6845;
  --forest-500: #3F8359;
  --forest-400: #6BA587;
  --forest-300: #A6C8B5;
  --forest-200: #D2E2D8;
  --forest-100: #E8F0EB;
  --forest-50:  #F2F6F3;
  --clay-700:   #B0561F;
  --clay-600:   #C6692C;
  --clay-500:   #D97A3D;
  --clay-100:   #FBE7D6;
  --bg:         #F7F4EE;
  --bg-sunk:    #F1ECE3;
  --surface:    #FFFFFF;
  --surface-2:  #FBF9F4;
  --ink:        #0E2218;
  --ink-2:      #2E3A33;
  --ink-3:      #5C6B62;
  --ink-4:      #8A968E;
  --border:     #E5DFD2;
  --border-2:   #D7CFBE;
  --danger:     #A8362A;
  --danger-bg:  #F8E2DE;
  --warning:    #B0780F;
  --warning-bg: #FBF1D9;
  --success:    #2E6845;
  --success-bg: #E8F0EB;
  --info:       #2A5C8A;
  --info-bg:    #E2ECF5;
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
  --shadow-xs: 0 1px 0 rgba(20,48,31,.04);
  --shadow-sm: 0 1px 2px rgba(20,48,31,.06),0 1px 1px rgba(20,48,31,.04);
  --shadow-md: 0 4px 12px rgba(20,48,31,.08),0 1px 2px rgba(20,48,31,.04);
  --shadow-lg: 0 12px 32px rgba(20,48,31,.10),0 2px 6px rgba(20,48,31,.05);
  --font-sans: "Instrument Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;
  --font-display: "Fraunces","Instrument Serif",Georgia,serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { color-scheme: light; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Sidebar shell layout ────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 240px;
  --sidebar-bg: #132b1c;
  --sidebar-text: #c8ddd0;
  --sidebar-text-muted: rgba(200,221,208,.55);
  --sidebar-active-bg: rgba(255,255,255,.10);
  --sidebar-hover-bg: rgba(255,255,255,.06);
  --sidebar-border: rgba(255,255,255,.08);
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 0 0 16px;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
}
.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 0 8px 4px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.06);
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--forest-500);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-profile-info { min-width: 0; }
.sidebar-profile-name {
  font-size: 13px; font-weight: 600;
  color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.sidebar-profile-role {
  font-size: 11px;
  color: var(--sidebar-text-muted);
  letter-spacing: 0.02em;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--sidebar-border);
  margin: 8px 16px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 120ms, color 120ms;
  line-height: 1;
}
.sidebar-nav-item:hover { background: var(--sidebar-hover-bg); color: #fff; }
.sidebar-nav-item.active { background: var(--sidebar-active-bg); color: #fff; font-weight: 600; }
.sidebar-nav-item svg { color: inherit; opacity: .8; }
.sidebar-nav-item.active svg { opacity: 1; }

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  background: #e53e3e;
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 0 4px;
  flex-shrink: 0;
}

.sidebar-logout {
  color: rgba(200,221,208,.7);
}
.sidebar-logout:hover { color: #ffb3b3 !important; background: rgba(239,68,68,.12) !important; }

/* SUDS alert widget */
.sidebar-suds-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 8px 0;
  padding: 10px 12px;
  background: rgba(180,83,9,.25);
  border: 1px solid rgba(251,146,60,.3);
  border-radius: var(--r-md);
}
.sidebar-suds-icon {
  color: #fb923c;
  flex-shrink: 0;
  display: flex; align-items: center;
}
.sidebar-suds-text { flex: 1; min-width: 0; }
.sidebar-suds-count { font-size: 13px; font-weight: 700; color: #fed7aa; line-height: 1.2; }
.sidebar-suds-label { font-size: 10px; color: rgba(253,186,116,.7); letter-spacing: 0.02em; }
.sidebar-suds-link {
  font-size: 11px; font-weight: 600;
  color: #fb923c;
  white-space: nowrap;
  text-decoration: none;
}
.sidebar-suds-link:hover { color: #fed7aa; }

/* Main area offset */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
}
.main-area > main {
  min-height: 100vh;
}

/* ── Topnav ─────────────────────────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topnav-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px 10px;
}
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 24px;
}
.topnav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.topnav-logo-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--forest-950);
  line-height: 1;
}
.topnav-badge {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--forest-700);
  background: var(--forest-100);
  border: 1px solid var(--forest-200);
  border-radius: var(--r-xs);
}
.topnav-utils {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topnav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 150ms;
}
.topnav-icon-btn:hover { background: var(--forest-50); }
.topnav-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 150ms;
}
.topnav-user-btn:hover { background: var(--forest-50); }
.topnav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--forest-600);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
}
.topnav-username { font-size: 13px; font-weight: 500; color: var(--forest-950); }
.topnav-nav {
  display: flex;
  gap: 2px;
  padding: 0 32px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav-nav::-webkit-scrollbar { display: none; }
.topnav-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 150ms, border-color 150ms;
}
.topnav-nav a:hover { color: var(--ink); }
.topnav-nav a.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--forest-700);
}
.topnav-nav svg { flex-shrink: 0; }

/* User dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: 6px;
  z-index: 200;
  display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-header { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown-header-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.dropdown-header-email { font-size: 12px; color: var(--ink-3); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--ink-2);
  font-size: 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 150ms;
}
.dropdown-item:hover { background: var(--forest-50); }
.dropdown-item.danger { color: var(--danger); }

/* ── Page wrapper ────────────────────────────────────────────────────────────── */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 48px;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
}
.page-subtitle { font-size: 14px; color: var(--ink-3); margin-top: 4px; }

/* ── Card ────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.card-body { padding: 20px; }
.card-body-flush { padding: 0; }

/* ── Stat card ───────────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}
.stat-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.stat-card-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); flex: 1; line-height: 1.4; }
.stat-card-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card-icon.forest { background: var(--forest-100); color: var(--forest-600); }
.stat-card-icon.danger { background: var(--danger-bg);  color: var(--danger); }
.stat-card-icon.info   { background: var(--info-bg);    color: var(--info); }
.stat-card-icon.warm   { background: var(--clay-100);   color: var(--clay-600); }
.stat-card-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

/* ── Grid helpers ────────────────────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px) { .grid-4,.grid-3,.grid-2 { grid-template-columns: 1fr; } }

/* ── Pill / badge ────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600;
  padding: 2px 8px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill.forest { background: var(--forest-100); color: var(--forest-700); }
.pill.danger { background: var(--danger-bg);  color: var(--danger); }
.pill.warning{ background: var(--warning-bg); color: var(--warning); }
.pill.info   { background: var(--info-bg);    color: var(--info); }
.pill.warm   { background: var(--clay-100);   color: var(--clay-700); }
.pill.gray   { background: var(--bg-sunk);    color: var(--ink-3); }
.pill.success{ background: var(--success-bg); color: var(--success); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn svg { flex-shrink: 0; }
.btn-primary { background: var(--forest-700); color: #fff; border-color: var(--forest-700); }
.btn-primary:hover { background: var(--forest-800); border-color: var(--forest-800); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--forest-50); border-color: var(--border-2); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bg); }
.btn-danger:hover { background: #f0d0cc; }
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn-xs { font-size: 12px; padding: 4px 9px; }

/* ── Form controls ───────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.form-input, .form-select, .form-textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  padding: 10px 12px;
  transition: border-color 150ms, box-shadow 150ms;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--forest-500);
  box-shadow: 0 0 0 3px rgba(63,131,89,.15);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--ink-4); }
.form-error { font-size: 12px; color: var(--danger); }

/* ── Table ───────────────────────────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-sunk);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 100ms; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--forest-50); }
tbody td { padding: 13px 16px; font-size: 14px; color: var(--ink); vertical-align: middle; }

/* Alpine cloak — hides x-cloak elements until Alpine initialises */
[x-cloak] { display: none !important; }

/* ── Tab strip ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; }
.tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  background: transparent;
  color: var(--ink-3);
  border: none;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { background: var(--forest-100); color: var(--forest-700); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Alert / empty state ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-3);
}
.empty-state svg { margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(14,34,24,.4);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  display: none;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── Login page ──────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 420px;
  padding: 40px;
}
.login-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.login-logo-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--forest-950);
}
.login-tagline { font-size: 14px; color: var(--ink-3); margin-bottom: 32px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }

/* ── Student card ────────────────────────────────────────────────────────────── */
.student-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.student-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--forest-600);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}

/* ── Consultation card ───────────────────────────────────────────────────────── */
.consult-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.consult-card .date-block {
  background: var(--forest-100);
  border-radius: var(--r-md);
  padding: 8px 12px;
  text-align: center;
  flex-shrink: 0;
}
.consult-card .date-block .day { font-family: var(--font-display); font-size: 28px; font-weight: 400; color: var(--forest-700); line-height: 1; }
.consult-card .date-block .month { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--forest-600); }

/* ── Filter bar ──────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}
.filter-bar .form-group { flex: 1; min-width: 160px; }

/* ── Chat layout ─────────────────────────────────────────────────────────────── */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 80px);
  min-height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.chat-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.chat-room-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 100ms;
  text-decoration: none;
  color: var(--ink);
}
.chat-room-item:hover, .chat-room-item.active { background: var(--forest-50); }
.chat-room-item.active { border-left: 3px solid var(--forest-700); }
.chat-messages { display: flex; flex-direction: column; overflow: hidden; }
.chat-messages-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.chat-messages-body {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-messages-input { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.message-bubble { max-width: 70%; }
.message-bubble p {
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.5;
}
.message-bubble.mine { align-self: flex-end; }
.message-bubble.mine p { background: var(--forest-700); color: #fff; border-radius: var(--r-md) var(--r-md) 4px var(--r-md); }
.message-bubble.theirs p { background: var(--forest-50); border: 1px solid var(--border); border-radius: var(--r-md) var(--r-md) var(--r-md) 4px; }
.message-bubble time { font-size: 11px; color: var(--ink-4); margin-top: 3px; display: block; }
.message-bubble.mine time { text-align: right; }
.message-bubble.ai-reply { align-self: flex-start; max-width: 75%; }
.message-bubble.ai-reply p { background: #ede9fe; border: 1px solid #c4b5fd; border-radius: var(--r-md) var(--r-md) var(--r-md) 4px; color: #3b0764; }
.message-bubble.ai-reply .ai-label { font-size: 11px; font-weight: 600; color: #7c3aed; margin-bottom: 2px; letter-spacing: .02em; }
.message-bubble.ai-reply time { color: #7c3aed; opacity: .7; }

/* ── Misc ────────────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-muted { color: var(--ink-3); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background 150ms, border-color 150ms;
  cursor: pointer;
  white-space: nowrap;
}
.page-btn:hover:not(.disabled):not(.active) {
  background: var(--forest-50);
  border-color: var(--border-2);
}
.page-btn.active {
  background: var(--forest-700);
  border-color: var(--forest-700);
  color: #fff;
  font-weight: 600;
}
.page-btn.disabled {
  opacity: .4;
  cursor: default;
  pointer-events: none;
}
.page-info {
  font-size: 12px;
  color: var(--ink-3);
  margin-left: 8px;
  white-space: nowrap;
}

/* ── Filter bar refinements ──────────────────────────────────────────────────── */
.filter-bar .form-input,
.filter-bar .form-select {
  font-size: 13px;
  padding: 7px 10px;
  height: 34px;
}
.filter-bar .btn {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

/* ── Mini calendar ───────────────────────────────────────────────────────────── */
.cal-day {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms, color 100ms;
  padding: 0;
  line-height: 1;
}
.cal-day:hover { background: var(--forest-100); color: var(--forest-700); }
.cal-day-today { font-weight: 700; color: var(--forest-700); }
.cal-day-selected { background: var(--forest-700) !important; color: #fff !important; font-weight: 600; }
