/* pray-app — Theme v9: tag chip × separation improved */

/* Art direction: Private pastoral prayer journal → calm, reflective, unhurried
   Palette: warm parchment surfaces, teal primary (spiritual life, growth), restrained
   Typography: Lora (display, warmth/gravitas) + Inter (body, clarity)
   Density: balanced — generous enough to feel unhurried, compact enough to be functional */

:root {
  /* Surfaces — warm parchment stack */
  --bg:                #f5f2ed;
  --surface:           #faf9f7;
  --surface-2:         #fdfcfb;
  --surface-alt:       #ede9e2;
  --surface-offset:    #e5e0d8;
  --surface-dynamic:   #ddd8d0;

  /* Borders */
  --border:            rgba(31,26,18,0.12);
  --border-subtle:     rgba(31,26,18,0.07);
  --divider:           rgba(31,26,18,0.09);

  /* Text */
  --text:              #1f1a12;
  --text-muted:        #635c52;
  --text-faint:        #9c9488;
  --text-inverse:      #f9f8f4;

  /* Primary — Pastoral Teal */
  --primary:           #0f6a64;
  --primary-hover:     #0a504b;
  --primary-active:    rgba(7,55,51,0.2);
  --primary-light:     rgba(15,106,100,0.08);
  --primary-highlight: rgba(15,106,100,0.14);

  /* Semantic */
  --success:           #3d7220;
  --success-hover:     #2a5315;
  --success-light:     rgba(61,114,32,0.09);

  --danger:            #a52e3f;
  --danger-hover:      #8a2434;
  --danger-light:      rgba(165,46,63,0.08);

  --warning:           #8c4a18;
  --warning-light:     rgba(140,74,24,0.08);

  /* Shadows — warm-tinted, never pure black */
  --shadow-sm: 0 1px 3px rgba(31,26,18,0.06), 0 1px 2px rgba(31,26,18,0.03);
  --shadow-md: 0 4px 12px rgba(31,26,18,0.08), 0 2px 4px rgba(31,26,18,0.04);
  --shadow-lg: 0 12px 28px rgba(31,26,18,0.11), 0 4px 8px rgba(31,26,18,0.05);

  /* Radius */
  --radius-xs:   6px;
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Type scale (fixed — web app, not editorial) */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 0.9375rem;
  --text-lg:   1rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;

  /* Fonts */
  --font-display: 'Lora', Georgia, serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Layout */
  --sidebar-width:      224px;
  --mobile-nav-height:  68px;
  --content-max:        720px;

  /* Animation */
  --transition:      180ms cubic-bezier(0.16,1,0.3,1);
  --transition-slow: 280ms cubic-bezier(0.16,1,0.3,1);

  /* Spacing (4px grid) */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
}

/* ========================================
   BASE RESET
   ======================================== */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
ul[role="list"], ol[role="list"] { list-style: none; }
button, input, textarea, select  { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

p, li { text-wrap: pretty; }

::selection { background: var(--primary-light); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

a, button, [role="button"], input, textarea, select {
  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
}

/* ========================================
   SKIP LINK
   ======================================== */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
  background: var(--surface);
  color: var(--text);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ========================================
   APP SHELL
   ======================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ========================================
   SIDEBAR (desktop)
   ======================================== */

.sidebar {
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.brand {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-1) 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--text-inverse);
  display: grid;
  place-items: center;
}

.brand-text h1 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.brand-text p {
  margin: 1px 0 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-family: var(--font-body);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-family: var(--font-body);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: 500;
  min-height: 44px;
  width: 100%;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--primary-light);
  color: var(--text);
  border-color: transparent;
  outline: none;
}

.nav-link.is-active {
  background: var(--primary-highlight);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* ========================================
   MOBILE BOTTOM NAV — floating pill
   ======================================== */

.mobile-nav {
  display: none;
  position: fixed;
  bottom: var(--space-4);
  left: 0;
  right: 0;
  z-index: 200;
  pointer-events: none;
}

.mobile-nav-inner {
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  width: min(360px, calc(100vw - var(--space-8)));
  margin: 0 auto;
  background: rgba(250,249,247,0.93);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3);
  gap: var(--space-1);
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--space-2) var(--space-3);
  min-height: 52px;
  min-width: 52px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: transparent;
  border: none;
  flex: 1;
  transition: background var(--transition), color var(--transition);
}

.mobile-nav-btn:hover,
.mobile-nav-btn:active,
.mobile-nav-btn.is-active {
  background: var(--primary-light);
  color: var(--primary);
}

.mobile-nav-btn svg { display: block; flex-shrink: 0; }

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
  padding: var(--space-6);
  padding-bottom: var(--space-10);
  min-width: 0;
  overflow-x: hidden;
}

.status-banner {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: 1.5;
  display: none;
  animation: banner-in 200ms var(--transition-slow) both;
}

@keyframes banner-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status-banner.is-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(165,46,63,0.2);
}

.status-banner.is-success {
  background: var(--success-light);
  color: var(--success-hover);
  border: 1px solid rgba(61,114,32,0.2);
}

.view { max-width: var(--content-max); }

/* ========================================
   CARDS
   ======================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

/* ========================================
   PAGE HEADER
   ======================================== */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.page-header h2 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-family: var(--font-body);
}

.actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

/* ========================================
   BUTTONS
   ======================================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  min-height: 40px;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.button:hover {
  background: var(--surface-alt);
  border-color: rgba(31,26,18,0.18);
  box-shadow: var(--shadow-sm);
}

.button:active { transform: translateY(1px); }

.button:disabled,
.button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}
.button-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.button-success {
  background: var(--success);
  color: var(--text-inverse);
  border-color: var(--success);
}
.button-success:hover {
  background: var(--success-hover);
  border-color: var(--success-hover);
}

.button-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: rgba(165,46,63,0.3);
}
.button-danger:hover {
  background: var(--danger-light);
  border-color: var(--danger);
}

.button-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.button-ghost:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: transparent;
  box-shadow: none;
}

.button-sm {
  padding: 7px 12px;
  font-size: var(--text-xs);
  min-height: 32px;
  border-radius: var(--radius-xs);
}

.button-icon {
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* ========================================
   FORMS
   ======================================== */

.form-grid { display: grid; gap: var(--space-4); }
.form-row  { display: grid; gap: var(--space-2); }

label {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
  font-family: var(--font-body);
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px var(--space-3);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-base);
}

input:hover,
textarea:hover,
select:hover {
  border-color: rgba(31,26,18,0.2);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.6;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  font-family: var(--font-body);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--space-1);
  font-family: var(--font-body);
}

/* ========================================
   LISTS
   ======================================== */

.list { display: grid; gap: var(--space-2); }

.list-item {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.list-item h3,
.list-item h4 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: 600;
}

.list-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.list-item-clickable {
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform var(--transition);
}
.list-item-clickable:hover {
  background: var(--surface-2);
  border-color: rgba(15,106,100,0.22);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.list-item-clickable:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.list-item-answered {
  background: color-mix(in srgb, rgba(61,114,32,0.07) 100%, var(--surface));
  border-color: rgba(61,114,32,0.14);
}

/* ========================================
   META & BADGES
   ======================================== */

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  color: var(--text-faint);
  font-size: var(--text-xs);
  font-family: var(--font-body);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 2px 9px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  background: var(--primary-light);
  color: var(--primary);
}

.badge-answered {
  background: var(--success-light);
  color: var(--success-hover);
}

.badge-archived {
  background: var(--surface-offset);
  color: var(--text-muted);
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
  padding: var(--space-10) var(--space-5);
  border: 1px dashed var(--divider);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}

.empty-state-icon {
  margin: 0 auto var(--space-4);
  width: 44px;
  height: 44px;
  color: var(--text-faint);
}

.empty-state h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 var(--space-6);
  color: var(--text-muted);
  font-family: var(--font-body);
  max-width: 36ch;
  margin-inline: auto;
}

/* ========================================
   NOTICE
   ======================================== */

.notice {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  font-style: italic;
}

/* ========================================
   AUTH
   ======================================== */

.auth-layout { max-width: 440px; }

/* ========================================
   WELCOME SCREEN
   ======================================== */

.welcome-hero {
  padding: var(--space-8) 0 var(--space-6);
}

.welcome-hero h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
  letter-spacing: -0.015em;
}

.welcome-hero p {
  color: var(--text-muted);
  font-size: var(--text-base);
  max-width: 50ch;
  line-height: 1.7;
}

/* ========================================
   SECTION HEADINGS & UTILITIES
   ======================================== */

.section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}

.muted-text {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
}

.divider {
  height: 1px;
  background: var(--divider);
  margin: var(--space-4) 0;
  border: none;
}

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

/* ========================================
   INVITE ROW
   ======================================== */

.invite-row {
  margin-top: var(--space-6);
  display: flex;
  justify-content: center;
}

/* ========================================
   MODAL
   ======================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(20,16,10,0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: modal-fade-in 180ms cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  width: 100%;
  max-width: 420px;
  animation: modal-slide-in 220ms cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes modal-slide-in {
  from { opacity: 0; transform: translateY(10px) scale(0.975); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.modal-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  background: transparent;
  border: none;
  flex-shrink: 0;
}

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

.modal-body-text {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

/* ========================================
   INVITE MODAL STATUS
   ======================================== */

.invite-modal-status {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.invite-modal-status-success {
  background: var(--success-light);
  color: var(--success-hover);
  border: 1px solid rgba(61,114,32,0.2);
}
.invite-modal-status-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(165,46,63,0.2);
}
.invite-modal-status-info {
  background: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid rgba(15,106,100,0.2);
}

/* ========================================
   SKELETON LOADERS
   ======================================== */

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-offset) 25%,
    var(--surface-dynamic) 50%,
    var(--surface-offset) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 1em; margin-bottom: var(--space-2); }
.skeleton-text:last-child { width: 60%; }
.skeleton-heading { height: 1.4em; width: 45%; margin-bottom: var(--space-4); }

/* ========================================
   PRAYER TABS
   ======================================== */

.prayer-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--divider);
  padding-bottom: 0;
}

.prayer-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  min-height: 40px;
}

.prayer-tab:hover {
  color: var(--text);
}

.prayer-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  background: var(--surface-offset);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-body);
}

.prayer-tab.is-active .tab-count {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========================================
   SHARED PRAYER BANNER
   ======================================== */

.shared-prayer-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--primary-light);
  border: 1px solid rgba(15,106,100,0.16);
  border-radius: var(--radius-sm);
  color: var(--primary-hover);
  font-size: var(--text-sm);
  font-family: var(--font-body);
}

.shared-by-label {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-body);
}

/* ========================================
   REMINDER TOGGLE
   ======================================== */

.reminder-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.reminder-toggle-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.4;
}

.reminder-toggle-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-body);
  font-weight: 400;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--surface-offset);
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: 0 1px 4px rgba(31,26,18,0.18), 0 1px 2px rgba(31,26,18,0.10);
  transition: transform var(--transition), box-shadow var(--transition);
  will-change: transform;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-track {
  background: var(--primary);
  border-color: var(--primary);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
  box-shadow: 0 1px 4px rgba(15,106,100,0.25), 0 1px 2px rgba(15,106,100,0.12);
}

.toggle-switch input[type="checkbox"]:focus-visible + .toggle-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.toggle-switch:hover .toggle-track {
  border-color: rgba(31,26,18,0.22);
}

.toggle-switch input[type="checkbox"]:checked:hover + .toggle-track {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.toggle-switch input[type="checkbox"]:disabled + .toggle-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-switch:has(input:disabled) {
  cursor: not-allowed;
}

/* ========================================
   PRAYER DETAIL — scoped classes
   ======================================== */

.detail-back-btn {
  margin-bottom: var(--space-2);
  color: var(--text-muted);
}

.detail-body-text {
  margin: 0;
  white-space: pre-wrap;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text);
}

.detail-notes-list {
  margin-bottom: var(--space-3);
}

.detail-notes-list .list-item p {
  -webkit-line-clamp: unset;
  overflow: visible;
  display: block;
  white-space: pre-wrap;
  color: var(--text);
}

.detail-share-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.detail-shares-container {
  margin-bottom: var(--space-3);
}

.detail-share-status {
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}
.detail-share-status-success { color: var(--success); }
.detail-share-status-error   { color: var(--danger); }

/* ── Prayer detail: title prominence ── */
.detail-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: var(--space-4) 0 var(--space-3);
  line-height: 1.2;
}

/* ── Prayer detail: compact metadata info-panel ── */
.info-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.info-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  flex-wrap: wrap;
}

.info-row + .info-row {
  border-top: 1px solid var(--border);
}

.info-row-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  min-width: 80px;
  flex-shrink: 0;
}

.info-row-value {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  flex: 1;
}

.info-row-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
}

.info-row-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* ── Profile: read-only email field ── */
.profile-field-readonly {
  color: var(--text);
  font-size: var(--text-base);
  padding: var(--space-2) 0;
  line-height: 1.5;
}

.profile-email-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--space-1);
}

/* ── Archived prayer: un-archive button ── */
.btn-unarchive {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Badge: archived status ── */
.badge-archived {
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── Group prayer wall ── */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.section-title-row .section-title {
  margin-bottom: 0;
}

.grp-prayer-owner {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
}

/* ── Group badge on prayer list items ── */
.badge-group {
  background: var(--surface-alt, var(--surface));
  color: var(--primary, var(--text));
  border: 1px solid var(--border);
  font-size: var(--text-xs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

/* ========================================
   TAG CHIPS — prayer detail tags
   ======================================== */

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

/*
  Outer pill: the tag name and × live inside one rounded container.
  We use overflow:hidden so the × button fills flush to the right edge
  of the pill without needing extra border-radius math.
*/
.tag-chip {
  display: inline-flex;
  align-items: stretch;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(15,106,100,0.25);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-body);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  overflow: hidden;
  min-height: 26px;
}

/*
  Label segment — generous left padding, tighter right padding.
  The right side intentionally has less space so the divider line
  before the × is clearly visible.
*/
.tag-chip-label {
  display: flex;
  align-items: center;
  padding: 5px var(--space-2) 5px var(--space-3);
}

/*
  × remove button — a visually distinct segment separated from the
  label by a solid hairline divider.

  Design decisions:
  - border-left creates an obvious "wall" between the word and the ×
  - Darker teal background at rest makes it look like a clickable zone
  - Wide padding (12px each side) so it can never be mistaken for a letter
  - Turns red on hover — destructive intent is unmistakable
  - Font-size slightly larger than the label text so × reads as a symbol
*/
.tag-chip-remove {
  appearance: none;
  cursor: pointer;
  font-family: var(--font-body);

  /* Visual separator */
  border: none;
  border-left: 1px solid rgba(15,106,100,0.35);

  /* Layout — fills height of chip, wide enough to tap comfortably */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  flex-shrink: 0;
  align-self: stretch;

  /* Distinct background at rest — clearly a button zone, not text */
  background: rgba(15,106,100,0.18);
  color: var(--primary);

  /* × character sized up so it reads as a control, not a letter */
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;

  transition: background var(--transition), color var(--transition),
              border-color var(--transition);
}

/* Hover: full danger red — no ambiguity about what this does */
.tag-chip-remove:hover {
  background: var(--danger);
  color: #fff;
  border-left-color: var(--danger-hover);
}

.tag-chip-remove:active {
  background: var(--danger-hover);
  color: #fff;
}

.tag-chip-remove:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* ========================================
   REMINDER BELL — active state indicator
   ======================================== */

.reminder-bell-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.reminder-bell {
  position: relative;
}

.reminder-bell.is-active {
  color: var(--primary);
  background: var(--primary-light);
  border-color: rgba(15,106,100,0.2);
}

.reminder-bell-wrap::after {
  content: '';
  display: block;
  position: absolute;
  top: 3px;
  right: 3px;
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--surface-offset);
  border: 2px solid var(--surface);
  pointer-events: none;
  transition: background var(--transition);
}

.reminder-bell-wrap.is-active::after {
  background: var(--primary);
}

/* ========================================
   MOBILE — < 1024px
   ======================================== */

@media (max-width: 1023px) {
  .app-shell    { display: block !important; }
  .sidebar      { display: none !important; }
  .mobile-nav   { display: block; }

  .main-content {
    padding: var(--space-4);
    padding-bottom: calc(var(--mobile-nav-height) + var(--space-8));
  }

  .view { max-width: 100%; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .page-header h2 { font-size: var(--text-xl); }

  .actions { width: 100%; }
  .actions .button {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 46px;
  }

  .actions .button-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    min-height: 46px;
  }

  .card {
    padding: var(--space-4);
    margin-bottom: var(--space-3);
  }

  .button     { min-height: 46px; padding: 12px 16px; }
  .button-sm  { min-height: 40px; padding: 9px 13px; font-size: var(--text-sm); }
  input, textarea, select { min-height: 46px; }

  .welcome-hero { padding: var(--space-5) 0 var(--space-4); }
  .welcome-hero h2 { font-size: var(--text-xl); }

  .modal {
    max-width: 100%;
    padding: var(--space-5);
    border-radius: var(--radius);
  }

  .prayer-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .prayer-tabs::-webkit-scrollbar { display: none; }

  .reminder-bell-wrap::after {
    width: 10px;
    height: 10px;
    top: 2px;
    right: 2px;
  }
}
