:root {
  --bg: #f3f1f7;
  --panel: #ffffff;
  --panel-soft: #f4f2f8;
  --primary: #6f4ed7;
  --primary-2: #8a72e8;
  --primary-deep: #4b3a97;
  --accent: #d5d0df;
  --success: #3ab97c;
  --text: #1f1d2b;
  --muted: #66657a;
  --dark: #2c2a3a;
  --shadow: 0 18px 38px rgba(75, 58, 151, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Manrope', sans-serif;
  background: linear-gradient(180deg, #edf3ff 0%, #f5f8ff 100%);
  color: var(--text);
}

button, input {
  font: inherit;
}

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

.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #2f2b3a 0%, #232130 100%);
  color: white;
  padding: 32px 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, #d9d2ef, #f3f1f8);
  color: var(--primary-deep);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  opacity: 0.7;
}

h1, h2, h3, h4, p {
  margin: 0;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.nav-link {
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.8);
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255,255,255,0.08);
  border-color: #8a72e8;
  color: white;
}

.sidebar-card {
  margin-top: auto;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
}

.session-pill {
  display: inline-flex;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.session-pill.online {
  background: rgba(47, 191, 113, 0.18);
  color: #b8f2d3;
}

.session-pill.offline {
  background: rgba(255, 255, 255, 0.08);
  color: #e9edf8;
}

.main-panel {
  flex: 1;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

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

.primary-btn,
.secondary-btn,
.danger-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 14px 24px rgba(79, 124, 255, 0.24);
}

.secondary-btn {
  background: rgba(79, 124, 255, 0.08);
  color: var(--primary);
}

.danger-btn {
  background: rgba(220, 53, 69, 0.08);
  color: #b42318;
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
}

.auth-controls,
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.profile-form,
.mini-form {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.volunteer-grid {
  align-items: start;
}

.volunteer-gates {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.volunteer-hub-switch .secondary-btn {
  border: 1px solid rgba(111, 78, 215, 0.22);
}

.volunteer-hub-switch .secondary-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(111, 78, 215, 0.22);
}

.volunteer-hub-panel {
  display: none;
}

.volunteer-hub-panel.active {
  display: block;
}

.volunteer-switch-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-soft);
  border: 1px solid #dde8ff;
  border-radius: 12px;
}

.volunteer-switch-row input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.choice-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  grid-column: 1 / -1;
}

.calendar-toggle-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-toggle-btn {
  border: 1px solid #dfe5ff;
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-toggle-btn.active {
  background: rgba(111, 78, 215, 0.12);
  border-color: rgba(111, 78, 215, 0.45);
  color: var(--primary-deep);
}

.calendar-card {
  background: var(--panel);
  border: 1px solid #ebebf7;
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.calendar-card.compact {
  padding: 14px 16px;
}

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

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-day {
  border: 1px solid #ebecf3;
  background: #f7f7fc;
  color: var(--text);
  border-radius: 10px;
  min-height: 36px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-day.empty {
  opacity: 0.35;
  cursor: default;
  background: transparent;
  border-style: dashed;
}

.calendar-day.today {
  background: rgba(111, 78, 215, 0.08);
  border-color: rgba(111, 78, 215, 0.35);
}

.calendar-day.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.calendar-day.has-entry {
  box-shadow: inset 0 0 0 2px rgba(111, 78, 215, 0.4);
}

.calendar-day-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.94rem;
}

.field-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.inline-add-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-add-row input {
  flex: 1;
}

.compact-btn {
  padding: 10px 14px;
  white-space: nowrap;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selfcare-task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.feeling-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.feeling-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 112px;
  border: 1px solid #ddd2ff;
  background: #f7f3ff;
  color: var(--primary-deep);
  border-radius: 20px;
  padding: 16px 12px;
  cursor: pointer;
  transition: 0.2s ease;
}

.feeling-card .feeling-icon {
  font-size: 34px;
  line-height: 1;
}

.feeling-card .feeling-label {
  font-size: 14px;
  font-weight: 700;
}

.feeling-card.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: white;
  box-shadow: 0 10px 18px rgba(111, 78, 215, 0.22);
}

.choice-chip,
.reward-choice-btn,
.dosage-unit-btn {
  border: 1px solid #ddd2ff;
  background: #f5f1ff;
  color: var(--primary-deep);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

.choice-chip.active,
.reward-choice-btn.active,
.dosage-unit-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: white;
  box-shadow: 0 10px 18px rgba(111, 78, 215, 0.22);
}

.hidden-select {
  display: none;
}

.reward-list .reward-choice-btn {
  min-width: 104px;
  text-align: center;
}

.profile-form label,
.mini-form label,
.profile-grid label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.stacked-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dosage-layout {
  display: grid;
  grid-template-columns: minmax(120px, 140px) 1fr;
  gap: 12px;
  align-items: start;
}

.dosage-value-column,
.dosage-unit-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dosage-value-column input {
  max-width: 120px;
}

.reminder-hour-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(44px, 1fr));
  gap: 8px;
}

.reminder-hour-btn {
  border: 1px solid #ddd2ff;
  background: #f5f1ff;
  color: var(--primary-deep);
  border-radius: 10px;
  min-height: 46px;
  font-weight: 700;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  transition: 0.2s ease;
}

.reminder-hour-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: white;
  box-shadow: 0 10px 18px rgba(111, 78, 215, 0.22);
}

.custom-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-time-row input[type='time'] {
  max-width: 160px;
}

.profile-form input,
.profile-form select,
.mini-form input,
.mini-form select,
.login-form input,
.profile-grid input {
  padding: 12px 14px;
  background: var(--panel-soft);
  border: 1px solid #dde8ff;
  border-radius: 12px;
  color: var(--text);
}

.profile-grid label {
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(249, 247, 255, 0.96), rgba(244, 241, 250, 0.96));
  border: 1px solid #e7e0f6;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.profile-grid label input {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: none;
  outline: none;
  min-height: auto;
}

.auth-card,
.panel-card,
.stat-card,
.list-item {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 24px;
  margin-bottom: 26px;
}

.auth-header {
  margin-bottom: 18px;
}

.auth-header p {
  margin-top: 6px;
  color: var(--muted);
}

.auth-quick-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.auth-role-block {
  grid-column: 1 / -1;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f7f4ff 0%, #f0f5ff 100%);
  border: 1px solid #dfe6ff;
  max-height: 220px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 0.28s ease, opacity 0.22s ease, transform 0.22s ease, margin 0.22s ease, padding 0.22s ease;
  overflow: hidden;
}

.auth-role-block.collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  pointer-events: none;
}

.auth-role-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(111, 78, 215, 0.08);
}

.auth-role-btn {
  border: 1px solid #d7defa;
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  color: var(--primary-deep);
  border-radius: 12px;
  padding: 12px 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 76px;
  position: relative;
}

.auth-role-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(93, 111, 172, 0.15);
  border-color: #bfcfff;
}

.auth-role-btn.active {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 22px rgba(111, 78, 215, 0.28);
}

.auth-role-btn.active::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.auth-role-name {
  font-size: 0.98rem;
  line-height: 1.1;
}

.auth-role-desc {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7396;
  line-height: 1.25;
}

.auth-role-btn.active .auth-role-desc {
  color: rgba(255, 255, 255, 0.9);
}

.auth-role-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-login-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.login-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px;
  align-items: end;
}

.form-message {
  min-height: 20px;
  margin-top: 12px;
  color: var(--muted);
}

.form-message.error {
  color: #d9534f;
}

.form-message.success {
  color: var(--success);
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 18px;
}

.section-heading.module-banner {
  justify-content: flex-start;
  gap: 16px;
  padding: 18px 22px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, #5b46d6, #8b7be8);
  box-shadow: 0 10px 24px rgba(91, 70, 214, 0.22);
}

.module-banner-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.module-banner-text {
  min-width: 0;
}

.section-heading.module-banner h3 {
  margin: 2px 0;
  font-size: 1.6rem;
  color: #fff;
}

.section-heading.module-banner .eyebrow {
  color: #fff;
  opacity: 0.8;
}

.module-banner-sub {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.9);
}

.scale-card {
  --scale-color: #22c55e;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--scale-color) 12%, white);
  border: 1px solid color-mix(in srgb, var(--scale-color) 35%, white);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.scale-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scale-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--scale-color);
  transition: background 0.2s ease;
}

.scale-title {
  flex: 1;
  font-weight: 700;
}

.scale-value {
  padding: 4px 12px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  background: var(--scale-color);
  transition: background 0.2s ease;
}

.scale-card input[type="range"] {
  width: 100%;
  margin: 10px 0 6px;
  accent-color: var(--scale-color);
}

.scale-bar {
  height: 6px;
  border-radius: 999px;
}

.scale-bar-pain {
  background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444);
}

.scale-bar-energy {
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e);
}

.scale-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #6b7280;
}

.symptom-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.symptom-emoji {
  font-size: 1.1em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
}

.stat-card {
  padding: 20px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card span {
  color: var(--muted);
  font-weight: 600;
}

.stat-card strong {
  font-size: clamp(2rem, 3vw, 2.5rem);
}

.stat-card small {
  color: var(--muted);
}

.accent-blue { border-top: 5px solid #4f7cff; }
.accent-purple { border-top: 5px solid #7c6bf6; }
.accent-green { border-top: 5px solid #2fbf71; }
.accent-pink { border-top: 5px solid #ef6bb5; }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(248,246,252,0.95));
  border: 1px solid rgba(126, 103, 204, 0.12);
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.list-item {
  padding: 18px;
}

.list-item h4 {
  margin-bottom: 10px;
  font-size: 18px;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.meta-pill {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 999px;
  background: #edf3ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.muted-label {
  color: var(--muted);
  font-size: 12px;
}

.warning-text {
  margin-top: 12px;
  margin-bottom: 0;
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
}

.inline-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-edit-btn,
.summary-delete-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

.summary-edit-btn {
  background: #4f46e5;
}

.summary-delete-btn {
  background: #b91c1c;
}

.history-block {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #e3dbf7;
}

.history-row {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.edit-history-section {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid #e3dbf7;
}

.edit-history-section h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.recorded-dose-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

.text-danger-btn {
  border: none;
  background: transparent;
  color: #b42318;
  font-weight: 700;
  cursor: pointer;
}

.input-highlight {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .login-form,
  .profile-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .selfcare-task-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .selfcare-task-grid {
    grid-template-columns: 1fr;
  }
}

.help-detail-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e6e0ff; }
.rating-stars { color: #f5a623; letter-spacing: 1px; }
.help-conversation { padding: 10px; margin: 6px 0; border-radius: 12px; background: #f7f5ff; cursor: pointer; }
.help-conversation.selected { background: #ede9ff; }
.chat-messages { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.chat-row { display: flex; }
.chat-row.mine { justify-content: flex-end; }
.chat-bubble { max-width: 75%; padding: 8px 12px; border-radius: 14px; background: #efedf7; word-break: break-word; }
.chat-row.mine .chat-bubble { background: #4f46e5; color: #fff; }
.chat-bubble small { display: block; opacity: 0.75; font-size: 0.7rem; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; }

.messages-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.messages-fab:hover {
  background: var(--primary-deep);
}

.messages-fab.hidden {
  display: none;
}

.messages-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #e5484d;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  box-sizing: border-box;
}

/* Subscription page */
.nav-link.locked {
  opacity: 0.75;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.35);
}

.subscription-notice {
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: #fff4e0;
  border: 1px solid #f3c77a;
  color: #7a4b00;
  font-weight: 700;
}

.subscription-period-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 18px;
}

.subscription-period-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 120px;
  padding: 10px 16px;
  border: 1px solid #ddd2ff;
  border-radius: 14px;
  background: #f5f1ff;
  color: #4b34a8;
  font-weight: 700;
  cursor: pointer;
}

.subscription-period-btn small {
  color: #1c7a43;
  font-size: 11px;
}

.subscription-period-btn.active {
  background: linear-gradient(135deg, #6f4ed7, #8a72e8);
  border-color: transparent;
  color: #fff;
}

.subscription-period-btn.active small {
  color: #e8fff1;
}

.subscription-tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.subscription-tier-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid #e3ddf5;
  border-radius: 18px;
  background: #fff;
}

.subscription-tier-card.active {
  border-color: #6f4ed7;
  box-shadow: 0 0 0 2px rgba(111, 78, 215, 0.2);
}

.subscription-tier-card.needed {
  border-color: #f3a93c;
  box-shadow: 0 0 0 2px rgba(243, 169, 60, 0.3);
}

.subscription-current-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.subscription-pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff4e0;
  color: #7a4a00;
  font-weight: 600;
}

.subscription-cancel {
  padding: 8px 14px;
}

.subscription-tier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.subscription-discount {
  padding: 2px 10px;
  border-radius: 999px;
  background: #e8f7ee;
  color: #1c7a43;
  font-size: 12px;
  font-weight: 700;
}

.subscription-price {
  font-size: 26px;
  font-weight: 800;
}

.subscription-price small {
  font-size: 13px;
  font-weight: 600;
  color: #6b6584;
}

.subscription-desc {
  margin: 0;
  color: #6b6584;
  font-size: 13px;
}

/* Legal pages */
.auth-legal { grid-column: 1 / -1; display: grid; gap: 6px; }
.legal-check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; cursor: pointer; }
.legal-check input { width: auto; margin-top: 3px; }
.legal-notice { margin: 0; color: var(--muted); font-size: 0.9rem; }
.legal-link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.legal-stamp { color: var(--muted); font-weight: 500; }
.legal-body { white-space: pre-wrap; line-height: 1.6; color: var(--text); }
.legal-page h3 { margin-top: 0; }
.subscription-terms { margin-bottom: 14px; }
.legal-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(31, 29, 43, 0.55); }
.legal-modal.hidden { display: none; }
.legal-modal-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); width: min(720px, 100%); max-height: 85vh; display: flex; flex-direction: column; padding: 22px; gap: 14px; }
.legal-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.legal-modal-head h3 { margin: 0 0 4px; }
.legal-modal-card .legal-body { overflow-y: auto; }
