button[style*="background:#b91c1c"]{ background:#b91c1c }
button[style*="background:#b91c1c"]:hover{ filter:brightness(.9) }

:root{--bg:#f9fafb;--text:#111827;--brand:#2563eb;--border:#e5e7eb}
*{box-sizing:border-box} body{margin:0;background:var(--bg);color:var(--text);font:16px/1.4 system-ui,sans-serif}
.container{
  max-width: 1800px;  /* or 1400px if you want even wider */
  width: 100%;
  margin: 24px auto;
  padding: 0 24px;
}
.topbar{display:flex;gap:16px;align-items:center;padding:12px 16px;background:#fff;border-bottom:1px solid var(--border)}
.topbar .brand{font-weight:700;color:var(--brand);}
label{display:block;margin:10px 0}
input,select,textarea{width:100%;padding:8px;border:1px solid var(--border);border-radius:6px}
button{background:var(--brand);color:#fff;border:none;padding:8px 12px;border-radius:6px;cursor:pointer}
.alert{padding:10px;border-radius:6px;margin:10px 0}
.alert.error{background:#fee2e2;color:#991b1b}
.alert.success{background:#dcfce7;color:#166534}
.right{margin-left:auto}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card h3 { margin: 0 0 8px; color: var(--brand); font-size: 1rem; }
.card p { font-size: 1.4rem; font-weight: 600; }


.builder-grid { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
.panel { background:#fff; border:1px solid var(--border); border-radius:10px; padding:12px; }
.card { background:#fff; border:1px dashed var(--border); border-radius:10px; padding:10px; margin-bottom:10px; }
.row { display:flex; gap:8px; align-items:center; }
.row.wrap { flex-wrap:wrap; }
.row.between { justify-content:space-between; }
.input { padding:8px; border:1px solid var(--border); border-radius:6px; }
.input.sm { width:160px; }
.input.md { width:220px; }
.input.lg { width:280px; }
.preview { background:#fafafa; border:1px solid var(--border); border-radius:10px; padding:10px; min-height: 120px; }
.preview-field { margin-bottom:8px; }
.chk { display:flex; align-items:center; gap:4px; }
.muted { color:#6b7280; font-size:12px; }

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.student-card {
  display: block;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.student-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  border-color: #3b82f6; /* subtle blue on hover */
}

.student-name {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.chart-box {
  max-width: 900px;
  height: 300px;
  margin: 12px 0;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* --- Auth / Login layout --- */

.auth-wrapper{
  /* was 1100px */
  max-width: 1280px;
  margin: 32px auto 40px;

  display: grid;

  /* was minmax(0, 520px) auto */
  grid-template-columns: minmax(0, 640px) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding: 0 24px;
  position: relative;
  isolation: isolate;
}

.auth-card{
  background:#fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  padding: 24px 24px 28px;

  /* was 480px */
  max-width: 600px;
}

.auth-header h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
  font-weight: 700;
}

.auth-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.auth-form {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.auth-field input {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  background: #f9fafb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.auth-remember input {
  width: 14px;
  height: 14px;
}

.auth-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-submit {
  margin-top: 4px;
  width: 100%;
  padding: 10px 0;
  border-radius: 999px;
  border: none;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.auth-submit:hover {
  background: #1d4ed8;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.auth-submit:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.auth-submit:disabled,
.auth-submit.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.1);
  box-shadow: none;
}

.auth-submit:disabled:hover,
.auth-submit.is-disabled:hover {
  background: var(--brand); /* prevent hover darkening when disabled */
  box-shadow: none;
}

.auth-footer-text {
  margin-top: 18px;
  font-size: 0.88rem;
  text-align: center;
  color: #6b7280;
}

/* Right-side panel on large screens */
.auth-side {
  padding: 16px 24px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, #bfdbfe, #eff6ff 40%, #e0f2fe);
  border: 1px solid rgba(148, 163, 184, 0.4);
  max-width: 480px;        /* ✅ don't exceed this width */
  width: max-content;      /* ✅ only as wide as its content, up to max-width */
}

.auth-side h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.4rem;
  color: #1f2937;
}

.auth-side p {
  margin: 0 0 12px;
  color: #374151;
  font-size: 0.95rem;
}

.auth-side ul {
  margin: 0;
  padding-left: 18px;
  color: #374151;
  font-size: 0.9rem;
}

.auth-side li + li {
  margin-top: 4px;
}

/* --- Extra spice for auth page --- */

body {
  /* subtle animated gradient background */
  background: radial-gradient(circle at top left, #dbeafe 0, #eff6ff 35%, #f9fafb 70%);
  background-attachment: fixed;
}


/* floating gradient blob behind everything */
.auth-wrapper::before {
  content: "";
  position: absolute;
  inset: 10% auto auto 55%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(59,130,246,0.25), transparent 60%);
  filter: blur(2px);
  z-index: -1;
}

/* glassy card */
.auth-card.spicy {
  backdrop-filter: blur(12px);
  max-width: 600px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}

/* gradient accent on side panel */
.auth-side.spicy {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, #2563eb, #10b981);
  border: none;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
  max-width: 420px;        /* important */
  width: max-content;
}

.auth-side.spicy::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 20% 0%, rgba(251, 191, 36, 0.5), transparent 55%),
    radial-gradient(circle at 100% 40%, rgba(244, 114, 182, 0.45), transparent 55%);
  opacity: 0.8;
}

.auth-side-inner {
  position: relative;
  z-index: 1;
  color: #e5e7eb;
}

.auth-side-inner h2 {
  color: #f9fafb;
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.auth-side-inner p {
  color: #e5e7eb;
}

.auth-side-inner ul {
  color: #e5e7eb;
}

/* brand badge at top of card */
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.06);
  margin-bottom: 12px;
}

.auth-logo-circle {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #eff6ff;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 6px 10px rgba(37, 99, 235, 0.5);
}

.auth-badge-text {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  line-height: 1.1;
  color: #4b5563;
}

.auth-badge-text strong {
  font-size: 0.82rem;
  color: #111827;
}

/* header tweaks */
.auth-header h1 {
  display: flex;
  align-items: center;
  gap: 4px;
}

.auth-header h1::after {
  content: "";
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  display: inline-block;
}

/* button spice */
.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.02em;
}

.auth-submit-icon {
  transition: transform 0.15s ease;
}

.auth-submit:hover .auth-submit-icon {
  transform: translateX(3px);
}

/* dev verify link styling */
.auth-footer-text.dev-link {
  margin-top: 12px;
  font-size: 0.8rem;
}

/* smooth entrance animation */
.auth-card.spicy,
.auth-side.spicy {
  animation: auth-pop 0.45s ease-out;
}

@keyframes auth-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  .auth-wrapper {
    grid-template-columns: minmax(0, 1fr);
    padding: 24px 16px 32px;
    max-width: 100%;
  }
  .auth-side { display:none; }
}


/* Responsive tweaks */
@media (max-width: 900px) {
  .auth-wrapper {
    grid-template-columns: minmax(0, 1fr);
    padding: 24px 16px 32px;
    max-width: 100%;
  }
  .auth-side {
    display: none;
  }
}

/* --- Admin data tables --- */

.data-card {
  margin-top: 16px;
  padding: 12px 16px 18px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.10),
    0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  overflow-x: auto;         /* horizontal scroll on small screens */
}

/* generic toolbar row above tables (search, filters, etc.) */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 6px;
  flex-wrap: wrap;
}

.table-toolbar .spacer {
  flex: 1 1 auto;
}

.table-toolbar input[type="text"],
.table-toolbar select {
  width: auto;
  min-width: 180px;
}

/* base table styling */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  color: #111827;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #f9fafb, #eef2ff);
  color: #4b5563;
  font-weight: 600;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.table thead th:first-child {
  border-top-left-radius: 10px;
}
.table thead th:last-child {
  border-top-right-radius: 10px;
}

.table tbody tr:hover {
  background: #eff6ff;
}

.table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.table td:last-child,
.table th:last-child {
  text-align: right;
}

/* subtle compact chips for status fields */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-pill--approved {
  background: #dcfce7;
  color: #166534;
}
.status-pill--pending {
  background: #fef3c7;
  color: #92400e;
}
.status-pill--rejected {
  background: #fee2e2;
  color: #991b1b;
}

/* nicer inline action buttons inside tables */
.table-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
}

.btn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #e5edff;
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn-chip:hover {
  background: #dbeafe;
  border-color: #bfdbfe;
  transform: translateY(-1px);
}

.btn-chip--danger {
  background: #fee2e2;
  color: #b91c1c;
}
.btn-chip--danger:hover {
  background: #fecaca;
  border-color: #fecaca;
}

/* tighten tables a bit on smaller screens */
@media (max-width: 900px) {
  .data-card {
    padding: 10px 10px 14px;
  }

  .table thead th,
  .table td {
    padding: 7px 8px;
    font-size: 0.8rem;
  }
}

/* --- APP HEADER --- */

.main-header {
  position: sticky;
  top: 0;
  z-index: 50;

  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);

  box-shadow:
    0 4px 24px rgba(0,0,0,0.06),
    inset 0 -1px 0 rgba(255,255,255,0.2);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 24px;

  display: flex;
  align-items: center;
  gap: 28px;
}

/* --- BRAND --- */

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;

  font-weight: 700;
  font-size: 1.15rem;
  color: var(--brand);
  text-decoration: none;

  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.25s ease;
}

.header-brand:hover {
  background: rgba(37, 99, 235, 0.08);
}

.brand-circle {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;

  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.5);
}

/* --- NAVIGATION --- */

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.header-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  color: #374151;
  padding: 6px 12px;
  border-radius: 8px;

  position: relative;
  transition: color 0.2s ease, background 0.2s ease;
}

.header-nav a:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand);
}

.header-nav a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  border-radius: 999px;
  opacity: 0;
  transform: scaleX(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.header-nav a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

/* --- RIGHT SIDE (USER + LOGOUT) --- */

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-username {
  font-size: 0.9rem;
  color: #4b5563;
  font-weight: 500;
}

.logout-btn {
  text-decoration: none;
  color: #ef4444;
  font-weight: 600;
  font-size: 0.9rem;

  padding: 6px 12px;
  border-radius: 8px;

  transition: background 0.2s ease, color 0.2s ease;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

/* --- MOBILE HEADER --- */
@media (max-width: 900px) {
  .header-nav {
    display: none; /* hide full nav for now (we can add a hamburger later!) */
  }
}

.btn-chip--primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

.btn-chip--primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* -------- Progress page & buttons (no Bootstrap) -------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease,
    color 0.15s ease;
}

.btn:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3);
}

/* Variants */
.btn-secondary {
  background: #fff;
  color: var(--brand);
  border-color: #bfdbfe;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.15);
}

.btn-secondary:hover {
  background: #eff6ff;
}

.btn-outline {
  background: #fff;
  color: #111827;
  border-color: #d1d5db;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.btn-outline:hover {
  background: #f3f4f6;
}

.btn-ghost {
  background: transparent;
  color: #4b5563;
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background: #e5e7eb;
}

/* Layout for the progress page */
.progress-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 4px;
}

.progress-header-title h1 {
  margin: 0;
  font-size: 1.8rem;
}

.progress-header-title p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.progress-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* Card wrapper */
.progress-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px 20px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

/* Make table scroll nicely on small screens */
.table-wrapper {
  overflow-x: auto;
}

/* Progress bar inside the table */
.progress-table .bar {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-table .bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #2563eb);
}

.progress-table .status-text {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 2px;
}

/* Trials column */
.progress-trials-list {
  font-size: 0.82rem;
}

.progress-trials-list .trial-date {
  color: #9ca3af;
  font-size: 0.75rem;
}

/* Add-trial form styling */
.add-trial-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.add-trial-form .checkbox-inline {
  align-self: flex-start;
  font-size: 0.8rem;
  color: #4b5563;
}

.add-trial-form .input-notes {
  width: 100%;
  max-width: 260px;
}

.progress-footer-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* -------- Goal create + recommendations -------- */

.goal-create-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr);
  gap: 24px;
  margin-top: 12px;
  align-items: flex-start;
}

.goal-create-form,
.goal-create-recommendations {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
}

.goal-create-form .field {
  margin-bottom: 12px;
}

.goal-create-recommendations {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);

  display: flex;
  flex-direction: column;

  max-height: 440px;      /* 👈 adjust this to how tall you want the card */
}

.goal-create-recommendations h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.goal-rec-list {
  margin-top: 8px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}


.goal-rec-card {
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  margin-bottom: 10px;
}

.goal-rec-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.goal-rec-category {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1f2937;
}

.goal-rec-source {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
}

.goal-rec-text {
  font-size: 0.85rem;
  color: #111827;
  margin: 4px 0 6px;
}

.goal-rec-reason {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 6px;
}

.goal-create-recommendations .btn-use-goal {
  width: 100%;
  justify-content: center;
}

/* -------- Admin: Goal Templates -------- */

.goal-templates-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr);
  gap: 20px;
  margin-top: 10px;
}

.goal-templates-form-card,
.goal-templates-list-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.goal-templates-form-card h2,
.goal-templates-list-card h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.field-group {
  display: flex;
  gap: 10px;
}

.field-group .field {
  flex: 1;
}

.required {
  color: #ef4444;
  font-weight: normal;
  font-size: 0.8rem;
}

/* -------- Goal templates search bar -------- */

.goal-templates-search {
  margin-top: 8px;
  margin-bottom: 10px;
}

.goal-templates-search form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.goal-templates-search .input-search {
  flex: 1 1 240px;
}

.goal-templates-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr);
  gap: 20px;
  margin-top: 10px;
  align-items: stretch; /* make both columns same height */
}

.goal-templates-form-card,
.goal-templates-list-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

/* Make the list card a flex column so header stays fixed and list scrolls */
.goal-templates-list-card {
  display: flex;
  flex-direction: column;
}

/* Scrollable area for the table, same height as the form card */
.goal-templates-list-scroll {
  margin-top: 8px;
  flex: 1;
  overflow-y: auto;
}

/* Optional: limit max height to avoid growing too huge on big screens */
.goal-templates-form-card,
.goal-templates-list-card {
  max-height: 520px;
}

/* Make sure table wrapper fills the scroll area nicely */
.goal-templates-list-scroll .table-wrapper {
  min-width: 100%;
}

/* -------- Messages page -------- */

.messages-page {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr);
  gap: 16px;
  margin-top: 10px;
}

.messages-sidebar,
.messages-main {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
}

/* Conversation header & body */

.conversation-header {
  margin-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 6px;
}

.conversation-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.conversation-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0; /* no side padding */
  display: flex;
  flex-direction: column;
  gap: 10px;
}


/* Message bubbles */

.message-row {
  display: flex;
  width: 100%;
}


.message-row.from-me {
  justify-content: flex-end;
}

.message-row.from-them {
  justify-content: flex-start;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 75%;       /* fills more space without looking like a brick */
  width: fit-content;   /* bubble size grows with text */
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}


.message-row.from-me .message-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 3px;
}

.message-row.from-them .message-bubble {
  background: #e5e7eb;
  color: #111827;
  border-bottom-left-radius: 3px;
}

.message-text {
  margin-bottom: 4px;
}

.message-meta {
  font-size: 0.7rem;
  opacity: 0.85;
}

.message-row.from-me .message-meta {
  color: rgba(249, 250, 251, 0.9);
}

.message-row.from-them .message-meta {
  color: #6b7280;
}

/* Reply form */

.conversation-reply {
  margin-top: 8px;
  border-top: 1px solid #e5e7eb;
  padding-top: 6px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.conversation-reply textarea {
  flex: 1;
  resize: vertical;
  min-height: 38px;
}

/* Clickable thread links */

.messages-thread-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
}

.messages-thread-link.is-active .messages-thread-item {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.messages-thread-item {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 6px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.05s ease;
}

.messages-thread-link:hover .messages-thread-item {
  background: #f9fafb;
  border-color: #e5e7eb;
  transform: translateY(-1px);
}


.messages-sidebar-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.messages-sidebar-header p {
  margin: 4px 0 8px;
}

.messages-thread-list {
  max-height: 420px;
  overflow-y: auto;
  margin-top: 4px;
  padding-right: 4px;
}

.messages-thread-item {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 6px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.05s ease;
}

.messages-thread-item:hover {
  background: #f9fafb;
  border-color: #e5e7eb;
  transform: translateY(-1px);
}

.messages-thread-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
}

.messages-thread-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  font-size: 0.78rem;
}

.messages-thread-preview {
  margin-top: 4px;
  font-size: 0.8rem;
  color: #4b5563;
}

.messages-main {
  background: #fff;
  border-radius: 16px;
  padding: 14px 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  width: 100%;
}

.messages-empty-state {
  text-align: center;
  max-width: 360px;
}

.messages-empty-state h2 {
  margin-bottom: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.7rem;
  font-weight: 500;
}

/* Icon button for + new message */
.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

/* Make messages header align button nicely */
.messages-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* ---- Simple modal (approval editor) ---- */
.simple-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
}

.simple-modal.is-open {
  display: block;
}

.simple-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.simple-modal__card {
  position: relative;
  width: min(420px, calc(100% - 28px));
  margin: 12vh auto 0;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.18);
}

/* --- Auth: make selects match inputs --- */
.auth-field select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  background: #f9fafb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-field select:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}

/* --- Auth: 2-column layout inside forms --- */
.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 700px) {
  .auth-grid { grid-template-columns: 1fr; }
}

.auth-hint {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #6b7280;
}

.auth-optional {
  font-weight: 500;
  font-size: 0.8rem;
  color: #6b7280;
}

/* --- Live validators (Register) --- */
.field-feedback {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #6b7280;
}

.field-feedback.ok { color: #166534; }
.field-feedback.bad { color: #991b1b; }

.pw-rules {
  margin-top: 8px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(229, 231, 235, 1);
  background: rgba(249, 250, 251, 0.9);
}

.pw-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #6b7280;
  margin: 6px 0;
}

.pw-rule .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d1d5db;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.7);
}

.pw-rule.ok { color: #166534; }
.pw-rule.ok .dot { background: #22c55e; }

.pw-rule.bad { color: #991b1b; }
.pw-rule.bad .dot { background: #ef4444; }

.pw-strength {
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.pw-strength.ok { color: #166534; }
.pw-strength.bad { color: #991b1b; }

.pw-rule.is-hidden { display: none; }

/* Make unmet rules red */
.pw-rule.bad { color: #991b1b; }
.pw-rule.bad .dot { background: #ef4444; }

/* Strength label colors */
.pw-strength.ok { color: #166534; }
.pw-strength.bad { color: #991b1b; }


