/* ═══════════════════════════════════════════════════════════
   THADUS PARTNER SUCCESS PORTAL — Stylesheet
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Typography — matching thaduscodelabs.com */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --brand:        #2563eb;
  --brand-dark:   #1d4ed8;
  --brand-light:  #eff6ff;
  --brand-faint:  #f0f7ff;
  --accent:       #f97316;
  --navy:         #0f172a;
  --navy-mid:     #1e293b;
  --navy-light:   #334155;
  --success:      #16a34a;
  --danger:       #dc2626;
  --warning:      #d97706;
  --amber:        #f97316;
  --gray-50:      #f8fafc;
  --gray-100:     #f1f5f9;
  --gray-200:     #e2e8f0;
  --gray-300:     #cbd5e1;
  --gray-400:     #94a3b8;
  --gray-500:     #64748b;
  --gray-700:     #334155;
  --gray-900:     #0f172a;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:    0 12px 32px rgba(0,0,0,.12);
  --sidebar-w:    240px;
}

body {
  font-family: var(--font-body);
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.55;
  font-size: 15px;
}

/* ── Utility ─────────────────────────────────────────────── */
.hidden   { display: none !important; }
/* auth pages and portal wrapper use flex; views inside the portal stack as blocks */
.auth-page.active, #page-portal.active { display: flex !important; }
.view.active { display: block !important; }

/* ══════════════════════════════════════════════════════════
   AUTH PAGES (Login + Signup)
   ══════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
}

.auth-left {
  width: 420px;
  min-width: 420px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 2.5rem;
}

.auth-brand { display: flex; flex-direction: column; gap: .6rem; }
.auth-brand h1 { font-size: 1.6rem; font-weight: 800; }
.auth-brand p  { color: var(--gray-400); font-size: .95rem; }

.brand-logo {
  width: 52px; height: 52px;
  background: var(--brand);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 900; color: #fff;
}
.brand-logo.sm { width: 36px; height: 36px; font-size: 1rem; border-radius: 10px; }

.brand-logo-img {
  width: 52px; height: 52px;
  object-fit: contain;
  border-radius: 10px;
  background: transparent;
  flex-shrink: 0;
}
.brand-logo-img.sm { width: 36px; height: 36px; }

.auth-tagline blockquote {
  font-size: 1rem;
  font-style: italic;
  color: var(--gray-300);
  border-left: 3px solid var(--brand);
  padding-left: 1rem;
  line-height: 1.7;
}

/* Signup step indicators */
.auth-steps { display: flex; align-items: center; gap: .75rem; padding-top: 1rem; }
.step-indicator { display: flex; align-items: center; gap: .5rem; color: var(--gray-400); font-size: .85rem; }
.step-indicator .step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--navy-light);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--gray-400);
  transition: background .2s, color .2s;
}
.step-indicator .step-dot.active { background: var(--brand); color: #fff; }
.step-line { flex: 1; height: 1px; background: var(--navy-light); }

.auth-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--gray-50);
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; }
.auth-sub { color: var(--gray-500); margin-bottom: 1.8rem; font-size: .9rem; }
.auth-switch { text-align: center; margin-top: 1.2rem; font-size: .875rem; color: var(--gray-500); }

/* Role picker */
.role-picker { display: flex; flex-direction: column; gap: .5rem; }

.role-option { display: block; cursor: pointer; }
.role-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.role-card {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.role-card:hover { border-color: var(--brand); background: var(--brand-faint); }
.role-option input:checked + .role-card {
  border-color: var(--brand);
  background: var(--brand-faint);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.role-card-icon { font-size: 1.4rem; line-height: 1; margin-top: .1rem; flex-shrink: 0; }
.role-card strong { display: block; font-size: .875rem; font-weight: 700; color: var(--gray-900); }
.role-card span   { display: block; font-size: .78rem; color: var(--gray-500); margin-top: .1rem; }
.auth-switch a { color: var(--brand); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field .hint { font-weight: 400; text-transform: none; color: var(--gray-400); letter-spacing: 0; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .95rem;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; min-height: 100px; }

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.4rem;
  border-radius: var(--radius);
  font-size: .9rem; font-weight: 700;
  cursor: pointer; border: none;
  transition: background .15s, transform .1s;
  font-family: inherit;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-full { width: 100%; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-700);
}
.btn-outline:hover:not(:disabled) { background: var(--gray-100); }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; }
.btn-ghost { background: transparent; color: var(--brand); padding: .4rem .6rem; }
.btn-ghost:hover { background: var(--brand-faint); }

.btn-label  { }
.btn-spinner { }

.btn-logout {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: 1.1rem; padding: .3rem;
  border-radius: 6px; transition: color .15s, background .15s;
}
.btn-logout:hover { color: var(--danger); background: rgba(220,38,38,.1); }

/* ══════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════ */
.alert {
  padding: .65rem .9rem; border-radius: var(--radius);
  font-size: .875rem; margin-bottom: 1rem;
}
.alert-error   { background: #fef2f2; color: var(--danger);  border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* ══════════════════════════════════════════════════════════
   PORTAL LAYOUT
   ══════════════════════════════════════════════════════════ */
#page-portal {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s;
}

.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
  font-size: 1.1rem; font-weight: 800;
  border-bottom: 1px solid var(--navy-light);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  overflow-y: auto;
}

.nav-btn {
  display: flex; align-items: center; gap: .75rem;
  width: 100%; background: none; border: none;
  padding: .7rem 1.25rem;
  color: var(--gray-400);
  font-size: .875rem; font-weight: 500;
  cursor: pointer; text-align: left;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
  border-radius: 0 6px 6px 0;
  font-family: inherit;
}
.nav-btn:hover  { background: var(--navy-mid); color: #fff; }
.nav-btn.active { background: var(--navy-mid); color: #fff; border-left-color: var(--brand); font-weight: 700; }

.nav-icon  { font-size: .9rem; width: 18px; text-align: center; }
.nav-label { }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--navy-light);
  display: flex; align-items: center; gap: .5rem;
}

.user-chip { flex: 1; display: flex; align-items: center; gap: .6rem; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px; min-width: 34px;
  background: var(--brand); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 800; color: #fff;
  text-transform: uppercase;
}
.user-info { min-width: 0; }
.user-name { font-size: .8rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .72rem; color: var(--gray-400); text-transform: capitalize; }

/* Mobile topbar */
.topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--navy); color: #fff;
  padding: .75rem 1rem;
  align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
}
.topbar-brand { font-weight: 800; font-size: .95rem; }
.hamburger { background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; }
.btn-logout-sm {
  background: none; border: 1px solid var(--gray-500); color: var(--gray-300);
  padding: .3rem .7rem; border-radius: 6px; font-size: .8rem; cursor: pointer; font-family: inherit;
}
.btn-logout-sm:hover { color: #fff; border-color: #fff; }

/* Main content area */
.portal-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 2.5rem 2rem;
  flex: 1;
}

/* ══════════════════════════════════════════════════════════
   VIEWS
   ══════════════════════════════════════════════════════════ */
.view { display: none; }
.view.active { display: block; }

.view-hero {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.view-hero h1 { font-size: 1.8rem; font-weight: 800; }
.view-sub { color: var(--gray-500); margin-top: .25rem; font-size: .95rem; }

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.card-header h3 { font-size: 1rem; font-weight: 700; }

/* Badges */
.badge {
  display: inline-block;
  padding: .25rem .7rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 700;
}
.badge-blue    { background: var(--brand-light); color: var(--brand); }
.badge-green   { background: #dcfce7; color: var(--success); }
.badge-amber   { background: #fef3c7; color: var(--warning); }
.badge-gray    { background: var(--gray-100); color: var(--gray-500); }

/* Tier badge */
.tier-badge {
  padding: .4rem 1rem;
  border-radius: 999px;
  font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD — welcome bar, trial banner, join-org prompt
   ══════════════════════════════════════════════════════════ */
.dash-welcome-bar {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: 1rem;
}
.dash-welcome-bar h1 { font-size: 1.8rem; font-weight: 800; }
.dash-org-name {
  margin-top: .3rem;
  font-size: 1rem; font-weight: 700;
  color: var(--brand);
  letter-spacing: .01em;
}

.trial-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: #fffbeb; border: 1.5px solid #fde68a;
  border-radius: var(--radius); padding: .75rem 1.25rem;
  font-size: .875rem; color: #92400e;
  margin-bottom: 1.5rem; flex-wrap: wrap;
}
.trial-banner-link {
  color: var(--brand); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.trial-banner-link:hover { text-decoration: underline; }

.join-org-prompt {
  background: var(--brand-faint);
  border: 1.5px solid var(--brand-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex; flex-direction: column; gap: .85rem;
}
.join-org-prompt strong { font-size: .95rem; font-weight: 700; color: var(--gray-900); }
.join-org-prompt p { font-size: .85rem; color: var(--gray-500); margin-top: .15rem; }
.join-org-inline {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
}
.join-search-input {
  flex: 1; min-width: 200px;
  padding: .6rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9rem; font-family: inherit;
}
.join-search-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* Org search dropdown */
.org-search-results {
  list-style: none;
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 220px; overflow-y: auto;
  margin-top: .4rem;
}
.org-result-item {
  padding: .65rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}
.org-result-item:last-child { border-bottom: none; }
.org-result-item:hover { background: var(--brand-faint); }
.org-result-item strong { display: block; font-size: .875rem; font-weight: 700; }
.org-result-item span   { font-size: .78rem; color: var(--gray-400); }
.org-result-empty { padding: .65rem 1rem; font-size: .875rem; color: var(--gray-400); }

/* Selected org chip */
.join-selected {
  display: flex; align-items: center; gap: .5rem;
  background: #dcfce7; border: 1px solid #86efac;
  border-radius: var(--radius); padding: .4rem .85rem;
  font-size: .875rem; font-weight: 600; color: var(--success);
  margin-top: .4rem;
}

/* Progress bar */
.progress-bar-wrap {
  background: var(--gray-100);
  border-radius: 999px;
  height: 6px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width .5s ease;
}

.checklist { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.checklist-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  font-size: .875rem;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  cursor: pointer;
  transition: background .12s, opacity .3s, max-height .4s, padding .4s, margin .4s;
  overflow: hidden;
}
.checklist-item:hover { background: var(--brand-faint); }
.checklist-item.checklist-done { cursor: default; opacity: .7; }
.checklist-item.checklist-done:hover { background: var(--gray-50); }
.check-box-done { background: var(--success) !important; border-color: var(--success) !important; }
.checklist-item.done .check-box { background: var(--success); border-color: var(--success); }
.checklist-item.done .check-box::after { content: '✓'; }
@keyframes fadeSlideOut {
  0%   { opacity: 1; max-height: 60px; margin-bottom: 0; }
  50%  { opacity: 0; }
  100% { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin-bottom: -.6rem; }
}
.checklist-item.fade-out { animation: fadeSlideOut .45s ease forwards; }

.check-box {
  width: 20px; height: 20px; min-width: 20px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: #fff; font-weight: 800;
  transition: background .2s, border-color .2s;
}
.checklist-item-label { flex: 1; font-weight: 500; }
.checklist-item-link  { font-size: .75rem; color: var(--brand); font-weight: 600; white-space: nowrap; }
.checklist-loading { color: var(--gray-400); font-size: .875rem; padding: .5rem 0; }

.updates-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.updates-list li { display: flex; gap: .75rem; align-items: flex-start; }
.update-dot {
  width: 10px; height: 10px; min-width: 10px; border-radius: 50%;
  background: var(--gray-300); margin-top: .35rem;
}
.update-dot.new { background: var(--brand); }
.updates-list strong { display: block; font-size: .875rem; font-weight: 700; }
.updates-list p    { font-size: .82rem; color: var(--gray-500); margin: .1rem 0; }
.updates-list time { font-size: .75rem; color: var(--gray-400); }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .85rem;
  margin-top: 1.75rem;
  align-items: start;
}
.quick-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex; flex-direction: row; align-items: center; gap: .85rem;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, background .12s;
  text-align: left; font-family: inherit;
  max-width: 320px;
}
.quick-card:hover { box-shadow: var(--shadow); border-color: var(--brand); background: var(--brand-faint); }
.qc-icon {
  font-size: 1.3rem;
  width: 40px; height: 40px; min-width: 40px;
  background: var(--brand-light);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.qc-text { display: flex; flex-direction: column; gap: .15rem; }
.quick-card strong { font-size: .875rem; font-weight: 700; color: var(--gray-900); }
.quick-card span   { font-size: .78rem; color: var(--gray-500); }

/* ══════════════════════════════════════════════════════════
   DOWNLOADS / RESOURCES
   ══════════════════════════════════════════════════════════ */
.filter-row { display: flex; gap: .75rem; align-items: center; }
.filter-select { padding: .5rem .8rem; border-radius: var(--radius); border: 1.5px solid var(--gray-200); font-size: .875rem; background: #fff; font-family: inherit; }

/* Filter bar (below title) */
.filter-bar {
  display: flex; align-items: center; gap: .85rem;
  margin-bottom: 1.5rem; flex-wrap: wrap;
}
.filter-bar-label { font-size: .8rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.filter-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-chip {
  padding: .35rem .85rem;
  border-radius: 999px;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  font-size: .8rem; font-weight: 600; color: var(--gray-500);
  cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s, color .12s;
}
.filter-chip:hover { border-color: var(--brand); color: var(--brand); }
.filter-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Trial divider on login page */
.trial-divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 1rem 0 .75rem;
  color: var(--gray-400); font-size: .82rem;
}
.trial-divider::before,
.trial-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }

/* ── Downloads 3-panel layout ─────────────────────────────── */
.dl-panels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.dl-panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.dl-panel-header {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.25rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.dl-panel-header h3 { font-size: .95rem; font-weight: 700; }
.dl-panel-icon { font-size: 1.2rem; }

.dl-list { list-style: none; }
.dl-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}
.dl-row:last-child { border-bottom: none; }
.dl-row:hover { background: var(--gray-50); }

.dl-row-icon  { font-size: 1.2rem; flex-shrink: 0; }
.dl-row-info  { flex: 1; min-width: 0; }
.dl-row-name  { font-size: .85rem; font-weight: 600; line-height: 1.3; word-break: break-word; }
.dl-row-meta  { font-size: .72rem; color: var(--gray-400); margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-row-btn   { flex-shrink: 0; }

/* Resource list (in Resources view) */
.resource-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.resource-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .75rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  font-size: .875rem;
}
.resource-list li:hover { background: var(--gray-50); }

/* ══════════════════════════════════════════════════════════
   SECTION SUB-HEADINGS (educator hub etc.)
   ══════════════════════════════════════════════════════════ */
.section-subheading {
  font-size: 1.05rem; font-weight: 800;
  color: var(--gray-700);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--gray-200);
}

/* ══════════════════════════════════════════════════════════
   TRAINING CENTRE
   ══════════════════════════════════════════════════════════ */
.tr-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* Training rows reuse dl-panel + dl-list styles */
.tr-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
  cursor: pointer;
}
.tr-row:last-child { border-bottom: none; }
.tr-row:hover { background: var(--brand-faint); }
.tr-row.done { background: #f0fdf4; }

.tr-play-btn {
  width: 36px; height: 36px; min-width: 36px;
  border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .75rem;
  flex-shrink: 0;
  transition: background .15s;
}
.tr-row.done .tr-play-btn { background: var(--success); }
.tr-row:hover .tr-play-btn { background: var(--brand-dark); }
.tr-row.tr-locked { opacity: .55; cursor: not-allowed; }
.tr-row.tr-locked .tr-play-btn { background: var(--gray-400); }

.tr-info   { flex: 1; min-width: 0; }
.tr-title  { font-size: .875rem; font-weight: 600; line-height: 1.3; }
.tr-meta   { font-size: .72rem; color: var(--gray-400); margin-top: .15rem; }
.tr-done-tag {
  font-size: .7rem; font-weight: 700; color: var(--success);
  background: #dcfce7; padding: .15rem .5rem; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
}

/* Video overlay */
.video-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.video-overlay.hidden { display: none; }

.video-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
  max-width: 820px;
  box-shadow: var(--shadow-lg);
}
.video-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}
.video-modal-header h3 { font-size: 1rem; font-weight: 700; }
.close-btn {
  background: none; border: none; font-size: 1.1rem; cursor: pointer;
  color: var(--gray-400); padding: .25rem; border-radius: 6px;
}
.close-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.video-wrap { position: relative; padding-top: 56.25%; background: #000; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.video-modal-footer {
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  border-top: 1px solid var(--gray-200);
}

/* ══════════════════════════════════════════════════════════
   IMPACT CENTRE
   ══════════════════════════════════════════════════════════ */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.mc-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); font-weight: 700; }
.mc-value { font-size: 2.25rem; font-weight: 900; color: var(--brand); margin: .25rem 0; line-height: 1; }
.mc-period { font-size: .75rem; color: var(--gray-400); }

/* ══════════════════════════════════════════════════════════
   SUPPORT CENTRE
   ══════════════════════════════════════════════════════════ */
.ticket-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.ticket-item {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  font-size: .875rem;
  display: flex; align-items: center; gap: .75rem;
}
.ticket-status {
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; white-space: nowrap;
}
.status-open        { background: #fef3c7; color: var(--warning); }
.status-in_progress { background: #dbeafe; color: var(--brand); }
.status-resolved    { background: #dcfce7; color: var(--success); }

.ticket-subject { flex: 1; font-weight: 600; }
.ticket-date    { font-size: .75rem; color: var(--gray-400); white-space: nowrap; }

.contact-info {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-200);
}
.contact-info h4 { font-size: .875rem; font-weight: 700; margin-bottom: .6rem; }
.contact-info p  { font-size: .875rem; color: var(--gray-500); margin-bottom: .35rem; }
.contact-info a  { color: var(--brand); text-decoration: none; }
.contact-info a:hover { text-decoration: underline; }

/* FAQs */
.faq-list { display: flex; flex-direction: column; gap: .5rem; }
.faq-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.faq-item summary {
  padding: .75rem 1rem;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.1rem; color: var(--brand); }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: .75rem 1rem 1rem; font-size: .875rem; color: var(--gray-500); line-height: 1.6; border-top: 1px solid var(--gray-100); }

/* ══════════════════════════════════════════════════════════
   COMING SOON
   ══════════════════════════════════════════════════════════ */
.coming-soon-section {
  background: var(--gray-50);
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.cs-label {
  display: inline-block;
  background: var(--amber);
  color: #fff;
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: .2rem .65rem; border-radius: 999px;
}
.cs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
}
.cs-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  opacity: .8;
}
.cs-card strong { display: block; font-size: .875rem; font-weight: 700; margin-bottom: .25rem; }
.cs-card p      { font-size: .8rem; color: var(--gray-500); }

.coming-soon-inline { display: flex; flex-direction: column; gap: .6rem; }
.coming-soon-inline p { font-size: .875rem; color: var(--gray-500); }
.cs-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.cs-list li { font-size: .875rem; color: var(--gray-500); padding: .3rem 0; border-bottom: 1px solid var(--gray-100); }

/* ══════════════════════════════════════════════════════════
   GLOBAL TRIAL BANNER + TRIAL GREY-OUT MODE
   ══════════════════════════════════════════════════════════ */
.global-trial-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--navy); color: #fff;
  padding: .75rem 1.25rem; border-radius: var(--radius);
  margin-bottom: 1.5rem; flex-wrap: wrap;
  font-size: .875rem;
}
.global-trial-banner strong { color: var(--amber); }
.trial-upgrade-link {
  color: var(--amber); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.trial-upgrade-link:hover { text-decoration: underline; }
/* When the upgrade link is also a button, keep the button's own text colour */
.btn.trial-upgrade-link { color: #fff; }

/* Inline "Upgrade to unlock" prompts — only visible in trial grey-out mode.
   They stay clickable above the greyed content (pointer-events restored). */
.trial-only-prompt { display: none; }
#page-portal.portal-trial .trial-only-prompt {
  display: inline-flex; align-items: center; gap: .3rem;
  margin-bottom: 1.25rem;
  filter: none; opacity: 1; pointer-events: auto; user-select: auto;
}

/* Grey out all content cards when trial mode is active */
#page-portal.portal-trial .card,
#page-portal.portal-trial .dl-panel,
#page-portal.portal-trial .quick-card,
#page-portal.portal-trial .metric-card,
#page-portal.portal-trial .resource-list > li,
#page-portal.portal-trial .updates-list > li,
#page-portal.portal-trial .tr-row,
#page-portal.portal-trial .ticket-list,
#page-portal.portal-trial .faq-list,
#page-portal.portal-trial .coming-soon-section {
  filter: grayscale(1);
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
}

/* Video pack locking for trial is handled in JS — no CSS override needed here */

/* Downloads view is always FULLY accessible in trial — override greys with !important */
#page-portal.portal-trial #view-downloads .dl-panel,
#page-portal.portal-trial #view-downloads .dl-list,
#page-portal.portal-trial #view-downloads .dl-row,
#page-portal.portal-trial #view-downloads li,
#page-portal.portal-trial #view-downloads .license-key-card,
#page-portal.portal-trial #view-downloads .coming-soon-section,
#page-portal.portal-trial #view-downloads .cs-card {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  user-select: auto !important;
}

/* Keep trial banner, headings, and licence card unaffected everywhere */
#page-portal.portal-trial #global-trial-banner,
#page-portal.portal-trial .view-hero,
#page-portal.portal-trial .dash-welcome-bar,
#page-portal.portal-trial .filter-bar,
#page-portal.portal-trial #license-key-card,
#page-portal.portal-trial .trial-feature-lock {
  filter: none;
  opacity: 1;
  pointer-events: auto;
  user-select: auto;
}

/* Trial: Course 1 videos (unlocked groups) are fully accessible */
#page-portal.portal-trial .course-video-group:not(.course-locked) .video-card,
#page-portal.portal-trial .course-video-group:not(.course-locked) .video-grid {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  user-select: auto !important;
}
#page-portal.portal-trial .course-video-group:not(.course-locked) {
  filter: none !important;
  opacity: 1 !important;
}

/* ── License key card ─────────────────────────────────────── */
.license-key-card {
  display: flex; align-items: center; gap: 1.25rem;
  background: var(--navy); color: #fff;
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem; flex-wrap: wrap;
}
.lk-icon { font-size: 1.75rem; flex-shrink: 0; }
.lk-body { flex: 1; min-width: 0; }
.lk-label { font-size: .72rem; font-weight: 700; color: var(--gray-400);
             text-transform: uppercase; letter-spacing: .06em; margin-bottom: .3rem; }
.lk-key   { font-size: 1.25rem; font-weight: 900; letter-spacing: .12em;
             font-family: 'Courier New', monospace; color: #fff; word-break: break-all; }
.lk-note  { font-size: .78rem; color: var(--gray-400); margin-top: .3rem; }
.lk-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   TRIAL FEATURE LOCK
   ══════════════════════════════════════════════════════════ */
.trial-feature-lock {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1.5px solid var(--amber);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.trial-lock-inner {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.trial-lock-icon { font-size: 2rem; flex-shrink: 0; }
.trial-lock-inner strong { display: block; font-size: 1rem; font-weight: 800; color: var(--gray-900); margin-bottom: .3rem; }
.trial-lock-inner p  { font-size: .875rem; color: var(--gray-700); }
.trial-lock-inner > div { flex: 1; }

/* Blurred/locked content beneath trial banner */
.trial-blurred { filter: blur(4px); pointer-events: none; user-select: none; opacity: .6; }

/* ══════════════════════════════════════════════════════════
   MISC
   ══════════════════════════════════════════════════════════ */
.state-msg {
  text-align: center; color: var(--gray-400);
  padding: 3rem 1rem; font-size: .9rem;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .two-col       { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .dl-panels     { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .auth-left   { display: none; }
  .auth-right  { padding: 1rem; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }

  .topbar  { display: flex; }
  .portal-main { margin-left: 0; padding: 5rem 1rem 1.5rem; }

  .quick-actions { grid-template-columns: 1fr; }
  .resource-grid, .training-grid { grid-template-columns: 1fr; }
  .dl-panels { grid-template-columns: 1fr; }
  .tr-panels { grid-template-columns: 1fr; }
  .metric-cards  { grid-template-columns: 1fr 1fr; }
  .field-row     { grid-template-columns: 1fr; }
  .view-hero     { flex-direction: column; }
}

@media (max-width: 480px) {
  .auth-card { padding: 1.5rem 1rem; }
  .metric-cards { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   PORTAL TOUR
   ══════════════════════════════════════════════════════════════ */
#tour-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 40, 0.62);
  z-index: 900;
  pointer-events: none;
  transition: opacity .25s;
}
#tour-overlay.hidden { display: none; }

/* Highlighted target element punches above the overlay */
.tour-highlight {
  position: relative !important;
  z-index: 901 !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--brand), 0 0 24px 4px rgba(59,130,246,.35) !important;
  transition: box-shadow .2s;
}

#tour-tooltip {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  z-index: 902;
  width: 300px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: 0 8px 32px rgba(10,15,40,.18), 0 2px 8px rgba(10,15,40,.08);
  padding: 1.1rem 1.1rem .9rem;
  pointer-events: all;
  animation: tour-slide-in .22s ease;
}
@keyframes tour-slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
#tour-tooltip.hidden { display: none; }
#tour-tooltip.tour-center {
  top: 50% !important; left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 360px;
}

.tour-header { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .75rem; }
.tour-thad img, .tour-thad span {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 2px solid var(--brand-light, #bfdbfe);
  display: flex; align-items: center; justify-content: center;
}
.tour-meta { flex: 1; }
.tour-step-badge { font-size: .7rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.tour-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); margin: 0; }
.tour-body { font-size: .875rem; color: var(--gray-600); line-height: 1.55; margin: 0 0 .9rem; }

.tour-dots { display: flex; gap: .35rem; margin-bottom: .9rem; }
.tour-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gray-200); transition: background .2s, transform .2s;
}
.tour-dot.active { background: var(--brand); transform: scale(1.25); }

.tour-actions { display: flex; align-items: center; justify-content: space-between; }
.tour-skip-btn {
  background: none; border: none; cursor: pointer;
  font-size: .8rem; color: var(--gray-400); padding: 0;
  font-family: inherit;
}
.tour-skip-btn:hover { color: var(--gray-600); }
.tour-next-btn {
  background: var(--brand); color: #fff; border: none; cursor: pointer;
  padding: .48rem 1.1rem; border-radius: 999px; font-size: .875rem;
  font-weight: 600; font-family: inherit; transition: background .15s;
}
.tour-next-btn:hover { background: var(--brand-dark, #1d4ed8); }

/* Arrow pointing toward the highlighted element */
.tour-arrow {
  position: absolute; width: 12px; height: 12px;
  background: #fff; transform: rotate(45deg);
  pointer-events: none;
}
.tour-arrow.arrow-left   { left: -6px;   top: 24px; box-shadow: -2px 2px 4px rgba(0,0,0,.08); }
.tour-arrow.arrow-right  { right: -6px;  top: 24px; box-shadow: 2px -2px 4px rgba(0,0,0,.08); }
.tour-arrow.arrow-top    { top: -6px;    left: 24px; box-shadow: -2px -2px 4px rgba(0,0,0,.08); }
.tour-arrow.arrow-bottom { bottom: -6px; left: 24px; box-shadow: 2px 2px 4px rgba(0,0,0,.08); }

@media (max-width: 600px) {
  #tour-tooltip, #tour-tooltip.tour-center { width: calc(100vw - 2rem); left: 1rem !important; transform: none !important; }
}

/* ══════════════════════════════════════════════════════════
   TYPOGRAPHY — Inter everywhere (matches thaduscodelabs.com body font);
   Instrument Serif is reserved for the logo / brand wordmark only.
   ══════════════════════════════════════════════════════════ */

/* Brand wordmark (logos) — the only place the display serif is used */
.auth-brand h1,
.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 400; /* Instrument Serif only ships 400 */
  letter-spacing: .01em;
}

/* Headings keep their existing sizing but use the normal (Inter) font */
.view-hero h1        { font-size: 2rem; }
.dash-welcome-bar h1 { font-size: 2rem; }
.auth-card h2        { font-size: 1.7rem; }

/* ══════════════════════════════════════════════════════════
   COURSE CONTENT VIDEOS (Training Centre)
   ══════════════════════════════════════════════════════════ */
.course-videos-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
}
.course-videos-section .section-header { margin-bottom: 1.5rem; }
.course-videos-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: .25rem;
}
.section-subtitle { color: var(--gray-500); font-size: .9rem; }

.course-video-group { margin-bottom: 2.25rem; }
.course-video-group-header {
  display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem;
}
.course-video-group-title { font-size: 1rem; font-weight: 600; color: var(--gray-700); margin: 0; }
.video-count-badge {
  background: var(--brand-light); color: var(--brand);
  font-size: .72rem; font-weight: 600; padding: .15rem .65rem; border-radius: 999px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.video-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease; cursor: pointer;
}
.video-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.video-thumbnail {
  position: relative; aspect-ratio: 16 / 9; background: var(--navy); overflow: hidden;
}
.video-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.video-card:hover .video-thumbnail img { opacity: .85; }
.thumbnail-missing { background: linear-gradient(135deg, var(--navy-mid), var(--brand)); }
.play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s; background: rgba(0,0,0,.3);
}
.video-card:hover .play-overlay { opacity: 1; }
.play-button {
  width: 48px; height: 48px; background: rgba(255,255,255,.95); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--brand); padding-left: 3px;
}
.video-duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,.75); color: #fff;
  font-size: .68rem; font-weight: 500; padding: .1rem .4rem; border-radius: 4px;
}
.video-info { padding: .75rem .85rem .85rem; }
.video-title {
  font-size: .82rem; font-weight: 600; color: var(--gray-700); margin: 0 0 .25rem;
  line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-description {
  font-size: .75rem; color: var(--gray-500); margin: 0; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.skeleton-course {
  height: 180px; border-radius: var(--radius); margin-bottom: 1rem;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: cv-shimmer 1.5s infinite;
}
@keyframes cv-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-state { color: var(--gray-400); font-size: .9rem; text-align: center; padding: 2.5rem 0; }

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

/* ═══════════════════════════════════════════════════════════
   SUPPORT CHAT WIDGET
   ═══════════════════════════════════════════════════════════ */
#chat-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 500; }
#chat-toggle-btn {
  position: relative;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--brand); color: #fff; font-size: 1.35rem;
  box-shadow: var(--shadow-lg); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
#chat-toggle-btn:hover { transform: scale(1.06); }
#chat-toggle-btn.has-unread::after {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}
#chat-panel {
  position: absolute; bottom: 70px; right: 0;
  width: 340px; max-width: calc(100vw - 2rem); height: 460px; max-height: 70vh;
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  display: flex; flex-direction: column; overflow: hidden;
}
#chat-panel.hidden { display: none; }
.chat-panel-header {
  background: var(--brand); color: #fff; padding: .7rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-identity { display: flex; align-items: center; gap: .65rem; }
.chat-thad-avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,.35); flex-shrink: 0;
}
.chat-thad-avatar-fallback {
  width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.15);
  align-items: center; justify-content: center; font-size: 1.35rem; flex-shrink: 0;
}
.chat-header-name { font-weight: 700; font-size: .92rem; line-height: 1.2; }
.chat-header-sub { font-size: .72rem; opacity: .8; font-weight: 400; }
.chat-panel-header button { background: none; border: none; color: #fff; cursor: pointer; font-size: .9rem; opacity: .85; }
.chat-panel-header button:hover { opacity: 1; }
#chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; background: var(--gray-50); }
.chat-msg { max-width: 85%; padding: .55rem .8rem; border-radius: 12px; font-size: .85rem; line-height: 1.45; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 3px; }
.chat-msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--gray-200); color: var(--gray-900); border-bottom-left-radius: 3px; }
.chat-msg.typing { align-self: flex-start; color: var(--gray-400); font-style: italic; font-size: .8rem; background: none; padding: 0 .2rem; }
#chat-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--gray-200); background: #fff; flex-shrink: 0; }
#chat-input { flex: 1; border: 1.5px solid var(--gray-200); border-radius: 999px; padding: .5rem .9rem; font-size: .85rem; font-family: inherit; min-width: 0; }
#chat-input:focus { outline: none; border-color: var(--brand); }
#chat-form button { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--brand); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#chat-form button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 480px) {
  #chat-panel { width: calc(100vw - 2rem); height: 65vh; }
}
