/* ============================================================
   MY LIVING MAP — Styles
   Warm, personal, trauma-informed. Not clinical. Not cold.
   ============================================================ */

:root {
  /* Neutrals */
  --bg:      #F7F5F0;
  --bg2:     #EDEAE3;
  --bg3:     #E2DDD5;
  --text:    #2C2825;
  --text2:   #6B6560;
  --text3:   #9E9890;
  --border:  #D5D0C8;
  --border2: #C8C2B8;

  /* Ten theme colours */
  --t1:#7F77DD; --t1bg:#EEEDFE;
  --t2:#1D9E75; --t2bg:#E1F5EE;
  --t3:#D85A30; --t3bg:#FAECE7;
  --t4:#BA7517; --t4bg:#FAEEDA;
  --t5:#A0337A; --t5bg:#FBEAF0;
  --t6:#1A6FBF; --t6bg:#E6F1FB;
  --t7:#3A7A18; --t7bg:#EAF3DE;
  --t8:#5A5A55; --t8bg:#F1EFE8;
  --t9:#A32D2D; --t9bg:#FCEBEB;
  --t10:#534AB7;--t10bg:#CECBF6;

  /* Parts cluster colours */
  --manager:     #7F77DD;
  --firefighter: #D85A30;
  --exile:       #378ADD;
  --unb:         #1D9E75;
  --unb-bg:      #E1F5EE;
  --therapist:   #ED93B1;
  --self:        #EF9F27;

  /* Relationship line colours */
  --r-protects:  #1D9E75;
  --r-polarised: #E24B4A;
  --r-alliance:  #378ADD;
  --r-afraid:    #D85A30;
  --r-clustered: #7F77DD;
  --r-curious:   #EF9F27;

  --radius: 10px;
  --shadow: 0 2px 12px rgba(44,40,37,.08);

  /* Growth tracker dot intensity */
  --growth-low:  #7bcfb2;
  --growth-mid:  #2aab82;
  --growth-high: #0a6e4f;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, .serif { font-family: 'Lora', serif; }

/* ===== APP SHELL ===== */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  background: var(--text);
  color: var(--bg);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 16px;
}

.app-title { font-family: 'Lora', serif; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.app-sub   { font-size: 11.5px; color: rgba(247,245,240,.55); margin-top: 2px; }

.app-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav-btn {
  font-size: 13px;
  padding: 6px 15px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.2);
  background: transparent;
  color: rgba(247,245,240,.65);
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
}
.nav-btn:hover  { background: rgba(255,255,255,.1); color: var(--bg); }
.nav-btn.active { background: rgba(255,255,255,.15); color: var(--bg); border-color: rgba(255,255,255,.4); }

.hdr-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.1);
  color: var(--bg);
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}
.hdr-btn:hover { background: rgba(255,255,255,.2); }

.app-body { flex: 1; overflow: hidden; }

/* ===== SECTIONS ===== */
.section { display: none; height: calc(100vh - 68px); overflow: hidden; }
.section.active { display: flex; flex-direction: column; animation: sectionFadeIn .2s ease-out; }
@keyframes sectionFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===== SHARED UTILITIES ===== */
.sec-label {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: .09em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.lm-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lm-sec-head .sec-label, .lm-sec-head .horizon-label { flex: 1; min-width: 0; }
.lm-edit-btn { flex-shrink: 0; font-size: 11px; padding: 3px 9px; border-radius: 5px; border: 1px solid var(--border); background: var(--bg); color: var(--text3); cursor: pointer; white-space: nowrap; font-family: 'DM Sans', sans-serif; }
.lm-edit-btn:hover { color: var(--text); background: var(--bg2); }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text3);
  font-size: 13px;
  font-style: italic;
  font-family: 'Lora', serif;
}

/* Loading dots */
.ldots { display: inline-flex; gap: 3px; }
.ldots span { width: 5px; height: 5px; border-radius: 50%; background: var(--t1); animation: bns .9s infinite; }
.ldots span:nth-child(2) { animation-delay: .2s; }
.ldots span:nth-child(3) { animation-delay: .4s; }
@keyframes bns { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ===== SCROLLABLE INNER ===== */
.section-inner {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ===== LIVING MAP SECTION ===== */
.lm-title { font-family: 'Lora', serif; font-size: 18px; font-weight: 500; margin-bottom: 4px; }

/* At-a-glance total-journal-entry badge (Living Map, Journal tab, Patterns) */
.je-count {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--text2);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 9px;
  vertical-align: middle;
  white-space: nowrap;
  letter-spacing: 0;
  text-transform: none;
}
.je-count:empty { display: none; }
.lm-subrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.lm-sub   { font-size: 12.5px; color: var(--text2); }
.lm-subrow .lm-sub { margin-bottom: 0; }
.lm-replay-btn { flex-shrink: 0; font-size: 12px; padding: 6px 14px; border-radius: 7px; border: 1px solid var(--t2); background: var(--t2bg); color: #085041; cursor: pointer; white-space: nowrap; font-family: 'DM Sans', sans-serif; }
.lm-replay-btn:hover { background: #cdeee2; }

.theme-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 8px; margin-bottom: 22px; }
.theme-grid-2 { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; margin-bottom: 22px; }

.tc {
  border-radius: var(--radius);
  padding: 10px 11px;
  cursor: default;
  border: 1.5px solid transparent;
  transition: opacity .15s;
}
.tl  { font-size: 12px; font-weight: 500; margin-bottom: 3px; font-family: 'Lora', serif; color: var(--text); }
.ts  { font-size: 10.5px; line-height: 1.35; color: var(--text2); }
.sub-tag { font-size: 9.5px; padding: 1px 5px; border-radius: 3px; margin-left: 3px; font-weight: 500; vertical-align: middle; }

/* Analysis layers */
.layers-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.layer-pill {
  font-size: 11px;
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text2);
  background: var(--bg2);
  white-space: nowrap;
}
.layer-pill.wot    { border-color: var(--t2);  color: #085041; background: var(--t2bg); }
.layer-pill.parts  { border-color: var(--t1);  color: #3C3489; background: var(--t1bg); }
.layer-pill.vision { border-color: var(--t4);  color: #412402; background: var(--t4bg); }

/* Growth tracker */
.growth-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin-bottom: 22px; }
.growth-item {
  font-size: 12px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
  cursor: default;
}
.growth-item.lit {
  background: var(--t2bg);
  border-color: var(--t2);
  color: #085041;
}
.growth-dots { display: inline-flex; gap: 3px; align-items: center; margin-left: 3px; vertical-align: middle; }
.gdot-circle { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.gdot-circle.low  { background: var(--growth-low); }
.gdot-circle.mid  { background: var(--growth-mid); }
.gdot-circle.high { background: var(--growth-high); }

/* Vision horizon */
.horizon-wrap { border-radius: var(--radius); border: 1px solid var(--t4); background: var(--t4bg); padding: 16px 20px; margin-bottom: 16px; }
.horizon-label { font-size: 10px; font-weight: 500; color: #854F0B; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 6px; }
.horizon-text  { font-size: 12.5px; color: #633806; line-height: 1.55; margin-bottom: 12px; }

.fn-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.fn-card { border-radius: 8px; background: #FFF8EE; border: 1px solid #EF9F27; padding: 10px 12px; }
.fn-card-title { font-size: 12px; font-weight: 500; color: #633806; margin-bottom: 3px; font-family: 'Lora', serif; }
.fn-card-desc  { font-size: 11px; color: #854F0B; line-height: 1.4; }

.fn-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.fn-stat  { font-size: 11px; padding: 4px 10px; border-radius: 6px; background: #FFF8EE; border: 1px solid #EF9F27; color: #633806; }

.status-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg2);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
}
.sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--t2); flex-shrink: 0; }

/* ===== JOURNAL SECTION ===== */
.journal-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--bg);
}

.entry-list { flex: 1; overflow-y: auto; padding: 16px 20px; }

.entry-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  margin-bottom: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.entry-card:hover { box-shadow: 0 3px 16px rgba(44,40,37,.11); border-color: var(--border2); }
.entry-card.open .entry-body { display: block; }

.entry-head {
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.entry-title { font-family: 'Lora', serif; font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.entry-meta  { font-size: 11px; color: var(--text3); display: flex; gap: 8px; flex-wrap: wrap; }
.entry-body  { display: none; padding: 0 16px 14px; }

.entry-text-preview {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.6;
  max-height: 80px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  margin-bottom: 8px;
}

.theme-tag {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
  margin: 2px 3px 2px 0;
  font-weight: 500;
}

.wot-badge {
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.wot-green  { background: #E1F5EE; color: #085041; border: 1px solid var(--t2); }
.wot-amber  { background: #FAEEDA; color: #412402; border: 1px solid var(--t4); }
.wot-red    { background: #FCEBEB; color: #791F1F; border: 1px solid var(--t9); }
.wot-grey   { background: #F1EFE8; color: var(--text2); border: 1px solid var(--border2); }

/* Add entry form */
.add-entry-panel {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.ae-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.ae-field { margin-bottom: 8px; }
.ae-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}
.ae-field input,
.ae-field select,
.ae-field textarea {
  width: 100%;
  font-size: 12.5px;
  font-family: 'DM Sans', sans-serif;
  padding: 6px 9px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.ae-field input:focus,
.ae-field select:focus,
.ae-field textarea:focus { border-color: var(--border2); }
.ae-field textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.theme-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.theme-check-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  color: var(--text2);
  user-select: none;
}
.theme-check-label input { display: none; }
.theme-check-label.selected { background: var(--text); color: var(--bg); border-color: var(--text); }

.anon-reminder {
  background: #FAEEDA;
  border: 1px solid #EF9F27;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 11.5px;
  color: #633806;
  margin-bottom: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}

/* AI analysis panel */
.analysis-panel {
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-top: 10px;
}
.analysis-section { margin-bottom: 10px; }
.analysis-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 4px;
}
.analysis-text { font-size: 12.5px; color: var(--text2); line-height: 1.6; }

.parts-proposal {
  border: 1px solid var(--t1);
  background: var(--t1bg);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 7px;
}
.parts-proposal-name { font-size: 13px; font-weight: 500; color: #3C3489; margin-bottom: 4px; font-family: 'Lora', serif; }
.parts-proposal-desc { font-size: 11.5px; color: var(--text2); margin-bottom: 7px; line-height: 1.5; }
.approval-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.approval-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
}
.approval-btn:hover { background: var(--bg3); }
.approval-btn.approve { border-color: var(--t2); color: var(--t2); background: var(--t2bg); }
.approval-btn.approve:hover { background: #b3e6d3; }

/* ===== PARTS SECTION ===== */
.parts-shell { display: grid; grid-template-columns: 1fr 1fr; flex: 1; overflow: hidden; }
.reg-panel   { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.map-panel   { display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; background: var(--bg); }
.panel-scroll { flex: 1; overflow-y: auto; padding: 14px 16px; }

.filter-bar { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.f-chip {
  font-size: 11.5px;
  padding: 3px 11px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all .15s;
}
.f-chip:hover  { border-color: var(--border2); color: var(--text); }
.f-chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.f-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* Part card */
.part-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  margin-bottom: 7px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.part-card:hover      { border-color: var(--border2); box-shadow: var(--shadow); }
.part-card.open .pc-body { display: block; }
.pc-head { padding: 9px 12px; display: flex; align-items: center; gap: 8px; }
.pc-bar  { width: 4px; border-radius: 2px; flex-shrink: 0; align-self: stretch; }
.pc-name { font-family: 'Lora', serif; font-size: 13.5px; font-weight: 500; flex: 1; }
.pc-cl   { font-size: 11px; color: var(--text3); }
.unb-pill { font-size: 9.5px; padding: 1px 6px; border-radius: 3px; background: var(--unb-bg); color: var(--unb); font-weight: 500; margin-left: 3px; }
.thr-pill { font-size: 9.5px; padding: 1px 6px; border-radius: 3px; background: #FBEAF0; color: #72243E; font-weight: 500; margin-left: 3px; }
.pc-body { display: none; padding: 0 12px 10px 20px; }

.fl { margin-bottom: 6px; }
.fl-label { font-size: 10px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.fl-val   { font-size: 12px; color: var(--text2); line-height: 1.5; }
.unb-field { background: var(--unb-bg); border-radius: 7px; padding: 7px 9px; margin: 5px 0; border: 1px solid #b3e6d3; }
.unb-field .fl-label { color: var(--unb); }
.unb-field .fl-val   { color: #085041; }

.pc-actions { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.pc-btn {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
}
.pc-btn:hover       { background: var(--bg3); }
.pc-help { font-weight: 700; color: var(--unb); border-color: var(--unb); }
.pc-help:hover { background: var(--unb-bg); }

/* Progressive-disclosure inline "?" help dot — sits next to a label/term */
.help-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; min-width: 18px; padding: 0;
  border-radius: 50%; border: 1px solid var(--t1); background: var(--t1bg);
  color: var(--t1); font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 700;
  line-height: 1; cursor: pointer; vertical-align: middle;
  text-transform: none; letter-spacing: 0; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.help-dot:hover { background: var(--t1); color: #fff; }
/* Larger tap target on touch devices */
@media (max-width: 760px) { .help-dot { width: 22px; height: 22px; min-width: 22px; font-size: 12px; } }

/* Header-guide glossary list */
.help-gloss-item { margin-bottom: 14px; }
.help-gloss-term { font-family: 'Lora', serif; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.help-gloss-def  { font-size: 12.5px; color: var(--text2); line-height: 1.6; }
.pc-btn.danger      { border-color: #F09595; color: #791F1F; background: #FCEBEB; }
.pc-btn.danger:hover { background: #f9d9d9; }

.map-on-btn {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid var(--unb);
  background: var(--unb-bg);
  color: var(--unb);
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}
.map-on-btn.on { background: var(--unb); color: #fff; }

/* Add part form */
.add-form-wrap {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.add-form-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; margin-bottom: 2px; }
.add-form-title { font-family: 'Lora', serif; font-size: 13.5px; font-weight: 500; }
.add-form-chev  { font-size: 11px; color: var(--text3); }
.add-form-body  { margin-top: 10px; }

.afl { margin-bottom: 6px; }
.afl label {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}
.afl input,
.afl select,
.afl textarea {
  width: 100%;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.afl textarea { resize: vertical; min-height: 40px; }
.afl-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.afl-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); margin-bottom: 5px; }
.afl-check input { width: 14px; height: 14px; accent-color: var(--unb); cursor: pointer; }

.add-part-btn {
  width: 100%;
  padding: 7px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-family: 'Lora', serif;
  font-size: 13px;
  cursor: pointer;
  border: none;
  margin-top: 3px;
}
.add-part-btn:hover { opacity: .88; }

/* Export bar */
.exp-bar {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.exp-lbl   { font-size: 11.5px; color: var(--text2); }
.exp-check { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text2); cursor: pointer; }
.exp-check input { width: 13px; height: 13px; accent-color: var(--text); }
.exp-btn {
  font-size: 12px;
  padding: 5px 13px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  margin-left: auto;
}
.exp-btn:hover { background: var(--text); color: var(--bg); }

/* ===== CONSTELLATION MAP ===== */
.map-toolbar {
  padding: 9px 13px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.mb {
  font-size: 12px;
  padding: 3px 9px;
  height: 27px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 3px;
}
.mb:hover  { background: var(--bg3); color: var(--text); }
.mb.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.map-leg {
  padding: 7px 13px;
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ml-item { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text2); }
.ml-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ml-line { width: 15px; height: 2px; border-radius: 1px; flex-shrink: 0; }
.ml-dbl  { width: 15px; height: 6px; display: flex; flex-direction: column; justify-content: space-between; flex-shrink: 0; }
.ml-dbl span { height: 1.5px; background: var(--unb); border-radius: 1px; display: block; }

.canvas-area { position: relative; flex: 1 0 auto; min-height: 300px; overflow: hidden; background: var(--bg2); }
canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

.pnode {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  text-align: center;
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px;
  line-height: 1.2;
}
.pnode:active { cursor: grabbing; }
.pnode.cmode  { cursor: crosshair; }

.selfnode {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Lora', serif;
  background: var(--t4bg);
  border: 2px solid var(--self);
  color: #633806;
  cursor: default;
  z-index: 10;
}

.img-tooltip {
  position: absolute;
  z-index: 100;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg);
  pointer-events: none;
  display: none;
  box-shadow: var(--shadow);
}
.img-tooltip img { width: 130px; height: 130px; object-fit: cover; display: block; }

.map-smsg { font-size: 11px; color: var(--text3); padding: 4px 13px; min-height: 20px; background: var(--bg); flex-shrink: 0; }

.rel-bar {
  padding: 8px 13px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.rel-bar select {
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  flex: 1;
  min-width: 75px;
}

/* ===== PATTERNS SECTION ===== */
.patterns-inner { flex: 1; overflow-y: auto; padding: 24px 28px; max-width: 820px; }

.synthesis-report {
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 22px;
  margin-top: 14px;
}
.report-section { margin-bottom: 16px; }
.report-h { font-family: 'Lora', serif; font-size: 15px; font-weight: 500; margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.report-p { font-size: 13px; color: var(--text2); line-height: 1.7; }

/* ===== RESOURCES SECTION ===== */
.resources-inner { flex: 1; padding: 32px 28px; max-width: 600px; }
.resources-link  { color: var(--t2); text-decoration: underline; font-weight: 500; }
.resources-link:hover { color: var(--unb); }

/* ===== VISION SECTION ===== */
.vision-inner { flex: 1; overflow-y: auto; padding: 24px 28px; max-width: 860px; }
.vision-tabs  { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.vtab {
  font-size: 13px;
  padding: 8px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text2);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}
.vtab:hover  { color: var(--text); }
.vtab.active { color: var(--text); border-bottom-color: var(--text); }
.vtab-panel  { display: none; }
.vtab-panel.active { display: block; }

/* Context / export */
.ctx-section { margin-bottom: 28px; }
.ctx-h { font-family: 'Lora', serif; font-size: 16px; font-weight: 500; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.ctx-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 10px; }
.ctx-table th,
.ctx-table td { padding: 7px 10px; border: 1px solid var(--border); text-align: left; }
.ctx-table th  { background: var(--bg2); font-weight: 500; color: var(--text2); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.ctx-table td  { color: var(--text2); }
.ctx-p    { font-size: 13px; color: var(--text2); line-height: 1.65; margin-bottom: 8px; }
.ctx-note {
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
  padding: 10px 14px;
  background: var(--bg2);
  border-radius: 8px;
  border-left: 3px solid var(--border2);
  margin-bottom: 10px;
}

.ctx-btn {
  font-size: 12px;
  padding: 6px 16px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ctx-btn:hover { background: var(--text); color: var(--bg); }
.ctx-btn.danger { border-color: #F09595; color: #791F1F; }
.ctx-btn.danger:hover { background: #791F1F; color: var(--bg); }

.data-mgmt-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  align-items: center;
}
.data-mgmt-label { font-size: 12px; font-weight: 500; color: var(--text2); }
.save-indicator  { font-size: 11px; color: var(--text3); }
.save-indicator.saved { color: var(--t2); }

/* Always-visible cloud-backup status badge (header) */
.sync-badge { font-size: 11px; padding: 2px 9px; border-radius: 12px; white-space: nowrap; line-height: 1.6; border: 1px solid transparent; }
.sync-badge.ok      { color: #085041; background: var(--unb-bg); border-color: var(--unb); }
.sync-badge.pending { color: #854F0B; background: var(--t4bg); border-color: #E9C27D; }
.sync-badge.fail    { color: #8a2a1b; background: var(--t3bg, #f7e3df); border-color: #d99; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,40,37,.55);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg);
  border-radius: 14px;
  padding: 22px 24px;
  max-width: 500px;
  width: 92%;
  box-shadow: 0 8px 40px rgba(44,40,37,.18);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title { font-family: 'Lora', serif; font-size: 17px; margin-bottom: 12px; }
.modal-close {
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  display: block;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  margin-top: 10px;
  width: 100%;
  padding: 8px 0;
  border-radius: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
}
.modal-close:hover { color: var(--text); background: var(--bg3); }

/* Portrait modal */
.portrait-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.portrait-tab {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  white-space: nowrap;
}
.portrait-tab:hover        { color: var(--text); }
.portrait-tab.active       { color: var(--text); border-bottom-color: var(--text); }
.portrait-tab.unb-tab.active { color: var(--unb); border-bottom-color: var(--unb); }
.portrait-tab-panel        { display: none; }
.portrait-tab-panel.active { display: block; }

.portrait-txt {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.65;
  padding: 9px 11px;
  background: var(--bg2);
  border-radius: 8px;
  margin-bottom: 9px;
  border: 1px solid var(--border);
  width: 100%;
  resize: vertical;
  font-style: normal;
  font-family: 'DM Sans', sans-serif;
}
.portrait-txt.unb { background: var(--unb-bg); border-color: #b3e6d3; color: #085041; }

.psec-label { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text3); margin-bottom: 6px; }

.launch-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 9px; }
.launch-btn {
  padding: 8px 5px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}
.launch-btn:hover { background: var(--bg3); }
.launch-name { font-size: 11.5px; font-weight: 500; }
.launch-sub  { font-size: 10px; color: var(--text3); }

.gen-btn {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  background: var(--t1bg);
  color: var(--t1);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #AFA9EC;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 8px;
}
.gen-btn:hover    { background: #CECBF6; }
.gen-btn.unb-gen  { background: var(--unb-bg); color: var(--unb); border-color: #7ecfb3; }
.gen-btn.unb-gen:hover { background: #c3edd9; }
.gen-btn:disabled { opacity: .5; cursor: not-allowed; }

.copy-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 9px; }
.copy-btn {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
}
.copy-btn:hover { background: var(--bg2); }

.upload-label {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.upload-label:hover { background: var(--bg3); }

/* API key setup */
.api-setup-banner {
  background: var(--t4bg);
  border: 1px solid var(--t4);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.api-setup-text { font-size: 12.5px; color: #633806; line-height: 1.6; }
.api-setup-text strong { font-weight: 600; }
.api-key-input {
  width: 100%;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  padding: 6px 9px;
  border-radius: 6px;
  border: 1px solid var(--t4);
  background: var(--bg);
  color: var(--text);
  margin-top: 8px;
  outline: none;
}

/* ===== JOURNAL ENTRY CARD ===== */
.entry-card { border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); margin-bottom: 10px; overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.entry-card:hover { box-shadow: 0 3px 16px rgba(44,40,37,.11); border-color: var(--border2); }
.entry-card.open .entry-body { display: block; }
.entry-head { padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.entry-title { font-family: 'Lora', serif; font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.entry-meta  { font-size: 11px; color: var(--text3); display: flex; gap: 8px; flex-wrap: wrap; }
.entry-body  { display: none; padding: 0 14px 14px; }
.entry-content-text { font-size: 12.5px; color: var(--text); line-height: 1.65; margin-bottom: 10px; white-space: pre-wrap; }

.icon-btn { background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px 4px; color: var(--text3); line-height: 1; border-radius: 4px; }
.icon-btn:hover { color: var(--t4); background: var(--t4bg); }
.icon-btn.danger:hover { color: #791F1F; background: #FCEBEB; }

.theme-chip { font-size: 10.5px; padding: 2px 8px; border-radius: 12px; display: inline-flex; align-items: center; gap: 2px; font-weight: 500; white-space: nowrap; }

.wot-badge { font-size: 10.5px; padding: 3px 9px; border-radius: 12px; font-weight: 500; white-space: nowrap; display: inline-block; }
.wot-green { background: #E1F5EE; color: #085041; border: 1px solid var(--t2); }
.wot-amber { background: #FAEEDA; color: #412402; border: 1px solid var(--t4); }
.wot-red   { background: #FCEBEB; color: #791F1F; border: 1px solid var(--t9); }
.wot-grey  { background: #F1EFE8; color: var(--text2); border: 1px solid var(--border2); }

/* Analysis panel */
.analysis-panel { background: var(--bg2); border-radius: var(--radius); border: 1px solid var(--border); padding: 14px 16px; margin-top: 10px; }
.analysis-header { font-family: 'Lora', serif; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.analysis-block { margin-bottom: 9px; }
.analysis-block.gentle-edge { background: var(--t4bg); border-radius: 7px; padding: 8px 10px; border: 1px solid var(--t4)40; }
.al { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 3px; }
.av { font-size: 12.5px; color: var(--text2); line-height: 1.65; }

/* Depth analysis badge (Change 5b) */
.depth-analysis-badge { font-size: 11px; color: var(--text3); font-style: italic; margin-bottom: 8px; }

/* Parts consent prompt (Change 1) */
.parts-consent { background: var(--t4bg); border: 1px solid var(--t4); border-radius: 9px; padding: 12px 14px; margin-top: 14px; }
.pc-question { font-size: 13px; color: #633806; font-family: 'Lora', serif; line-height: 1.5; }
.pc-yes { padding: 7px 16px; border-radius: 7px; background: var(--t4); color: #fff; border: none; font-family: 'Lora', serif; font-size: 13px; cursor: pointer; }
.pc-yes:hover { opacity: .9; }
.pc-no { padding: 7px 14px; border-radius: 7px; background: var(--bg2); color: var(--text2); border: 1px solid var(--border); font-family: 'DM Sans', sans-serif; font-size: 12px; cursor: pointer; }
.parts-detect-btn { display: inline-block; margin-top: 12px; padding: 6px 14px; border-radius: 7px; background: none; border: 1px solid var(--t1)60; color: var(--t1); font-family: 'DM Sans', sans-serif; font-size: 12px; cursor: pointer; }
.parts-detect-btn:hover { background: var(--t1bg); }
.parts-detected-names { margin-top: 12px; font-size: 12.5px; line-height: 1.7; color: var(--text2); }

/* "Did this land?" reflection feedback (#5) */
.reflection-feedback { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); }
.rfb-q { font-size: 12.5px; color: var(--text2); margin-bottom: 8px; }
.rfb-rates { display: flex; gap: 7px; flex-wrap: wrap; }
.rfb-rate { font-size: 12px; padding: 6px 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg); color: var(--text2); cursor: pointer; min-height: 32px; transition: border-color .15s, background .15s; }
.rfb-rate:hover { border-color: var(--t1); }
.rfb-rate.active { border-color: var(--t1); background: var(--t1bg); color: var(--t1); font-weight: 600; }
.rfb-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.rfb-tag { font-size: 11px; padding: 4px 10px; border-radius: 13px; border: 1px dashed var(--border); background: var(--bg); color: var(--text3); cursor: pointer; }
.rfb-tag:hover { border-style: solid; border-color: var(--t1); color: var(--t1); }
.rfb-tag.active { border-style: solid; border-color: var(--t1); background: var(--t1bg); color: var(--t1); font-weight: 500; }
.rfb-note { width: 100%; margin-top: 10px; font-size: 12.5px; font-family: inherit; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; resize: none; overflow: hidden; box-sizing: border-box; }
.rfb-thanks { font-size: 11px; color: var(--text3); font-style: italic; margin-top: 6px; }

/* Reflection feedback summary (Vision → Data & Backup) */
.rfs-wrap { margin-top: 8px; }
.rfs-sub { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); margin: 12px 0 6px; }
.rfs-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text2); padding: 3px 0; border-bottom: 1px solid var(--border); }
.rfs-n { font-weight: 600; color: var(--text); }
.rfs-note { font-size: 12.5px; color: var(--text2); line-height: 1.55; padding: 8px 10px; background: var(--bg2); border-radius: 7px; margin-bottom: 6px; }
.rfs-note-meta { display: block; font-size: 10.5px; color: var(--text3); margin-bottom: 3px; }
.parts-detected-names .pdn-label { color: var(--text3); }
.parts-detected-names .pdn-name { color: var(--t1); font-weight: 500; }
.parts-detected-names .pdn-sep { color: var(--text3); margin: 0 5px; }

/* Parts proposal (in entry) */
.parts-proposal { border: 1px solid var(--t1)50; background: var(--t1bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 7px; }
.parts-proposal-name { font-size: 13px; font-weight: 500; color: #3C3489; margin-bottom: 4px; font-family: 'Lora', serif; }
.parts-proposal-desc { font-size: 11.5px; color: var(--text2); margin-bottom: 7px; line-height: 1.5; }
.approval-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.approval-btn { font-size: 11px; padding: 3px 10px; border-radius: 5px; cursor: pointer; border: 1px solid var(--border); background: var(--bg); color: var(--text2); font-family: 'DM Sans', sans-serif; }
.approval-btn:hover { background: var(--bg3); }
.approval-btn.approve { border-color: var(--t2); color: var(--t2); background: var(--t2bg); }
.approval-btn.approve:hover { background: #b3e6d3; }

/* Reflection */
.reflection-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.reflection-textarea { width: 100%; font-size: 12.5px; font-family: 'DM Sans', sans-serif; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical; min-height: 70px; outline: none; line-height: 1.6; margin-bottom: 6px; }
.reflection-textarea:focus { border-color: var(--border2); }
.reflection-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.copy-entry-btn { font-size: 11.5px; padding: 5px 12px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); font-family: 'DM Sans', sans-serif; }
.copy-entry-btn:hover { background: var(--bg3); color: var(--text); }
.reflection-save-btn { font-size: 11.5px; padding: 5px 14px; border-radius: 6px; cursor: pointer; border: 1px solid var(--unb); background: var(--unb); color: #fff; font-family: 'DM Sans', sans-serif; transition: background 0.15s, opacity 0.15s; }
.reflection-save-btn:hover { opacity: 0.88; }
.reflection-save-btn.saved { background: #157a5b; border-color: #157a5b; cursor: default; }
.reflection-save-btn:disabled { cursor: default; }
.supervision-export-btn { border-color: var(--t2) !important; color: var(--t2) !important; }
.supervision-export-btn:hover { background: var(--t2bg) !important; color: var(--t2) !important; }
.supervision-export-btn.saved { background: var(--t2bg) !important; border-color: var(--t2) !important; }

/* "Write from Self" — IFS-familiar only, soft + distinct from AI analysis */
.self-response { margin-top: 12px; }
.self-response-prompt { display: block; width: 100%; text-align: left; font-size: 12.5px; font-family: 'Lora', serif; padding: 10px 14px; border-radius: 9px; cursor: pointer; border: 1px dashed var(--t2); background: var(--t2bg); color: var(--t2); transition: background 0.15s; }
.self-response-prompt:hover { background: var(--bg2); }
.self-response-editor, .self-response-saved { padding: 12px 14px; border-radius: 9px; background: var(--t2bg); border: 1px solid var(--t2); }
.sr-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--t2); margin-bottom: 6px; }
.self-response-textarea { width: 100%; font-size: 12.5px; font-family: 'DM Sans', sans-serif; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--t2); background: var(--bg); color: var(--text); resize: vertical; min-height: 70px; outline: none; line-height: 1.6; }
.self-response-textarea:focus { border-color: var(--text); }
.self-response-text { font-size: 12.5px; color: var(--text); line-height: 1.65; white-space: pre-wrap; }

/* Journal entry image upload */
.img-dropzone { border: 1.5px dashed var(--border2); border-radius: 10px; background: var(--bg2); padding: 16px; text-align: center; cursor: pointer; color: var(--text3); font-size: 12px; transition: border-color .15s, background .15s; }
.img-dropzone:hover, .img-dropzone.dragover { border-color: var(--unb); background: var(--unb-bg); color: var(--text2); }
.img-dropzone.prominent { padding: 24px; border-color: var(--unb); background: var(--unb-bg); }
.img-dropzone-empty { line-height: 1.6; }
.img-preview-wrap { position: relative; display: inline-block; max-width: 100%; }
.img-preview-wrap img { max-width: 100%; max-height: 240px; border-radius: 9px; display: block; }
.img-remove-btn { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(44,40,37,.78); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.img-remove-btn:hover { background: rgba(44,40,37,.95); }
.img-warn { font-size: 11.5px; color: var(--t3); margin-top: 6px; }
#image-upload-field.prominent > label { color: var(--unb); font-weight: 500; }
/* Saved entry image card */
.entry-image-card { margin: 4px 0 12px; }
.entry-image-card img { max-width: 100%; max-height: 320px; border-radius: 10px; border: 1px solid var(--border); display: block; }

/* Friendly date field */
.date-field-wrap { position: relative; display: flex; align-items: center; gap: 6px; }
.date-text-input { flex: 1; min-width: 0; }
.date-cal-btn { flex-shrink: 0; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); cursor: pointer; font-size: 14px; line-height: 1; }
.date-cal-btn:hover { background: var(--bg3); }
.date-native-hidden { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.date-warn { font-size: 11px; color: var(--t3); margin-top: 4px; }

/* Journal two-tab layout */
.journal-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.jtab { font-family: 'Lora', serif; font-size: 13.5px; padding: 8px 18px; border: none; background: none; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.jtab:hover { color: var(--text2); }
.jtab.active { color: var(--text); border-bottom-color: var(--text); }
/* Zone filter + sort row */
.wot-filter-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; padding: 0 20px; }
.wotf-label { font-size: 11.5px; color: var(--text3); }
.wotf-pill { font-size: 11.5px; padding: 3px 11px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); cursor: pointer; }
.wotf-pill:hover { background: var(--bg3); }
.wotf-pill.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.j-sort { font-size: 12px; padding: 4px 7px; border-radius: 5px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); margin-left: auto; }
.entry-count { font-size: 11.5px; color: var(--text3); margin: 0 0 10px; padding: 0 20px; }

/* Pending parts recovery (FIX 4) — soft amber */
.pending-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--t4bg); color: #854F0B; border: 1px solid #E9C27D; cursor: pointer; margin-left: 4px; white-space: nowrap; }
.pending-badge:hover { background: #F6E2C2; }
.pending-prompt { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--t4bg); border: 1px solid #E9C27D; color: #854F0B; border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; font-size: 12.5px; }
.pending-review-btn { font-size: 11.5px; padding: 5px 12px; border-radius: 6px; border: 1px solid #C9912E; background: #C9912E; color: #fff; cursor: pointer; white-space: nowrap; font-family: 'DM Sans', sans-serif; }
.pending-review-btn:hover { opacity: .9; }

/* Journal panels: the active panel fills the section; content scrolls */
.jpanel { display: none; }
.jpanel.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#jpanel-new.active { display: block; overflow-y: auto; padding: 16px 20px; -webkit-overflow-scrolling: touch; }
#jpanel-entries .entry-list { min-height: 0; }

/* Warm, subtle scrollbars (FIX 1) */
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background-color: var(--border2); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--text3); }

/* Add entry panel */
.add-entry-panel { background: var(--bg2); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; border: 1px solid var(--border); }
.ae-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.ae-field { margin-bottom: 8px; }
.ae-field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.ae-field input, .ae-field select, .ae-field textarea { width: 100%; font-size: 12.5px; font-family: 'DM Sans', sans-serif; padding: 6px 9px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; }
.ae-field input:focus, .ae-field select:focus, .ae-field textarea:focus { border-color: var(--border2); }
.ae-field textarea { resize: vertical; min-height: 90px; line-height: 1.65; }

.anon-reminder { background: #FAEEDA; border: 1px solid #EF9F27; border-radius: 8px; padding: 9px 13px; font-size: 11.5px; color: #633806; margin-bottom: 10px; display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }

/* Gentle message (patterns) */
.gentle-message { font-family: 'Lora', serif; font-size: 14px; color: var(--text2); font-style: italic; padding: 20px 24px; background: var(--bg2); border-radius: var(--radius); border: 1px solid var(--border); line-height: 1.7; }

/* Seeds lit notification */
.seeds-lit-msg { background: var(--t2bg); border: 1px solid var(--t2); border-radius: 8px; padding: 10px 14px; font-size: 12.5px; color: #085041; margin-bottom: 12px; }
.pattern-focus-banner { background: var(--t1bg); border: 1px solid var(--t1); border-radius: 8px; padding: 8px 13px; font-size: 12px; color: var(--t1); font-weight: 500; margin-bottom: 12px; }
.snap-focus { color: var(--t1); font-weight: 500; }
#patterns-theme-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Synthesis report */
.synthesis-report { background: var(--bg2); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px 22px; }
.report-h { font-family: 'Lora', serif; font-size: 15px; font-weight: 500; margin: 14px 0 7px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.report-p { font-size: 13px; color: var(--text2); line-height: 1.75; margin-bottom: 6px; }

/* Part approval popup */
#part-popup-overlay { background: rgba(44,40,37,.6); }

/* Pending part card highlight */
.pending-card { border-color: var(--t1)50 !important; background: var(--t1bg) !important; }

/* ===== DISABLED BUTTON STATE ===== */
button:disabled { opacity: .55; cursor: not-allowed; }

/* ===== WOT ZONE SELECTOR ===== */
.wot-zone-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 6px;
}
.wot-pill {
  padding: 8px 16px;
  min-height: 40px;
  border-radius: 20px;
  border: 1.5px solid var(--border2);
  background: var(--bg);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.wot-pill:hover { background: var(--bg2); }
.wot-pill.selected[data-zone="green"] { background: #E1F5EE; border-color: #1D9E75; color: #085041; font-weight: 500; }
.wot-pill.selected[data-zone="blue"]  { background: #E6F1FB; border-color: #1A6FBF; color: #0D3A66; font-weight: 500; }
.wot-pill.selected[data-zone="red"]   { background: #FAECE7; border-color: #D85A30; color: #7A2410; font-weight: 500; }

/* Depth pills (UX1) — same shape as WoT pills */
.depth-pill { padding: 8px 16px; min-height: 40px; border-radius: 20px; border: 1.5px solid var(--border2); background: var(--bg); color: var(--text2); font-family: 'DM Sans', sans-serif; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.depth-pill:hover { background: var(--bg2); }
.depth-pill.selected { background: var(--unb-bg); border-color: var(--unb); color: #085041; font-weight: 500; }

/* Affirming observation in the Reflective Pause (UX3) */
.rp-observation { font-size: 12.5px; color: #3A5A22; font-style: italic; line-height: 1.65; margin-bottom: 10px; }

/* One-line summary (UX2) */
.analysis-summary { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; }
.as-label { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.as-text { font-size: 14px; color: var(--text); line-height: 1.6; }
.full-analysis-toggle { font-size: 12px; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text2); cursor: pointer; font-family: 'DM Sans', sans-serif; margin-bottom: 8px; }
.full-analysis-toggle:hover { background: var(--bg2); color: var(--text); }

/* Depth milestone notice (UX5) — soft amber */
.depth-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--t4bg); border: 1px solid #E9C27D; color: #854F0B; border-radius: 8px; padding: 9px 14px; margin: 0 0 12px; font-size: 12.5px; }
.depth-notice-x { background: none; border: none; color: #854F0B; font-size: 14px; cursor: pointer; line-height: 1; padding: 0 2px; }

/* My Map customisation editor (Day 7 Task 4) */
.mymap-section { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: var(--bg); overflow: hidden; }
.mymap-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; cursor: pointer; font-family: 'Lora', serif; font-size: 13.5px; font-weight: 500; user-select: none; }
.mymap-head:hover { background: var(--bg2); }
.mm-chev { font-size: 10px; color: var(--text3); }
.mymap-body { padding: 10px 14px 14px; border-top: 1px solid var(--border); }
.mm-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.mm-input { flex: 1; min-width: 0; font-size: 12.5px; font-family: inherit; padding: 6px 9px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; }
.mm-input:focus { border-color: var(--border2); }
.mm-input.mm-narrow { flex: 0 0 120px; }
.mm-vs { font-size: 11px; color: var(--text3); font-style: italic; flex-shrink: 0; }
.mm-remove { flex-shrink: 0; width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg2); color: var(--text3); cursor: pointer; font-size: 11px; }
.mm-remove:hover { color: var(--t3); border-color: var(--t3); }
.mm-label { font-size: 12.5px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.mm-textarea { width: 100%; min-height: 64px; font-size: 12.5px; font-family: inherit; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; resize: vertical; line-height: 1.6; }
.mm-field { margin-bottom: 8px; }
.mm-footer { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.mm-add { font-size: 12px; padding: 5px 12px; border-radius: 6px; border: 1px dashed var(--border2); background: var(--bg2); color: var(--text2); cursor: pointer; font-family: 'DM Sans', sans-serif; }
.mm-add:hover { background: var(--bg3); }
.mm-save { font-size: 12px; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--unb); background: var(--unb); color: #fff; cursor: pointer; font-family: 'DM Sans', sans-serif; }
.mm-save:hover { opacity: .9; }
.mm-reset { font-size: 12px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text3); cursor: pointer; font-family: 'DM Sans', sans-serif; }
.mm-reset:hover { color: var(--text); }
.mm-confirm { flex-basis: 100%; font-size: 11.5px; color: #085041; margin-top: 4px; line-height: 1.5; }
.mm-confirm.warn { color: #854F0B; }
.mm-edit-btn { font-size: 11px; padding: 3px 9px; border-radius: 5px; border: 1px solid var(--border); background: var(--bg2); color: var(--text3); cursor: pointer; font-family: 'DM Sans', sans-serif; white-space: nowrap; }
.mm-edit-btn:hover { color: var(--text); background: var(--bg); }

/* Onboarding overlay (Day 7 Task 5) */
.onboarding-overlay { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 44px 18px; -webkit-overflow-scrolling: touch; }
.onboarding-inner { width: 100%; max-width: 620px; }
.ob-progress { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.ob-h { font-family: 'Lora', serif; font-size: 24px; font-weight: 500; color: var(--text); margin-bottom: 12px; line-height: 1.3; }
.ob-text { font-size: 14px; color: var(--text2); line-height: 1.7; margin-bottom: 18px; }
.ob-text p { margin-bottom: 12px; }
.ob-sub { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 12px; }
.ob-nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.ob-primary { font-family: 'Lora', serif; font-size: 14px; padding: 10px 22px; border-radius: 8px; background: var(--text); color: var(--bg); border: none; cursor: pointer; }
.ob-primary:hover { opacity: .9; }
.ob-back { font-size: 13px; padding: 9px 16px; border-radius: 8px; background: var(--bg2); color: var(--text2); border: 1px solid var(--border); cursor: pointer; }
.ob-back:hover { background: var(--bg3); }
.ob-skip { display: block; margin: 16px auto 0; font-size: 12px; color: var(--text3); background: none; border: none; cursor: pointer; text-decoration: underline; }
.ob-skip:hover { color: var(--text2); }
.ob-theme-item { margin-bottom: 4px; }
.ob-theme-tag { font-size: 10px; font-weight: 500; text-align: right; margin: 1px 30px 6px 0; letter-spacing: .02em; }
.ob-theme-tag.sug  { color: var(--t1); }
.ob-theme-tag.cust { color: var(--text3); font-style: italic; }
.ob-signin-row { font-size: 13px; color: var(--text2); margin-bottom: 18px; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; }
.ob-signin-link { background: none; border: none; padding: 0; font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500; color: var(--text); text-decoration: underline; cursor: pointer; }
.ob-signin-link:hover { color: var(--t2); }

/* Step 1 intro block — "What is My Living Map?" card + expandable lineage */
.ob-intro { margin-bottom: 22px; padding: 16px 18px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; }
.ob-intro-h { font-family: 'Lora', serif; font-size: 16px; font-weight: 500; color: var(--text); margin: 0 0 10px; }
.ob-intro-primary, .ob-intro-para { font-size: 13.5px; color: var(--text2); line-height: 1.65; margin: 0 0 10px; }
.ob-intro-toggle { display: inline-block; font-size: 12.5px; color: var(--t2); text-decoration: underline; cursor: pointer; user-select: none; }
.ob-intro-toggle:hover { color: var(--text); }
.ob-intro-more { font-size: 13px; color: var(--text2); line-height: 1.65; margin: 10px 0 0; }
.ob-intro-boundary { font-size: 13.5px; font-weight: 400; color: var(--text2); line-height: 1.5; margin: 12px 0 0; }

/* Onboarding single-select options (steps 1-2) */
.ob-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.ob-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; transition: all .15s; min-height: 44px; }
.ob-option:hover { border-color: var(--text3); background: var(--bg2); }
.ob-option.selected { border-color: var(--t2); background: var(--t2bg); box-shadow: 0 0 0 1px var(--t2); }
.ob-option-title { font-family: 'Lora', serif; font-size: 14px; color: var(--text); }
.ob-option.selected .ob-option-title { color: #085041; }
.ob-option-desc { font-size: 12px; color: var(--text3); line-height: 1.45; }
.ob-ifs-explainer { margin-top: 14px; padding: 12px 14px; background: var(--unb-bg); border: 1px solid var(--unb); border-radius: 10px; }
.ob-ifs-explainer p { margin-bottom: 8px; font-size: 13px; color: #085041; }
.ob-ifs-explainer p:last-child { margin-bottom: 0; }
/* ob-type-grid and ob-type-btn — used in onboarding steps 1 and 2 */
.ob-type-grid { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 6px; }
.ob-type-btn { text-align: left; padding: 12px 16px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg2); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 13.5px; cursor: pointer; min-height: 44px; width: 100%; transition: border-color .15s, background .15s; }
.ob-type-btn:hover { border-color: var(--t2); background: var(--bg); }
.ob-type-btn.selected { border-color: var(--t2); background: var(--t2bg); color: var(--t2); font-weight: 600; }

/* Onboarding Step 3 — scrollable Welcome/How-to/Privacy + agreement gate */
.ob-scrollbox { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 16px 16px 18px; background: var(--bg2); margin: 12px 0 14px; }
.ob-howto { margin-top: 18px; }
.ob-howto-h { font-family: 'Lora', serif; font-size: 15.5px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.ob-howto-sub { font-size: 12px; color: var(--text3); margin-bottom: 12px; }
.ob-howto-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.ob-howto-num { background: var(--t1); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; flex-shrink: 0; }
.ob-howto-t { font-size: 13.5px; font-weight: 500; color: var(--text); }
.ob-howto-d { font-size: 12.5px; color: var(--text3); margin-top: 2px; line-height: 1.5; }
.ob-privacy { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.ob-privacy p { font-size: 12.5px; color: var(--text2); line-height: 1.6; margin-bottom: 8px; }
.ob-agree-row { margin-bottom: 12px; }
.ob-agree-label { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.ob-agree-label input { margin-top: 3px; width: 17px; height: 17px; flex-shrink: 0; cursor: pointer; }
.ob-agree-label input:disabled { cursor: not-allowed; }
.ob-agree-hint { font-size: 11.5px; color: var(--text3); margin-top: 5px; margin-left: 26px; }
.ob-primary:disabled { opacity: .45; cursor: not-allowed; }

/* Onboarding Step 4 — theme chips (chips-first design) */
.ob-chips-section { margin-top: 8px; }
.ob-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ob-chip {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  cursor: pointer;
  min-height: 36px;
  transition: background .15s, border-color .15s, color .15s;
}
.ob-chip:hover { border-color: var(--t2); }
.ob-chip.selected { background: var(--t2bg); border-color: var(--t2); color: var(--t2); font-weight: 500; }
.ob-free-input { display: block; width: 100%; margin-bottom: 6px; font-size: 16px; }

/* Onboarding Step 5 — Growth Areas dropdown picker */
.ob-seed-row { margin-bottom: 10px; }
.ob-seed-select {
  width: 100%;
  padding: 12px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px; /* 16px prevents iOS auto-zoom */
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--text);
  cursor: pointer;
  min-height: 44px;
  box-sizing: border-box;
}
.ob-seed-select:focus { outline: 2px solid var(--t2); border-color: var(--t2); }
.ob-seed-custom {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  border: 1.5px solid var(--t2);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}
.ob-seed-custom:focus { outline: 2px solid var(--t2); }
.ob-seed-add {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--t2);
  background: none;
  border: 1.5px dashed var(--t2);
  border-radius: 8px;
  cursor: pointer;
}
.ob-seed-add:hover { background: var(--t2bg); }

/* Post-first-entry nudge (Day 7 Task 6) — soft amber */
.journal-nudge { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--t4bg); border: 1px solid #E9C27D; color: #854F0B; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 12.5px; line-height: 1.5; }
.jn-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.jn-btn { font-size: 12px; padding: 5px 12px; border-radius: 6px; border: 1px solid #C9912E; background: #C9912E; color: #fff; cursor: pointer; white-space: nowrap; font-family: 'DM Sans', sans-serif; }
.jn-btn:hover { opacity: .9; }
.jn-x { background: none; border: none; color: #854F0B; font-size: 14px; cursor: pointer; line-height: 1; padding: 0 2px; }
.theme-chip-pick { font-size: 12px; padding: 5px 11px; border-radius: 15px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); cursor: pointer; opacity: .55; transition: all .15s; }
.theme-chip-pick.selected { opacity: 1; background: var(--t2bg); border-color: var(--t2); color: #085041; font-weight: 500; }

/* Inline edit forms — parts + journal entries */
.pe-form, .entry-edit-form { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.pe-field, .ee-field { display: flex; flex-direction: column; gap: 3px; }
.pe-field > label, .ee-field > label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; }
.pe-input, .ee-input { font-size: 12.5px; font-family: inherit; padding: 6px 9px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; }
.pe-input:focus, .ee-input:focus { border-color: var(--border2); }
textarea.pe-input, textarea.ee-input { min-height: 48px; resize: vertical; line-height: 1.5; }
.ee-content { min-height: 150px; }
.pe-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text2); }
.pe-actions, .ee-actions { display: flex; gap: 7px; margin-top: 4px; }
.pc-btn.save { background: var(--unb); color: #fff; border-color: var(--unb); }
.pc-btn.save:hover { opacity: .9; }
.entry-edit-row { margin-bottom: 8px; }
.content-changed-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--t4bg); border: 1px solid #E9C27D; color: #854F0B; border-radius: 7px; padding: 7px 11px; margin-bottom: 10px; font-size: 12px; }

/* Portrait launch toast (e.g. Leonardo prompt-copied) */
.portrait-toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12.5px; padding: 9px 16px; border-radius: 8px; z-index: 1100; box-shadow: 0 4px 16px rgba(44,40,37,.22); }

/* Cloud-backup confirmation toast — a clear, friendly "you're backed up" popup */
.sync-toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--unb-bg); color: #085041; border: 1.5px solid var(--unb); font-size: 13px; font-weight: 500; padding: 11px 20px; border-radius: 24px; z-index: 1200; box-shadow: 0 6px 22px rgba(8,80,65,.18); display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; }
.sync-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sync-toast .st-dot { font-size: 15px; }

/* Data-loss warning banner (sign-in restore brought back fewer entries than expected) */
.restore-warning { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; background: var(--t4bg); border-bottom: 2px solid #E9C27D; color: #854F0B; padding: 11px 18px; font-size: 13px; line-height: 1.5; text-align: center; }
.restore-warning .rw-icon { font-size: 15px; flex-shrink: 0; }
.restore-warning .rw-dismiss { background: #854F0B; color: #fff; border: none; border-radius: 6px; padding: 5px 14px; font-size: 12px; font-family: inherit; cursor: pointer; flex-shrink: 0; }
.restore-warning .rw-dismiss:hover { opacity: .9; }

/* Crisis helpline block — deterministic safety net, always visible when crisis language is detected */
.crisis-helplines { margin-top: 14px; padding: 14px 16px; border: 2px solid #C0392B; border-radius: 10px; background: #FBEAE7; color: #7A271A; }
.crisis-helplines .ch-title { font-weight: 600; font-size: 13px; line-height: 1.5; margin-bottom: 8px; }
.crisis-helplines .ch-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.crisis-helplines .ch-list li { font-size: 13px; }
.crisis-helplines .ch-list b { font-weight: 600; }
.crisis-helplines .ch-note { color: #9A4A3A; font-size: 11.5px; }
.crisis-helplines .ch-foot { font-size: 12.5px; font-style: italic; }

/* Crisis containment panel — calm, warm; the red helpline block below supplies the urgency */
.analysis-panel.crisis-contained { background: var(--bg2); border: 1px solid var(--border); }
.crisis-affirm { font-size: 14px; line-height: 1.6; color: var(--text); margin-bottom: 14px; }
/* Active self-harm tier — directive 995 wording carries more visual weight */
.crisis-affirm-urgent { font-weight: 600; color: #7A271A; }
/* Gentle grounding note shown ALONGSIDE a normal reflection (despair / supervisor reminder).
   Soft and warm — deliberately not the red helpline styling, to avoid alarming ordinary low mood. */
.crisis-gentle { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); color: var(--text2); font-size: 13px; line-height: 1.6; }

/* Pattern snapshots (Day 8) */
.snap-confirm { font-size: 12px; color: #085041; }
.pattern-snapshots { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.snap-list-label { font-size: 10.5px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px; }
.snap-item { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.snap-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; background: var(--bg); user-select: none; }
.snap-head:hover { background: var(--bg2); }
.snap-date { flex: 1; font-size: 12.5px; color: var(--text2); }
.snap-chev { font-size: 9px; color: var(--text3); flex-shrink: 0; }
.snap-del { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 12px; padding: 0 2px; flex-shrink: 0; }
.snap-del:hover { color: var(--t3); }
.snap-body { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--bg2); }

/* Relationship list (Day 8) */
#rels-list { flex-shrink: 0; }
.rels-list-inner { padding: 8px 12px 10px; border-top: 1px solid var(--border); max-height: 160px; overflow-y: auto; }
.rels-list-label { position: sticky; top: 0; background: var(--bg); padding-bottom: 4px; z-index: 1; font-size: 10.5px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.rel-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); padding: 3px 0; }
.rel-row-text { flex: 1; }
.rel-type { font-style: italic; color: var(--text3); }
.rel-del { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 11px; padding: 0 3px; }
.rel-del:hover { color: var(--t3); }
.wot-gate-msg {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 7px;
  margin-top: 6px;
  font-style: italic;
  display: none;
}
.wot-gate-msg.blue { background: #E6F1FB; color: #0D3A66; border: 1px solid rgba(26,111,191,.25); }
.wot-gate-msg.red  { background: #FAECE7; color: #7A2410; border: 1px solid rgba(216,90,48,.25); }

/* WoT zone badge on entry cards */
.wot-zone-badge {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-style: normal;
}
.wot-zone-badge.green { background: #E1F5EE; color: #085041; }
.wot-zone-badge.blue  { background: #E6F1FB; color: #0D3A66; }
.wot-zone-badge.red   { background: #FAECE7; color: #7A2410; }

/* ===== REFLECTIVE PAUSE CARD ===== */
.reflective-pause-card {
  background: #EAF3DE;
  border: 1px solid rgba(58,122,24,.25);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.rp-header {
  font-family: 'Lora', serif;
  font-size: 13.5px;
  font-weight: 500;
  color: #27500A;
  margin-bottom: 5px;
  letter-spacing: -.01em;
}
.rp-possibility {
  font-size: 13px;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 12px;
}
.rp-question {
  font-family: 'Lora', serif;
  font-size: 13.5px;
  font-style: italic;
  color: #27500A;
  line-height: 1.65;
}

/* ===== AI ERROR PANEL ===== */
.ai-error-panel {
  background: #FAEEDA;
  border: 1px solid rgba(239,159,39,.4);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 10px;
}
.ai-error-panel p { color: #633806; font-size: 13px; line-height: 1.6; margin-bottom: 8px; }

/* Map mobile note — hidden on desktop, shown on mobile */
.map-mobile-note { display: none; }

/* Parts mobile Register/Map toggle — hidden on desktop */
.parts-mobile-tabs { display: none; }
.pm-tab { flex: 1; min-height: 44px; font-size: 13px; font-weight: 500; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); cursor: pointer; font-family: 'DM Sans', sans-serif; }
.pm-tab:first-child { border-radius: 8px 0 0 8px; }
.pm-tab:last-child  { border-radius: 0 8px 8px 0; border-left: none; }
.pm-tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ===== MOBILE ===== */
@media (max-width: 760px) {
  .app-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .app-title  { font-size: 17px; }

  /* Nav: horizontally scrollable, never wraps */
  .app-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 3px;
    padding-bottom: 2px;
  }
  .app-nav::-webkit-scrollbar { display: none; }
  .nav-btn { font-size: 12px; padding: 5px 10px; white-space: nowrap; flex-shrink: 0; min-height: 36px; }

  .section { height: auto; min-height: calc(100vh - 60px); overflow: visible; }
  .app-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .jpanel.active { display: block; flex: none; min-height: 0; }
  #jpanel-new.active { overflow: visible; padding: 12px 14px; }
  #jpanel-entries .entry-list { overflow: visible; }
  .section-inner { padding: 16px; }

  /* Minimum font size 14px on mobile */
  body { font-size: 14px; }
  .entry-meta span, .al, .fl-val, .ctx-p, .report-p, .ae-field label { font-size: 14px; }

  /* Minimum 44px tap targets */
  .mb, .ctx-btn, .f-chip, .nav-btn, .vtab, .wot-pill,
  .exp-btn, .pc-btn, button[onclick] { min-height: 44px; }

  .theme-grid,
  .theme-grid-2 { grid-template-columns: 1fr 1fr; }
  .polarities-grid { grid-template-columns: 1fr 1fr; }
  .growth-grid     { grid-template-columns: 1fr 1fr; }

  /* Parts: Register/Map toggle (single column, one panel at a time) */
  .parts-mobile-tabs { display: flex; gap: 0; padding: 10px 14px 0; }
  .parts-shell  { display: flex; flex-direction: column; }
  .reg-panel    { border-right: none; border-bottom: 1px solid var(--border); max-height: none; }
  .map-panel    { display: none; min-height: 60vw; }
  /* Default = Register view; .show-map flips it */
  .parts-shell .map-panel { display: none; }
  .parts-shell .reg-panel { display: flex; }
  .parts-shell.show-map .reg-panel { display: none; }
  .parts-shell.show-map .map-panel { display: flex; }
  .map-mobile-note {
    display: block;
    font-size: 13px;
    color: var(--text3);
    font-style: italic;
    padding: 12px 16px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    text-align: center;
  }

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

  .modal { border-radius: 18px 18px 0 0; max-width: 100%; width: 100%; }
  .modal-overlay { align-items: flex-end; }
  .launch-grid { grid-template-columns: 1fr 1fr; }

  .ae-grid  { grid-template-columns: 1fr; }
  .afl-grid { grid-template-columns: 1fr; }

  /* Vision tabs: scrollable */
  .vision-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .vision-tabs::-webkit-scrollbar { display: none; }
  .vtab { white-space: nowrap; flex-shrink: 0; }

  /* Journal toolbar */
  .journal-toolbar { flex-wrap: wrap; padding: 10px 12px; gap: 6px; }
  .journal-toolbar .j-date-wrap { display: none; }
  .journal-toolbar input[type="search"] { min-width: 120px; }

  /* Entry list */
  .entry-list { height: auto; padding: 12px 14px; }
  .entry-card { width: 100%; }
  .entry-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

  /* Patterns and Vision */
  .patterns-inner,
  .vision-inner { padding: 16px; }

  /* Inputs/textareas at 16px to stop iOS auto-zoom on focus */
  input, select, textarea,
  .ae-field input, .ae-field select, .ae-field textarea,
  .afl input, .afl select, .afl textarea,
  .reflection-textarea, .ee-input, .mm-input, .mm-textarea,
  #entry-content, #entry-relate { font-size: 16px; }
  textarea, .reflection-textarea, #entry-content { min-height: 80px; }

  /* Depth pills wrap rather than truncate */
  #depth-field .wot-zone-selector { flex-wrap: wrap; }
  .depth-pill { flex: 1 1 auto; min-width: 30%; }

  /* Full-width primary action buttons */
  .entry-form-actions { flex-direction: column; }
  .entry-form-actions button { width: 100%; }
  .add-part-btn, #patterns-btn { width: 100%; }

  /* Touch-friendly chips */
  .f-chip, .depth-pill, .wot-pill, .theme-chip-pick, .layer-pill { min-height: 36px; padding: 8px 14px; }

  /* Stronger tap area for small icon buttons without enlarging them visually */
  .lm-edit-btn, .mm-edit-btn, .icon-btn, .jn-x, .rel-del { min-height: 36px; min-width: 36px; }

  /* Modals as safe bottom sheets */
  .modal { max-width: 100vw; max-height: 90vh; overflow-y: auto; }
}

@media (max-width: 480px) {
  .theme-grid,
  .theme-grid-2   { grid-template-columns: 1fr; }
  .polarities-grid { grid-template-columns: 1fr; }
  .growth-grid     { grid-template-columns: 1fr 1fr; }
  .wot-zone-selector { flex-direction: column; }
  #help-overlay > div { padding: 24px 18px; }
}

@media (max-width: 400px) {
  /* WoT check-in stacks on very small screens */
  #wot-selector .wot-pill, .wot-zone-selector .wot-pill { width: 100%; }
}

/* List-view summary preview — analysis "one thing alive here" on the collapsed card */
.entry-summary-preview { margin-top: 7px; font-size: 12px; color: var(--text2); font-style: italic; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry-card.open .entry-summary-preview { display: none; }

/* Containment micro-signal + time-based re-analyse nudge (PROMPT E) */
.containment-signal { font-size: 12.5px; color: var(--text2); font-style: italic; line-height: 1.6; margin: 12px 2px 0; padding: 10px 12px; background: var(--bg2); border-radius: 7px; border-left: 3px solid var(--border2); }
.reanalyse-nudge { font-size: 12.5px; color: var(--text2); line-height: 1.6; margin: 12px 2px 0; padding: 10px 12px; background: var(--bg2); border-radius: 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* First-analysis parts orientation (Build 2) */
.first-analysis-orientation { font-size: 12.5px; color: var(--text2); line-height: 1.65; margin: 0 2px 12px; padding: 11px 13px; background: var(--t2bg); border: 1px solid var(--t2); border-radius: 9px; }

/* Boundary-of-fit note on onboarding Step 1 (Build 3) */
.ob-boundary-note { font-size: 12.5px; color: var(--text2); line-height: 1.6; margin: 0 0 16px; padding: 11px 14px; background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--border2); border-radius: 8px; }

/* "Noticing is enough" bridge + save-for-supervision (Build 4) */
.noticing-bridge { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.noticing-text { font-size: 11.5px; color: var(--text3); font-style: italic; line-height: 1.5; }
.supervision-btn { font-size: 11.5px; padding: 5px 12px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); font-family: 'DM Sans', sans-serif; white-space: nowrap; }
.supervision-btn:hover { color: var(--text); border-color: var(--border2); }
.supervision-btn.saved { background: var(--t2bg); border-color: var(--t2); color: var(--t2); }

/* ===== Guided Entry tab (IFS-informed) ===== */
#jpanel-guided { padding: 4px 2px; }
.guided-h { font-family: 'Lora', serif; font-size: 18px; font-weight: 500; color: var(--text); margin-bottom: 10px; }
.guided-orient p, .guided-steady p, .guided-close p { font-size: 13px; color: var(--text2); line-height: 1.65; margin: 0 0 10px; }
.guided-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text2); line-height: 1.5; margin-bottom: 9px; cursor: pointer; }
.guided-check input { margin-top: 2px; flex-shrink: 0; }
.guided-step { margin-bottom: 14px; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 9px; }
.guided-q { font-size: 13px; color: var(--text); font-weight: 500; line-height: 1.5; margin-bottom: 6px; }
.guided-stepnum { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--t2); margin-right: 6px; }
.guided-f-label { font-size: 11px; color: var(--text3); font-style: italic; margin: -2px 0 6px; }
.guided-textarea { width: 100%; font-size: 12.5px; font-family: 'DM Sans', sans-serif; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical; line-height: 1.6; outline: none; }
.guided-textarea:focus { border-color: var(--border2); }
.guided-steady, .guided-close { padding: 14px 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; }
.guided-close-lead { font-weight: 500; color: var(--text) !important; }

/* ===== Analysis history (Prompt F) — previous reflections, muted + collapsed ===== */
.analysis-history { margin: 0 0 12px; }
.analysis-history > summary { font-size: 12px; color: var(--text3); cursor: pointer; list-style: none; padding: 4px 0; }
.analysis-history > summary:hover { color: var(--text2); }
.analysis-history .ah-item { margin: 6px 0 0; padding: 7px 10px; background: var(--bg2); border-radius: 6px; }
.analysis-history .ah-itemsummary { font-size: 11.5px; color: var(--text3); line-height: 1.5; cursor: pointer; list-style: none; }
.analysis-history .ah-itemsummary::-webkit-details-marker { display: none; }
.analysis-history .ah-itemsummary:hover { color: var(--text2); }
.analysis-history .ah-date { display: block; font-size: 10.5px; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 1px; }
.analysis-history .ah-body { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.analysis-history .ah-field { font-size: 11.5px; color: var(--text3); line-height: 1.55; margin-bottom: 6px; }
.analysis-history .ah-flabel { font-weight: 600; color: var(--text2); }
