/* MIRR mobile recovery shell */

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

:root {
  --app-max-width: 600px;
  --capture-padding-bottom: max(18px, env(safe-area-inset-bottom));
  --capture-reserve: 190px;
  --nav-reserve: 78px;
  --surface: #0a0a0a;
  --surface-soft: #121212;
  --surface-raised: #181818;
  --line: #1f1f1f;
  --text: #f5f5f5;
  --muted: rgba(255, 255, 255, 0.5);
  --faint: rgba(255, 255, 255, 0.3);
  --success: #a7d9b7;
  --warning: #fbc02d;
  --error: #ef9a9a;
  --accent: #fff;
}

html,
body {
  margin: 0;
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  touch-action: manipulation;
}

.today-page {
  --app-max-width: 920px;
}

img,
svg {
  max-width: 100%;
}

button,
summary,
input,
textarea {
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.12);
}

.app {
  position: relative;
  width: min(100%, var(--app-max-width));
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}

.page-body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

.page-app {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: visible;
}

.app-nav {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 260;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(100%, var(--app-max-width));
  min-width: 0;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.app-nav-area {
  height: 0;
}

.app-nav a {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: all 0.2s ease;
}

.app-nav a.nav-home {
  flex-grow: 1.5;
  color: #fff;
  background: #111;
  border-color: #222;
  font-weight: 800;
  font-size: 12px;
}

.app-nav a.nav-secondary {
  flex-grow: 0.8;
}

.app-nav a.nav-home.active,
.app-nav a.nav-home:hover {
  color: #000;
  background: #fff;
  border-color: #fff;
}

.app-nav a.nav-secondary.active,
.app-nav a.nav-secondary:hover {
  color: #fff;
  background: #1a1a1a;
  border-color: #333;
}

.page-content {
  min-width: 0;
  padding: 84px 14px 28px;
}

h1 {
  margin: 0 48px 18px 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.subtitle,
.section-heading {
  display: none;
}

.today-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 32px;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: var(--nav-reserve) 24px var(--capture-reserve);
}

.today-stream-area,
.today-context-panel-area {
  min-width: 0;
  min-height: 0;
}

.today-stream-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.today-stream-heading {
  flex: 0 0 auto;
  padding: 16px 4px 20px;
}

.today-kicker {
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.today-stream-heading h1,
.today-context-panel h2 {
  margin: 0;
}

.today-stream-heading h1 {
  font-size: 28px;
}

.today-context-panel-area {
  padding-top: 12px;
  overflow: hidden;
}

.today-context-panel {
  min-width: 0;
  padding: 20px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.today-context-panel .label {
  margin-top: 0;
}

.today-context-panel h2 {
  margin-bottom: 14px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
}

.context-panel-note {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.context-panel-actions {
  display: grid;
  gap: 10px;
}

.today-context-panel button {
  width: 100%;
}

#entries {
  flex: 1 1 auto;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 0;
  padding: 24px 16px var(--capture-reserve);
  scroll-behavior: auto;
  perspective: 1000px;
  perspective-origin: 50% 100%;
  -webkit-overflow-scrolling: touch;
}

.today-page #entries {
  height: auto;
  padding: 0 8px 24px 0;
}

.entry {
  min-width: 0;
  background: transparent;
  border: none;
  border-left: 2px solid var(--line);
  margin-bottom: 28px;
  padding-left: 20px;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.entry.is-gem {
  border-left: none;
  padding-left: 0;
  display: flex;
  justify-content: center;
  margin-bottom: 56px;
}

.entry-anchor {
  border-left-color: var(--warning);
}

.entry-text {
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  letter-spacing: -0.01em;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-top: 10px;
}

.entry-tags {
  display: inline-flex;
  flex: 1 1 160px;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.timestamp,
.category-meta {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.tag-pill {
  min-width: 0;
  max-width: 100%;
  background: var(--surface-soft);
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-transform: lowercase;
  transition: all 0.2s ease;
}

.tag-pill:hover {
  color: var(--muted);
  border-color: var(--muted);
}

.day-icon-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin: 20px auto;
  background: var(--surface);
  border: 1px solid #222;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.day-icon-block:hover {
  background: var(--surface-raised);
  border-color: #333;
}

.day-icon-emoji {
  font-size: 24px;
  margin-bottom: 2px;
}

.day-icon-label {
  font-size: 10px;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.capture-section {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  z-index: 240;
  width: min(100%, var(--app-max-width));
  margin: 0;
  padding: 10px 16px var(--capture-padding-bottom);
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.drawer-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  margin: 0 0 6px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.2s ease;
}

.drawer-handle:hover {
  opacity: 0.8;
}

.drawer-handle-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#input {
  display: block;
  width: 100%;
  min-height: 60px;
  max-height: min(30vh, 160px);
  max-height: min(30dvh, 160px);
  margin: 0 0 12px;
  padding: 16px 20px;
  resize: none;
  overflow-y: auto;
  outline: none;
  background: #0d0d0d;
  color: #fff;
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  font-size: 17px;
  line-height: 1.45;
  transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

#input:focus,
textarea:focus,
input:focus {
  border-color: #444;
  background: #111;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04), inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.capture-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 12px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  max-width: 100%;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.8);
  background: #151515;
  border: 1px solid #282828;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

button:hover {
  background: #1d1d1d;
  border-color: #333;
  color: #fff;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  cursor: wait;
  opacity: 0.4;
  transform: none;
}

button#saveEntryButton {
  color: #000;
  background: #fff;
  border-color: #fff;
}

button#saveEntryButton:hover {
  background: #f0f0f0;
  border-color: #f0f0f0;
}

button#refreshButton {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

button#refreshButton:hover {
  color: var(--text);
  background: #111;
  border-color: var(--muted);
}

#featureDrawer {
  position: fixed;
  top: 0;
  left: 50%;
  bottom: 0;
  z-index: 200;
  width: min(100%, var(--app-max-width));
  height: 100vh;
  height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  background: #050505;
  border-top: 1px solid #1a1a1a;
  transform: translate(-50%, 100%);
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  -webkit-overflow-scrolling: touch;
}

#featureDrawer.open {
  transform: translate(-50%, 0);
}

.context-drawer {
  --context-header-space: 0px;
}

.context-drawer-header {
  min-width: 0;
  margin-bottom: 24px;
  padding-right: 60px;
}

.context-drawer-header .label {
  margin-top: 0;
}

.context-drawer-header h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.context-drawer-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.context-drawer-mode {
  display: none;
  min-width: 0;
}

.context-drawer-mode.is-active {
  display: block;
}

.context-mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.context-mode-tab,
.context-mode-secondary-tab {
  min-height: 42px;
  padding: 10px 8px;
  color: rgba(255, 255, 255, 0.6);
  background: #111;
  border: 1px solid #282828;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.context-mode-tab.is-active-trigger,
.context-mode-secondary-tab.is-active-trigger {
  color: #fff;
  background: #1a1a1a;
  border-color: #555;
}

.context-mode-more-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 4px 0 16px;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.context-mode-more-label {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.context-mode-secondary-tab {
  flex: 0 1 auto;
  min-height: 34px;
  padding: 8px 14px;
  color: var(--muted);
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
}

.context-mode-secondary-tab:hover {
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 640px) {
  .context-mode-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .context-mode-more-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .context-mode-secondary-tab {
    flex: 1 1 80px;
  }
}

.context-mode-title {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.drawer-close-btn {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: max(18px, calc((100vw - var(--app-max-width)) / 2 + 18px));
  z-index: 270;
  width: auto;
  min-height: 40px;
  padding: 0 16px;
  color: var(--text);
  background: #181818;
  border: 1px solid #333;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  transition: all 0.2s ease;
}

.drawer-close-btn:hover {
  background: #222;
  border-color: #555;
}

[data-context-mode-trigger].is-active-trigger {
  border-color: rgba(255, 255, 255, 0.42);
}

.today-weekly-box {
  min-width: 0;
}

.today-weekly-section {
  min-width: 0;
  margin: 12px 0;
}

.today-weekly-counts {
  margin: 12px 0;
}

.today-weekly-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.today-weekly-snapshot-grid .category {
  margin-top: 0;
}

.today-page #featureDrawer {
  padding-top: max(78px, calc(env(safe-area-inset-top) + 78px));
}

.today-page .drawer-close-btn {
  top: max(70px, calc(env(safe-area-inset-top) + 70px));
}

.section {
  margin: 0;
}

.collapsible-section {
  margin-bottom: 14px;
  overflow: hidden;
  background: #101010;
  border: 1px solid #202020;
  border-radius: 8px;
}

.section-summary {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 14px 40px 14px 14px;
  cursor: pointer;
  touch-action: manipulation;
}

.section-summary::marker {
  content: "";
}

.section-summary::-webkit-details-marker {
  display: none;
}

.section-summary::after {
  position: absolute;
  top: 14px;
  right: 14px;
  color: rgba(255, 255, 255, 0.48);
  content: "+";
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.collapsible-section[open] > .section-summary::after {
  content: "-";
}

.section-title {
  flex: 0 0 auto;
  min-width: 0;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.section-description {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-align: right;
  overflow-wrap: anywhere;
}

.section-body {
  padding: 0 14px 14px;
}

.reflection-box {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid #232323;
  border-radius: 8px;
  line-height: 1.45;
}

.reflection-box.stale {
  border-color: rgba(255, 202, 40, 0.24);
}

.reflection-box.due {
  border-color: rgba(255, 202, 40, 0.46);
}

.reflection-summary {
  margin-bottom: 14px;
  font-size: 17px;
  line-height: 1.45;
}

.label {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.label:first-child {
  margin-top: 0;
}

textarea,
input {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0 0 10px;
  padding: 12px;
  color: #fff;
  background: #0c0c0c;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  font: inherit;
  line-height: 1.45;
  outline: none;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}

textarea {
  min-height: 88px;
  resize: vertical;
  scrollbar-color: #3a3a3a #111;
  scrollbar-width: thin;
}

textarea::-webkit-scrollbar {
  width: 10px;
}

textarea::-webkit-scrollbar-track {
  background: #111;
  border-radius: 999px;
}

textarea::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border: 2px solid #111;
  border-radius: 999px;
}

textarea::-webkit-resizer {
  background: transparent;
}

.direction-box textarea {
  margin-bottom: 12px;
}

.direction-textarea {
  min-height: 96px;
  resize: none;
  overflow-y: hidden;
  white-space: pre-wrap;
}

.direction-short-textarea {
  min-height: 68px;
}

.direction-card {
  min-width: 0;
  margin-top: 10px;
  padding: 10px 11px;
  background: #101010;
  border: 1px solid #242424;
  border-radius: 8px;
}

.direction-row {
  min-width: 0;
  padding: 7px 0;
}

.direction-row + .direction-row {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.direction-label {
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.direction-value {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.direction-list {
  margin: 0;
  padding-left: 17px;
}

.direction-list li {
  margin: 1px 0;
  padding-left: 1px;
}

.search-intro {
  margin-bottom: 12px;
}

.search-helper {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.45;
}

.search-controls,
.safety-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  margin-bottom: 14px;
}

.search-field {
  min-width: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.search-field span {
  display: block;
  margin-bottom: 6px;
}

.search-field input {
  margin: 0;
}

.date-range {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.search-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.secondary-button {
  color: rgba(255, 255, 255, 0.78);
  background: #111;
  border-color: #303030;
}

.context-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
  gap: 8px;
  margin-top: 12px;
}

.context-full-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.context-full-link:hover,
.context-full-link:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.today-reflection-box .reflection-summary {
  min-height: 84px;
}

.today-context-summary {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  color: rgba(255, 255, 255, 0.78);
  background: #111;
  border: 1px solid #2b2b2b;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.today-context-summary.empty {
  color: rgba(255, 255, 255, 0.52);
}

.search-controls button,
.safety-controls button,
#generateWeeklySummaryButton,
#searchButton,
#clearSearchButton {
  width: 100%;
}

.inline-field {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.inline-field input {
  width: 96px;
  margin: 0;
}

.freshness-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.freshness-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #171717;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
  white-space: normal;
}

.freshness-tag.fresh {
  color: var(--success);
  background: #132019;
}

.freshness-tag.stale {
  color: var(--warning);
  background: #2b2312;
}

.freshness-tag.due {
  color: #ffd86b;
  background: #33280f;
}

.freshness-tag.empty {
  color: rgba(255, 255, 255, 0.58);
  background: #191919;
}

.freshness-details {
  margin: -4px 0 12px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#runReviewButton.review-due {
  border-color: rgba(255, 202, 40, 0.5);
  box-shadow: 0 0 0 1px rgba(255, 202, 40, 0.12);
}

.alignment-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.reflection-box > .alignment-topline {
  flex-wrap: wrap;
}

.alignment-card,
.category,
.session-type,
.day-map-row,
.composition-row {
  min-width: 0;
  margin-bottom: 10px;
  padding: 12px;
  overflow-wrap: anywhere;
  background: #141414;
  border: 1px solid #282828;
  border-radius: 8px;
}

.alignment-score {
  font-size: 28px;
  font-weight: 800;
}

.alignment-overall,
.day-type-value {
  font-size: 18px;
  font-weight: 700;
  text-transform: capitalize;
}

.alignment-meter,
.composition-bar {
  height: 8px;
  overflow: hidden;
  background: #272727;
  border-radius: 999px;
}

.alignment-fill,
.composition-fill {
  height: 100%;
  background: #d7d7d7;
  border-radius: 999px;
}

.alignment-details,
.day-map-grid,
.trend-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.alignment-row {
  padding-top: 10px;
  border-top: 1px solid #272727;
}

.alignment-list {
  margin: 0;
  padding-left: 18px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  line-height: 1.45;
}

.day-type-kicker {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.day-map-label,
.session-type-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.day-map-value,
.session-type-reason,
.composition-reason {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.4;
}

.day-type-highlight {
  border-color: #3f3f3f;
}

.personal-day-type {
  background: #101010;
  border-color: #3b3b3b;
}

.composition-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 700;
}

.opportunity-card {
  margin: 16px 0;
  padding: 14px;
  overflow: hidden;
  background: #101210;
  border: 1px solid #2b312b;
  border-radius: 8px;
}

.opportunity-freshness-note {
  margin: -2px 0 12px;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 202, 40, 0.07);
  border: 1px solid rgba(255, 202, 40, 0.18);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.opportunity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
}

.opportunity-subtitle {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  line-height: 1.35;
}

.next-action-wrap {
  min-width: 0;
  max-width: 48ch;
  margin-bottom: 12px;
  padding: 12px;
  background: #171917;
  border: 1px solid #343a34;
  border-radius: 8px;
}

.next-action-text {
  margin-top: 5px;
  color: #f4f4f4;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.opportunity-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.state-pill {
  flex: 0 0 auto;
  max-width: 52%;
  padding: 5px 9px;
  color: rgba(255, 255, 255, 0.78);
  background: #202020;
  border: 1px solid #343434;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  white-space: normal;
}

.state-pill.state-focus {
  color: #cfe8d5;
  background: #152019;
  border-color: #2d4233;
}

.state-pill.state-drift {
  color: #ded5c5;
  background: #211f19;
  border-color: #423a2d;
}

.state-pill.state-recovery {
  color: #d9d4e8;
  background: #1e1c24;
  border-color: #393346;
}

.state-pill.state-unknown {
  color: rgba(255, 255, 255, 0.62);
  background: #1a1a1a;
  border-color: #303030;
}

.opportunity-meta-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 9px 10px;
  background: #141414;
  border: 1px solid #272727;
  border-radius: 8px;
}

.meta-label {
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-value {
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.deeper-meaning {
  margin-top: 12px;
  padding: 11px 12px;
  color: rgba(255, 255, 255, 0.72);
  background: #131313;
  border: 1px solid #292929;
  border-left: 2px solid #4a4a4a;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.quote-box {
  margin: 14px 0 18px;
  padding: 11px 12px;
  color: rgba(255, 255, 255, 0.68);
  background: #101010;
  border: 1px solid #252525;
  border-left: 2px solid #3a3a3a;
  border-radius: 8px;
}

.quote-text {
  margin-bottom: 7px;
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.quote-author {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.secondary-small-button {
  min-height: 40px;
  padding: 7px 11px;
  font-size: 12px;
  white-space: normal;
}

.open-loops-panel {
  min-width: 0;
  margin: 16px 0;
}

.open-loops-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 10px;
}

.open-loops-header .label {
  margin-top: 0;
}

.open-loops-description {
  max-width: 46ch;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.open-loop-group,
.open-loop-closed-details {
  min-width: 0;
  margin-top: 10px;
}

.open-loop-group-title,
.open-loop-closed-details summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.open-loop-closed-details summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
  touch-action: manipulation;
}

.open-loop-item {
  min-width: 0;
  margin-top: 8px;
  padding: 11px;
  background: #141414;
  border: 1px solid #282828;
  border-radius: 8px;
}

.open-loop-item.closed {
  background: #111;
  border-color: #242424;
}

.open-loop-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.open-loop-status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.open-loop-status {
  max-width: 100%;
  padding: 4px 8px;
  color: #ded5c5;
  background: #211f19;
  border: 1px solid #3a3327;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.open-loop-item.closed .open-loop-status {
  color: rgba(255, 255, 255, 0.58);
  background: #1b1b1b;
  border-color: #303030;
}

.open-loop-text {
  min-width: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.open-loop-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
  margin-top: 10px;
}

.open-loop-meta-row {
  min-width: 0;
  padding: 8px 9px;
  background: #101010;
  border: 1px solid #242424;
  border-radius: 8px;
}

.open-loop-meta-label {
  display: block;
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.open-loop-meta-value {
  display: block;
  color: rgba(255, 255, 255, 0.67);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.open-loop-empty {
  margin-top: 8px;
  padding: 11px;
  color: rgba(255, 255, 255, 0.48);
  background: #111;
  border: 1px solid #242424;
  border-radius: 8px;
  font-size: 13px;
  font-style: italic;
  line-height: 1.45;
}

.diagnostic-details {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #262626;
}

.diagnostic-details summary {
  min-width: 0;
  min-height: 44px;
  padding: 8px 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

.diagnostic-details[open] summary {
  margin-bottom: 10px;
}

.weekly-trend-details {
  min-width: 0;
}

.weekly-summary-helper {
  margin: 8px 0 10px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.weekly-summary-card {
  min-width: 0;
  margin: 12px 0 16px;
  padding: 12px;
  overflow-wrap: anywhere;
  background: #111311;
  border: 1px solid #2a322a;
  border-radius: 8px;
}

.weekly-summary-card.loading {
  color: rgba(255, 255, 255, 0.58);
  font-style: italic;
}

.weekly-summary-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin-bottom: 10px;
}

.weekly-summary-main {
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.weekly-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.weekly-summary-section {
  min-width: 0;
  padding: 10px;
  background: #141414;
  border: 1px solid #282828;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.weekly-summary-section .alignment-list {
  margin-top: 6px;
}

.weekly-trend-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.weekly-trend-block {
  min-width: 0;
  padding: 11px;
  background: #141414;
  border: 1px solid #282828;
  border-radius: 8px;
}

.weekly-trend-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.weekly-trend-badge {
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  color: rgba(255, 255, 255, 0.72);
  background: #1d1d1d;
  border: 1px solid #333;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.weekly-nested-details {
  margin-top: 12px;
  padding-top: 10px;
}

.weekly-trend-card {
  min-width: 0;
  margin-top: 8px;
  padding: 10px;
  background: #101010;
  border: 1px solid #242424;
  border-radius: 8px;
}

.weekly-trend-card.closed {
  background: #111;
  border-color: #303030;
}

.weekly-trend-card-title {
  min-width: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.weekly-loop-counts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}

.search-result-item {
  min-width: 0;
  margin-bottom: 10px;
  padding: 12px;
  overflow-wrap: anywhere;
  background: #141414;
  border: 1px solid #282828;
  border-radius: 8px;
  font-size: 14px;
}

#dataSafety,
#backupList,
#restoreInstructions {
  min-width: 0;
  overflow-wrap: anywhere;
}

.search-result-item:last-child {
  margin-bottom: 0;
}

.search-result-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.anchor-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  color: rgba(255, 255, 255, 0.68);
  background: #1d1d1d;
  border: 1px solid #333;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
}

.anchor-status.active {
  color: var(--warning);
  background: rgba(255, 202, 40, 0.08);
  border-color: rgba(255, 202, 40, 0.24);
}

.search-result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 10px;
}

.search-anchor-button {
  min-height: 44px;
  flex: 0 1 auto;
}

.search-anchor-button.active {
  color: var(--warning);
  border-color: rgba(255, 202, 40, 0.42);
}

.search-result-id {
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.search-results {
  min-width: 0;
  overflow-wrap: anywhere;
}

.item {
  margin-bottom: 8px;
}

.empty {
  color: rgba(255, 255, 255, 0.45);
  font-size: 14px;
  font-style: italic;
}

.hint {
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 8px;
}

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

.status-error {
  color: var(--error);
}

.status-info {
  color: rgba(255, 255, 255, 0.72);
}

strong {
  font-weight: 700;
}

@media (max-width: 480px) {
  :root {
    --capture-reserve: 188px;
    --nav-reserve: 104px;
  }

  .today-page {
    --app-max-width: 600px;
  }

  .today-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-left: 16px;
    padding-right: 16px;
  }

  .today-stream-heading {
    padding: 12px 0 16px;
  }

  .today-stream-heading h1 {
    font-size: 24px;
  }

  .today-context-panel-area {
    display: none;
  }

  #entries {
    padding-left: 14px;
    padding-right: 14px;
  }

  .today-page #entries {
    padding: 0 4px 20px 0;
  }

  .app-nav {
    padding: max(10px, env(safe-area-inset-top)) 10px 10px;
    gap: 6px;
  }

  .app-nav a {
    flex-basis: calc(33.333% - 6px);
    min-height: 32px;
    padding: 7px 4px;
    font-size: 11px;
  }

  .app-nav a.nav-home {
    font-size: 12px;
  }

  .page-content {
    padding-top: 104px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .entry-text {
    font-size: 16px;
  }

  #featureDrawer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .today-page #featureDrawer {
    padding-top: max(104px, calc(env(safe-area-inset-top) + 104px));
  }

  .today-page .drawer-close-btn {
    top: max(96px, calc(env(safe-area-inset-top) + 96px));
    right: 14px;
  }

  .capture-section {
    padding-left: 14px;
    padding-right: 14px;
    padding-top: 8px;
  }

  .drawer-handle {
    min-height: 40px;
    margin-bottom: 4px;
  }

  #input {
    min-height: 56px;
    margin-bottom: 10px;
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 16px;
  }

  .capture-buttons {
    gap: 10px;
  }

  .section-summary {
    display: block;
    min-height: 54px;
    padding-right: 40px;
  }

  .section-description {
    margin-top: 4px;
    text-align: left;
  }

  .search-controls,
  .safety-controls {
    grid-template-columns: 1fr;
  }

  .date-range {
    grid-template-columns: 1fr;
  }

  .search-actions {
    grid-template-columns: 1fr;
  }

  .opportunity-header {
    display: block;
  }

  .state-pill {
    display: inline-flex;
    max-width: 100%;
    margin-top: 10px;
  }

  .next-action-wrap {
    max-width: 100%;
  }

  .opportunity-meta {
    grid-template-columns: 1fr;
  }

  .open-loops-header {
    display: block;
  }

  .open-loops-header .secondary-small-button {
    width: 100%;
    margin-top: 10px;
  }

  .open-loop-item {
    display: block;
  }

  .open-loop-main {
    grid-template-columns: 1fr;
  }

  .open-loop-status-row {
    justify-content: flex-start;
  }

  .open-loop-status {
    display: inline-flex;
  }

  .open-loop-meta-grid {
    grid-template-columns: 1fr;
  }

  .weekly-loop-counts {
    grid-template-columns: 1fr;
  }

  .weekly-summary-grid {
    grid-template-columns: 1fr;
  }

  .weekly-trend-block {
    padding: 10px;
  }

  .weekly-trend-badge {
    white-space: normal;
  }

  .search-result-actions {
    align-items: flex-start;
  }

  .search-anchor-button {
    flex-basis: 100%;
  }
}

@media (max-width: 390px) {
  :root {
    --capture-reserve: 210px;
    --nav-reserve: 112px;
  }

  #entries {
    padding-left: 12px;
    padding-right: 12px;
  }

  .today-page #entries {
    padding: 0 4px 20px 0;
  }

  .today-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .page-content {
    padding: 112px 12px 24px;
  }

  .capture-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .capture-buttons button {
    min-height: 48px;
  }

  #featureDrawer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .today-page #featureDrawer {
    padding-top: max(112px, calc(env(safe-area-inset-top) + 112px));
  }

  .today-page .drawer-close-btn {
    top: max(104px, calc(env(safe-area-inset-top) + 104px));
  }

  .collapsible-section {
    margin-bottom: 10px;
  }

  .section-summary {
    padding: 12px 38px 12px 12px;
  }

  .section-summary::after {
    top: 12px;
    right: 12px;
  }

  .section-body {
    padding: 0 10px 10px;
  }

  .reflection-box {
    padding: 12px;
  }

  .reflection-box > button,
  .diagnostic-details button,
  .search-actions button,
  .safety-controls button,
  #generateWeeklySummaryButton,
  #composition7Button,
  #composition14Button,
  #composition30Button,
  #weekly7Button,
  #weekly14Button,
  #weekly30Button {
    width: 100%;
    min-height: 44px;
    margin-bottom: 8px;
  }

  .inline-field {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .inline-field input {
    width: 100%;
  }

  .alignment-topline,
  .composition-header,
  .search-result-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .freshness-row {
    justify-content: flex-start;
  }

  .opportunity-card,
  .weekly-summary-card,
  .weekly-summary-section,
  .weekly-trend-block,
  .weekly-trend-card,
  .search-result-item,
  .open-loop-item,
  .category {
    padding: 10px;
  }

  .next-action-text {
    font-size: 17px;
  }

  .weekly-trend-badge,
  .anchor-status,
  .tag-pill {
    white-space: normal;
  }
}
