/**
 * Modern, Peaceful & Dignified Styling for 4th Step Moral Inventory
 * Completely Reimagined for Maximum Intuition, Serenity & Clarity.
 */

:root {
  /* =========================================================================
     THEME 1: SACRED PARCHMENT (Default: Warm Antique Linen, Forest & Gold)
     ========================================================================= */
  --bg-page: #fbf9f4;
  --bg-card: #ffffff;
  --bg-card-secondary: #f5efe3;
  --bg-input: #ffffff;
  --bg-hover: #ede4d3;
  --text-main: #2b251d;
  --text-muted: #6e6353;
  --border-color: #ded3c0;
  --border-light: #ece3d3;

  --primary: #2d5038;
  --primary-hover: #223e2b;
  --primary-light: #edf4ee;
  --accent: #b0621e;
  --accent-hover: #934f15;
  --accent-light: #faeee2;
  --gold: #b38933;
  --gold-light: #fbf4e2;
  --danger: #b23b3b;
  --danger-light: #faeceb;
  --success: #287233;
  --success-light: #e8f5e9;

  --font-serif: "Lora", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-heading: "Cinzel", "Lora", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --shadow-xs: 0 1px 2px rgba(43, 37, 29, 0.05);
  --shadow-sm: 0 2px 6px rgba(43, 37, 29, 0.06);
  --shadow-md: 0 6px 18px rgba(43, 37, 29, 0.08);
  --shadow-lg: 0 16px 36px rgba(43, 37, 29, 0.12);

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* =========================================================================
   THEME 2: MIDNIGHT SLATE (Deep Contemplative Dark Mode)
   ========================================================================= */
[data-theme="midnight"] {
  --bg-page: #0f1217;
  --bg-card: #181d24;
  --bg-card-secondary: #212833;
  --bg-input: #151a21;
  --bg-hover: #2a3341;
  --text-main: #ebf0f7;
  --text-muted: #9aa5b5;
  --border-color: #313c4c;
  --border-light: #242c38;

  --primary: #52a868;
  --primary-hover: #67bf7e;
  --primary-light: #16291d;
  --accent: #e59740;
  --accent-hover: #f5a954;
  --accent-light: #342111;
  --gold: #dfb54b;
  --gold-light: #2d2511;
  --danger: #e05d5d;
  --danger-light: #361717;
  --success: #48bb78;
  --success-light: #153322;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.7);
}

/* =========================================================================
   THEME 3: SANCTUARY PINE (Deep Evergreen Forest & Ancient Gold)
   ========================================================================= */
[data-theme="sanctuary"] {
  --bg-page: #0f1c16;
  --bg-card: #172a22;
  --bg-card-secondary: #203a2f;
  --bg-input: #13241d;
  --bg-hover: #294c3d;
  --text-main: #f0f7f3;
  --text-muted: #a3c5b5;
  --border-color: #325746;
  --border-light: #223f32;

  --primary: #cda840;
  --primary-hover: #dfba50;
  --primary-light: #2d2612;
  --accent: #e09453;
  --accent-hover: #f0a667;
  --accent-light: #382414;
  --gold: #cda840;
  --gold-light: #2d2612;
  --danger: #e56b6f;
  --danger-light: #381a1c;
  --success: #68d391;
  --success-light: #163623;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.75);
}

/* =========================================================================
   THEME 4: MINIMALIST PEARL (Crisp, High-Clarity Editorial)
   ========================================================================= */
[data-theme="pearl"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-secondary: #f1f5f9;
  --bg-input: #ffffff;
  --bg-hover: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;

  --primary: #1e3a8a;
  --primary-hover: #172554;
  --primary-light: #eff6ff;
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-light: #fef3c7;
  --gold: #b45309;
  --gold-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --success: #16a34a;
  --success-light: #dcfce7;
}

/* =========================================================================
   BASE & RESET
   ========================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.55;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* =========================================================================
   HEADER: Serene, Dignified & Intuitive
   ========================================================================= */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.brand-compass {
  font-size: 1.85rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-main);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.header-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-secondary);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  font-size: 0.8rem;
  font-weight: 500;
}

.summary-pill {
  color: var(--text-muted);
}

.summary-success {
  color: var(--success);
  font-weight: 600;
}

.summary-amber {
  color: var(--accent);
  font-weight: 600;
}

.summary-separator {
  color: var(--border-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zen-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.825rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  position: relative;
}

.zen-pill-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.zen-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.btn-icon-round {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.btn-icon-round:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

/* =========================================================================
   ZEN TOOLS DRAWER
   ========================================================================= */
.zen-drawer {
  background: var(--bg-card-secondary);
  border-bottom: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
  animation: slide-down 0.2s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.zen-drawer-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  position: relative;
  flex-wrap: wrap;
}

.zen-drawer-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.zen-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.zen-buttons-row {
  display: flex;
  gap: 0.5rem;
}

.zen-ambient-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.volume-slider {
  accent-color: var(--primary);
  width: 90px;
}

.btn-close-zen {
  position: absolute;
  right: 1.25rem;
  top: 1rem;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-zen:hover {
  background: var(--bg-hover);
}

/* =========================================================================
   PRIMARY NAVIGATION: 4 Inventories + 2 Sanctuaries
   ========================================================================= */
.app-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.nav-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-container::-webkit-scrollbar {
  display: none;
}

.nav-segment {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-separator {
  height: 24px;
  width: 1px;
  background: var(--border-color);
  margin: 0 0.5rem;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid transparent;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.nav-pill:hover {
  background: var(--bg-card-secondary);
  color: var(--text-main);
}

.nav-pill.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.pill-badge {
  background: var(--bg-card-secondary);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  line-height: 1;
}

.nav-pill.active .pill-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.pill-badge-prayer {
  background: var(--gold-light);
  color: var(--gold);
}

/* =========================================================================
   APP CONTENT & PANES
   ========================================================================= */
.app-content {
  flex: 1;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fade-in 0.2s ease-out;
}

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

/* =========================================================================
   HERO STRIP
   ========================================================================= */
.hero-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.hero-strip-prayer {
  border-left-color: var(--gold);
}

.hero-strip-step5 {
  border-left-color: var(--accent);
}

.hero-text h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.hero-cite {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-muted);
  font-style: italic;
}

.hero-quote {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.hero-actions {
  flex-shrink: 0;
}

/* =========================================================================
   BRAIN DUMP CARD: Quick 1-Tap Name Collector
   ========================================================================= */
.brain-dump-card {
  background: var(--bg-card-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.5rem;
}

.dump-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.dump-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
}

.dump-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.dump-sub {
  font-size: 0.825rem;
  font-weight: 400;
  color: var(--text-muted);
}

.dump-form {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.dump-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  transition: border-color var(--transition-fast);
}

.dump-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.dump-prefix {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-right: 0.65rem;
  white-space: nowrap;
}

.dump-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-main);
}

.btn-dump {
  white-space: nowrap;
  padding: 0.45rem 1.25rem;
}

.dump-quick-tags {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.quick-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-chip:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* =========================================================================
   WORKSPACE TOOLBAR & FILTERS
   ========================================================================= */
.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-field {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-field:focus {
  border-color: var(--primary);
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.select-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.825rem;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
}

.view-mode-toggle {
  display: inline-flex;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.view-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* =========================================================================
   RESENTMENT CARDS VIEW (Clean, Human & Intuitive)
   ========================================================================= */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1.25rem;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.item-card-draft {
  border-left: 4px solid var(--accent);
}

.item-card-complete {
  border-left: 4px solid var(--primary);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.target-badge-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-target-name {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.card-category {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.card-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.status-complete {
  background: var(--success-light);
  color: var(--success);
}

.status-pending {
  background: var(--accent-light);
  color: var(--accent);
}

.card-cause-box {
  background: var(--bg-card-secondary);
  border-left: 3px solid var(--border-color);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-xs);
}

.card-cause-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.card-cause-text {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.45;
}

.card-instincts-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.instinct-badge {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-pill);
}

/* Turnaround Highlight Box */
.card-turnaround-box {
  background: var(--primary-light);
  border: 1px solid rgba(45, 80, 56, 0.18);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.turnaround-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.turnaround-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.defects-chips-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.defect-chip-tag {
  background: rgba(178, 59, 59, 0.12);
  color: var(--danger);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-xs);
}

.card-mypart-text {
  font-family: var(--font-serif);
  font-size: 0.925rem;
  color: var(--text-main);
  line-height: 1.45;
  font-style: italic;
}

.asset-highlight {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.825rem;
  color: var(--success);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.6);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
}

/* 14-Day Prayer Inline Bar in Card */
.card-prayer-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gold-light);
  border: 1px solid rgba(179, 137, 51, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.prayer-strip-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: var(--gold);
}

.prayer-beads-inline {
  display: flex;
  gap: 3px;
}

.bead-mini {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: transparent;
  cursor: pointer;
}

.bead-mini.completed {
  background: var(--gold);
}

/* Card Footer Actions */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
  margin-top: auto;
}

.footer-btn-group {
  display: flex;
  gap: 0.4rem;
}

/* =========================================================================
   CLASSIC 4-COLUMN LEDGER TABLE VIEW (Big Book 1939 Format)
   ========================================================================= */
.ledger-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.ledger-table th {
  background: var(--bg-card-secondary);
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.03em;
}

.ledger-table th:last-child {
  border-right: none;
}

.ledger-table td {
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  padding: 0.85rem 1rem;
  vertical-align: top;
  line-height: 1.5;
}

.ledger-table td:last-child {
  border-right: none;
}

.ledger-table tr:hover td {
  background: var(--bg-card-secondary);
}

.td-target {
  font-weight: 600;
}

.td-cause {
  font-family: var(--font-serif);
}

.td-turnaround {
  font-family: var(--font-serif);
}

/* =========================================================================
   14-DAY PRAYER SANCTUARY VIEW
   ========================================================================= */
.prayer-sanctuary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 1.5rem;
}

.prayer-shrine-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.prayer-shrine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prayer-shrine-target {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.prayer-progress-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-light);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
}

.prayer-rosary-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  background: var(--bg-card-secondary);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.prayer-bead-node {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.prayer-bead-node:hover {
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(179, 137, 51, 0.4);
}

.prayer-bead-node.checked {
  background: var(--gold);
  color: #ffffff;
}

.sick-prayer-recitation {
  background: var(--gold-light);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-xs);
  padding: 1rem;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-main);
  font-style: italic;
}

/* =========================================================================
   STEP 5 SPONSOR SUITE
   ========================================================================= */
.step5-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sponsor-paper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem 2.5rem;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-serif);
}

.sponsor-paper h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
}

.sponsor-notes-area {
  width: 100%;
  min-height: 140px;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
  resize: vertical;
}

/* =========================================================================
   MODERN <dialog> STYLING (Per modern-web-guidance)
   ========================================================================= */
dialog.modern-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: transparent;
  max-width: 760px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
  margin: auto;
}

dialog.dialog-sm {
  max-width: 520px;
}

dialog:modal {
  overscroll-behavior: contain; /* stops scroll gestures in dialog chaining to page */
}

dialog::backdrop {
  background: rgba(15, 18, 23, 0.65);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.dialog-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-secondary);
}

.dialog-heading {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.dialog-close-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.dialog-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.dialog-body {
  padding: 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Wizard Stepper in Dialog */
.wizard-progress-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  background: var(--bg-card-secondary);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
}

.wizard-step-node {
  background: transparent;
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
}

.wizard-step-node.active {
  background: var(--primary);
  color: #ffffff;
}

.wizard-step-node.done {
  color: var(--success);
}

.interactive-instinct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.instinct-choice-card {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.instinct-choice-card:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.instinct-choice-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.choice-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.choice-text strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.choice-text span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Turnaround Interactive Mirror */
.turnaround-assistant-card {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
  transition: all var(--transition-fast);
}

.turnaround-assistant-card.activated {
  border-color: var(--primary);
  background: var(--primary-light);
}

.turnaround-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.turnaround-defect-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.turnaround-asset-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  background: var(--success-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
}

.turnaround-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-main);
  outline: none;
  resize: vertical;
}

/* =========================================================================
   FORM CONTROLS & BUTTONS
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card-secondary);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

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

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

/* =========================================================================
   PREFERENCES & THEME TILES
   ========================================================================= */
.pref-section {
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.pref-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.pref-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.pref-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.theme-tile {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.theme-tile:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.theme-tile.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

.theme-color-preview {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

.parchment-preview { background: #fbf9f4; border: 1px solid #b38933; }
.midnight-preview { background: #0f1217; border: 1px solid #52a868; }
.sanctuary-preview { background: #0f1c16; border: 1px solid #cda840; }
.pearl-preview { background: #ffffff; border: 1px solid #1e3a8a; }

.theme-tile-name {
  font-size: 0.825rem;
  font-weight: 600;
}

.pref-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* =========================================================================
   PANIC SCREEN OVERLAY (<kbd>Esc</kbd>)
   ========================================================================= */
.privacy-overlay {
  position: fixed;
  inset: 0;
  background: #fbfbf9;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.privacy-cover-card {
  max-width: 540px;
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5e5e0;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

.cover-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.privacy-cover-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a1a18;
  margin-bottom: 0.25rem;
}

.cover-sub {
  font-size: 0.85rem;
  color: #707068;
  margin-bottom: 1.5rem;
}

.cover-journal-entry {
  background: #f9f9f6;
  border-left: 3px solid #b5b5ad;
  padding: 1rem 1.25rem;
  text-align: left;
  border-radius: 4px;
  margin-bottom: 1.75rem;
}

.journal-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: #60605a;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.journal-line {
  font-family: Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #2c2c28;
}

.cover-hint {
  font-size: 0.75rem;
  color: #909088;
  margin-top: 1rem;
}

/* =========================================================================
   TOAST NOTIFICATIONS
   ========================================================================= */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.25s ease-out;
  pointer-events: auto;
}

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

/* =========================================================================
   EMPTY STATE
   ========================================================================= */
.empty-state {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 3rem 1.5rem;
  text-align: center;
  margin: 1.5rem 0;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.85;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 1.25rem;
  line-height: 1.5;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 768px) {
  .header-summary {
    display: none;
  }

  .inventory-grid, .prayer-sanctuary-grid {
    grid-template-columns: 1fr;
  }

  .dump-form {
    flex-direction: column;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }
}
