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

:root {
  --bg-deep: #1a2a1f;
  --bg-mid: #243b2c;
  --bg-light: #2d4a38;
  --jade: #7a9b76;
  --jade-glow: #9bc48a;
  --amber: #d4a574;
  --amber-soft: #e8c9a0;
  --text: #e8e4df;
  --text-muted: #a8a098;
  --text-dim: #6b6560;
  --danger: #c47a7a;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --dyslexia-font: "OpenDyslexic", "Comic Sans MS", system-ui, sans-serif;
}

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

body.dyslexia { font-family: var(--dyslexia-font); letter-spacing: 0.05em; }

body.colorblind-redgreen {
  --jade: #f2c94c;
  --jade-glow: #fff1a8;
  --amber: #66d9ff;
  --amber-soft: #bdefff;
  --text: #fffaf0;
  --text-muted: #e7f6ff;
  --text-dim: #b8d7e8;
  --danger: #ff8a8a;
}

body.colorblind-redgreen button,
body.colorblind-redgreen .btn-primary,
body.colorblind-redgreen .btn-secondary,
body.colorblind-redgreen .btn-small,
body.colorblind-redgreen .bottom-nav a.active {
  border: 2px solid rgba(255, 241, 168, 0.78);
}

body.colorblind-redgreen input:focus,
body.colorblind-redgreen textarea:focus {
  border-color: #fff1a8;
  box-shadow: 0 0 0 3px rgba(102, 217, 255, 0.25);
}

body.colorblind-redgreen h1,
body.colorblind-redgreen h2,
body.colorblind-redgreen h3,
body.colorblind-redgreen h4,
body.colorblind-redgreen p,
body.colorblind-redgreen label,
body.colorblind-redgreen .dash-logo,
body.colorblind-redgreen .dash-user,
body.colorblind-redgreen .dash-greeting h1,
body.colorblind-redgreen .dash-greeting p,
body.colorblind-redgreen .settings-section h3,
body.colorblind-redgreen .settings-toggle-row,
body.colorblind-redgreen .settings-hint {
  color: #fffaf0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.62);
}

body.colorblind-redgreen .dashboard-layout,
body.colorblind-redgreen .settings-panel,
body.colorblind-redgreen .checkin-panel {
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.52);
}

body.colorblind-redgreen .home-chat {
  background: rgba(7, 27, 42, 0.58);
  border-color: rgba(255, 241, 168, 0.54);
}

body.colorblind-redgreen .home-chat-heading h2,
body.colorblind-redgreen .home-chat-heading p,
body.colorblind-redgreen .home-chat-note,
body.colorblind-redgreen .home-chat-empty {
  color: #fffaf0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.72);
}

body.colorblind-redgreen input,
body.colorblind-redgreen textarea,
body.colorblind-redgreen select,
body.colorblind-redgreen .home-chat-composer textarea {
  background: rgba(250, 255, 252, 0.9);
  border-color: rgba(255, 241, 168, 0.7);
  color: #10231d;
  text-shadow: none;
}

body.colorblind-redgreen input::placeholder,
body.colorblind-redgreen textarea::placeholder {
  color: #436054;
  opacity: 1;
}

body.colorblind-redgreen .settings-section {
  background: rgba(7, 27, 42, 0.64);
  border-color: rgba(102, 217, 255, 0.38);
}

body.colorblind-redgreen .checkin-today-done {
  background: rgba(9, 32, 48, 0.92);
  border-color: rgba(255, 241, 168, 0.7);
  color: #fffaf0;
}

body.colorblind-redgreen .checkin-today-done > p,
body.colorblind-redgreen .checkin-today-note,
body.colorblind-redgreen .checkin-today-nextstep {
  color: #fffaf0;
}

body.colorblind-redgreen .checkin-history {
  background: rgba(7, 27, 42, 0.78);
  border-color: rgba(102, 217, 255, 0.45);
}

body.colorblind-redgreen .checkin-history h3,
body.colorblind-redgreen .checkin-history-note {
  color: #fffaf0;
}

body.colorblind-redgreen .checkin-history-date,
body.colorblind-redgreen .checkin-history-nextstep,
body.colorblind-redgreen .checkin-hint {
  color: #e7f6ff;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ===== AUTH SCREENS ===== */
.screen { max-width: 420px; width: 100%; text-align: center; margin: auto; padding: 2rem; }
.screen-wide { max-width: 800px; width: 100%; }

h1 { color: var(--jade-glow); font-size: 2.2rem; margin-bottom: 0.25rem; }
h2 { color: var(--jade); font-size: 1.4rem; margin-bottom: 1.5rem; }
h3 { color: var(--jade-glow); font-size: 1.1rem; margin-bottom: 0.5rem; }
h4 { color: var(--jade); font-size: 1rem; margin: 1rem 0 0.5rem; }
p { color: var(--text-muted); margin-bottom: 1rem; }

input[type="email"], input[type="password"], input[type="text"], input[type="date"], textarea {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--bg-mid);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--jade); }
textarea { resize: vertical; min-height: 80px; }

button {
  width: 100%;
  padding: 12px;
  background: var(--jade);
  color: var(--bg-deep);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.5rem;
}
button:hover { background: var(--jade-glow); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-small {
  width: auto;
  padding: 8px 16px;
  font-size: 0.9rem;
  margin: 0;
}
.btn-cancel { background: var(--bg-light); color: var(--text-muted); width: auto; padding: 8px 16px; margin: 0; }
.btn-cancel:hover { background: var(--bg-mid); color: var(--text); }
.btn-save { width: auto; padding: 8px 20px; margin: 0; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #d48a8a; }

.link-btn { background: none; color: var(--jade); font-weight: normal; margin-top: 1rem; }
.link-btn:hover { background: none; text-decoration: underline; }

.error, .form-error { color: var(--danger); margin-top: 0.75rem; font-size: 0.9rem; }
.success { color: var(--jade-glow); margin-top: 1rem; }
.loading { color: var(--text-muted); text-align: center; padding: 2rem; }

.butterfly { font-size: 3rem; margin: 1rem 0; animation: flutter 2s ease-in-out infinite; }
@keyframes flutter { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

/* ===== BUTTERFLY OVERLAY (save animation) ===== */
.bfly-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 0; transition: opacity 0.3s;
}
.bfly-overlay.bfly-show { opacity: 1; }
.bfly-card {
  background: var(--bg-mid);
  border-radius: 16px;
  padding: 2rem 3rem;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.bfly-icon { font-size: 3rem; animation: flutter 0.6s ease-in-out 3; }
.bfly-msg { color: var(--jade-glow); font-size: 1.2rem; margin-top: 0.75rem; }

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-layout {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.5rem 5rem;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--bg-mid);
  margin-bottom: 1.5rem;
}
.dash-logo { color: var(--jade-glow); font-size: 1.3rem; font-weight: 600; }
.dash-user { color: var(--text-muted); font-size: 0.9rem; cursor: pointer; }
.dash-user:hover { color: var(--jade); }

.dash-greeting { margin-bottom: 1.5rem; }
.dash-greeting h1 { font-size: 1.8rem; }
.dash-greeting p { margin-bottom: 0; }

/* 4 quick-action cards */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.dash-card {
  background: var(--bg-mid);
  border-radius: 12px;
  padding: 1.25rem;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, background 0.15s;
  border: 1px solid transparent;
}
.dash-card:hover { background: var(--bg-light); transform: translateY(-2px); border-color: var(--jade); }
.dash-card-icon { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }
.dash-card h3 { color: var(--jade-glow); font-size: 0.95rem; margin-bottom: 0.25rem; }
.dash-card p { color: var(--text-muted); font-size: 0.8rem; margin: 0; }

/* ===== FOLDER TABS ===== */
.folder-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.5rem 0 0.75rem;
  -webkit-overflow-scrolling: touch;
}
.folder-tabs::-webkit-scrollbar { height: 4px; }
.folder-tabs::-webkit-scrollbar-thumb { background: var(--bg-light); border-radius: 2px; }
.folder-tabs-empty {
  color: var(--text-muted);
  padding: 1rem 0;
  font-size: 0.95rem;
}

.folder-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--bg-mid);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s;
  margin: 0;
  width: auto;
}
.folder-tab:hover { background: var(--bg-light); color: var(--text); }
.folder-tab.active {
  background: var(--bg-light);
  border-color: var(--jade);
  color: var(--jade-glow);
}
.folder-tab-add {
  font-size: 1.2rem;
  padding: 4px 14px;
}
.folder-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ===== CONTEXT MENU ===== */
.ctx-menu {
  position: fixed;
  z-index: 9998;
  background: var(--bg-light);
  border: 1px solid var(--bg-mid);
  border-radius: 8px;
  padding: 0.25rem 0;
  min-width: 140px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.ctx-menu button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 0.9rem;
  font-weight: normal;
  border-radius: 0;
  cursor: pointer;
  margin: 0;
}
.ctx-menu button:hover { background: var(--bg-mid); }
.ctx-menu button.danger { color: var(--danger); }

/* ===== MEMORY GRID ===== */
.add-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}
.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.mem-card {
  background: var(--bg-mid);
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.mem-card:hover { background: var(--bg-light); transform: translateY(-2px); border-color: var(--jade); }
.card-type-icon { font-size: 1.5rem; flex-shrink: 0; padding-top: 2px; }
.card-body { flex: 1; min-width: 0; }
.card-body h4 { color: var(--text); font-size: 0.95rem; margin: 0 0 0.25rem; }
.card-desc { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 0.25rem; }
.card-date { color: var(--amber); font-size: 0.8rem; }

.grid-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.grid-empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.grid-empty p { margin-bottom: 1rem; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9990;
  padding: 1rem;
}
.modal {
  background: var(--bg-deep);
  border-radius: 14px;
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 50px rgba(0,0,0,0.7);
}
.modal-detail { max-width: 600px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.modal-header h2 { margin: 0; }
.modal-close {
  background: none;
  color: var(--text-muted);
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  width: auto;
  margin: 0;
}
.modal-close:hover { color: var(--text); background: none; }

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Type selector in add modal */
.type-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.type-opt {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 6px 12px;
  background: var(--bg-mid);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background 0.15s;
}
.type-opt:hover { background: var(--bg-light); }
.type-opt input[type="radio"] { accent-color: var(--jade); width: auto; margin: 0; }
.add-file-label {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg-mid);
  border: 1px dashed var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  color: var(--jade);
  font-size: 0.9rem;
  transition: background 0.15s;
}
.add-file-label:hover { background: var(--bg-light); border-color: var(--jade); }
.add-file-name {
  display: inline-block;
  margin-left: 0.75rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  vertical-align: middle;
}

/* ===== DETAIL VIEW ===== */
.detail-body { padding: 0 0.5rem; }
.detail-type-icon { font-size: 3rem; text-align: center; margin-bottom: 0.5rem; }
.detail-title { text-align: center; margin-bottom: 0.5rem; }
.detail-date { text-align: center; color: var(--amber); margin-bottom: 1rem; font-size: 0.95rem; }
.detail-desc { color: var(--text); line-height: 1.8; margin-bottom: 1.5rem; white-space: pre-wrap; }
.detail-meta { color: var(--text-dim); font-size: 0.8rem; margin-bottom: 1rem; }
.detail-actions { display: flex; gap: 0.5rem; justify-content: center; }
.detail-actions button { width: auto; }
.detail-media { margin-bottom: 1rem; text-align: center; }
.detail-img { max-width: 100%; max-height: 400px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.detail-media-name { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.25rem; }
.detail-download { display: inline-block; padding: 0.5rem 1rem; background: var(--surface); border-radius: 6px; color: var(--amber); text-decoration: none; font-size: 0.9rem; }
.detail-download:hover { background: var(--surface-hover); }

/* ===== SEARCH ===== */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.search-bar input { flex: 1; margin-bottom: 0; }
.search-results { margin-bottom: 1.5rem; padding: 1rem; background: var(--bg-mid); border-radius: 10px; }
.search-results h3 { margin-top: 0; }
.search-list { display: flex; flex-direction: column; gap: 0.5rem; }
.search-item {
  padding: 0.75rem;
  background: var(--bg-light);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-item:hover { background: var(--bg-mid); }
.search-item strong { color: var(--text); display: block; }
.search-item p { color: var(--text-muted); font-size: 0.85rem; margin: 0.25rem 0 0; }
.search-privacy-note { color: var(--text-muted); font-size: 0.82rem; margin: -0.35rem 0 1rem; }

/* ===== PHOTO ALBUMS ===== */
.albums-panel { max-width: 900px; margin: 0 auto; padding: 1rem; }
.albums-header, .album-detail-top { display: flex; align-items: center; gap: 0.75rem; }
.albums-header h2 { flex: 1; margin: 0; }
.albums-note, .albums-empty { color: var(--text-muted); }
.albums-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; }
.album-card { text-align: left; padding: 1rem; border: 0; border-radius: 10px; background: var(--bg-mid); color: var(--text); cursor: pointer; }
.album-card:hover { background: var(--surface-hover); }
.album-card strong, .album-card span { display: block; }
.album-card span { color: var(--text-muted); margin-top: 0.25rem; }
.album-detail h3 { margin-bottom: 0.25rem; }
.album-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.album-photo { background: var(--bg-mid); border-radius: 8px; padding: 0.5rem; }
.album-photo img { display: block; width: 100%; height: 130px; object-fit: cover; border-radius: 5px; margin-bottom: 0.5rem; cursor: pointer; }
.album-photo img:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.album-analyse-note { display: block; margin: 0.15rem 0 0.35rem; font-size: 0.7rem; line-height: 1.3; color: var(--text-muted); opacity: 0.75; }
.album-photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.82);
}
.album-photo-viewer-inner {
  position: relative;
  max-width: min(96vw, 1100px);
  max-height: 94vh;
}
.album-photo-viewer-inner img {
  display: block;
  max-width: 100%;
  max-height: 94vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}
.album-photo-viewer-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 18, 12, 0.82);
  color: #fff;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}
.album-photo-viewer-close:hover,
.album-photo-viewer-close:focus {
  background: rgba(120, 180, 130, 0.95);
  outline: none;
}
.album-analysis { color: var(--text-muted); font-size: 0.8rem; margin: 0.5rem 0 0; }
.files-list { display: grid; gap: 0.5rem; margin-bottom: 1.25rem; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.65rem; border-radius: 8px; background: var(--bg-mid); }
.file-row-meta { min-width: 0; display: grid; gap: 0.15rem; }
.file-row-meta strong, .file-row-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-open-name { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.file-open-name:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.file-row-meta span { color: var(--text-muted); font-size: 0.85rem; }
.file-row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.file-preview-modal { width: min(920px, 94vw); height: min(760px, 88vh); display: flex; flex-direction: column; }
.file-preview-modal h2 { margin: 0 2.5rem 0.75rem 0; font-size: 1.1rem; }
.file-preview-body { flex: 1; min-height: 0; overflow: auto; border-radius: 8px; background: #fff; color: #17231e; }
.file-preview-body pre { margin: 0; padding: 1rem; white-space: pre-wrap; word-break: break-word; font: 0.9rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.file-preview-body img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
@media (max-width: 600px) { .file-row { align-items: flex-start; flex-direction: column; } .file-row-actions { justify-content: flex-start; } }
@media (max-width: 600px) { .albums-panel { padding: 0.75rem; } .albums-header { flex-wrap: wrap; } .albums-header h2 { min-width: 130px; } }

/* ===== TIMELINE (Family Tree view) ===== */
.timeline-list { display: flex; flex-direction: column; gap: 0.5rem; }
.timeline-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-mid);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid var(--jade);
}
.timeline-item:hover { background: var(--bg-light); }
.tl-date { color: var(--amber); font-size: 0.85rem; white-space: nowrap; min-width: 100px; }
.tl-content strong { color: var(--text); }
.tl-content p { color: var(--text-muted); font-size: 0.85rem; margin: 0.15rem 0 0; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-mid);
  display: flex;
  justify-content: space-around;
  padding: 0.6rem 0 0.9rem;
  z-index: 100;
  border-top: 1px solid var(--bg-light);
}
.bottom-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--jade-glow); }

/* ===== KEEP AREA (brain dump text screen) ===== */
.keep-screen {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.keep-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--bg-mid);
  margin-bottom: 1.5rem;
}
.btn-back {
  width: auto;
  background: none;
  color: var(--jade);
  font-size: 1.5rem;
  padding: 4px 12px;
  margin: 0;
  cursor: pointer;
}
.btn-back:hover { background: var(--bg-mid); color: var(--jade-glow); }
.keep-status { color: var(--text-dim); font-size: 0.85rem; flex: 1; text-align: center; }
.keep-prompt { color: var(--jade-glow); font-size: 1.5rem; margin-bottom: 0.25rem; }
.keep-subprompt { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1rem; }
#keep-textarea {
  flex: 1;
  min-height: 50vh;
  font-size: 1.1rem;
  line-height: 1.7;
  padding: 1.25rem;
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: 10px;
  resize: vertical;
}
.keep-actions { margin-top: 1rem; }
.btn-save-big {
  width: 100%;
  padding: 16px;
  background: var(--jade);
  color: var(--bg-deep);
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-save-big:hover { background: var(--jade-glow); }
.btn-save-big:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== MIRROR VIEW (sorted brain dump) ===== */
.mirror-screen {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  min-height: 100vh;
}
.mirror-tone {
  color: var(--amber);
  font-style: italic;
  font-size: 0.95rem;
}
.mirror-summary {
  background: var(--bg-mid);
  border-left: 3px solid var(--jade-glow);
  padding: 1rem 1.25rem;
  border-radius: 0 10px 10px 0;
  margin: 1rem 0 1.5rem;
  color: var(--text);
  line-height: 1.6;
}
.mirror-original {
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: 10px;
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
}
.mirror-original summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
.mirror-original p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0.65rem 0;
}
.mirror-original-text {
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.mirror-bucket {
  background: var(--bg-mid);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--bucket-color, var(--jade));
}
.bucket-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.bucket-icon { font-size: 1.2rem; }
.bucket-header h3 { color: var(--text); margin: 0; flex: 1; font-size: 1.05rem; }
.bucket-count {
  background: var(--bg-light);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
}
.bucket-desc { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 0.75rem; font-style: italic; }
.bucket-list { list-style: none; padding: 0; margin: 0; }
.bucket-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--bg-light);
  color: var(--text);
  line-height: 1.5;
}
.bucket-list li:last-child { border-bottom: none; }
.reminder-context {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.2rem;
  font-style: italic;
}
.conflict-item {
  background: var(--bg-light);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}
.conflict-new { color: var(--text); margin-bottom: 0.25rem; }
.conflict-existing { color: var(--text-muted); font-size: 0.9rem; }
.conflict-sim { color: var(--danger); font-size: 0.75rem; margin-top: 0.25rem; }
.mirror-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.mirror-actions .btn-save-big { flex: 1; }
.mirror-actions .btn-cancel { flex: 1; padding: 16px; }

/* ===== RECENT BRAIN DUMPS (keep screen history) ===== */
.keep-recent {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-mid);
  border-radius: 10px;
  border: 1px solid var(--bg-light);
}
.keep-recent-header {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}
.keep-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 180px;
  overflow-y: auto;
}
.keep-recent-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-light);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid var(--jade);
}
.keep-recent-item:hover { background: var(--bg-deep); }
.keep-recent-when {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
}
.keep-recent-title {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ===== MIRROR TASK CHECKBOXES ===== */
.mirror-tasks-list { margin: 0; padding: 0; list-style: none; }
.mirror-task {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--bg-light);
}
.mirror-task:last-child { border-bottom: none; }
.mirror-task-check {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  color: var(--text);
  line-height: 1.4;
}
.mirror-task-check input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--jade-glow);
  cursor: pointer;
  flex-shrink: 0;
}
.mirror-task-title { flex: 1; }
.mirror-task.done .mirror-task-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

/* ===== MIRROR FOLDER PICKER ===== */
.mirror-folder-picker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-mid);
  border-radius: 10px;
  border: 1px solid var(--bg-light);
}
.mirror-folder-picker label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.mirror-folder-picker select {
  flex: 1;
  min-width: 140px;
  padding: 0.45rem 0.6rem;
  background: var(--bg-light);
  color: var(--text);
  border: 1px solid var(--bg-deep);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}
.mirror-folder-picker select:focus { outline: 1px solid var(--jade-glow); }
.mirror-folder-status {
  color: var(--text-muted);
  font-size: 0.8rem;
  min-width: 1.5rem;
}

/* ============================================================
   PHASE 7 — CHAT PANEL
   ============================================================ */

.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
}

.chat-header {
  padding: 1rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header h2 { margin: 0.25rem 0 0; font-size: 1.2rem; }
.chat-subtitle { margin: 0; font-size: 0.8rem; color: var(--muted); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chat-empty {
  text-align: center;
  margin-top: 3rem;
  color: var(--muted);
}
.chat-empty p { max-width: 320px; margin: 0 auto; line-height: 1.5; }

.chat-bubble {
  display: flex;
  max-width: 85%;
}
.chat-bubble.chat-user {
  align-self: flex-end;
}
.chat-bubble.chat-assistant {
  align-self: flex-start;
}

.chat-bubble-inner {
  padding: 0.65rem 0.9rem;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.chat-user .chat-bubble-inner {
  background: var(--leaf);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-assistant .chat-bubble-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-typing .chat-bubble-inner {
  padding: 0.45rem 1rem;
}
.typing-dots {
  display: inline-block;
  animation: typingPulse 1.4s infinite;
}
@keyframes typingPulse {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}
.chat-input-bar > * { margin: 0; }

.chat-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
}
.chat-input:focus { border-color: var(--leaf); }

.btn-send {
  width: auto !important;
  padding: 0.55rem 1rem;
  border-radius: 20px;
  border: none;
  background: var(--leaf);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  margin: 0 !important;
}
.btn-send:hover { filter: brightness(1.1); }
.btn-send:disabled { opacity: 0.5; cursor: default; }

.btn-mic {
  width: 38px !important;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  margin: 0 !important;
}
.btn-mic:hover { background: var(--bg); }
.btn-mic.listening {
  background: #c0392b;
  border-color: #c0392b;
  animation: micPulse 1s infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(192,57,43,0); }
}

/* ============================================================
   PHASE 8 — VOICE NOTES
   ============================================================ */

.voice-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-deep);
  padding: 0 1.25rem 6rem;
}

.voice-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 0.5rem;
  border-bottom: 1px solid var(--bg-light);
  margin-bottom: 1rem;
}
.voice-topbar h2 { margin: 0; font-size: 1.2rem; color: var(--jade-glow); }
.voice-topbar-spacer { width: 2.5rem; }

.voice-prompt {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  margin: 0.5rem 0 1.5rem;
  line-height: 1.5;
}

.voice-input-row {
  display: flex !important;
  gap: 0.75rem;
  margin: 1rem 0;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.voice-input-row > * { margin: 0; }

.voice-record-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem !important;
  background: var(--bg-light) !important;
  color: var(--text) !important;
  border: 1px solid var(--jade) !important;
  border-radius: 24px !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  cursor: pointer;
  width: auto !important;
  flex-shrink: 0;
  margin: 0 !important;
  transition: background 0.15s ease;
}
.voice-record-btn:hover:not(:disabled) { background: var(--bg-mid) !important; }
.voice-record-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.voice-record-dot {
  width: 12px;
  height: 12px;
  background: #c0392b;
  border-radius: 50%;
  flex-shrink: 0;
  animation: voicePulse 1.5s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

.voice-upload-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 1.4rem;
  background: var(--bg-light);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  margin: 0;
}
.voice-upload-label { display: inline-block; }
.voice-upload-btn:hover { background: var(--bg-mid); }

.voice-recording-area {
  text-align: center;
  padding: 1.5rem 0;
  background: var(--bg-mid);
  border-radius: 12px;
  margin: 1rem 0;
  border: 1px solid #c0392b;
}
.voice-timer {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--jade-glow);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}
.voice-recording-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}
.voice-stop-btn {
  background: #c0392b !important;
  color: #fff !important;
  border: none !important;
  padding: 0.6rem 1.4rem !important;
  border-radius: 20px !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  width: auto !important;
  margin: 0 !important;
}
.voice-stop-btn:hover { background: #a83328 !important; }

.voice-review-area {
  background: var(--bg-mid);
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid var(--border);
}
.voice-review-area audio {
  width: 100%;
  margin-bottom: 0.75rem;
}
.voice-review-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.voice-review-actions button {
  flex: 1;
  width: auto !important;
  margin: 0 !important;
}

.voice-status {
  text-align: center;
  padding: 0.5rem;
  margin: 0.5rem 0;
  border-radius: 8px;
  font-size: 0.9rem;
  min-height: 1.2rem;
}
.voice-info { color: var(--text-muted); }
.voice-success { color: var(--jade-glow); background: rgba(155, 196, 138, 0.1); }
.voice-error { color: var(--danger); background: rgba(196, 122, 122, 0.1); }

.voice-results {
  background: var(--bg-mid);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1rem 0;
  border: 1px solid var(--bg-light);
}
.voice-results h3 {
  color: var(--jade-glow);
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}
.voice-tone {
  display: inline-block;
  background: var(--bg-light);
  color: var(--amber-soft);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-style: italic;
  margin: 0.25rem 0 0.75rem;
}
.voice-summary {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--bg-light);
}
.voice-section { margin: 1rem 0; }
.voice-section h4 {
  color: var(--jade);
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.voice-transcript {
  background: var(--bg-light);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}
.voice-list {
  margin: 0;
  padding: 0 0 0 1.25rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
}
.voice-list li { margin: 0.2rem 0; }
.voice-list em { color: var(--amber); font-style: italic; font-size: 0.85rem; }
.voice-empty { color: var(--text-dim); font-size: 0.85rem; font-style: italic; }
.voice-people { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.voice-person {
  background: var(--bg-light);
  color: var(--text);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
}

.voice-recent { margin-top: 1.5rem; }
.voice-recent-header {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}
.voice-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 240px;
  overflow-y: auto;
}
.voice-recent-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-mid);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid var(--jade);
}
.voice-recent-item:hover { background: var(--bg-light); }
.voice-recent-when {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
}
.voice-recent-title {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.3;
}
.voice-recent-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ===== TIMELINE PANEL ===== */
.timeline-panel {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}
.timeline-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.timeline-topbar h2 { margin: 0; flex: 1; text-align: center; }
.btn-add-event {
  background: var(--jade);
  color: var(--bg-deep);
  white-space: nowrap;
}
.btn-add-event:hover { background: var(--jade-glow); }

.timeline-prompt {
  text-align: center;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  font-style: italic;
}

.timeline-add-form {
  background: var(--bg-mid);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--bg-light);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.timeline-add-form input,
.timeline-add-form textarea {
  margin-bottom: 0;
}
.timeline-add-form-row {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.timeline-add-status {
  font-size: 0.85rem;
  text-align: right;
  min-height: 1.2em;
}
.timeline-add-status.timeline-info { color: var(--text-muted); }
.timeline-add-status.timeline-error { color: var(--danger); }
.timeline-add-status.timeline-success { color: var(--jade-glow); }

.timeline-status {
  text-align: center;
  color: var(--text-muted);
  padding: 0.5rem;
  font-size: 0.9rem;
}
.timeline-status.timeline-error { color: var(--danger); }
.timeline-status.timeline-info { color: var(--text-muted); }

.timeline-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.timeline-empty-emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.timeline-empty h3 {
  color: var(--jade-glow);
  margin-bottom: 0.5rem;
}
.timeline-empty p {
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.5;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}

.timeline-year {
  position: relative;
}
.timeline-year-marker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  position: sticky;
  top: 0;
  background: var(--bg-deep);
  padding: 0.5rem 0;
  z-index: 2;
}
.timeline-year-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.5);
  flex-shrink: 0;
}
.timeline-year-label {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.02em;
}
.timeline-year-items {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--bg-light);
  margin-left: 6px;
  padding-top: 0.25rem;
}

.timeline-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--bg-mid);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  position: relative;
  margin-left: 1.5rem;
  border-left: 3px solid var(--jade);
  transition: background 0.15s ease, transform 0.15s ease;
}
.timeline-card:hover {
  background: var(--bg-light);
  transform: translateX(2px);
}
.timeline-card-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.timeline-card-body {
  flex: 1;
  min-width: 0;
}
.timeline-card-date {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.timeline-card-title {
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 0.2rem;
  word-wrap: break-word;
}
.timeline-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 0.25rem;
  word-wrap: break-word;
}

@media (max-width: 600px) {
  .timeline-year-label { font-size: 1.2rem; }
  .timeline-card { margin-left: 1rem; padding: 0.7rem 0.85rem; }
}

/* =====================================================
   SUPPORT + ONE NEXT STEP
   ===================================================== */

.panic-view {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  color: #fff;
}

.panic-close-row {
  margin-bottom: 1rem;
}

.panic-close-btn {
  background: rgba(205, 225, 214, .24);
  border: 1px solid rgba(255,255,255,.42);
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .54);
}
.panic-close-btn:hover {
  background: rgba(205, 225, 214, .34);
  color: #fff;
}

.panic-title {
  font-size: 2rem;
  color: #fff;
  margin: 0 0 0.4rem 0;
  font-weight: 750;
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .64);
}

.panic-subtitle {
  color: rgba(255,255,255,.9);
  margin: 0 0 2rem 0;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .58);
}

.panic-section {
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.panic-section h3 {
  color: #fff;
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 750;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .58);
}

.panic-section p {
  color: rgba(255,255,255,.88);
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
  line-height: 1.5;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .54);
}

.panic-breathing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem 0 0.5rem;
}

.breathing-circle-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.breathing-controls {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn-breathing-toggle,
.btn-breathing-reset {
  background: rgba(82, 115, 96, .82);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  padding: 0.5rem 1.4rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.1s;
}
.btn-breathing-toggle:hover,
.btn-breathing-reset:hover {
  background: rgba(98, 135, 113, .9);
}
.btn-breathing-toggle:active,
.btn-breathing-reset:active {
  transform: scale(0.97);
}

/* 5-4-3-2-1 Grounding */
.panic-grounding {
  margin-top: 0.5rem;
}

.btn-grounding-start,
.btn-grounding-again {
  background: rgba(82, 115, 96, .82);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  padding: 0.6rem 1.4rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}
.btn-grounding-start:hover,
.btn-grounding-again:hover {
  background: rgba(98, 135, 113, .9);
}

.grounding-step {
  animation: fadeIn 0.3s ease-out;
}

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

.grounding-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.grounding-icon {
  font-size: 1.6rem;
}

.grounding-header h4 {
  color: #fff;
  margin: 0;
  font-size: 1.1rem;
}

.grounding-prompt {
  color: rgba(255,255,255,.9);
  font-size: 1rem;
  margin: 0.5rem 0 1rem 0;
  line-height: 1.5;
}

.grounding-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.grounding-input {
  background: rgba(248,252,247,.88);
  border: 1px solid rgba(255,255,255,.52);
  color: #183126;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}
.grounding-input:focus {
  outline: none;
  border-color: #7ec8a0;
}

.btn-grounding-next {
  background: #b8d9bd;
  color: #183126;
  border: 1px solid rgba(255,255,255,.5);
  padding: 0.6rem 1.6rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-grounding-next:hover {
  background: #d2ead4;
}

.grounding-complete {
  text-align: center;
  padding: 1rem 0;
}
.grounding-complete-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.grounding-complete h4 {
  color: #fff;
  margin: 0 0 0.5rem 0;
}
.grounding-complete p {
  color: rgba(255,255,255,.9);
  margin: 0 0 1.2rem 0;
}

/* Audio buttons */
.panic-audio-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn-audio,
.btn-audio-stop {
  background: rgba(82, 115, 96, .82);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  padding: 0.55rem 1.1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.92rem;
  transition: background 0.2s, transform 0.1s;
}
.btn-audio:hover,
.btn-audio-stop:hover {
  background: rgba(98, 135, 113, .9);
}
.btn-audio:active,
.btn-audio-stop:active {
  transform: scale(0.97);
}
.btn-audio-stop {
  background: rgba(130, 76, 76, .9);
  border-color: rgba(255,210,210,.44);
}
.btn-audio-stop:hover {
  background: rgba(150, 88, 88, .94);
}

.btn-onenext {
  background: #b8d9bd;
  color: #183126;
  border: 1px solid rgba(255,255,255,.5);
  padding: 0.7rem 1.6rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.2s, transform 0.1s;
}
.btn-onenext:hover {
  background: #d2ead4;
}
.btn-onenext:active {
  transform: scale(0.97);
}

/* =====================================================
   ONE NEXT STEP VIEW
   ===================================================== */

.onenext-view {
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  color: #d4e4d4;
}

.onenext-back-row {
  margin-bottom: 1rem;
}

.onenext-back-btn {
  background: none;
  border: 1px solid #4a5a4e;
  color: #a8c8a8;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
.onenext-back-btn:hover {
  background: #2a3a2e;
  color: #d4e4d4;
}

.onenext-title {
  font-size: 2rem;
  color: #d4e4d4;
  margin: 0 0 0.4rem 0;
  font-weight: 300;
  letter-spacing: 0.5px;
}

.onenext-subtitle {
  color: #8aa88a;
  font-style: italic;
  margin: 0 0 1.5rem 0;
  line-height: 1.5;
}

.onenext-textarea {
  width: 100%;
  min-height: 180px;
  background: #0f1810;
  border: 1px solid #3a4a3e;
  color: #d4e4d4;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.onenext-textarea:focus {
  outline: none;
  border-color: #7ec8a0;
}

.btn-onenext-submit {
  background: #7ec8a0;
  color: #0f1810;
  border: none;
  padding: 0.7rem 1.6rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  margin-top: 1rem;
  transition: background 0.2s;
}
.btn-onenext-submit:hover {
  background: #9ed8b8;
}
.btn-onenext-submit:disabled {
  background: #4a5a4e;
  cursor: not-allowed;
}

.onenext-loading {
  text-align: center;
  padding: 3rem 0;
  color: #a8c8a8;
}

.onenext-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #3a4a3e;
  border-top-color: #7ec8a0;
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.onenext-result {
  animation: fadeIn 0.4s ease-out;
}

.onenext-validation {
  background: #1a2a1a;
  border-left: 3px solid #7ec8a0;
  padding: 1rem 1.2rem;
  border-radius: 6px;
  color: #b4d4b4;
  font-style: italic;
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.onenext-priority,
.onenext-action {
  background: #1a241a;
  border: 1px solid #3a4a3e;
  border-radius: 10px;
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.onenext-priority h4,
.onenext-action h4 {
  color: #a8c8a8;
  margin: 0 0 0.6rem 0;
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.onenext-priority-text,
.onenext-action-text {
  color: #d4e4d4;
  font-size: 1.1rem;
  line-height: 1.5;
}

.onenext-priority-text {
  font-weight: 500;
}

.onenext-action-text {
  font-style: italic;
}

.onenext-buttons {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.btn-onenext-again {
  background: #2a3a2e;
  color: #d4e4d4;
  border: 1px solid #4a5a4e;
  padding: 0.6rem 1.3rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-onenext-again:hover {
  background: #3a4a3e;
}

.btn-onenext-save {
  background: #4a5a4e;
  color: #fff;
  border: none;
  padding: 0.6rem 1.3rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-onenext-save:hover {
  background: #5a6a5e;
}
.btn-onenext-save:disabled {
  background: #3a4a3e;
  cursor: not-allowed;
}

/* ===== Phase 11: Pattern Map ===== */

.pattern-map {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
}

.pattern-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #2a3a2e;
}

.pattern-header h1 {
  font-size: 1.8rem;
  color: #c5d6b6;
  margin: 0;
}

.pattern-subtitle {
  color: #7a8a7e;
  margin: 0;
}

.pattern-section {
  background: #121a14;
  border: 1px solid #2a3a2e;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.pattern-section h2 {
  color: #a4b69a;
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

.pattern-section h3 {
  color: #7a8a7e;
  font-size: 1rem;
  font-weight: 400;
}

.pattern-empty {
  color: #4a5a4e;
  font-style: italic;
}

/* Keyword cloud */
.pattern-keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.pattern-keyword {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #1a2a1e;
  border: 1px solid #2a3a2e;
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
  color: #a4b69a;
  position: relative;
}

.pattern-keyword:hover {
  background: #2a3a2e;
}

.pattern-keyword.sm { font-size: 0.85rem; }
.pattern-keyword.md { font-size: 0.95rem; }
.pattern-keyword.lg { font-size: 1.1rem; }
.pattern-keyword.xl { font-size: 1.3rem; font-weight: 600; }

.kw-count {
  background: #2a3a2e;
  color: #7a8a7e;
  border-radius: 10px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Mood section */
.pattern-mood-summary {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mood-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mood-emoji {
  font-size: 2.5rem;
}

.mood-text strong {
  color: #c5d6b6;
  text-transform: capitalize;
}

.mood-text p {
  color: #7a8a7e;
  margin: 0.2rem 0 0;
}

.mood-timeline {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0;
}

.mood-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: default;
}

.mood-dot.mood-positive { background: #1a2e1a; border-color: #3a6a3a; }
.mood-dot.mood-neutral  { background: #1a1a2e; border-color: #3a3a6a; }
.mood-dot.mood-negative { background: #2e1a1a; border-color: #6a3a3a; }

/* Trigger cards */
.pattern-triggers {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.pattern-trigger-card {
  background: #1a2a1e;
  border: 1px solid #2a3a2e;
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.trigger-text {
  color: #c5d6b6;
  margin: 0 0 0.3rem;
}

.trigger-word {
  color: #8ab87a;
  font-weight: 600;
}

.trigger-meta {
  color: #5a6a5e;
  font-size: 0.85rem;
  margin: 0;
}

.pattern-source-link {
  color: #6a8a7e;
  text-decoration: underline;
  cursor: pointer;
}

.pattern-source-link:hover {
  color: #8ab87a;
}

/* Feedback buttons */
.pattern-feedback {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: 0.5rem;
}

.fb-btn {
  background: transparent;
  border: 1px solid #2a3a2e;
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.fb-btn:hover {
  background: #2a3a2e;
}

.fb-btn.active {
  background: #2a4a2e;
  border-color: #4a8a4a;
}

/* Entry popup */
.pattern-entry-popup {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  background: #0a120c;
  border: 1px solid #2a3a2e;
  border-radius: 8px;
  padding: 0.8rem;
  min-width: 250px;
  max-width: 350px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.popup-close {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: none;
  border: none;
  color: #7a8a7e;
  cursor: pointer;
  font-size: 1rem;
}

.popup-close:hover { color: #c5d6b6; }

.popup-entry-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.popup-entry-list li {
  padding: 0.5rem;
  border-bottom: 1px solid #1a2a1e;
  cursor: pointer;
  border-radius: 4px;
}

.popup-entry-list li:last-child { border-bottom: none; }

.popup-entry-list li:hover {
  background: #1a2a1e;
}

.popup-entry-list li strong {
  color: #a4b69a;
  display: block;
}

.popup-entry-list li p {
  color: #6a7a6e;
  font-size: 0.85rem;
  margin: 0.2rem 0 0;
}

.popup-entry-list li small {
  color: #4a5a4e;
  font-size: 0.75rem;
}

/* Feedback active state for keywords */
.pattern-keyword .fb-btn.active {
  background: #2a4a2e;
  border-color: #4a8a4a;
}

/* Loading state in popup */
.pattern-entry-popup .loading {
  color: #7a8a7e;
  padding: 1rem;
  text-align: center;
}

/* ============================================================
   PHASE 12 — SETTINGS PANEL
   ============================================================ */

.settings-panel {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  min-height: 100vh;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--bg-mid);
  margin-bottom: 1.5rem;
}
.settings-header h2 { margin: 0; font-size: 1.3rem; }

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-section {
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}
.settings-section h3 {
  color: var(--jade-glow);
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.settings-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.settings-row input { margin-bottom: 0; flex: 1; }

.settings-hint {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.settings-success { color: var(--jade-glow); font-size: 0.85rem; }
.settings-error { color: var(--danger); font-size: 0.85rem; }
#settings-name-msg, #settings-email-msg, #settings-password-msg,
#settings-export-msg, #settings-delete-msg {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* Settings danger zone */
.settings-danger { border-color: var(--danger); }
.settings-danger h3 { color: var(--danger); }

/* Toggle switches */
.settings-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  color: var(--text);
}
.settings-toggle-row + .settings-toggle-row {
  border-top: 1px solid var(--bg-light);
}

.settings-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
/* Visually hidden but still focusable and announced by screen readers. */
.settings-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.settings-toggle input:focus-visible + .toggle-slider {
  outline: 2px solid var(--jade-glow);
  outline-offset: 2px;
}
.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-light);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.25s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s;
}
.settings-toggle input:checked + .toggle-slider {
  background: var(--jade);
}
.settings-toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: var(--jade-glow);
}

/* Settings gear button in dashboard header */
.dash-settings-btn {
  width: auto;
  margin: 0;
  padding: 4px 10px;
  background: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.dash-settings-btn:hover {
  background: var(--bg-mid);
  color: var(--jade-glow);
}

/* ============================================================
   PHASE 12 — ENHANCED MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  /* Extend existing 600px breakpoint */
  .dash-cards { grid-template-columns: repeat(2, 1fr); }
  .memory-grid { grid-template-columns: 1fr; }
  .dashboard-layout { padding: 0.75rem 1rem 5rem; }
  .dash-greeting h1 { font-size: 1.5rem; }
  .modal { padding: 1.25rem; }

  /* Header compact */
  .dash-header { padding: 0.3rem 0 0.75rem; margin-bottom: 1rem; }
  .dash-logo { font-size: 1rem; }
  .dash-user { font-size: 0.8rem; }

  /* Bottom nav — tighter */
  .bottom-nav { padding: 0.4rem 0 0.6rem; }
  .bottom-nav a { font-size: 0.7rem; padding: 2px 4px; }

  /* Settings panel */
  .settings-panel { padding: 0.75rem 1rem 2rem; }
  .settings-section { padding: 1rem; }
  .settings-row { flex-direction: column; }
  .settings-row .btn-small { width: 100%; }

  /* Chat */
  .chat-panel { height: calc(100vh - 52px); }
  .chat-messages { padding: 0.75rem 1rem; }
  .chat-input-bar { padding: 0.5rem 0.75rem; }

  /* Panic */
  .panic-view { padding: 1rem; }
  .panic-section { padding: 1rem; }

  /* Keep (brain dump) */
  .keep-screen { padding: 0.75rem 1rem 2rem; }
  #keep-textarea { min-height: 35vh; font-size: 1rem; }

  /* Voice */
  .voice-panel { padding: 0.75rem 1rem 2rem; }

  /* Timeline */
  .timeline-item { flex-direction: column; gap: 0.25rem; }
  .tl-date { min-width: auto; }
}

@media (max-width: 400px) {
  /* Very small phones */
  .dash-cards { grid-template-columns: 1fr; }
  .bottom-nav { padding: 0.3rem 0 0.5rem; }
  .bottom-nav a { font-size: 0.65rem; }
  .modal { padding: 1rem; max-height: 95vh; }
  body { font-size: 16px; }
}

/* ============================================================
   TASKS PANEL
   ============================================================ */

.tasks-panel {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  min-height: 100vh;
}

.tasks-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--bg-mid);
  margin-bottom: 1.5rem;
}
.tasks-header h2 { margin: 0; font-size: 1.3rem; }

.tasks-empty {
  text-align: center;
  padding: 3rem 1rem;
}
.tasks-empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }

.tasks-count {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

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

.tasks-item {
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.tasks-item-done {
  background: var(--bg-light);
  border-color: var(--jade);
}

.tasks-title {
  flex: 1;
  min-width: 150px;
  cursor: pointer;
  padding: 2px 0;
}
.tasks-title:hover {
  color: var(--jade);
}

.tasks-cat {
  font-size: 0.75rem;
  background: var(--bg-light);
  color: var(--jade-glow);
  padding: 2px 8px;
  border-radius: 4px;
}

.tasks-due {
  font-size: 0.8rem;
  color: var(--amber);
}

.tasks-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  margin-left: auto;
}
.tasks-done-btn {
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  color: var(--jade);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.tasks-done-btn:hover {
  background: var(--jade);
  color: #fff;
}
.tasks-done-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.tasks-source-btn {
  background: transparent;
  border: 1px solid var(--bg-light);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.tasks-source-btn:hover {
  color: var(--jade);
  border-color: var(--jade);
}

/* ----- Family Tree (Phase 12.7) ----- */
.ft-group {
  margin-bottom: 2rem;
}
.ft-group-title {
  font-size: 1.1rem;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.ft-group-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}
.ft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}
.ft-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ft-card:hover {
  border-color: var(--jade);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.ft-card-linked {
  cursor: pointer;
}
.ft-card-expanded {
  border-color: var(--jade);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.ft-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ft-card-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ft-card-name {
  font-weight: 500;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ft-card-arrow {
  color: var(--text-muted);
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ft-card-expanded .ft-card-arrow {
  transform: rotate(180deg);
}
.ft-card-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding-left: 1.65rem;
}
.ft-entries {
  margin-top: 0.6rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}
.ft-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  cursor: pointer;
  border-radius: 0.35rem;
  transition: background 0.15s;
}
.ft-entry:hover {
  background: rgba(255,255,255,0.04);
}
.ft-entry-type {
  font-size: 0.9rem;
  flex-shrink: 0;
}
.ft-entry-title {
  font-size: 0.85rem;
  color: var(--jade);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.ft-entry-context {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: auto;
}
.ft-loading {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  text-align: center;
}
.ft-no-entries {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  text-align: center;
}


/* ── Reminders panel (Phase 13.1) ── */
.reminders-panel {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 5rem;
  color: #e8f0e8;
}
.reminders-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.reminders-header h2 {
  flex: 1;
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: #c8e6c9;
}
.reminders-hint {
  color: #9bb5a0;
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 1rem;
}
.reminders-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.reminders-notify-status {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(120, 180, 130, 0.25);
  border-radius: 8px;
  background: rgba(20, 40, 28, 0.5);
  padding: 0.65rem 0.75rem;
  font-size: 0.85rem;
  color: #b5d4bb;
}
.reminders-add-form {
  background: rgba(20, 40, 28, 0.75);
  border: 1px solid rgba(120, 180, 130, 0.25);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.reminders-add-form input,
.reminders-add-form textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(8, 18, 12, 0.7);
  border: 1px solid rgba(120, 180, 130, 0.3);
  border-radius: 8px;
  color: #e8f0e8;
  padding: 0.65rem 0.75rem;
  font: inherit;
}
.reminders-add-form input:focus,
.reminders-add-form textarea:focus {
  outline: none;
  border-color: #7cbc8a;
}
.reminder-when-row {
  display: grid;
  grid-template-columns: auto minmax(9rem, 1fr) auto minmax(7rem, 0.75fr);
  align-items: center;
  gap: 0.55rem;
}
.reminder-when-row label {
  color: #b5d4bb;
  font-size: 0.86rem;
  font-weight: 600;
}
.aime-time-picker {
  position: absolute;
  z-index: 10000;
  box-sizing: border-box;
  background: rgba(19, 38, 28, 0.97);
  border: 1px solid rgba(150, 210, 160, 0.38);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  padding: 0.9rem;
  color: #e8f0e8;
}
.aime-time-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.aime-time-display,
.aime-time-period {
  border: 1px solid rgba(150, 210, 160, 0.3);
  border-radius: 8px;
  background: rgba(8, 18, 12, 0.72);
  color: #dceee0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0.45rem 0.55rem;
}
.aime-time-display {
  min-width: 2.65rem;
  font-size: 1.25rem;
}
.aime-time-display.active,
.aime-time-period.active {
  background: rgba(124, 188, 138, 0.25);
  border-color: #7cbc8a;
  color: #ffffff;
}
.aime-time-clock {
  position: relative;
  width: min(14rem, 72vw);
  aspect-ratio: 1;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  background: rgba(8, 18, 12, 0.62);
  border: 1px solid rgba(150, 210, 160, 0.24);
}
.aime-time-hand {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 36%;
  background: #a5d6a7;
  border-radius: 999px;
  transform-origin: 50% 100%;
  pointer-events: none;
}
.aime-time-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.7rem;
  height: 0.7rem;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: #a5d6a7;
  pointer-events: none;
}
.aime-time-number {
  position: absolute;
  width: 2.2rem;
  height: 2.2rem;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #dceee0;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}
.aime-time-number:hover,
.aime-time-number.selected {
  background: rgba(124, 188, 138, 0.32);
  color: #ffffff;
}
.aime-time-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}
.reminders-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.reminders-count {
  font-size: 0.9rem;
  color: #8faa94;
  margin-bottom: 0.75rem;
}
.reminders-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.reminders-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(18, 36, 26, 0.85);
  border: 1px solid rgba(120, 180, 130, 0.22);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  transition: border-color 0.15s ease, opacity 0.2s ease;
}
.reminders-item:hover {
  border-color: rgba(140, 200, 150, 0.45);
}
.reminders-item-overdue {
  border-color: rgba(220, 120, 90, 0.55);
  background: rgba(40, 22, 18, 0.7);
}
.reminders-item-done {
  opacity: 0.45;
}
.reminders-main {
  flex: 1;
  min-width: 0;
}
.reminders-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  color: #dceee0;
  margin-bottom: 0.25rem;
}
.reminders-title-clickable {
  cursor: pointer;
}
.reminders-title-clickable:hover {
  color: #a5d6a7;
  text-decoration: underline;
}
.reminders-due {
  display: inline-block;
  font-size: 0.82rem;
  color: #b5d4bb;
  margin-bottom: 0.35rem;
}
.reminders-due-overdue {
  color: #ef9a7a;
  font-weight: 600;
}
.reminders-context {
  color: #a8c0ae;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  margin-top: 0.25rem;
}
.reminders-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
}
.reminders-actions button {
  background: rgba(30, 55, 40, 0.9);
  border: 1px solid rgba(120, 180, 130, 0.3);
  border-radius: 8px;
  color: #c8e6c9;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.reminders-actions button:hover {
  background: rgba(50, 90, 60, 0.95);
  border-color: #7cbc8a;
}
.reminders-done-btn:hover {
  color: #81c784;
}
.reminders-dismiss-btn:hover {
  color: #ef9a7a;
}
.reminders-empty {
  text-align: center;
  color: #8faa94;
  padding: 2.5rem 1rem;
  border: 1px dashed rgba(120, 180, 130, 0.25);
  border-radius: 12px;
}
.reminders-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 600px) {
  .reminders-panel {
    padding: 1rem 0.75rem 5.5rem;
  }
  .reminders-header h2 {
    font-size: 1.15rem;
  }
  .reminder-when-row {
    grid-template-columns: 1fr;
  }
  .bottom-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- Daily Check In (Phase 13.2) ---- */

.checkin-panel {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
  color: #f7fff9;
}

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

.checkin-header h2 { margin: 0; font-size: 1.25rem; }

.checkin-hint {
  color: rgba(247, 255, 249, 0.86);
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

.checkin-form {
  background: #f9fafb;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.checkin-field {
  margin-bottom: 1.25rem;
}

.checkin-field label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: #374151;
}

.checkin-emoji-row {
  display: flex;
  gap: 0.5rem;
}

.checkin-emoji-btn {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkin-emoji-btn:hover {
  border-color: #8b5cf6;
  transform: scale(1.08);
}

.checkin-emoji-selected {
  border-color: #7c3aed;
  background: #ede9fe;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
  transform: scale(1.12);
}

.checkin-field textarea,
.checkin-field input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
}

.checkin-field textarea { resize: vertical; }

.checkin-today-done {
  background: rgba(231, 240, 234, 0.94);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: #173329;
  box-shadow: 0 14px 34px rgba(12, 31, 23, 0.22);
}

.checkin-done-icon { font-size: 2rem; margin: 0 0 0.5rem; }

.checkin-today-done > p {
  color: #173329;
  font-weight: 700;
}

.checkin-today-summary {
  font-size: 1.5rem;
  margin: 0.5rem 0;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.checkin-today-note {
  color: #203b31;
  font-style: italic;
  margin: 0.75rem 0 0;
}

.checkin-today-nextstep {
  color: #2c5142;
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

.checkin-history {
  background: rgba(13, 31, 24, 0.66);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 12px;
  padding: 1rem;
  padding-top: 1rem;
  box-shadow: 0 14px 34px rgba(12, 31, 23, 0.16);
}

.checkin-history h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
  color: #f7fff9;
}

.checkin-history-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.24);
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.checkin-history-date {
  color: rgba(247, 255, 249, 0.78);
  min-width: 80px;
  font-size: 0.8rem;
}

.checkin-history-emojis {
  font-size: 1.15rem;
  min-width: 48px;
  text-align: center;
}

.checkin-history-note {
  color: #f7fff9;
  flex: 1;
  min-width: 120px;
}

.checkin-history-nextstep {
  color: rgba(247, 255, 249, 0.82);
  font-size: 0.8rem;
}

.dash-nudge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #ede9fe, #fae8ff);
  border: 1px solid #d8b4fe;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.75rem;
  max-width: 600px;
}

.dash-nudge-icon { font-size: 1.25rem; }

.dash-nudge-text {
  flex: 1;
  font-size: 0.9rem;
  color: #4c1d95;
  font-weight: 500;
}

.btn-dismiss {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #9ca3af;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.btn-dismiss:hover {
  color: #6b7280;
  background: rgba(0,0,0,0.05);
}

/* ---- Calm Space (Phase 13.3) ---- */

.calm-panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}

.calm-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.calm-header h2 {
  margin: 0;
  font-size: 1.25rem;
  flex: 1;
}

.calm-hint {
  color: #6b7280;
  font-size: 0.9rem;
  margin: 0 0 1rem;
  line-height: 1.4;
}

.calm-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
}

.calm-empty p {
  margin: 0 0 1rem;
  color: #374151;
}

.calm-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.calm-starters-small {
  justify-content: flex-start;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.calm-starters-label {
  width: 100%;
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.calm-starter-chip {
  border: 1px solid #86efac;
  background: #fff;
  color: #166534;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.calm-starter-chip:hover {
  background: #dcfce7;
}

.calm-list-index {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.calm-list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  border: 1px solid #d1fae5;
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-family: inherit;
}

.calm-list-card:hover {
  border-color: #6ee7b7;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
}

.calm-list-card-title {
  font-weight: 600;
  color: #065f46;
  font-size: 1rem;
}

.calm-list-card-count {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
}

.calm-detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.calm-detail-title {
  margin: 0;
  flex: 1;
  min-width: 140px;
  color: #064e3b;
  font-size: 1.15rem;
}

.calm-danger {
  color: #b91c1c !important;
}

.calm-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.calm-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}

.calm-item-text {
  flex: 1;
  color: #1f2937;
  line-height: 1.4;
}

.calm-item-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.calm-add-item {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.calm-add-item input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #111;
  background: #fff;
}

.calm-add-item button {
  width: auto;
  flex: 0 0 auto;
  margin-top: 0;
  padding: 0.65rem 1.1rem;
  white-space: nowrap;
}


/* ---- Bills & Subs tracker (Phase 13.5) ---- */
.subs-panel {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 5.5rem;
}
.subs-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.subs-header h2 {
  flex: 1;
  margin: 0;
  font-size: 1.35rem;
  color: #dceee0;
}
.subs-hint {
  color: #8faa94;
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 1rem;
}
.subs-form {
  background: rgba(18, 36, 26, 0.85);
  border: 1px solid rgba(120, 180, 130, 0.25);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.subs-form input,
.subs-form select,
.subs-form textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(10, 22, 16, 0.9);
  border: 1px solid rgba(120, 180, 130, 0.3);
  border-radius: 8px;
  color: #dceee0;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
}
.subs-form input:focus,
.subs-form select:focus,
.subs-form textarea:focus {
  outline: none;
  border-color: #7cbc8a;
}
.subs-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.subs-label {
  font-size: 0.82rem;
  color: #a8c0ae;
}
.subs-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.subs-form-actions button {
  width: auto;
}
.subs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.subs-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(18, 36, 26, 0.85);
  border: 1px solid rgba(120, 180, 130, 0.22);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}
.subs-item-overdue {
  border-color: rgba(220, 120, 90, 0.55);
  background: rgba(40, 22, 18, 0.7);
}
.subs-main {
  flex: 1;
  min-width: 0;
}
.subs-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  color: #dceee0;
  margin-bottom: 0.2rem;
}
.subs-meta {
  display: block;
  font-size: 0.88rem;
  color: #b5d4bb;
  margin-bottom: 0.25rem;
}
.subs-due {
  display: inline-block;
  font-size: 0.82rem;
  color: #b5d4bb;
}
.subs-due-overdue {
  color: #ef9a7a;
  font-weight: 600;
}
.subs-notes {
  color: #a8c0ae;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  margin: 0.35rem 0 0;
}
.subs-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
}
.subs-actions button {
  background: rgba(30, 55, 40, 0.9);
  border: 1px solid rgba(120, 180, 130, 0.3);
  border-radius: 8px;
  color: #c8e6c9;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.subs-actions button:hover {
  background: rgba(50, 90, 60, 0.95);
  border-color: #7cbc8a;
}
.subs-delete-btn:hover {
  color: #ef9a7a;
}
.subs-empty {
  text-align: center;
  color: #8faa94;
  padding: 2.5rem 1rem;
  border: 1px dashed rgba(120, 180, 130, 0.25);
  border-radius: 12px;
}
.subs-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 600px) {
  .subs-panel {
    padding: 1rem 0.75rem 5.5rem;
  }
  .subs-form-row {
    grid-template-columns: 1fr;
  }
}
/* --- Phase 13.7 Tutorial --- */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(8, 18, 12, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.25rem 6.5rem;
  box-sizing: border-box;
  overflow-y: auto;
}
.tutorial-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(165deg, #1a3324 0%, #122418 100%);
  border: 1px solid rgba(120, 180, 130, 0.35);
  border-radius: 16px;
  padding: 1.5rem 1.35rem 1.25rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  text-align: center;
  color: #dceee0;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
}
@media (max-width: 560px), (max-height: 700px) {
  .tutorial-overlay { align-items: flex-start; }
  .tutorial-card { margin-top: .5rem; }
}
.tutorial-progress {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8faa94;
  margin-bottom: 0.65rem;
}
.tutorial-icon {
  font-size: 2.25rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.tutorial-title {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
  color: #e8f5e9;
  font-weight: 600;
}
.tutorial-body {
  margin: 0 0 1.15rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: #b5d4bb;
  text-align: left;
}
.tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 1.15rem;
}
.tutorial-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(120, 180, 130, 0.25);
}
.tutorial-dot.active {
  background: #7cbc8a;
  transform: scale(1.15);
}
.tutorial-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: space-between;
}
.tutorial-btn {
  flex: 1;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}
.tutorial-btn-primary {
  background: #3d7a4a;
  color: #f0fff3;
  border-color: #5a9a68;
}
.tutorial-btn-primary:hover {
  background: #4a8f58;
}
.tutorial-btn-ghost {
  background: transparent;
  color: #a8c0ae;
  border-color: rgba(120, 180, 130, 0.3);
}
.tutorial-btn-ghost:hover {
  color: #dceee0;
  border-color: #7cbc8a;
}

/* ========== Phase 16: AI Skills ========== */
.skills-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.skills-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.skills-header h2 {
  margin: 0.25rem 0 0;
  font-size: 1.2rem;
}

.skills-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.skills-body {
  flex: 1;
  padding: 1rem 1.25rem 1.5rem;
  overflow-y: auto;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.skill-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  padding: 0.9rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.skill-card:hover {
  border-color: var(--leaf);
}

.skill-card-icon { font-size: 1.45rem; }
.skill-card-name { font-weight: 650; font-size: 0.95rem; }
.skill-card-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }

.skill-session {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 88px);
  min-height: 360px;
}

.skill-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.skill-session-badge {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(124, 188, 138, 0.15);
  border: 1px solid rgba(124, 188, 138, 0.35);
  font-size: 0.88rem;
  font-weight: 600;
}

.skill-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
}

.skill-input-bar {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: auto;
}

.skill-input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  padding: 0.55rem 0.8rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
}

.skill-input:focus { border-color: var(--leaf); }

/* Home chat emoji picker (Deep Forest Sanctuary glass popover) */
.home-chat-composer { position: relative; }
.chat-emoji-btn { font-size: 1.15rem; }
.emoji-picker {
  position: absolute; left: 0; bottom: calc(100% + .5rem); z-index: 30;
  width: min(21rem, 100%); box-sizing: border-box; padding: .5rem;
  background: linear-gradient(var(--glass-strong), var(--glass-strong)), var(--bg-deep);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px rgba(3, 9, 6, .45); color: var(--text);
}
.emoji-picker[hidden] { display: none; }
.emoji-picker-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem; margin-bottom: .45rem; }
.emoji-picker .emoji-picker-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  width: auto; min-width: 0; margin: 0; padding: .35rem .25rem; border-radius: 10px;
  background: transparent; border: 1px solid transparent; box-shadow: none;
  color: var(--text-muted); font: inherit; font-size: .78rem; cursor: pointer; white-space: nowrap; overflow: hidden;
}
.emoji-picker .emoji-picker-tab:hover { background: rgba(167, 215, 188, .12); color: var(--text); transform: none; }
.emoji-picker .emoji-picker-tab[aria-selected="true"] { background: rgba(167, 215, 188, .16); border-color: var(--glass-border); color: var(--amber-soft); }
.emoji-picker-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .15rem; }
.emoji-picker .emoji-picker-item {
  width: auto; min-width: 0; height: 2.3rem; margin: 0; padding: 0; border-radius: 10px;
  background: transparent; border: 1px solid transparent; box-shadow: none;
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.emoji-picker .emoji-picker-item:hover, .emoji-picker .emoji-picker-item:focus-visible { background: rgba(227, 184, 122, .18); border-color: rgba(227, 184, 122, .35); transform: none; }
@media (max-width: 520px) {
  /* Two icon buttons + Send: tighten so the textarea keeps room on phones. */
  .home-chat-composer { gap: .4rem; }
  .home-chat-composer .chat-attach-btn { width: 2.4rem !important; min-width: 2.4rem; }
  .home-chat-composer .home-chat-send { min-width: 64px; padding-inline: .7rem; }
}
@media (max-width: 420px) {
  .emoji-picker-tab-label { display: none; }
  .emoji-picker .emoji-picker-tab { font-size: 1.05rem; }
}

/* ===== HOME CHAT FILLS THE SCREEN =====
   The home layout is a full-height column above the fixed bottom nav
   (#app already reserves 5.75rem for it). The chat card takes the spare
   height and only the message log scrolls, so the page itself does not
   scroll (no double scrollbars). On very short screens min-height kicks in
   and the page scrolls normally instead. */
.dashboard-layout.dashboard-home {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 5.75rem);
  height: calc(100dvh - 5.75rem);
  min-height: 32rem;
  padding-bottom: 1rem;
  box-sizing: border-box;
}
.dashboard-home .dash-header { flex: 0 0 auto; }
.dashboard-home .home-chat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}
.dashboard-home .home-chat-heading,
.dashboard-home .home-chat-composer,
.dashboard-home .home-chat-note { flex: 0 0 auto; }
.dashboard-home .home-chat-messages {
  flex: 1 1 auto;
  min-height: 10rem;
  max-height: none;
  overscroll-behavior: contain;
}
@media (max-width: 760px) {
  .dashboard-layout.dashboard-home { padding-bottom: .5rem; min-height: 28rem; }
  .dashboard-home .home-chat-messages { min-height: 8rem; }
}

/* ---- Sanctuary dialogs (showConfirmDialog / showNoticeDialog / showPromptDialog in app.js) ----
   Appended to <body>, so body.dyslexia and body.colorblind-redgreen (Easy View)
   restyle them through the same variables and font as the rest of the app. */
.sanctuary-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 12, 9, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: sanctuary-dialog-fade 160ms ease-out;
}
.sanctuary-dialog {
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.4rem 1.4rem 1.2rem;
  border-radius: 20px;
  border: 1px solid var(--glass-border-strong, var(--glass-border, rgba(167, 215, 188, 0.42)));
  background: var(--glass-strong, rgba(16, 30, 23, 0.92));
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: inherit;
  animation: sanctuary-dialog-rise 180ms ease-out;
}
.sanctuary-dialog-danger { border-top: 3px solid var(--danger); }
.sanctuary-dialog-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text-strong, var(--text));
}
body.dyslexia .sanctuary-dialog-title { font-family: var(--dyslexia-font); }
.sanctuary-dialog-message {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sanctuary-dialog-input {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border, var(--border));
  background: rgba(8, 20, 15, 0.62);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  resize: vertical;
}
.sanctuary-dialog-input:focus { outline: none; border-color: var(--jade); box-shadow: 0 0 0 3px rgba(167, 215, 188, 0.22); }
.sanctuary-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.2rem;
}
.sanctuary-dialog-actions button {
  width: auto;
  min-width: 96px;
  min-height: 44px;
  margin: 0;
  padding: 0.6rem 1.1rem;
  border-radius: 12px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.sanctuary-dialog .sanctuary-dialog-confirm {
  background: var(--sage-btn, var(--jade));
  color: #10241a;
  border: 1px solid transparent;
}
.sanctuary-dialog .sanctuary-dialog-confirm:hover { background: var(--sage-btn-hover, var(--jade-glow)); }
.sanctuary-dialog .sanctuary-dialog-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--glass-border, var(--border));
}
.sanctuary-dialog .sanctuary-dialog-cancel:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.sanctuary-dialog-danger .sanctuary-dialog-confirm { background: var(--danger); color: #2a0f0f; }
.sanctuary-dialog-danger .sanctuary-dialog-confirm:hover { background: var(--danger); filter: brightness(1.08); }
.sanctuary-dialog button:focus-visible { outline: 3px solid var(--amber-soft); outline-offset: 2px; }
@keyframes sanctuary-dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sanctuary-dialog-rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .sanctuary-dialog-overlay, .sanctuary-dialog { animation: none; }
}
@media (max-width: 480px) {
  .sanctuary-dialog-actions button { flex: 1 1 0; }
}

/* Easy View (body.colorblind-redgreen): dialog card and buttons use the same
   navy-blue surfaces, cyan borders and yellow focus accents as Easy View's
   settings cards, instead of the default forest-green glass. */
body.colorblind-redgreen .sanctuary-dialog {
  background: rgba(9, 32, 48, 0.96);
  border-color: rgba(102, 217, 255, 0.55);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 241, 168, 0.12) inset;
}
body.colorblind-redgreen .sanctuary-dialog-title,
body.colorblind-redgreen .sanctuary-dialog-message { color: #fffaf0; }
body.colorblind-redgreen .sanctuary-dialog .sanctuary-dialog-confirm {
  background: #66d9ff;
  color: #071b2a;
  border: 2px solid rgba(255, 241, 168, 0.78);
}
body.colorblind-redgreen .sanctuary-dialog .sanctuary-dialog-confirm:hover { background: #bdefff; }
body.colorblind-redgreen .sanctuary-dialog .sanctuary-dialog-cancel {
  background: rgba(7, 27, 42, 0.7);
  color: #e7f6ff;
}
body.colorblind-redgreen .sanctuary-dialog .sanctuary-dialog-cancel:hover { background: rgba(102, 217, 255, 0.16); color: #fffaf0; }
body.colorblind-redgreen .sanctuary-dialog-danger { border-top-color: var(--danger); }
body.colorblind-redgreen .sanctuary-dialog-danger .sanctuary-dialog-confirm { background: var(--danger); color: #2a0f0f; }
body.colorblind-redgreen .sanctuary-dialog-danger .sanctuary-dialog-confirm:hover { background: var(--danger); filter: brightness(1.08); }
body.colorblind-redgreen .sanctuary-dialog button:focus-visible { outline-color: #fff1a8; }

/* Startup splash ("Your clean mirror."): showSplash() holds it for at least
   1.5s, then adds .splash-leaving to fade it out over 300ms before the
   login or dashboard view is rendered. */
.app-view.splash-leaving {
  opacity: 0;
  transform: none;
  transition: opacity 300ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .app-view.splash-leaving { transition: none; }
}

/* Cloudflare Turnstile on the signup form (empty, and so invisible, when the check is off) */
.turnstile-widget { display: flex; justify-content: center; margin: 8px 0; }
.turnstile-widget:empty { display: none; }
