/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

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

:root {
  --bg:       #1b1b1b;
  --surface:  #161616;
  --border:   #2a2a2a;
  --text:     #e8e8e8;
  --muted:    #888;
  --accent:   #7c6ef5;
  --accent-h: #9d91f7;
  --danger:   #e05c5c;
  --success:  #4caf78;
  --radius:   6px;
  --font:     "Science Gothic", "Inter", system-ui, -apple-system, sans-serif;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: 0.03em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-hamburger--open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-hamburger--open span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger--open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-link {
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.15s;
}

.nav-link:hover { color: var(--text); }

.nav-link--cta {
  background: var(--accent);
  color: #fff;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
}

.nav-link--cta:hover { background: var(--accent-h); color: #fff; }

/* ── Main content ───────────────────────────────────────── */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  min-height: calc(100vh - 120px);
}

/* ── Flash messages ─────────────────────────────────────── */
.flash {
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.flash--notice {
  background: rgba(76, 175, 120, 0.15);
  border: 1px solid rgba(76, 175, 120, 0.4);
  color: var(--success);
}

.flash--alert {
  background: rgba(224, 92, 92, 0.15);
  border: 1px solid rgba(224, 92, 92, 0.4);
  color: var(--danger);
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.6rem 0.85rem;
  font-size: 0.95rem;
  transition: border-color 0.15s;
  outline: none;
}

.form-control:focus { border-color: var(--accent); }

.form-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-h); color: #fff; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

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

/* ── Auth pages ─────────────────────────────────────────── */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 0;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.auth-links {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ── Profile page ───────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ── Avatar upload ──────────────────────────────────────── */
.avatar-upload-area {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.avatar-upload-preview {
  flex-shrink: 0;
}

.avatar-upload-current {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.avatar-upload-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}

.avatar-upload-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.avatar-file-label {
  cursor: pointer;
  position: relative;
}

.avatar-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
}

.avatar-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.avatar-error {
  font-size: 0.85rem;
  color: var(--danger);
  margin-top: 0.4rem;
}

.profile-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.profile-email { color: var(--muted); font-size: 0.9rem; }

.profile-actions { margin-top: 2rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

.action-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.action-row--tight {
  gap: 0.5rem;
  margin-top: 0;
}

/* ── How Femsyn Works section ──────────────────────────────── */
.how-it-works {
  margin-top: 1.5rem;
}

.how-it-works-heading {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.how-it-works-intro {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  max-width: 640px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.how-it-works-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 600px) {
  .how-it-works-grid {
    grid-template-columns: 1fr;
  }
}

.how-it-works-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.how-it-works-icon {
  font-size: 1.6rem;
  margin-bottom: 0.65rem;
  line-height: 1;
}

.how-it-works-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.how-it-works-text {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Site stats bar ─────────────────────────────────────── */
.site-stats {
  text-align: center;
  padding: 2rem 0 1rem;
}

.site-stats-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.site-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  min-width: 110px;
}

.site-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.site-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Home page ──────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── Error messages ─────────────────────────────────────── */
.error-list {
  background: rgba(224, 92, 92, 0.12);
  border: 1px solid rgba(224, 92, 92, 0.35);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.error-list p {
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.error-list ul {
  list-style: disc;
  padding-left: 1.2rem;
}

.error-list li { color: var(--danger); font-size: 0.85rem; }

/* ── Home info row (Recently Joined + Default Habits) ─── */
.home-info-row {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-top: 2rem;
}

.home-info-row .recent-profiles {
  flex: 0 0 200px;
}

.home-info-row--single .recent-profiles {
  flex: 1;
}

.home-info-row .default-habits-card {
  flex: 1;
}

@media (max-width: 600px) {
  .home-info-row {
    flex-direction: column;
  }

  .home-info-row .recent-profiles {
    flex: none;
    width: 100%;
  }
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  background-color: #000;
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-link {
  margin-left: 1rem;
}

/* ── Utility ────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-muted { color: var(--muted); }
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ── Policy / Terms pages ───────────────────────────────── */
.policy-body h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.policy-body p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.policy-body ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.policy-body li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* ── Profile form ───────────────────────────────────────── */
.profile-form-card {
  max-width: 760px;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.form-section-title:first-of-type { margin-top: 0; }

.required-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(224, 92, 92, 0.18);
  color: var(--danger);
  border: 1px solid rgba(224, 92, 92, 0.35);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
}

.optional-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(124, 110, 245, 0.15);
  color: var(--accent);
  border: 1px solid rgba(124, 110, 245, 0.3);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
}

/* ── Radio groups ───────────────────────────────────────── */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.85rem;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.9rem;
}

.radio-option:hover {
  border-color: var(--accent);
}

.radio-input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.radio-input:checked + .radio-label {
  color: var(--accent);
}

.radio-option:has(.radio-input:checked) {
  border-color: var(--accent);
  background: rgba(124, 110, 245, 0.08);
}

/* ── Checkbox grids ─────────────────────────────────────── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem;
}

.checkbox-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.875rem;
}

.checkbox-option:hover {
  border-color: var(--accent);
}

.checkbox-input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.checkbox-option:has(.checkbox-input:checked) {
  border-color: var(--accent);
  background: rgba(124, 110, 245, 0.08);
}

/* ── Profile sections ───────────────────────────────────── */
.profile-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.profile-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.profile-fields {
  display: grid;
  gap: 0.85rem;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.profile-field-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  list-style: none;
}

.profile-field-value {
  color: var(--text);
  font-size: 0.95rem;
  white-space: pre-wrap;
  list-style: none;
}

.profile-field-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}

.profile-tag {
  background: rgba(124, 110, 245, 0.12);
  border: 1px solid rgba(124, 110, 245, 0.28);
  color: var(--accent-h);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 500;
}

/* ── Messages ───────────────────────────────────────── */
.btn-danger {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}
.btn-danger:hover { background: #a93226; border-color: #a93226; }

.btn-sm {
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
}

.unread-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 0.05rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 0.2rem;
}

.thread-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr;
  gap: 1rem;
  align-items: start;
}

.thread-list .messages-list,
.thread-detail .messages-list {
  gap: 0.75rem;
}

.thread-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.thread-preview {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.thread-preview-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.thread-preview-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thread-preview-content {
  min-width: 0;
  flex: 1;
}

.message-item--active {
  border-color: var(--accent-h);
}

.thread-detail {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.thread-title {
  margin: 0;
  font-size: 1.05rem;
}

.thread-reply {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface);
}

.messages-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.message-from { font-weight: 600; }
.message-date { color: var(--muted); }

.message-body {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.message-image-wrap {
  margin-top: 0.4rem;
}

.message-image {
  display: block;
  max-width: 100%;
  max-height: 360px;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.message-image-removed-indicator {
  color: var(--muted);
  font-size: 0.9rem;
}

.message-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.messages-empty {
  color: var(--muted);
  font-style: italic;
  padding: 2rem 0;
}

.message-compose { max-width: 600px; margin: 0 auto; }
.message-compose .page-title { margin-bottom: 1.5rem; }

.form-field { margin-bottom: 1.2rem; display: flex; flex-direction: column; gap: 0.3rem; }
.form-field label { font-weight: 600; font-size: 0.9rem; }
.form-control {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  width: 100%;
  resize: vertical;
}
.form-control:focus { outline: none; border-color: var(--accent-h); }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.field-hint { color: var(--muted); font-size: 0.82rem; }

/* ── Habits ─────────────────────────────────────────── */
.profile-section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.profile-section-header .profile-section-title {
  margin-bottom: 0;
}

.btn-xs {
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
}

.habits-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.habit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
}

.habit-card-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.habit-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  flex: 1;
}

.habit-frequency {
  background: rgba(124, 110, 245, 0.12);
  border: 1px solid rgba(124, 110, 245, 0.28);
  color: var(--accent-h);
  border-radius: 4px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.habit-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.habit-description {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
  white-space: pre-wrap;
}

.profile-empty-text {
  color: var(--muted);
  font-style: italic;
  font-size: 0.92rem;
}

/* ── Service Applications ───────────────────────────── */
.submissives-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.submissive-item {
  background: rgba(124, 110, 245, 0.08);
  border: 1px solid rgba(124, 110, 245, 0.22);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.92rem;
}

.submissive-link {
  color: var(--accent-h);
  text-decoration: none;
}

.submissive-link:hover { text-decoration: underline; }

.users-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.user-item {
  background: rgba(124, 110, 245, 0.08);
  border: 1px solid rgba(124, 110, 245, 0.22);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.92rem;
}

.user-link {
  color: var(--accent-h);
  text-decoration: none;
}

.user-link:hover { text-decoration: underline; }

.home-search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.search-results-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result-item {
  border: 1px solid rgba(124, 110, 245, 0.22);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.search-result-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.search-result-name {
  margin: 0;
  font-size: 1rem;
}

.search-result-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-result-description {
  margin: 0.25rem 0 0;
  color: var(--text);
  white-space: pre-wrap;
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.form-control--inline {
  font-size: 0.85rem;
  resize: none;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* ── Habit Completions ──────────────────────────────────── */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.dominant-group {
  margin-bottom: 2.5rem;
}

.dominant-group-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.habit-status-badge {
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.habit-status--complete {
  background: rgba(76, 175, 120, 0.15);
  border: 1px solid rgba(76, 175, 120, 0.4);
  color: var(--success);
}

.habit-status--pending {
  background: rgba(124, 110, 245, 0.12);
  border: 1px solid rgba(124, 110, 245, 0.28);
  color: var(--accent-h);
}

/* ── Compliance history strip ───────────────────────────── */
.compliance-submissive-section {
  margin-bottom: 2.5rem;
}

.compliance-sub-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.history-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.6rem;
}

.history-period {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 42px;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  gap: 0.15rem;
}

.history-period--completed {
  background: rgba(76, 175, 120, 0.12);
  border-color: rgba(76, 175, 120, 0.35);
}

.history-period--missed {
  background: rgba(224, 92, 92, 0.10);
  border-color: rgba(224, 92, 92, 0.35);
}

.history-period--pending {
  background: var(--surface);
  border-color: var(--border);
}

.history-period-icon {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.history-period--completed .history-period-icon { color: var(--success); }
.history-period--missed    .history-period-icon { color: var(--danger); }
.history-period--pending   .history-period-icon { color: var(--muted); }

.history-period-label {
  color: var(--muted);
  font-size: 0.65rem;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

/* ── Status Modal ───────────────────────────────────────── */
body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  width: 100%;
  max-width: 480px;
  margin: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

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

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

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ── Admin ───────────────────────────────────────────── */
.admin-users-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 1rem;
}

.admin-users-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.admin-users-table th,
.admin-users-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.admin-users-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-messages-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-messages-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-message-thread-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-message-thread {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
}

.admin-message-thread-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.admin-message-thread-meta p {
  margin: 0;
}

.admin-message-thread-last-incoming {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.85rem;
}

.admin-message-thread-last-incoming .message-from {
  margin: 0 0 0.35rem;
}

.admin-message-thread-last-incoming .message-body {
  margin-bottom: 0;
}

.admin-message-thread-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .nav-container {
    height: 56px;
    padding: 0 1rem;
    position: relative;
  }

  .nav-hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 0;
    z-index: 99;
  }

  .nav-links--open {
    display: flex;
  }

  .nav-links .nav-link {
    width: 100%;
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
  }

  .nav-links .nav-link--cta {
    margin: 0.5rem 1.5rem;
    width: auto;
  }

  .main-content {
    padding: 1.5rem 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero-title {
    font-size: 1.95rem;
  }

  .profile-header,
  .profile-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .message-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.65rem;
  }

  .thread-layout {
    grid-template-columns: 1fr;
  }

  .checkbox-grid,
  .checkbox-grid--wide {
    grid-template-columns: 1fr;
  }
}

/* fix weird button height problem */
button.btn {
  height: auto;
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.plan-card--selected {
  border-color: var(--accent) !important;
  background: #1e1a3a;
}
