/*
 * Stylesheet index
 * 1. Foundations and shell
 * 2. Habits, rewards, data, forms, and dialogs
 * 3. Journal
 * 4. Agenda
 * 5. Shared motion and supporting surfaces
 * 6. Health dashboard and nutrition
 * 7. Responsive layouts
 */

/* 1. Foundations and shell */
:root {
  color-scheme: light;
  --bg: #f4f2ee;
  --bg-accent: #ebe7df;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-muted: #f8f6f2;
  --text: #312f2d;
  --muted: #7d756c;
  --line: rgba(108, 99, 89, 0.18);
  --line-strong: rgba(108, 99, 89, 0.28);
  --accent: #6f8f7a;
  --accent-soft: #dfe9e1;
  --rose-accent: #c9849e;
  --rose-ink: #704d5b;
  --rose-surface: #fff4f8;
  --rose-surface-soft: #fff7fa;
  --danger-ink: #8e625c;
  --birthday-ink: #2d8f92;
  --blue-soft: #e0ebf5;
  --green-soft: #ebf2ec;
  --amber-soft: #f4ecdc;
  --shadow: 0 20px 50px rgba(69, 60, 52, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --scrollbar-track: rgba(250, 248, 244, 0.72);
  --scrollbar-thumb: rgba(201, 132, 158, 0.32);
  --scrollbar-thumb-hover: rgba(201, 132, 158, 0.48);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 32%),
    linear-gradient(180deg, #f7f5f1 0%, #f0ece6 100%);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(1720px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px 18px;
}

.topbar h1,
.view-heading h2,
.panel-heading h2,
.modal-header h2 {
  margin: 0;
  line-height: 1;
}

.topbar h1 {
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar-actions,
.period-controls,
.tabs,
.legend,
.button-row,
.chip-row,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-button,
.text-button,
.tab,
.status-button,
.tiny-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-weight: 800;
}

.text-button,
.tab,
.status-button {
  padding: 0 14px;
  font-weight: 700;
}

.tiny-button {
  min-height: 28px;
  min-width: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.icon-button.subtle,
.tiny-button.subtle {
  background: var(--surface-muted);
}

.text-button.primary,
.status-button.primary,
.tiny-button.primary {
  border-color: rgba(111, 143, 122, 0.45);
  background: var(--accent-soft);
  color: #45604d;
}

.text-button.danger,
.status-button.danger,
.tiny-button.danger {
  color: var(--danger-ink);
}

.icon-button:hover:not(:disabled),
.text-button:hover:not(:disabled),
.tab:hover,
.status-button:hover:not(:disabled),
.tiny-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.98);
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(69, 60, 52, 0.05);
}

.text-button.primary:hover:not(:disabled),
.status-button.primary:hover:not(:disabled),
.tiny-button.primary:hover:not(:disabled) {
  background: #d3e2d6;
}

.download-icon-button {
  font-size: 16px;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.82);
  box-shadow: inset 0 1px 2px rgba(69, 60, 52, 0.04), 0 8px 18px rgba(69, 60, 52, 0.05);
}

.segmented-control button {
  min-width: 88px;
  min-height: 30px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.segmented-control button.is-active {
  background: var(--surface-strong);
  color: var(--rose-ink);
  box-shadow: 0 8px 14px rgba(69, 60, 52, 0.08);
}

.segmented-control button:hover:not(.is-active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.52);
}

.habit-cadence-toggle {
  background: rgba(255, 247, 250, 0.88);
  border-color: rgba(239, 199, 213, 0.82);
}

.habit-cadence-toggle button {
  min-width: 82px;
}

.text-button:disabled,
.icon-button:disabled,
.status-button:disabled,
.tiny-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.tabs {
  margin: 0 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
}

.tab {
  flex: 0 0 auto;
}

.tab.is-active {
  border-color: rgba(111, 143, 122, 0.4);
  background: var(--surface-strong);
  box-shadow: 0 8px 16px rgba(69, 60, 52, 0.06);
}

.data-tab {
  margin-left: auto;
  min-width: 42px;
  padding-inline: 12px;
  color: var(--muted);
}

.data-tab.is-active {
  border-color: rgba(125, 117, 108, 0.3);
  background: #fffdf9;
  color: var(--text);
}

.agenda-tab,
.diary-tab {
  border-color: rgba(201, 132, 158, 0.24);
  background: rgba(250, 235, 242, 0.72);
  color: #7f5c68;
}

.health-tab {
  border-color: rgba(91, 170, 142, 0.34);
  background: transparent;
  color: #79b99e;
}

.agenda-tab:hover,
.agenda-tab.is-active,
.diary-tab:hover,
.diary-tab.is-active {
  border-color: rgba(201, 132, 158, 0.38);
  background: var(--rose-surface);
  color: var(--rose-ink);
}

.agenda-tab.is-active,
.diary-tab.is-active {
  box-shadow: 0 8px 16px rgba(111, 71, 88, 0.07);
}

.health-tab:hover,
.health-tab.is-active {
  border-color: rgba(91, 170, 142, 0.42);
  background: #ecfbf5;
  color: #35695b;
  box-shadow: 0 8px 16px rgba(60, 118, 101, 0.08);
}

.main-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.workspace,
.summary-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.workspace {
  overflow: hidden;
}

.view-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.view-heading h2 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.view-heading-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.legend {
  justify-content: flex-end;
  gap: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.legend-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border-radius: 7px;
  cursor: default;
  line-height: 1;
}

.legend-copy {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.legend-copy strong {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.legend-copy span {
  font-size: 10px;
  color: var(--muted);
}

#viewRoot {
  min-height: 360px;
}

#viewRoot:has(.health-view) {
  min-height: 0;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.claim-panel-actions {
  justify-content: flex-end;
}

.claim-panel-tools,
.claim-total-actions,
.claim-selection-actions,
.diary-gallery-actions,
.diary-gallery-selection-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.claim-panel-tools {
  padding-right: 2px;
}

.claim-panel-tools .icon-button {
  width: 30px;
  min-height: 30px;
  font-size: 13px;
}

.claim-total-actions {
  padding-left: 2px;
}

.claim-total-pill.is-selecting {
  border-color: rgba(111, 143, 122, 0.4);
  background: var(--accent-soft);
  color: #45604d;
}

.claim-selection-actions:empty {
  display: none;
}

.claims-panel,
.diary-gallery-panel,
.health-food-panel {
  overflow: hidden;
}

.pill,
.category-chip,
.mini-pill,
.fire-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill,
.category-chip {
  padding: 0 10px;
}

.mini-pill,
.fire-pill {
  padding: 0 8px;
  color: var(--muted);
}

.fire-pill {
  color: #8b6b48;
  background: #faf3e6;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.agenda-category-icon {
  display: inline-grid;
  place-items: center;
  min-width: 14px;
  color: rgb(var(--habit-rgb, 201, 132, 158));
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

/* 2. Habits, rewards, data, forms, and dialogs */
.tracker-scroll {
  width: 100%;
  overflow: auto;
  padding: 16px 22px 22px;
}

.tracker-scroll,
.agenda-panel-list,
.agenda-nearby-list,
.agenda-urgent-list,
.agenda-history-list,
.diary-readable-content,
.diary-day-activity-list {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.tracker-scroll::-webkit-scrollbar,
.agenda-panel-list::-webkit-scrollbar,
.agenda-nearby-list::-webkit-scrollbar,
.agenda-urgent-list::-webkit-scrollbar,
.agenda-history-list::-webkit-scrollbar,
.diary-readable-content::-webkit-scrollbar,
.diary-day-activity-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tracker-scroll::-webkit-scrollbar-track,
.agenda-panel-list::-webkit-scrollbar-track,
.agenda-nearby-list::-webkit-scrollbar-track,
.agenda-urgent-list::-webkit-scrollbar-track,
.agenda-history-list::-webkit-scrollbar-track,
.diary-readable-content::-webkit-scrollbar-track,
.diary-day-activity-list::-webkit-scrollbar-track {
  background: transparent;
}

.tracker-scroll::-webkit-scrollbar-thumb,
.agenda-panel-list::-webkit-scrollbar-thumb,
.agenda-nearby-list::-webkit-scrollbar-thumb,
.agenda-urgent-list::-webkit-scrollbar-thumb,
.agenda-history-list::-webkit-scrollbar-thumb,
.diary-readable-content::-webkit-scrollbar-thumb,
.diary-day-activity-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
  background-color: var(--scrollbar-thumb);
}

.tracker-scroll::-webkit-scrollbar-thumb:hover,
.agenda-panel-list::-webkit-scrollbar-thumb:hover,
.agenda-nearby-list::-webkit-scrollbar-thumb:hover,
.agenda-urgent-list::-webkit-scrollbar-thumb:hover,
.agenda-history-list::-webkit-scrollbar-thumb:hover,
.diary-readable-content::-webkit-scrollbar-thumb:hover,
.diary-day-activity-list::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

.matrix {
  --label-width: 500px;
  --cell-size: 28px;
  display: grid;
  grid-template-columns: var(--label-width) repeat(var(--cols), var(--cell-size));
  gap: 7px;
  width: max-content;
  min-width: 100%;
}

.matrix.weekly {
  --label-width: 380px;
  --cell-size: 84px;
  grid-template-columns: var(--label-width) repeat(var(--cols), var(--cell-size));
  width: max-content;
  min-width: 100%;
}

.matrix.monthly {
  --label-width: 380px;
  --cell-size: 58px;
  grid-template-columns: var(--label-width) repeat(var(--cols), var(--cell-size));
  width: max-content;
  min-width: 100%;
}

.matrix-header {
  display: grid;
  align-items: center;
  justify-items: center;
  min-height: 38px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.matrix-header .sub {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
}

.row-label {
  display: grid;
  grid-template-columns: minmax(min-content, 1fr) minmax(0, auto);
  align-items: center;
  gap: 14px;
  min-height: 38px;
  padding: 2px 8px 2px 0;
  border-bottom: 1px dotted rgba(108, 99, 89, 0.2);
}

.row-label .name {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.row-label .meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  justify-self: end;
  column-gap: 8px;
  max-width: 100%;
  min-width: 0;
  position: relative;
}

.row-label .meta-main {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  align-content: flex-start;
  row-gap: 8px;
  min-width: 0;
}

.row-label .category-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  max-width: 100%;
  padding: 4px 12px 4px 10px;
  box-sizing: border-box;
  border-color: rgba(var(--habit-rgb, 111, 143, 122), 0.18);
  background: rgba(var(--habit-pale, 248, 246, 242), 0.92);
  white-space: normal;
  line-height: 1.25;
}

.row-label .category-chip .dot {
  flex: 0 0 auto;
  align-self: center;
  margin-top: 0;
}

.row-label .category-chip-label {
  display: block;
  min-width: 0;
  padding-right: 4px;
  line-height: 1.35;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}

.row-label.is-hover-habit {
  padding-left: 10px;
  padding-right: 10px;
  border-bottom-color: transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 10px 22px rgba(69, 60, 52, 0.08),
    inset 0 0 0 1px rgba(108, 99, 89, 0.1);
}

.cell.is-hover-habit:not(.unavailable) {
  box-shadow:
    0 6px 14px rgba(69, 60, 52, 0.08),
    0 0 0 1px rgba(108, 99, 89, 0.16);
  transform: translateY(-2px);
}

.row-menu {
  position: relative;
  align-self: start;
}

.row-menu summary {
  list-style: none;
}

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

.row-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  letter-spacing: 0.08em;
  box-shadow: none;
}

.row-menu-trigger:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(108, 99, 89, 0.08);
  color: var(--text);
  box-shadow: none;
}

.row-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  display: grid;
  gap: 4px;
  min-width: 122px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 32px rgba(69, 60, 52, 0.12);
}

.row-menu-item {
  min-height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
  cursor: pointer;
}

.row-menu-item:hover {
  background: var(--surface-muted);
}

.row-menu-item:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.row-menu-item:disabled:hover {
  background: transparent;
}

.row-menu-item.danger {
  color: var(--danger-ink);
}

.notes-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.notes-table {
  width: 100%;
  border-collapse: collapse;
}

.notes-table th,
.notes-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

.notes-table th {
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 244, 0.88);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notes-table td {
  border-bottom: 1px solid rgba(108, 99, 89, 0.08);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.notes-table tbody tr:last-child td {
  border-bottom: 0;
}

.reorder-list {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.reorder-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  cursor: grab;
  box-shadow: 0 6px 16px rgba(69, 60, 52, 0.04);
}

.reorder-item:active {
  cursor: grabbing;
}

.reorder-item.is-dragging {
  opacity: 0.55;
}

.reorder-handle {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.reorder-copy {
  display: grid;
  gap: 4px;
}

.row-label.archived .name {
  color: var(--muted);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border: 1px solid rgba(108, 99, 89, 0.26);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.76);
  color: #5c645d;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
}

.cell:hover:not(:disabled) {
  border-color: rgba(var(--habit-rgb, 111, 143, 122), 0.55);
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px rgba(var(--habit-rgb, 111, 143, 122), 0.18);
}

.cell.today {
  box-shadow: inset 0 0 0 2px rgba(var(--habit-rgb, 111, 143, 122), 0.35);
}

.cell.done {
  border-color: rgba(var(--habit-rgb, 111, 143, 122), 0.5);
  background: rgba(var(--habit-soft, 223, 233, 225), 0.98);
  color: rgb(var(--habit-ink, 74, 96, 77));
}

.cell.late {
  border-color: rgba(125, 156, 189, 0.5);
  background: linear-gradient(180deg, rgba(var(--habit-pale, 245, 248, 246), 0.95), #edf4fa);
  color: #557192;
}

.cell.freeze {
  border-color: rgba(145, 168, 193, 0.48);
  background: #f3f8fc;
  color: #54708b;
}

.cell.covered {
  border-color: rgba(var(--habit-rgb, 111, 143, 122), 0.26);
  background: rgba(var(--habit-pale, 240, 245, 241), 0.58);
  box-shadow: inset 0 0 0 1px rgba(var(--habit-rgb, 111, 143, 122), 0.14);
}

.cell.partial {
  border-color: rgba(var(--habit-rgb, 111, 143, 122), 0.36);
  background: linear-gradient(180deg, rgba(var(--habit-pale, 245, 248, 246), 0.96), rgba(var(--habit-soft, 223, 233, 225), 0.82));
  color: rgb(var(--habit-ink, 74, 96, 77));
}

.cell.future {
  border-color: rgba(108, 99, 89, 0.12);
  background: rgba(255, 255, 255, 0.45);
}

.cell.unavailable {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.empty-state {
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  padding: 14px 10px;
  font-size: 12px;
}

.list-stack {
  display: grid;
  gap: 12px;
  padding: 16px 22px 22px;
}

.view-stack {
  display: grid;
  gap: 16px;
  padding: 16px 22px 22px;
}

.view-toolbar,
.section-toolbar,
.streak-strip,
.category-rules {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-toolbar {
  padding-bottom: 4px;
}

.inline-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.transfer-flow {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding: 0 4px 4px 0;
}

.transfer-quick-actions,
.transfer-option,
.transfer-file-card,
.transfer-summary-card,
.transfer-strategy {
  display: flex;
  align-items: center;
}

.transfer-quick-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.transfer-options {
  display: grid;
  gap: 9px;
}

.transfer-option,
.transfer-file-card,
.transfer-summary-card,
.transfer-strategy,
.transfer-warnings,
.transfer-safe-note,
.transfer-warning-note {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.transfer-option {
  min-width: 0;
  gap: 11px;
  padding: 11px 13px;
  cursor: pointer;
}

.transfer-option:hover {
  border-color: rgba(201, 132, 158, 0.34);
  background: rgba(255, 250, 252, 0.92);
}

.transfer-option input[type="checkbox"] {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  accent-color: var(--rose);
}

.transfer-option-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 2px;
}

.transfer-option-copy strong,
.transfer-file-card strong,
.transfer-summary-card strong,
.transfer-warnings strong {
  color: var(--text);
  font-size: 13px;
}

.transfer-option-copy small,
.transfer-file-card span,
.transfer-summary-card span,
.transfer-strategy span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.transfer-health-group {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(189, 238, 228, 0.74);
  border-radius: 20px;
  background: rgba(247, 252, 250, 0.76);
}

.transfer-health-group > .transfer-option {
  border-color: transparent;
  background: transparent;
}

.transfer-health-parts {
  display: grid;
  gap: 7px;
  padding: 0 4px 4px 28px;
}

.transfer-option.is-nested {
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.76);
}

.transfer-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.52;
}

.transfer-duplicate-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(236, 174, 126, 0.18);
  color: #9b633e;
  font-size: 10px;
  font-weight: 850;
}

.transfer-file-card,
.transfer-summary-card {
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
}

.transfer-file-card span,
.transfer-summary-card span {
  text-align: right;
}

.transfer-strategy {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(160px, 1fr);
  gap: 8px 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.transfer-strategy span {
  grid-column: 1 / -1;
  font-weight: 600;
}

.transfer-warnings,
.transfer-safe-note,
.transfer-warning-note {
  margin: 0;
  padding: 11px 13px;
  font-size: 11px;
  line-height: 1.45;
}

.transfer-warnings {
  border-color: rgba(236, 174, 126, 0.42);
  background: rgba(255, 248, 239, 0.86);
}

.transfer-warnings ul {
  margin: 7px 0 0;
  padding-left: 18px;
  color: #8c654a;
}

.transfer-safe-note {
  border-color: rgba(160, 211, 184, 0.48);
  background: rgba(245, 251, 247, 0.9);
  color: #568066;
}

.transfer-warning-note {
  color: #9b633e;
  background: rgba(255, 248, 239, 0.86);
}

.streak-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(247, 244, 239, 0.92));
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}

.streak-card strong,
.claim-item strong,
.manage-item strong,
.history-item strong,
.reward-line strong,
.reward-summary-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.list-grid {
  display: grid;
  gap: 8px;
}

.streak-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.streak-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px;
}

.streak-card strong {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tone-card {
  border-color: rgba(var(--habit-rgb, 111, 143, 122), 0.16);
  background: rgba(var(--habit-pale, 244, 248, 245), 0.86);
}

.tone-card::before,
.highlight-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 999px;
}

.tone-card::before {
  background: rgba(var(--habit-rgb, 111, 143, 122), 0.46);
}

.highlight-card {
  border-color: rgba(185, 162, 132, 0.16);
  background: rgba(249, 246, 239, 0.92);
}

.highlight-card::before {
  background: rgba(204, 173, 123, 0.44);
}

.list-grid.two-up,
.reward-info-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.claim-item,
.claim-notice,
.manage-item,
.history-item,
.reward-line,
.reward-summary-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  padding: 12px;
}

.streak-card {
  gap: 6px;
  border-radius: 16px;
  padding: 10px 12px;
  min-height: 0;
}

.streak-card .inline-note {
  font-size: 10px;
  line-height: 1.25;
  color: rgba(125, 117, 108, 0.92);
}

.claim-item.is-claimed {
  opacity: 0.62;
}

.claim-item.is-selected {
  border-color: rgba(111, 143, 122, 0.42);
  background: rgba(245, 250, 246, 0.95);
}

.claim-item.has-selection {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
}

.claim-item.has-selection .claim-select {
  grid-row: 1 / span 2;
}

.claim-item.has-selection .claim-actions {
  grid-column: 2;
}

.claim-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.claim-select {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.claim-select input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.claim-select span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.claim-select input:checked + span {
  border-color: rgba(111, 143, 122, 0.45);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.68);
}

.claim-notice {
  border-color: rgba(111, 143, 122, 0.34);
  background: linear-gradient(180deg, #f5faf6, #fffdf9);
}

.claim-meta,
.fine-print {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.claim-actions,
.manage-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-manage-head {
  display: grid;
  gap: 6px;
}

.category-color-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
}

.category-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  width: fit-content;
  padding: 0 9px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 999px;
  background: rgba(250, 248, 244, 0.9);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.category-edit-button {
  width: 28px;
  min-height: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.category-edit-button:hover:not(:disabled) {
  background: var(--surface);
}

.color-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  flex: 0 0 auto;
}

.category-color-form {
  display: grid;
  gap: 14px;
}

.category-color-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: var(--radius);
  background: rgba(250, 248, 244, 0.72);
}

.settings-grid,
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px 22px 22px;
}

.data-grid .history-section {
  display: grid;
  gap: 12px;
}

.settings-section.full,
.history-section.full {
  grid-column: 1 / -1;
}

.settings-section h3,
.history-section h3,
.subsection-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

.form-error {
  border: 1px solid rgba(142, 98, 92, 0.22);
  border-radius: 14px;
  background: #fff5f3;
  color: var(--danger-ink);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.form-block {
  display: grid;
  gap: 8px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  padding: 9px 12px;
}

.toolbar-select {
  width: auto;
  min-width: 170px;
  min-height: 38px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0 36px 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.custom-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.custom-select.is-toolbar {
  display: inline-block;
  width: auto;
  min-width: 170px;
}

.custom-select-trigger {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 7px 18px rgba(111, 71, 88, 0.04);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.custom-select.is-toolbar .custom-select-trigger {
  min-height: 38px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0 13px 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.custom-select-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid rgba(108, 99, 89, 0.45);
  border-bottom: 2px solid rgba(108, 99, 89, 0.45);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease;
}

.custom-select.is-open .custom-select-trigger {
  border-color: rgba(201, 132, 158, 0.32);
  background: rgba(255, 248, 251, 0.96);
  box-shadow: 0 10px 24px rgba(111, 71, 88, 0.08);
}

.custom-select.is-open .custom-select-trigger::after {
  transform: rotate(225deg) translate(-2px, -1px);
}

.custom-select-trigger:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-menu {
  position: absolute;
  z-index: 90;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  max-height: min(320px, 52vh);
  display: grid;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 38px rgba(111, 71, 88, 0.14);
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 99, 89, 0.24) transparent;
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-menu::-webkit-scrollbar {
  width: 8px;
  height: 0;
}

.custom-select-menu::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-menu::-webkit-scrollbar-thumb {
  border: 2px solid rgba(255, 255, 255, 0.98);
  border-radius: 999px;
  background-color: rgba(108, 99, 89, 0.24);
}

.custom-select-menu::-webkit-scrollbar-thumb:hover {
  background-color: rgba(108, 99, 89, 0.34);
}

.custom-select-option {
  width: 100%;
  max-width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.custom-select-option:hover {
  background: rgba(248, 240, 244, 0.72);
}

.custom-select-option.has-tone:hover {
  border-color: color-mix(in srgb, var(--custom-option-color, var(--rose-accent)) 28%, transparent);
  background: color-mix(in srgb, var(--custom-option-color, var(--rose-accent)) 14%, white);
}

.custom-select-option.is-selected {
  border-color: rgba(201, 132, 158, 0.26);
  background: rgba(255, 244, 248, 0.86);
  font-weight: 800;
}

.custom-select-option.has-tone.is-selected {
  border-color: color-mix(in srgb, var(--custom-option-color, var(--rose-accent)) 34%, transparent);
  background: color-mix(in srgb, var(--custom-option-color, var(--rose-accent)) 18%, white);
}

.custom-select-option:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.58;
}

.custom-select-plain,
.custom-select-option-content {
  min-width: 0;
}

.custom-select-option-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
}

.custom-select-option-content.is-compact {
  display: inline-grid;
  width: auto;
  max-width: 100%;
}

.custom-select-option-dot,
.custom-select-option-icon {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.custom-select-option-dot {
  background: var(--custom-option-color, #87919a);
}

.custom-select-option-icon {
  width: auto;
  height: auto;
  display: inline-grid;
  place-items: center;
  color: var(--custom-option-color, #87919a);
  font-size: 13px;
  line-height: 1;
}

.custom-select-option-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.custom-select-option-text strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.22;
  text-overflow: ellipsis;
}

.custom-select-option-text small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.24;
  text-overflow: ellipsis;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  padding: 0 12px;
  color: var(--text);
}

.checkbox-row input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: #7b9c84;
}

.checkbox-row.is-disabled {
  opacity: 0.6;
}

.dependency-builder {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.dependency-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.dependency-chip {
  max-width: 100%;
  padding-right: 6px;
}

.quick-note-option-chip {
  max-width: 100%;
  padding-right: 6px;
  background: #fffafc;
}

.quick-note-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(201, 132, 158, 0.14);
  border-radius: 16px;
  background: rgba(255, 250, 252, 0.58);
}

.quick-note-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-note-panel-head strong {
  font-size: 12px;
}

.quick-note-selected,
.quick-note-available {
  gap: 6px;
}

.quick-note-selected-chip {
  border-color: rgba(201, 132, 158, 0.22);
  background: var(--rose-surface);
}

.quick-note-choice {
  min-height: 30px;
  background: rgba(255, 255, 255, 0.82);
}

.settings-list,
.history-list,
.reward-editor {
  display: grid;
  gap: 10px;
}

.settings-list {
  margin-top: 18px;
}

.reward-summary-card {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(108, 99, 89, 0.16);
}

.reward-formula {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.reward-rule-grid {
  display: grid;
  gap: 12px;
}

.reward-rule-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 14px;
  background: rgba(250, 248, 244, 0.8);
}

.reward-rule-head {
  display: grid;
  gap: 3px;
}

.reward-rule-head strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.reward-insight-card {
  gap: 10px;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(69, 60, 52, 0.04);
}

.reward-insight-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.reward-insight-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.reward-insight-head strong {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.reward-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reward-amount-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 999px;
  background: #faf8f4;
  color: #5d554c;
  font-size: 12px;
  font-weight: 700;
}

.modal {
  width: min(620px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  color: var(--text);
}

.modal.wide-modal {
  width: min(980px, calc(100vw - 24px));
}

.modal.diary-entry-modal {
  width: min(1120px, calc(100vw - 24px));
}

.modal.diary-entry-modal .modal-card {
  display: flex;
  max-height: calc(100vh - 44px);
  flex-direction: column;
}

.modal.diary-entry-modal #modalBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(52, 45, 39, 0.2);
  backdrop-filter: blur(8px);
}

.modal-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 60px rgba(69, 60, 52, 0.14);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

#modalBody {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 700;
}

.date-chip button {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.monthly-notes {
  display: grid;
  gap: 8px;
}

.note-line {
  border-left: 3px solid rgba(111, 143, 122, 0.4);
  padding: 5px 0 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

/* 3. Journal */
.diary-layout {
  display: grid;
  gap: 18px;
  padding: 18px 22px 22px;
}

.diary-list-section {
  display: grid;
  gap: 14px;
}

.diary-form {
  display: grid;
  gap: 12px;
}

.diary-textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

.diary-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diary-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  cursor: pointer;
}

.diary-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.diary-toggle span {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 17px;
  line-height: 1;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.diary-toggle input:checked + span {
  border-color: rgba(111, 143, 122, 0.4);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(111, 143, 122, 0.12);
}

.diary-toggle:hover span {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.96);
  transform: translateY(-1px);
}

.diary-toggle input:focus-visible + span {
  outline: 2px solid rgba(111, 143, 122, 0.34);
  outline-offset: 2px;
}

.diary-list {
  display: grid;
  gap: 10px;
}

.diary-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-filter-trigger {
  width: 30px;
  min-height: 30px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.date-filter-trigger.is-active {
  border-color: rgba(201, 132, 158, 0.34);
  background: var(--rose-surface);
  color: var(--rose-ink);
}

.date-filter-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 220px;
  padding: 0 9px;
  border: 1px solid rgba(201, 132, 158, 0.14);
  border-radius: 999px;
  background: rgba(255, 244, 248, 0.64);
  color: #7d6f75;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-filter-label[hidden] {
  display: none;
}

/* 4. Agenda */
.agenda-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: stretch;
  gap: 16px;
  padding: 18px 22px 22px;
}

.agenda-calendar-card,
.agenda-side-panel {
  border: 1px solid rgba(108, 99, 89, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 14px 32px rgba(69, 60, 52, 0.05);
}

.agenda-calendar-card {
  overflow: hidden;
}

.agenda-calendar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(108, 99, 89, 0.12);
}

.agenda-calendar-head h3 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.agenda-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: rgba(126, 145, 160, 0.12);
}

.agenda-weekday,
.agenda-day {
  background: var(--surface-strong);
}

.agenda-weekday {
  min-height: 34px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.agenda-day {
  position: relative;
  min-height: 122px;
  padding: 8px;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.agenda-day.is-muted {
  background: #f8fafc;
}

.agenda-day.is-today {
  background: var(--rose-surface-soft);
  box-shadow: inset 0 0 0 2px rgba(201, 132, 158, 0.2);
}

.agenda-day-number {
  width: fit-content;
  min-width: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agenda-day.is-today .agenda-day-number {
  background: #ffe4ef;
  color: var(--rose-ink);
}

.agenda-day.is-range-hovered {
  background: rgba(201, 132, 158, 0.08);
  box-shadow: inset 0 0 0 1px rgba(201, 132, 158, 0.16);
}

.agenda-day.has-hidden-items:hover,
.agenda-day.has-hidden-items:focus-within {
  z-index: 6;
  background: var(--surface-strong);
  box-shadow: 0 18px 34px rgba(69, 60, 52, 0.12), inset 0 0 0 1px rgba(201, 132, 158, 0.14);
  transform: translateY(-1px);
}

.agenda-day-items {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.agenda-day.has-hidden-items .agenda-cal-item.is-extra {
  display: none;
}

.agenda-day.has-hidden-items:hover .agenda-cal-item.is-extra,
.agenda-day.has-hidden-items:focus-within .agenda-cal-item.is-extra {
  display: grid;
}

.agenda-cal-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid rgba(var(--habit-rgb, 201, 132, 158), 0.2);
  border-radius: 999px;
  background: rgba(var(--habit-pale, 255, 244, 248), 0.76);
  color: rgb(var(--habit-ink, 112, 77, 91));
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.agenda-cal-item.is-task-like {
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 6px;
  min-height: 20px;
  padding: 1px 3px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 750;
}

.agenda-cal-item.is-task-like::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgb(var(--habit-rgb, 86, 82, 76));
  box-shadow: 0 0 0 2px rgba(var(--habit-rgb, 86, 82, 76), 0.12);
}

.agenda-cal-item.has-icon:not(.is-task-like) {
  grid-template-columns: auto minmax(0, 1fr);
}

.agenda-cal-item.has-icon.is-task-like {
  grid-template-columns: 7px auto minmax(0, 1fr);
}

.agenda-cal-item.has-icon.is-task-like.is-done {
  grid-template-columns: auto minmax(0, 1fr);
}

.agenda-cal-item.is-task-like.is-done::before {
  display: none;
}

.agenda-cal-item:hover {
  background: rgba(var(--habit-pale, 248, 250, 252), 0.56);
}

.agenda-cal-item:not(.is-task-like):hover {
  background: rgba(var(--habit-pale, 255, 244, 248), 0.92);
}

.agenda-cal-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-cal-item.is-done {
  opacity: 0.52;
  text-decoration: line-through;
}

.agenda-cal-item.is-moved {
  border-color: rgba(var(--habit-rgb, 135, 145, 154), 0.2);
  background: rgba(var(--habit-pale, 248, 250, 252), 0.42);
  color: rgba(var(--habit-ink, 104, 104, 104), 0.82);
  opacity: 0.6;
}

.agenda-cal-item.is-moved:hover {
  background: rgba(var(--habit-pale, 248, 250, 252), 0.54);
  opacity: 0.76;
}

.agenda-cal-item.is-moved .agenda-cal-icon {
  color: rgba(var(--habit-rgb, 135, 145, 154), 0.82);
}

.agenda-cal-icon.is-image-icon,
.agenda-year-icon.is-image-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
}

.agenda-title-icon.is-image-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.agenda-cal-item.is-birthday {
  border-color: rgba(70, 169, 171, 0.55);
  background: transparent;
  color: var(--birthday-ink);
}

.agenda-cal-item.is-birthday:hover {
  background: rgba(70, 169, 171, 0.06);
}

.agenda-cal-item.is-special {
  border-color: rgba(var(--habit-rgb, 201, 132, 158), 0.42);
  background: transparent;
  color: rgb(var(--habit-rgb, 201, 132, 158));
}

.agenda-cal-item.is-special:hover {
  background: rgba(var(--habit-pale, 255, 244, 248), 0.38);
}

.agenda-cal-item.is-special.is-urgent {
  border-color: rgba(var(--habit-rgb, 201, 132, 158), 0.42);
  background: transparent;
  color: rgb(var(--habit-rgb, 201, 132, 158));
}

.agenda-cal-item.is-urgent {
  color: rgb(var(--habit-ink, 112, 77, 91));
}

.agenda-cal-item.is-birthday.is-urgent {
  color: var(--birthday-ink);
}

.agenda-cal-item.is-animated,
.agenda-urgent-card.is-animated {
  animation: agendaPulse 1.9s ease-in-out infinite;
}

.agenda-more {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding-left: 7px;
}

.agenda-day.has-hidden-items:hover .agenda-more,
.agenda-day.has-hidden-items:focus-within .agenda-more {
  display: none;
}

.agenda-year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.agenda-year-month {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 110px;
  padding: 14px;
  border: 1px solid rgba(108, 99, 89, 0.14);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
  text-align: left;
}

.agenda-year-month.is-current {
  border-color: rgba(201, 132, 158, 0.24);
  background: var(--rose-surface-soft);
  box-shadow: inset 0 0 0 2px rgba(201, 132, 158, 0.12), 0 10px 18px rgba(111, 71, 88, 0.05);
}

.agenda-year-month-head {
  display: grid;
  gap: 5px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.agenda-year-month-head strong {
  font-size: 19px;
  font-weight: 850;
  line-height: 1.1;
}

.agenda-year-month-head .month-short {
  display: none;
}

.agenda-year-month-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agenda-year-items {
  display: grid;
  gap: 6px;
  align-content: start;
}

.agenda-year-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid rgba(var(--habit-rgb, 201, 132, 158), 0.2);
  border-radius: 999px;
  background: rgba(var(--habit-pale, 255, 244, 248), 0.72);
  color: rgb(var(--habit-ink, 112, 77, 91));
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.agenda-year-item.is-task-like {
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 7px;
  min-height: 22px;
  padding: 1px 3px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.agenda-year-item.is-task-like::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgb(var(--habit-rgb, 86, 82, 76));
  box-shadow: 0 0 0 2px rgba(var(--habit-rgb, 86, 82, 76), 0.12);
}

.agenda-year-item.has-icon:not(.is-task-like) {
  grid-template-columns: auto minmax(0, 1fr);
}

.agenda-year-item.has-icon.is-task-like {
  grid-template-columns: 7px auto minmax(0, 1fr);
}

.agenda-year-item.has-icon.is-task-like.is-done {
  grid-template-columns: auto minmax(0, 1fr);
}

.agenda-year-item.is-task-like.is-done::before {
  display: none;
}

.agenda-year-item:hover {
  background: rgba(var(--habit-pale, 248, 250, 252), 0.56);
}

.agenda-year-item:not(.is-task-like):hover {
  background: rgba(var(--habit-pale, 255, 244, 248), 0.9);
}

.agenda-year-item.is-birthday {
  border-color: rgba(70, 169, 171, 0.55);
  background: transparent;
  color: var(--birthday-ink);
}

.agenda-year-item.is-birthday:hover {
  background: rgba(70, 169, 171, 0.06);
}

.agenda-year-item.is-special {
  border-color: rgba(var(--habit-rgb, 201, 132, 158), 0.42);
  background: transparent;
  color: rgb(var(--habit-rgb, 201, 132, 158));
}

.agenda-year-item.is-special:hover {
  background: rgba(var(--habit-pale, 255, 244, 248), 0.38);
}

.agenda-year-item.is-special.is-urgent {
  border-color: rgba(var(--habit-rgb, 201, 132, 158), 0.42);
  background: transparent;
  color: rgb(var(--habit-rgb, 201, 132, 158));
}

.agenda-year-item span:last-child {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.25;
}

.agenda-year-item.is-done {
  opacity: 0.58;
  text-decoration: line-through;
}

.agenda-sidebar {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: auto;
  min-height: min(760px, calc(100vh - 190px));
  overflow: visible;
  padding-right: 0;
}

.agenda-side-panel {
  position: relative;
  flex: 0 0 auto;
  min-height: 62px;
  min-width: 0;
  padding: 12px;
  overflow: hidden;
  z-index: 1;
}

.agenda-side-panel.has-open-select {
  overflow: visible;
  z-index: 30;
}

.agenda-side-panel.is-condensed {
  min-height: 56px;
  padding-block: 10px;
}

.agenda-urgent-panel {
  flex: 1 1 0;
  min-height: 156px;
  max-height: none;
  display: flex;
  flex-direction: column;
}

.agenda-panel-toggle,
.agenda-panel-title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
}

.agenda-panel-toggle {
  min-height: 38px;
  border-radius: 14px;
  background: rgba(255, 244, 248, 0.72);
  padding: 0 12px;
  cursor: pointer;
}

.agenda-side-panel.is-condensed .agenda-panel-toggle {
  min-height: 34px;
  background: rgba(255, 244, 248, 0.52);
}

.agenda-panel-toggle .mini-pill,
.agenda-panel-title .mini-pill {
  flex: 0 0 auto;
  margin-left: auto;
}

.agenda-panel-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  min-height: 0;
}

.agenda-side-panel.is-condensed .agenda-panel-list {
  max-height: 148px;
  overflow: auto;
  padding-right: 2px;
}

.agenda-all-panel.is-expanded .agenda-panel-list {
  max-height: min(28vh, 260px);
  overflow-y: auto;
  padding-right: 2px;
}

.agenda-unscheduled-panel.is-expanded .agenda-panel-list,
.agenda-nearby-panel.is-expanded .agenda-nearby-list {
  max-height: min(24vh, 220px);
  overflow-y: auto;
  padding-right: 2px;
}

.agenda-nearby-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.agenda-nearby-filter .toolbar-select,
.agenda-nearby-filter .custom-select.is-toolbar,
.agenda-nearby-filter input {
  width: 100%;
  min-height: 34px;
  border-radius: var(--radius-sm);
}

.agenda-nearby-card {
  border-color: rgba(var(--habit-rgb, 108, 99, 89), 0.16);
}

.agenda-urgent-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 2px;
}

.agenda-side-panel.is-condensed .agenda-urgent-list {
  flex: 0 0 auto;
  min-height: 84px;
  max-height: 148px;
}

.agenda-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.agenda-panel-actions .agenda-panel-filter,
.agenda-panel-actions .custom-select.is-panel-filter {
  flex: 1 1 auto;
  margin-top: 0;
}

.agenda-panel-actions .tiny-button {
  flex: 0 0 auto;
}

.agenda-panel-filter {
  width: 100%;
  margin-top: 10px;
  min-height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
}

.custom-select.is-panel-filter {
  width: 100%;
  margin-top: 10px;
}

.custom-select.is-panel-filter .custom-select-trigger,
.agenda-nearby-filter .custom-select.is-toolbar .custom-select-trigger {
  min-height: 34px;
  border-radius: var(--radius-sm);
}

.agenda-task-card,
.agenda-unscheduled-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(var(--habit-rgb, 108, 99, 89), 0.14);
  border-radius: 16px;
  background: rgba(var(--habit-pale, 255, 255, 255), 0.74);
}

.agenda-unscheduled-card {
  grid-template-columns: minmax(0, 1fr);
}

.agenda-task-card.has-inline-action {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.agenda-task-card.has-linked-pill,
.agenda-task-card.has-panel-pills {
  padding-bottom: 30px;
}

.agenda-task-card.is-done {
  opacity: 0.62;
}

.agenda-check {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(201, 132, 158, 0.32);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--rose-ink);
  font-weight: 900;
  cursor: pointer;
}

.agenda-check.is-locked {
  border-color: rgba(108, 99, 89, 0.12);
  background: rgba(250, 248, 244, 0.78);
  color: var(--muted);
  cursor: default;
}

.agenda-kind-badge {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.agenda-kind-icon.is-image-icon,
.agenda-link-icon.is-image-icon,
.agenda-panel-linked-icon.is-image-icon,
.agenda-mini-icon.is-image-icon {
  width: 17px;
  height: 17px;
  object-fit: contain;
}

.agenda-mini-icon {
  margin-right: 4px;
}

.agenda-task-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.agenda-task-main strong,
.agenda-task-main span,
.agenda-task-main em {
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-task-main span,
.agenda-task-main em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.agenda-panel-pill-row {
  position: absolute;
  right: 9px;
  bottom: 6px;
  left: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  pointer-events: none;
}

.agenda-panel-linked-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: min(210px, 100%);
  min-height: 20px;
  padding: 2px 8px;
  border: 1px solid rgba(201, 132, 158, 0.16);
  border-radius: 999px;
  background: rgba(255, 244, 248, 0.78);
  color: var(--rose-ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.agenda-panel-linked-pill.is-parent-task {
  border-color: rgba(108, 99, 89, 0.14);
  background: rgba(248, 250, 252, 0.82);
  color: #6f665d;
}

.agenda-panel-linked-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-urgent-card {
  border-color: rgba(var(--habit-rgb, 201, 132, 158), 0.24);
  background: rgba(var(--habit-pale, 255, 244, 248), 0.72);
}

.agenda-urgent-card.is-birthday {
  border-color: rgba(70, 169, 171, 0.42);
  background: transparent;
  color: var(--birthday-ink);
}

.agenda-urgent-card.is-birthday .agenda-kind-badge {
  border-color: rgba(70, 169, 171, 0.36);
  background: transparent;
  color: var(--birthday-ink);
}

.agenda-urgent-card.is-birthday .agenda-task-main span,
.agenda-urgent-card.is-birthday .agenda-task-main em {
  color: rgba(45, 143, 146, 0.78);
}

.agenda-urgent-card.is-special {
  border-color: rgba(var(--habit-rgb, 201, 132, 158), 0.34);
  background: transparent;
  color: rgb(var(--habit-rgb, 201, 132, 158));
}

.agenda-urgent-card.is-special .agenda-kind-badge {
  border-color: rgba(var(--habit-rgb, 201, 132, 158), 0.28);
  background: transparent;
  color: rgb(var(--habit-rgb, 201, 132, 158));
}

.agenda-urgent-card.is-special .agenda-task-main span,
.agenda-urgent-card.is-special .agenda-task-main em {
  color: rgba(var(--habit-rgb, 201, 132, 158), 0.76);
}

.agenda-form .agenda-repeat-block,
.agenda-detail-stack,
.agenda-postpone-box,
.agenda-postpone-history,
.agenda-urgency-form {
  display: grid;
  gap: 12px;
}

.agenda-time-field[hidden],
.agenda-category-field[hidden],
.agenda-icon-field[hidden],
.agenda-parent-field[hidden],
.agenda-repeat-block[hidden],
.agenda-repeat-fields[hidden],
.agenda-schedule-field[hidden] {
  display: none;
}

.agenda-schedule-button {
  width: 32px;
  padding: 0;
}

.agenda-schedule-button .calendar-glyph {
  width: 14px;
  height: 13px;
}

.agenda-link-field {
  display: grid;
  gap: 8px;
}

.agenda-link-field[hidden],
.agenda-icon-field[hidden],
.agenda-parent-field[hidden] {
  display: none;
}

.agenda-icon-field,
.agenda-parent-field {
  display: grid;
  gap: 8px;
}

.agenda-icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.agenda-icon-choice {
  position: relative;
  display: inline-flex;
}

.agenda-icon-choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.agenda-icon-choice span {
  min-width: 36px;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0 9px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font-size: 17px;
  font-weight: 850;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.agenda-icon-choice span img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.agenda-icon-choice:first-child span {
  min-width: 46px;
  color: var(--muted);
  font-size: 12px;
}

.agenda-icon-choice input:checked + span {
  border-color: rgba(201, 132, 158, 0.42);
  background: rgba(255, 244, 248, 0.9);
  box-shadow: 0 7px 18px rgba(111, 71, 88, 0.08);
}

.agenda-icon-choice span:hover {
  transform: translateY(-1px);
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agenda-link-options,
.agenda-linked-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agenda-link-picker {
  position: relative;
}

.agenda-link-picker-trigger {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid rgba(108, 99, 89, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 7px 18px rgba(111, 71, 88, 0.05);
  cursor: pointer;
  list-style: none;
}

.agenda-link-picker-trigger::-webkit-details-marker {
  display: none;
}

.agenda-link-picker-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid rgba(108, 99, 89, 0.48);
  border-bottom: 2px solid rgba(108, 99, 89, 0.48);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease;
}

.agenda-link-picker[open] .agenda-link-picker-trigger {
  border-color: rgba(201, 132, 158, 0.32);
  background: rgba(255, 248, 251, 0.96);
}

.agenda-link-picker[open] .agenda-link-picker-trigger::after {
  transform: rotate(225deg) translate(-2px, -1px);
}

.agenda-link-picker-current {
  min-width: 0;
}

.agenda-link-picker-current,
.agenda-link-picker-current .agenda-link-option-main {
  display: flex;
  align-items: center;
  flex: 1;
}

.agenda-link-picker-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  max-height: min(320px, 52vh);
  display: grid;
  gap: 6px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 38px rgba(111, 71, 88, 0.14);
}

.agenda-link-picker-option {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.agenda-link-picker-option:hover {
  background: rgba(248, 240, 244, 0.72);
}

.agenda-link-picker-option.is-selected {
  border-color: rgba(201, 132, 158, 0.26);
  background: rgba(255, 244, 248, 0.86);
}

.agenda-link-picker-option .agenda-link-option-main {
  width: 100%;
}

.agenda-link-empty-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.agenda-link-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  cursor: pointer;
}

.agenda-link-option input {
  accent-color: var(--rose-accent);
}

.agenda-link-option-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.agenda-link-option-main strong,
.agenda-link-option-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-link-option-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.agenda-linked-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.agenda-related-pill {
  width: fit-content;
  max-width: 100%;
  cursor: pointer;
}

.agenda-subtask-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.agenda-subtask-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agenda-subtask-list {
  display: grid;
  gap: 7px;
}

.agenda-subtask-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.agenda-subtask-row span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.agenda-subtask-row strong,
.agenda-subtask-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-subtask-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agenda-subtask-row.is-done {
  opacity: 0.65;
}

.agenda-history-modal {
  display: grid;
  gap: 12px;
}

.agenda-history-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agenda-history-toolbar .agenda-panel-filter {
  flex: 1 1 auto;
  margin-top: 0;
}

.agenda-history-list {
  display: grid;
  gap: 8px;
  max-height: min(58vh, 520px);
  overflow-y: auto;
  padding-right: 2px;
}

.agenda-history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.agenda-history-check {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(92, 157, 118, 0.22);
  border-radius: 10px;
  background: rgba(224, 243, 232, 0.82);
  color: #2f7d52;
  font-weight: 900;
}

.agenda-history-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.agenda-history-main strong,
.agenda-history-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-history-main small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.agenda-back-link {
  justify-self: start;
  width: fit-content;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.agenda-back-link:hover {
  color: var(--text);
  border-color: rgba(201, 132, 158, 0.28);
  background: rgba(255, 244, 248, 0.74);
}

.agenda-repeat-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.agenda-detail-note,
.agenda-postpone-history {
  margin: 0;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: 16px;
  background: rgba(250, 248, 244, 0.72);
  padding: 12px;
  color: var(--text);
  white-space: pre-wrap;
}

.agenda-postpone-history span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.agenda-urgency-card {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(4, minmax(110px, 0.7fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
}

.agenda-urgency-card strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* 5. Shared motion and supporting surfaces */
@keyframes agendaPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(201, 132, 158, 0); }
  50% { box-shadow: 0 0 0 4px rgba(201, 132, 158, 0.14); }
}

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

@keyframes healthRingEnter {
  from {
    opacity: 0;
    transform: scale(0.86) rotate(-12deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes healthFillBar {
  from { width: 0; }
}

@keyframes healthWaterRise {
  from { height: 0; }
}

@keyframes healthWaterWave {
  0%, 100% { transform: translateX(-4%) rotate(1deg); }
  50% { transform: translateX(4%) rotate(-1deg); }
}

.calendar-glyph {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 14px;
  border: 1.6px solid currentColor;
  border-radius: 4px;
}

.calendar-glyph::before {
  content: "";
  position: absolute;
  left: -1.6px;
  right: -1.6px;
  top: 3px;
  border-top: 1.6px solid currentColor;
}

.calendar-glyph::after {
  content: "";
  position: absolute;
  inset: -3px 3px auto;
  height: 4px;
  border-left: 1.6px solid currentColor;
  border-right: 1.6px solid currentColor;
}

.date-range-modal {
  display: grid;
  gap: 14px;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: var(--radius);
  background: rgba(250, 248, 244, 0.68);
}

.date-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.diary-gallery-panel-body {
  padding: 16px 22px 22px;
}

.diary-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 12px;
}

.diary-gallery-tile {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  text-align: center;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.diary-gallery-tile.is-selected {
  border-color: rgba(201, 132, 158, 0.36);
  background: var(--rose-surface-soft);
  box-shadow: inset 0 0 0 1px rgba(201, 132, 158, 0.14);
}

.diary-gallery-tile:hover {
  border-color: rgba(201, 132, 158, 0.34);
  background: rgba(255, 250, 252, 0.98);
  box-shadow: 0 12px 24px rgba(111, 71, 88, 0.07);
  transform: translateY(-1px);
}

.diary-gallery-open {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: center;
}

.diary-gallery-photo {
  position: relative;
  display: block;
}

.diary-gallery-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: 15px;
  object-fit: cover;
  background: var(--surface-muted);
}

.diary-gallery-date {
  position: absolute;
  left: 50%;
  bottom: -13px;
  transform: translateX(-50%);
  max-width: calc(100% - 12px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(69, 60, 52, 0.1);
  z-index: 1;
}

.diary-gallery-title {
  display: block;
  min-height: 20px;
  padding: 14px 4px 1px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.gallery-select-mark {
  position: absolute;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(108, 99, 89, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(69, 60, 52, 0.1);
}

.gallery-select-mark {
  top: 8px;
  left: 8px;
  font-size: 13px;
  font-weight: 900;
}

.diary-entry {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  padding: 12px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.diary-entry:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 24px rgba(69, 60, 52, 0.06);
  transform: translateY(-1px);
}

.diary-day {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eaf2fb;
  color: #5c7897;
  font-size: 12px;
  font-weight: 800;
}

.diary-day.is-saturday,
.diary-day.is-sunday {
  background: #f7e8ef;
  color: #95677a;
}

.diary-entry-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.diary-entry-main strong {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 800;
}

.diary-entry-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.diary-entry-summary {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diary-entry-badges,
.diary-modal-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.diary-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.diary-modal-stack {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.diary-modal-stack.has-day-activity {
  grid-template-columns: 1fr;
}

.diary-entry-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.diary-modal-stack.has-day-activity .diary-entry-content-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr);
  align-items: stretch;
}

.diary-entry-main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  align-content: start;
}

.modal.diary-entry-modal .diary-entry-content-grid {
  max-height: calc(100vh - 258px);
}

.modal.diary-entry-modal .diary-entry-main-column {
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.diary-entry-actions {
  margin-top: 2px;
}

.diary-gallery-view {
  display: grid;
  gap: 14px;
}

.diary-gallery-stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #faf8f4;
  min-height: min(62vh, 620px);
}

.diary-gallery-stage img {
  width: 100%;
  max-height: min(72vh, 680px);
  object-fit: contain;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(108, 99, 89, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
  transform: translateY(-50%);
  box-shadow: 0 12px 24px rgba(69, 60, 52, 0.1);
}

.gallery-nav:hover:not(:disabled) {
  background: var(--rose-surface);
  border-color: rgba(201, 132, 158, 0.3);
}

.gallery-nav:disabled {
  cursor: default;
  opacity: 0.35;
}

.gallery-nav-prev {
  left: 14px;
}

.gallery-nav-next {
  right: 14px;
}

.diary-gallery-caption {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.diary-gallery-caption > div:first-child {
  display: grid;
  gap: 6px;
}

.diary-gallery-caption strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.diary-modal-meta {
  justify-content: flex-start;
}

.diary-summary {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.diary-readable {
  display: grid;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 0 12px 14px;
  line-height: 1.65;
  overflow: hidden;
}

.modal.diary-entry-modal .diary-readable {
  min-height: 180px;
  max-height: 100%;
}

.diary-readable-content {
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  padding: 2px 16px 2px 0;
  white-space: pre-wrap;
}

.diary-day-activity {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  align-self: start;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.diary-day-activity-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.diary-day-activity-head strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.diary-day-activity-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.diary-day-activity-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(var(--habit-rgb, 201, 132, 158), 0.14);
  border-radius: 14px;
  background: rgba(var(--habit-pale, 255, 244, 248), 0.48);
}

.diary-day-activity-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--habit-rgb, 201, 132, 158), 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: rgb(var(--habit-ink, 112, 77, 91));
  font-size: 13px;
  font-weight: 900;
}

.diary-day-activity-image-icon.is-image-icon {
  width: 17px;
  height: 17px;
  object-fit: contain;
}

.diary-day-activity-item strong,
.diary-day-activity-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diary-day-activity-item strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.diary-day-activity-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.diary-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.diary-pasted-preview:empty {
  display: none;
}

.diary-pasted-preview {
  display: grid;
  gap: 8px;
}

.diary-paste-note {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.diary-pasted-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.diary-pasted-item {
  position: relative;
  display: inline-flex;
}

.diary-pasted-item img {
  width: 74px;
  height: 74px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  object-fit: cover;
}

.diary-pasted-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--danger-ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 6px 12px rgba(69, 60, 52, 0.08);
}

.diary-pasted-remove:hover {
  background: #fff5f3;
  border-color: rgba(142, 98, 92, 0.26);
}

.diary-image-card {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  padding: 8px;
}

.diary-image-card img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.diary-image-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.diary-remove-image {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: var(--danger-ink);
}

/* 6. Health dashboard and nutrition */
.health-view,
.health-food-panel {
  --health-mint: #e9f8f1;
  --health-blue: #eaf5fb;
  --health-lavender: #f1edfb;
  --health-pink: #fff0f6;
  --health-ink: #2f4d45;
  --health-sky: #b8dcf7;
  --health-sea: #bdeee4;
  --health-sun: #ffe7a8;
  --health-rose: #f7b7cf;
  --health-violet: #d8c1f2;
  --health-calorie-ink: #5c9d91;
}

.health-view {
  display: grid;
  gap: 16px;
  padding: 18px 22px 22px;
  background: linear-gradient(135deg, rgba(233, 248, 241, 0.72), rgba(255, 240, 246, 0.48));
}

.health-hero,
.health-panel,
.health-stat-card,
.health-macro-card,
.health-macro-stats,
.health-future-row article {
  border: 1px solid rgba(91, 170, 142, 0.16);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 34px rgba(68, 111, 98, 0.07);
}

.health-today-card {
  display: grid;
  gap: 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.health-today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.health-period-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.language-control {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
}

.language-glyph {
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
}

.language-control select {
  width: auto;
  min-width: 76px;
  padding: 0 20px 0 0;
  border: 0;
  background-color: transparent;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
}

.language-control select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.language-setup-modal {
  width: min(440px, calc(100vw - 24px));
}

.language-setup-card {
  width: 100%;
}

.language-setup-body {
  gap: 18px;
  padding: 20px 22px 22px;
}

.language-setup-card .field {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.language-setup-card select {
  width: 100%;
}

.language-setup-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.health-period-toggle {
  background: rgba(247, 252, 250, 0.86);
  border-color: rgba(189, 238, 228, 0.7);
}

.health-period-toggle button {
  min-width: 74px;
}

.health-period-toggle button.is-active {
  color: #4f9285;
  box-shadow: 0 8px 14px rgba(84, 143, 132, 0.08);
}

.health-today-head h3,
.health-panel h3 {
  margin: 0;
  color: var(--health-ink);
  font-size: 24px;
  letter-spacing: -0.03em;
}

.health-today-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.health-stat-card {
  min-height: 254px;
  display: grid;
  gap: 12px;
  align-content: space-between;
  padding: 15px;
  border-color: rgba(214, 225, 241, 0.86);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 26px rgba(86, 103, 120, 0.08);
  animation: healthCardEnter 0.55s ease both;
}

.health-macro-donut-card {
  overflow: visible;
}

.health-calorie-dashboard-card {
  border-color: rgba(214, 225, 241, 0.86);
}

.health-calorie-dashboard-card .health-card-label strong {
  background: rgba(230, 250, 246, 0.92);
  color: var(--health-calorie-ink);
}

.health-card-label,
.health-macro-stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.health-card-label span,
.health-macro-stat-head span {
  color: #746783;
  font-size: 13px;
  font-weight: 900;
}

.health-card-label > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  font-weight: 950;
}

.health-card-label > span:first-child::after {
  color: currentColor;
  font-size: 12px;
  letter-spacing: 0;
  opacity: 0.88;
}

.health-calorie-dashboard-card .health-card-label > span:first-child {
  color: #8dd6c7;
}

.health-calorie-dashboard-card .health-card-label > span:first-child::after {
  content: "✦";
}

.health-macro-donut-card .health-card-label > span:first-child {
  color: #c8aee9;
}

.health-macro-donut-card .health-card-label > span:first-child::after {
  content: "♡";
}

.health-water-dashboard-card .health-card-label > span:first-child {
  color: #8fcde9;
}

.health-water-dashboard-card .health-card-label > span:first-child::after {
  content: "✧";
}

.health-weight-card .health-card-label > span:first-child {
  color: #f0a6c4;
}

.health-weight-card .health-card-label > span:first-child::after {
  content: "♡";
}

.health-card-label strong,
.health-macro-stat-head strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(235, 248, 242, 0.88);
  color: #69aa92;
  font-size: 12px;
  font-weight: 900;
}

.health-comparison-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

span.health-comparison-pill {
  --comparison-bg: rgba(235, 248, 242, 0.9);
  --comparison-border: rgba(105, 170, 146, 0.24);
  --comparison-ink: var(--health-calorie-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: fit-content;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--comparison-border);
  border-radius: 999px;
  background: var(--comparison-bg);
  color: var(--comparison-ink);
  font-size: 11px;
  font-weight: 920;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 14px rgba(86, 103, 120, 0.05);
}

.health-comparison-pill i {
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--comparison-ink);
  font-style: normal;
  font-size: 10px;
  line-height: 1;
}

.health-comparison-pill i.is-goal-good {
  background: rgba(226, 247, 235, 0.96);
  color: #4c9f75;
}

.health-comparison-pill i.is-goal-bad {
  background: rgba(255, 235, 236, 0.96);
  color: #c86f78;
}

.health-comparison-pill i.is-goal-neutral {
  background: rgba(255, 255, 255, 0.72);
  color: var(--comparison-ink);
}

.health-comparison-pill.is-down i {
  transform: translateY(1px);
}

span.health-comparison-pill.is-same {
  --comparison-bg: rgba(247, 247, 248, 0.92);
  --comparison-border: rgba(146, 140, 151, 0.18);
  --comparison-ink: #908796;
}

span.health-comparison-pill.is-kcal,
span.health-comparison-pill.is-carbs {
  --comparison-bg: rgba(225, 249, 244, 0.9);
  --comparison-border: rgba(99, 190, 171, 0.25);
  --comparison-ink: #579b8e;
}

span.health-comparison-pill.is-water,
span.health-comparison-pill.is-protein {
  --comparison-bg: rgba(232, 246, 255, 0.92);
  --comparison-border: rgba(132, 194, 231, 0.26);
  --comparison-ink: #5d91b5;
}

span.health-comparison-pill.is-fat {
  --comparison-bg: rgba(255, 235, 244, 0.94);
  --comparison-border: rgba(247, 183, 207, 0.58);
  --comparison-ink: #b95f84;
}

span.health-comparison-pill.is-weight {
  --comparison-bg: rgba(248, 240, 255, 0.94);
  --comparison-border: rgba(216, 193, 242, 0.58);
  --comparison-ink: #8b6fab;
}

.health-macro-donut-card .health-comparison-pill {
  min-height: 24px;
  padding-inline: 7px;
  font-size: 10px;
}

.health-donut {
  position: relative;
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  filter: drop-shadow(0 12px 18px rgba(102, 111, 130, 0.1));
  transform: scale(0.96);
  animation: healthRingEnter 0.8s ease 0.08s both;
}

.health-donut::after {
  content: "";
  position: absolute;
  inset: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 0 0 1px rgba(213, 226, 232, 0.5);
  z-index: 0;
}

.health-donut span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
}

.health-donut strong {
  color: #60738b;
  font-size: 18px;
  font-weight: 950;
}

.health-donut small {
  color: #8c8494;
  font-size: 10px;
  font-weight: 850;
}

.health-macro-donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.health-macro-svg {
  width: 124px;
  height: 124px;
  overflow: visible;
  transform: rotate(-90deg);
  filter: drop-shadow(0 12px 18px rgba(102, 111, 130, 0.08));
  animation: healthRingEnter 0.8s ease 0.08s both;
}

.health-macro-track,
.health-macro-arc {
  fill: none;
  stroke-width: 20;
}

.health-macro-track {
  stroke: rgba(239, 235, 247, 0.9);
}

.health-macro-arc {
  stroke-dasharray: var(--arc-length) 295.31;
  stroke-dashoffset: var(--arc-offset);
  transition: stroke-width 0.14s ease, filter 0.14s ease;
  pointer-events: stroke;
  outline: none;
}

.health-macro-arc.is-protein { stroke: var(--health-sky); }
.health-macro-arc.is-carbs { stroke: var(--health-sea); }
.health-macro-arc.is-fat { stroke: var(--health-rose); }

.health-macro-arc:hover,
.health-macro-arc:focus-visible {
  stroke-width: 22;
  filter: drop-shadow(0 4px 8px rgba(86, 103, 120, 0.1));
}

.health-macro-float-card {
  position: absolute;
  z-index: 6;
  left: calc(50% + 46px);
  top: 50%;
  min-width: 124px;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(213, 226, 232, 0.74);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 24px rgba(86, 103, 120, 0.1);
  opacity: 0;
  transform: translate(8px, -50%) scale(0.96);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.health-macro-float-card span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #746783;
  font-size: 12px;
  font-weight: 900;
}

.health-macro-float-card strong {
  color: var(--health-sky);
  font-size: 18px;
  font-weight: 950;
}

.health-macro-float-card small {
  color: #9a90a4;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.health-macro-float-card .health-macro-remaining {
  width: max-content;
  max-width: 100%;
  margin-top: 2px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(249, 244, 250, 0.86);
  color: #7c7087;
}

.health-macro-float-card.is-protein strong { color: var(--health-sky); }
.health-macro-float-card.is-carbs strong { color: var(--health-sea); }
.health-macro-float-card.is-fat strong { color: var(--health-rose); }

.health-macro-float-card.is-protein {
  border-color: rgba(184, 220, 247, 0.74);
}

.health-macro-float-card.is-carbs {
  border-color: rgba(189, 238, 228, 0.78);
}

.health-macro-float-card.is-fat {
  border-color: rgba(247, 183, 207, 0.76);
}

.health-macro-donut-wrap:has(.health-macro-arc.is-protein:hover) .health-macro-float-card.is-protein,
.health-macro-donut-wrap:has(.health-macro-arc.is-protein:focus-visible) .health-macro-float-card.is-protein,
.health-macro-donut-wrap:has(.health-macro-arc.is-carbs:hover) .health-macro-float-card.is-carbs,
.health-macro-donut-wrap:has(.health-macro-arc.is-carbs:focus-visible) .health-macro-float-card.is-carbs,
.health-macro-donut-wrap:has(.health-macro-arc.is-fat:hover) .health-macro-float-card.is-fat,
.health-macro-donut-wrap:has(.health-macro-arc.is-fat:focus-visible) .health-macro-float-card.is-fat {
  opacity: 1;
  transform: translate(0, -50%) scale(1);
}

.health-kcal-ring {
  position: relative;
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  justify-self: center;
  filter: drop-shadow(0 12px 18px rgba(102, 111, 130, 0.08));
  animation: healthRingEnter 0.8s ease 0.08s both;
}

.health-kcal-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.health-kcal-track,
.health-kcal-progress {
  fill: none;
  stroke-width: 16;
  pointer-events: stroke;
  outline: none;
  transition: stroke-width 0.18s ease, stroke 0.18s ease, stroke-dashoffset 0.75s ease;
}

.health-kcal-track {
  stroke: rgba(189, 238, 228, 0.36);
}

.health-kcal-progress {
  stroke: #9bded2;
  stroke-linecap: round;
  stroke-dasharray: 295.31;
  stroke-dashoffset: var(--kcal-offset);
}

.health-kcal-track:hover,
.health-kcal-track:focus-visible {
  stroke: rgba(184, 220, 247, 0.58);
  stroke-width: 18;
}

.health-kcal-progress:hover,
.health-kcal-progress:focus-visible {
  stroke: #8ed7ca;
  stroke-width: 18;
}

.health-kcal-center {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 48px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--health-calorie-ink);
}

.health-kcal-center span {
  grid-area: 1 / 1;
  display: grid;
  gap: 1px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.health-kcal-center .is-default {
  opacity: 1;
  transform: translateY(0);
}

.health-kcal-center small {
  color: #8f98a3;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}

.health-kcal-center strong {
  color: var(--health-calorie-ink);
  font-size: 17px;
  font-weight: 950;
  line-height: 1.05;
}

.health-kcal-center .is-remaining strong {
  color: #79aebf;
}

.health-kcal-ring:has(.health-kcal-progress:hover) .health-kcal-center .is-default,
.health-kcal-ring:has(.health-kcal-progress:focus-visible) .health-kcal-center .is-default,
.health-kcal-ring:has(.health-kcal-track:hover) .health-kcal-center .is-default,
.health-kcal-ring:has(.health-kcal-track:focus-visible) .health-kcal-center .is-default {
  opacity: 0;
  transform: translateY(-2px);
}

.health-kcal-ring:has(.health-kcal-progress:hover) .health-kcal-center .is-consumed,
.health-kcal-ring:has(.health-kcal-progress:focus-visible) .health-kcal-center .is-consumed,
.health-kcal-ring:has(.health-kcal-track:hover) .health-kcal-center .is-remaining,
.health-kcal-ring:has(.health-kcal-track:focus-visible) .health-kcal-center .is-remaining {
  opacity: 1;
  transform: translateY(0);
}

.health-macro-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
}

.health-macro-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #7d708a;
  font-size: 11px;
  font-weight: 850;
}

.health-macro-legend i,
.health-macro-stat-head i {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 999px;
  background: var(--health-sky);
}

.health-macro-legend i.is-carbs,
.health-macro-stat.is-carbs .health-macro-stat-head i { background: var(--health-sea); }
.health-macro-legend i.is-fat,
.health-macro-stat.is-fat .health-macro-stat-head i { background: var(--health-rose); }
.health-macro-stat.is-water .health-macro-stat-head i { background: #9dd8ee; }

.health-water-orb {
  position: relative;
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border: 3px solid rgba(142, 207, 223, 0.58);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 251, 255, 0.88));
  box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.78), 0 12px 18px rgba(102, 143, 157, 0.1);
}

.health-water-fill {
  position: absolute;
  left: -18%;
  right: -18%;
  bottom: 0;
  height: calc(var(--water) * 1%);
  border-radius: 42% 46% 0 0;
  background: linear-gradient(180deg, #8ed7ee, #53bfe6);
  animation: healthWaterRise 0.9s ease both;
}

.health-water-orb.is-empty .health-water-fill {
  display: none;
}

.health-water-fill::before,
.health-water-fill::after {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  top: -15px;
  height: 30px;
  border-radius: 45%;
  background: rgba(255, 255, 255, 0.42);
  animation: healthWaterWave 2.6s ease-in-out infinite;
}

.health-water-fill::after {
  top: -10px;
  background: rgba(115, 207, 239, 0.42);
  animation-duration: 3.2s;
  animation-direction: reverse;
}

.health-water-orb span {
  position: relative;
  z-index: 2;
  color: #3f7f93;
  font-size: 20px;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.health-weight-card {
  min-height: 254px;
  align-content: space-between;
  justify-items: center;
  gap: 8px;
  padding-block: 15px;
  border-color: rgba(229, 196, 214, 0.58);
  background: rgba(255, 255, 255, 0.94);
}

.health-weight-card .health-card-label {
  width: 100%;
  align-self: start;
}

.health-weight-value {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  color: #2c2d32;
  line-height: 1;
}

.health-weight-value strong {
  font-size: 34px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.health-weight-value span {
  color: #9a969f;
  font-size: 24px;
  font-weight: 950;
}

.health-weight-meter {
  position: relative;
  width: 256px;
  max-width: 100%;
  height: 100px;
  overflow: visible;
  border-radius: var(--radius);
  background: transparent;
}

.health-weight-rule {
  position: absolute;
  inset: 0;
}

.health-weight-tick,
.health-weight-current {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 1.4px;
  border-radius: 999px;
  transform: translate(-50%, -100%) rotate(var(--tilt));
  transform-origin: 50% 100%;
}

.health-weight-tick {
  height: 16px;
  background: rgba(154, 151, 162, 0.22);
}

.health-weight-tick.is-major {
  width: 2px;
  height: 29px;
  background: rgba(103, 104, 116, 0.48);
}

.health-weight-tick small {
  position: absolute;
  left: 50%;
  top: calc(100% + 9px);
  color: #b2aab5;
  font-size: 11px;
  font-weight: 850;
  transform: translateX(-50%) rotate(calc(var(--tilt) * -1));
  transform-origin: center;
  white-space: nowrap;
}

.health-weight-current {
  z-index: 3;
  width: 3px;
  height: 38px;
  background: #d9a9c5;
  box-shadow: 0 0 0 5px rgba(217, 169, 197, 0.13);
}

.health-weight-current i {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #d9a9c5;
  box-shadow: 0 2px 8px rgba(185, 120, 158, 0.22);
  transform: translateX(-50%);
}

.health-weight-caption {
  min-height: 14px;
  margin-top: -2px;
  color: #c5bac3;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.health-card-caption {
  display: grid;
  gap: 3px;
  text-align: center;
}

.health-card-caption strong {
  color: var(--health-ink);
  font-size: 16px;
  font-weight: 950;
}

.health-card-caption span {
  color: #918797;
  font-size: 12px;
  font-weight: 780;
}

.health-macro-stats {
  display: grid;
  gap: 13px;
  padding: 15px 16px;
  border-color: rgba(255, 231, 168, 0.78);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
}

.health-macro-stat {
  display: grid;
  gap: 7px;
}

.health-soft-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(244, 237, 248, 0.86);
}

.health-soft-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--health-sky);
  animation: healthFillBar 0.95s ease both;
}

.health-macro-stat.is-carbs .health-soft-progress span { background: var(--health-sea); }
.health-macro-stat.is-fat .health-soft-progress span { background: var(--health-rose); }
.health-macro-stat.is-water .health-soft-progress span { background: #b8dcf7; }

.health-macro-stat small {
  color: #968b9d;
  font-size: 11px;
  font-weight: 800;
}

.health-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.health-hero-copy,
.health-panel,
.health-log-list,
.health-food-library,
.health-impact-summary,
#healthPortionRows {
  display: grid;
  gap: 10px;
}

.health-food-panel-body {
  display: grid;
  gap: 16px;
  padding: 16px 22px 22px;
}

.health-food-panel-actions {
  justify-content: flex-end;
}

.health-hero-copy h3,
.health-panel h3 {
  margin: 0;
  color: var(--health-ink);
  font-size: 24px;
  letter-spacing: -0.03em;
}

.health-date-picker {
  max-width: 210px;
}

.button-row .health-date-picker,
.panel-actions .health-date-picker {
  min-height: 38px;
  max-width: 190px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 3px 10px 3px 12px;
  border: 1px solid rgba(189, 238, 228, 0.7);
  border-radius: 999px;
  background: rgba(247, 252, 250, 0.86);
  color: #6d7f7a;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.button-row .health-date-picker input,
.panel-actions .health-date-picker input {
  width: auto;
  min-height: 28px;
  max-width: 118px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--health-ink);
  font-size: 12px;
  font-weight: 850;
  padding: 5px 8px;
}

.health-kcal-card,
.health-water-card {
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
}

.health-kcal-card strong,
.health-water-card strong {
  display: block;
  color: var(--health-ink);
  font-size: 18px;
  font-weight: 900;
}

.health-kcal-card span,
.health-water-card span,
.health-log-main span,
.health-log-main small,
.health-food-card small,
.health-water-log small,
.health-future-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.health-arc {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--surface-strong) 55%, transparent 57%), conic-gradient(#79b99e calc(var(--progress) * 1%), #edf1ed 0);
}

.health-arc span {
  color: #4d7568;
  font-size: 14px;
  font-weight: 900;
}

.health-glass {
  position: relative;
  width: 48px;
  height: 78px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(89, 154, 178, 0.34);
  border-radius: 14px 14px 18px 18px;
  background: var(--surface-strong);
}

.health-glass::before {
  content: "";
  position: absolute;
  inset: auto 4px 4px;
  height: calc(min(var(--water), 100) * 1%);
  border-radius: 10px 10px 14px 14px;
  background: linear-gradient(180deg, #bce4f1, #8ecfdf);
  transition: height 0.2s ease;
}

.health-glass span {
  position: relative;
  z-index: 1;
  color: #3d7888;
  font-size: 11px;
  font-weight: 900;
}

.health-dashboard-grid,
.health-two-column {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.health-two-column {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
}

.health-macro-card,
.health-panel {
  padding: 14px;
}

.health-macro-card {
  display: grid;
  gap: 10px;
}

.health-macro-card strong {
  display: block;
  color: var(--health-ink);
  font-size: 14px;
  font-weight: 900;
}

.health-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(108, 99, 89, 0.08);
}

.health-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #79b99e;
}

.health-macro-card.is-carbs .health-progress span { background: #8bb9dc; }
.health-macro-card.is-fat .health-progress span { background: #d7a4c1; }
.health-macro-card.is-water .health-progress span { background: #8ecfdf; }

.health-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.health-panel-head.compact {
  align-items: center;
  margin-bottom: 10px;
}

.health-log-card,
.health-food-card,
.health-water-log {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(108, 99, 89, 0.11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.health-log-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(var(--habit-rgb, 91, 170, 142), 0.22);
  border-radius: 13px;
  background: rgba(var(--habit-pale, 233, 248, 241), 0.8);
}

.health-log-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.health-log-main {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.health-log-main strong,
.health-food-card strong {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
}

.health-water-actions,
.health-food-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.health-category-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 9px;
}

.health-category-card,
.health-food-picker-card {
  border: 1px solid rgba(var(--habit-rgb, 108, 99, 89), 0.14);
  border-radius: var(--radius);
  background: rgba(var(--habit-pale, 255, 255, 255), 0.58);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.health-category-card {
  min-height: 88px;
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 11px;
  text-align: left;
}

.health-category-card:hover,
.health-category-card.is-active,
.health-food-picker-card:hover,
.health-food-picker-card.is-active {
  border-color: rgba(var(--habit-rgb, 91, 170, 142), 0.34);
  background: rgba(var(--habit-pale, 255, 255, 255), 0.86);
  box-shadow: 0 12px 24px rgba(68, 111, 98, 0.09);
  transform: translateY(-1px);
}

.health-category-card-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.76);
}

.health-category-card strong,
.health-food-picker-card strong {
  font-size: 13px;
  font-weight: 900;
}

.health-category-card small,
.health-food-picker-card small,
.health-food-picker-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 780;
}

.health-food-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 10px;
}

.health-food-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.health-food-search-row label {
  min-width: 0;
}

.health-food-search-row .text-button {
  white-space: nowrap;
}

.health-food-picker-card {
  min-height: 92px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  text-align: left;
}

.health-food-picker-card span:not(.health-food-picker-visual) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.health-food-picker-card strong,
.health-food-picker-card small,
.health-food-picker-card em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-food-picker-visual,
.health-food-match-icon,
.health-food-icon,
.health-food-image-preview {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(var(--habit-rgb, 91, 170, 142), 0.22);
  border-radius: 15px;
  background: rgba(var(--habit-pale, 233, 248, 241), 0.82);
  font-size: 20px;
}

.health-food-picker-visual img,
.health-food-match-icon img,
.health-food-icon img,
.health-food-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.health-food-identity,
.health-food-category-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.health-food-visual-editor {
  display: grid;
  grid-template-columns: auto minmax(120px, 0.8fr) minmax(160px, 1fr);
  gap: 10px;
  align-items: end;
}

.health-food-visual-editor [data-health-clear-image] {
  align-self: end;
  justify-self: start;
}

.health-food-cropper {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(116, 168, 215, 0.16);
  border-radius: var(--radius);
  background: rgba(247, 252, 252, 0.78);
}

.health-food-cropper[hidden] {
  display: none !important;
}

.health-crop-stage {
  position: relative;
  width: 148px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(91, 170, 142, 0.22);
  border-radius: 24px;
  background:
    linear-gradient(45deg, rgba(139, 200, 213, 0.09) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(139, 200, 213, 0.09) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(139, 200, 213, 0.09) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(139, 200, 213, 0.09) 75%),
    rgba(255, 255, 255, 0.78);
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  background-size: 18px 18px;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.46);
}

.health-crop-stage::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(61, 120, 136, 0.28);
  border-radius: var(--radius);
  pointer-events: none;
}

.health-crop-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center;
}

.health-crop-controls {
  display: grid;
  gap: 8px;
}

.health-crop-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.health-crop-controls input[type="range"] {
  width: 100%;
  accent-color: #8bc8d5;
}

.health-form label,
.health-form input,
.health-form textarea,
.health-form select {
  min-width: 0;
}

.health-form input[type="file"] {
  width: 100%;
  max-width: 100%;
}

.health-food-image-preview {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  font-size: 28px;
}

.health-selected-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.health-selected-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 8px 6px 10px;
  border: 1px solid rgba(var(--habit-rgb, 108, 99, 89), 0.16);
  border-radius: 999px;
  background: rgba(var(--habit-pale, 255, 255, 255), 0.76);
  color: rgb(var(--habit-ink, 54, 50, 46));
}

.health-selected-category-chip strong {
  font-size: 12px;
  font-weight: 850;
}

.health-selected-category-chip button {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  cursor: pointer;
}

.health-food-duplicate-hint {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(116, 168, 215, 0.2);
  border-radius: var(--radius);
  background: rgba(238, 248, 252, 0.72);
  color: var(--text);
}

.health-food-duplicate-hint[hidden] {
  display: none !important;
}

.health-food-duplicate-hint.is-warning {
  border-color: rgba(217, 130, 179, 0.32);
  background: rgba(255, 242, 248, 0.82);
}

.health-food-duplicate-hint > strong {
  color: var(--health-ink);
  font-size: 13px;
  font-weight: 900;
}

.health-food-duplicate-hint > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.health-food-match-list {
  display: grid;
  gap: 7px;
}

.health-food-match {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.health-food-match:hover {
  border-color: rgba(91, 170, 142, 0.26);
  background: rgba(255, 255, 255, 0.92);
}

.health-food-match span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.health-food-match strong,
.health-food-match small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-food-match strong {
  font-size: 12px;
  font-weight: 900;
}

.health-food-match small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.health-measure-toggle {
  width: min(360px, 100%);
  margin-bottom: 12px;
}

.health-measure-toggle button {
  flex: 1 1 0;
  min-width: 0;
}

[data-health-base-measure][hidden],
[data-health-custom-measures][hidden],
[data-health-custom-action][hidden] {
  display: none !important;
}

[data-health-log-mode-toggle-wrap][hidden],
[data-health-log-portion-label][hidden],
[data-health-log-portion-quantity-label][hidden],
[data-exact-amount-label][hidden] {
  display: none !important;
}

.health-base-measure {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.optional-mark {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.health-category-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.health-category-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(var(--habit-rgb, 108, 99, 89), 0.16);
  border-radius: 999px;
  background: rgba(var(--habit-pale, 255, 255, 255), 0.58);
  color: rgb(var(--habit-ink, 54, 50, 46));
  cursor: pointer;
}

.health-category-check input {
  width: 14px;
  height: 14px;
  accent-color: rgb(var(--habit-rgb, 91, 170, 142));
}

.health-category-check strong {
  font-size: 12px;
  font-weight: 850;
}

.health-water-log {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.health-water-log span {
  color: #3d7888;
  font-weight: 900;
}

.health-goal-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.health-goal-grid span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.62);
}

.health-goal-grid strong {
  color: var(--health-ink);
  font-weight: 900;
}

.health-goal-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.health-macro-goals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.health-macro-goals label span {
  color: var(--muted);
  font-size: 12px;
}

.health-goals-preview {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: 16px;
  background: rgba(235, 248, 242, 0.72);
}

.health-goals-preview strong {
  color: var(--health-ink);
  font-weight: 900;
}

.health-goals-preview span,
.health-goals-preview small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.health-goals-preview.is-warning {
  border-color: rgba(214, 126, 126, 0.22);
  background: rgba(255, 241, 241, 0.78);
}

.health-goals-preview.is-warning strong {
  color: #9e5b5b;
}

.health-future-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.health-future-row article {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.health-future-row span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--health-lavender);
  color: #8b6bc4;
}

.health-impact-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(91, 170, 142, 0.16);
  border-radius: var(--radius);
  background: rgba(236, 251, 245, 0.72);
}

.health-impact-summary strong {
  color: var(--health-ink);
  font-size: 18px;
  font-weight: 900;
}

.health-impact-box ul {
  margin: 0;
  padding-left: 18px;
  color: #5f746e;
  font-size: 12px;
  font-weight: 700;
}

.health-portion-editor {
  padding: 12px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.health-portion-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(108, 99, 89, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
}

.health-remove-portion {
  align-self: center;
}

.health-liquid-field[hidden] {
  display: none;
}

/* 7. Responsive layouts */
@media (max-width: 1080px) {
  .view-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .view-heading-side {
    justify-items: stretch;
  }

  .legend {
    justify-content: flex-start;
  }

  .list-grid.two-up,
  .settings-grid,
  .history-grid,
  .reward-info-grid,
  .agenda-layout,
  .health-two-column {
    grid-template-columns: 1fr;
  }

  .health-hero,
  .health-today-grid,
  .health-dashboard-grid,
  .health-future-row {
    grid-template-columns: 1fr 1fr;
  }

  .health-portion-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-base-measure,
  .health-food-visual-editor,
  .health-food-cropper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-year-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .agenda-urgency-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-sidebar {
    height: auto;
    min-height: 0;
  }

  .agenda-urgent-panel {
    flex: 0 1 auto;
    max-height: 360px;
  }

  .agenda-urgent-list {
    min-height: 96px;
  }

  .diary-modal-stack.has-day-activity .diary-entry-content-grid {
    grid-template-columns: 1fr;
  }

  .matrix,
  .matrix.weekly,
  .matrix.monthly {
    --label-width: 300px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: calc(100% - 12px);
    padding: 12px 0 24px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding-inline: 10px;
  }

  .tabs,
  .workspace,
  .summary-panel {
    border-radius: 22px;
  }

  .tabs {
    margin-inline: 10px;
  }

  .tab {
    flex: 1 1 auto;
  }

  .view-heading,
  .tracker-scroll,
  .list-stack,
  .view-stack,
  .diary-layout,
  .health-view,
  .agenda-layout,
  .diary-gallery-panel-body,
  .health-food-panel-body,
  .settings-grid,
  .history-grid,
  .panel-heading {
    padding-inline: 14px;
  }

  .matrix,
  .matrix.weekly,
  .matrix.monthly {
    --label-width: 240px;
  }

  .row-label .category-chip {
    max-width: 144px;
    white-space: normal;
  }

  .row-label {
    gap: 10px;
  }

  .diary-entry {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .diary-entry-main {
    display: grid;
    gap: 3px;
  }

  .diary-entry-badges {
    justify-content: flex-start;
  }

  .diary-images {
    grid-template-columns: 1fr;
  }

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

  .agenda-calendar-card {
    overflow-x: auto;
  }

  .agenda-month-grid {
    min-width: 720px;
  }

  .agenda-year-grid {
    grid-template-columns: 1fr 1fr;
  }

  .agenda-year-month .month-full {
    display: none;
  }

  .agenda-year-month .month-short {
    display: inline;
  }

  .agenda-repeat-fields,
  .agenda-urgency-card,
  .health-hero,
  .health-today-grid,
  .health-dashboard-grid,
  .health-two-column,
  .health-goal-grid,
  .health-macro-goals,
  .health-base-measure,
  .health-food-visual-editor,
  .health-food-cropper,
  .health-food-search-row,
  .health-future-row,
  .health-portion-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .language-control {
    flex: 0 0 auto;
  }

  .language-setup-body {
    padding: 18px;
  }

  .health-crop-stage {
    width: min(190px, 100%);
    justify-self: center;
  }

  .form-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .health-today-head {
    flex-direction: column;
  }

  .habit-cadence-toggle {
    width: 100%;
  }

  .habit-cadence-toggle button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 10px;
  }

  .transfer-health-parts {
    padding-left: 8px;
  }

  .transfer-option,
  .transfer-file-card,
  .transfer-summary-card {
    align-items: flex-start;
  }

  .transfer-file-card,
  .transfer-summary-card {
    flex-direction: column;
  }

  .transfer-file-card span,
  .transfer-summary-card span {
    text-align: left;
  }

  .transfer-strategy {
    grid-template-columns: 1fr;
  }
}
