/* Record tools only. Shared navigation, photos and the companion keep their own layout. */
#life-tool-root {
  --record-ink: #344c58;
  --record-muted: #6b7d85;
  --record-accent: #527c96;
  --record-line: #dfe5e5;
  --record-paper: #fffdf9;
  min-width: 0;
  color: var(--record-ink);
}

#life-tool-root .p-record-heading {
  gap: 16px;
  margin: 10px 0 20px;
  min-height: 48px;
  align-items: center;
}
#life-tool-root .p-record-heading h1 {
  min-width: 0;
  margin: 0;
  font-size: clamp(24px, 5.8vw, 30px);
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: .025em;
}
#life-tool-root .p-add-record {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid #cddde5;
  border-radius: 16px;
  background: #eaf1f5;
  color: var(--record-accent);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 3px 10px #344c5806;
}
#life-tool-root > .p-tool-status:empty { display: none; }
#life-tool-root > .p-tool-status:not(:empty) {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
#life-tool-root :is(.p-todo-scopes, .p-record-views) {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  padding: 2px 0 8px;
  border: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
#life-tool-root :is(.p-todo-scopes, .p-record-views) button {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid var(--record-line);
  border-radius: 14px;
  background: var(--record-paper);
  color: var(--record-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
#life-tool-root :is(.p-todo-scopes, .p-record-views) button[aria-pressed="true"] {
  border-color: var(--record-accent);
  background: var(--record-accent);
  color: #fff;
}
#life-tool-root .p-record-views [data-lock] { margin-left: auto; }
#life-tool-root .p-record-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: center;
  margin: 0 0 20px;
}
#life-tool-root .p-record-search .p-search { margin: 0; }
#life-tool-root .p-record-search input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--record-line);
  border-radius: 14px;
  background: #fffdfb;
  color: var(--record-ink);
  font-size: 16px;
  line-height: 1.5;
  box-sizing: border-box;
}
#life-tool-root .p-record-search [data-refresh] {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--record-line);
  border-radius: 14px;
  background: #f1f4f3;
  color: var(--record-accent);
  font-size: 22px;
  line-height: 1;
}
#life-tool-root .p-category-filter { margin: -4px 0 12px auto; }
#life-tool-root .p-category-filter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  min-width: 88px;
  padding: 8px 13px;
  border: 1px solid var(--record-line);
  border-radius: 12px;
  color: var(--record-ink);
  background: var(--record-paper);
  font-size: 14px;
  list-style: none;
  cursor: pointer;
  box-sizing: border-box;
}
#life-tool-root .p-category-filter summary::-webkit-details-marker { display: none; }
#life-tool-root .p-category-filter summary::after {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
#life-tool-root .p-category-filter[open] summary { border-color: #a3bbc9; }
#life-tool-root .p-category-filter [data-category-filter] {
  top: calc(100% + 6px);
  width: min(260px, calc(100vw - 48px));
  min-width: 180px;
  max-height: min(320px, 50dvh);
  padding: 8px;
  border: 1px solid var(--record-line);
  border-radius: 16px;
  background: #fffdf9;
  box-shadow: 0 12px 32px #344c5815;
  box-sizing: border-box;
  z-index: 8;
}
#life-tool-root .p-category-filter label {
  gap: 9px;
  min-height: 44px;
  padding: 8px;
  border-radius: 10px;
  color: var(--record-ink);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  cursor: pointer;
}
#life-tool-root .p-category-filter label:has(input:checked) { background: #eaf1f5; }
#life-tool-root .p-category-filter input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--record-accent); }
#life-tool-root .p-category-filter i { flex-shrink: 0; }
#life-tool-root .p-filter-details {
  margin: 0 0 16px;
  padding: 0 16px 4px;
  border: 1px solid var(--record-line);
  border-radius: 16px;
  background: #f3f5f2;
}
#life-tool-root .p-filter-details summary { color: var(--record-ink); font-size: 14px; }

#life-tool-root .p-records { gap: 14px; }
#life-tool-root .p-record {
  margin: 0;
  padding: 20px;
  border: 1px solid #e2e7e5;
  border-radius: 20px;
  background: var(--record-paper);
  box-shadow: 0 3px 14px #344c5805;
}
#life-tool-root .p-record-meta {
  color: var(--record-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: .02em;
  overflow-wrap: anywhere;
}
#life-tool-root .p-record h3 {
  margin: 11px 0 8px;
  color: var(--record-ink);
  font-size: 18px;
  line-height: 1.55;
  font-weight: 650;
  overflow-wrap: anywhere;
}
#life-tool-root .p-record-body {
  margin: 8px 0 0;
  max-height: 240px;
  padding-right: 3px;
  color: #50646d;
  font-size: 15px;
  line-height: 1.85;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
#life-tool-root .p-record.is-completed h3 { color: #84949a; text-decoration-thickness: 1px; }
#life-tool-root .p-category-tag {
  max-width: 100%;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 7px;
  color: #425965;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
#life-tool-root .p-record-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #edf0ee;
}
#life-tool-root .p-record-actions button {
  min-width: 44px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f0f4f5;
  color: var(--record-accent);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}
#life-tool-root .p-record-actions [data-delete] { margin-left: auto; background: transparent; color: #88656a; }
#life-tool-root .p-record-actions [data-complete][aria-pressed="true"] { background: #eaf1eb; color: #55745c; }
#life-tool-root .p-record-money {
  display: block;
  margin-top: 14px;
  color: var(--record-ink);
  font-size: 24px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
#life-tool-root > [data-more] {
  display: block;
  min-width: 120px;
  min-height: 44px;
  margin: 20px auto 4px;
  padding: 10px 18px;
  border: 1px solid var(--record-line);
  border-radius: 14px;
  background: var(--record-paper);
  color: var(--record-accent);
  font-size: 14px;
}
#life-tool-root > [data-more][hidden] { display: none; }
#life-tool-root .p-empty {
  padding: 36px 20px;
  border: 1px dashed #d8e1e1;
  border-radius: 20px;
  background: #fcfaf6;
  color: var(--record-muted);
  font-size: 14px;
  line-height: 1.8;
}

#life-tool-root .p-totals { gap: 8px; margin: 4px 0 22px; }
#life-tool-root .p-totals > div {
  min-width: 0;
  padding: 16px 12px;
  border: 1px solid #e1e8e6;
  border-radius: 16px;
  background: #f1f5f3;
}
#life-tool-root .p-totals span { color: var(--record-muted); font-size: 12px; line-height: 1.5; }
#life-tool-root .p-totals strong { margin-top: 8px; color: var(--record-ink); font-size: clamp(16px, 4.3vw, 23px); line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#life-tool-root .p-category-summary:not(:empty) { margin: 0 0 22px; padding: 16px 18px; border: 1px solid var(--record-line); border-radius: 18px; background: var(--record-paper); }
#life-tool-root .p-spending-bar { gap: 9px 12px; margin: 0 0 18px; font-size: 13px; line-height: 1.6; }
#life-tool-root .p-spending-bar:last-child { margin-bottom: 0; }
#life-tool-root .p-spending-bar span { min-width: 0; color: var(--record-muted); overflow-wrap: anywhere; }
#life-tool-root .p-spending-bar strong { color: var(--record-ink); font-variant-numeric: tabular-nums; }
#life-tool-root .p-spending-bar i { height: 5px; background: #98b2c2; }

#life-tool-root .p-calendar-panel { margin: 0 0 20px; padding: 16px 12px 12px; border: 1px solid var(--record-line); border-radius: 20px; background: var(--record-paper); }
#life-tool-root .p-calendar-panel .p-section-title { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; margin: 0 0 14px; }
#life-tool-root .p-calendar-panel h2 { margin: 0; text-align: center; color: var(--record-ink); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
#life-tool-root .p-calendar-panel [data-month-shift] { min-width: 44px; height: 44px; padding: 0; border: 1px solid var(--record-line); border-radius: 12px; background: #f4f6f4; color: var(--record-accent); font-size: 25px; line-height: 1; }
#life-tool-root .p-calendar-week { margin: 0 0 4px; color: var(--record-muted); font-size: 12px; }
#life-tool-root .p-calendar-week span { padding-block: 6px; }
#life-tool-root .p-calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px 0; }
#life-tool-root .p-calendar-day { position: relative; min-width: 0; min-height: 44px; height: 46px; padding: 9px 0 12px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--record-ink); font-size: 15px; line-height: 1.3; font-variant-numeric: tabular-nums; }
#life-tool-root .p-calendar-day.is-outside { color: #89999f; }
#life-tool-root .p-calendar-day[aria-pressed="true"] { border-color: var(--record-accent); background: var(--record-accent); color: white; }
#life-tool-root .p-calendar-day i { position: absolute; bottom: 5px; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: var(--record-accent); }
#life-tool-root .p-calendar-day[aria-pressed="true"] i { background: white; }
#life-tool-root .p-calendar-panel [data-all-month] { display: block; min-height: 44px; margin: 12px auto 0; padding: 8px 15px; border: 0; border-radius: 12px; background: #eef3f5; color: var(--record-accent); font-size: 14px; }

.p-record-modal,
.p-category-modal {
  --record-ink: #344c58;
  --record-muted: #6b7d85;
  --record-accent: #527c96;
  --record-line: #dfe5e5;
  --record-modal-pad: 20px;
  width: min(600px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: auto;
  padding: var(--record-modal-pad);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 80px;
  scrollbar-width: thin;
  border: 1px solid #e0e6e4;
  border-radius: 24px;
  background: #faf8f4;
  color: var(--record-ink);
  box-shadow: 0 18px 70px #243e4826;
  box-sizing: border-box;
}
.p-record-modal::backdrop,
.p-category-modal::backdrop { background: #223a4652; backdrop-filter: blur(4px); }
.p-record-modal .p-section-title {
  position: sticky;
  top: calc(-1 * var(--record-modal-pad));
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: calc(-1 * var(--record-modal-pad)) calc(-1 * var(--record-modal-pad)) 20px;
  padding: 14px var(--record-modal-pad);
  border-bottom: 1px solid var(--record-line);
  background: #faf8f4;
}
.p-record-modal .p-section-title h2,
.p-category-modal h2 { margin: 0; min-width: 0; color: var(--record-ink); font-size: 20px; font-weight: 650; line-height: 1.5; }
.p-record-modal .p-section-title [data-close] {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--record-line);
  border-radius: 13px;
  background: #fffdf9;
  color: var(--record-muted);
  font-size: 25px;
  line-height: 1;
}
.p-record-modal form { gap: 20px; }
.p-record-modal .p-field,
.p-category-modal .p-field,
#life-tool-root > .p-field,
#life-tool-root .p-filter-details .p-field { display: grid; gap: 8px; min-width: 0; margin: 0; color: var(--record-ink); }
.p-record-modal .p-field > span,
.p-category-modal .p-field > span,
#life-tool-root > .p-field > span,
#life-tool-root .p-filter-details .p-field > span { color: var(--record-muted); font-size: 13px; font-weight: 500; line-height: 1.5; }
.p-record-modal :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select),
.p-category-modal :is(input:not([type="hidden"]), select),
#life-tool-root > .p-field input,
#life-tool-root .p-filter-details :is(input, select) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #d8e1e3;
  border-radius: 13px;
  background: #fffdfb;
  color: var(--record-ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  box-sizing: border-box;
}
.p-record-modal textarea { min-height: 150px; resize: vertical; line-height: 1.8; }
.p-record-modal .p-form-row,
.p-record-modal [data-todo-date] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 14px; margin: 0; }
.p-record-modal .p-check { gap: 9px; min-height: 44px; margin: 0; color: var(--record-ink); font-size: 15px; }
.p-record-modal :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--record-accent); }
.p-record-modal .p-direction-options { gap: 10px; margin: 0; }
.p-record-modal .p-direction-options span { min-height: 46px; border-color: var(--record-line); border-radius: 13px; background: #fffdfb; color: var(--record-muted); font-size: 15px; }
.p-record-modal .p-direction-options input:checked + span { border-color: #a8bfce; background: #eaf1f5; color: var(--record-accent); }
.p-record-modal .p-category-chips { gap: 8px; margin: 0; padding: 0; }
.p-record-modal .p-category-chips button { min-width: 44px; min-height: 44px; padding: 9px 12px; border: 1px solid var(--record-line); border-radius: 13px; background: #fffdf9; color: var(--record-ink); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.p-record-modal .p-category-chips button[aria-pressed="true"] { border-color: #9cb8c8; background: #eaf1f5; color: var(--record-accent); box-shadow: inset 0 0 0 1px #9cb8c833; }
.p-record-modal .p-category-chips [data-add-category] { padding: 7px 12px; border-style: dashed; background: transparent; color: var(--record-accent); font-size: 23px; line-height: 1; }
.p-record-modal .p-small { margin: 0; color: var(--record-muted); font-size: 12px; line-height: 1.8; }
.p-record-modal .p-modal-status:empty,
.p-category-modal [role="status"]:empty { display: none; }
.p-record-modal .p-modal-status { margin: 0; color: #88656a; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.p-record-modal .p-form-actions {
  position: sticky;
  bottom: calc(-1 * var(--record-modal-pad));
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(88px, .48fr);
  align-items: stretch;
  gap: 10px;
  margin: 4px calc(-1 * var(--record-modal-pad)) calc(-1 * var(--record-modal-pad));
  padding: 16px var(--record-modal-pad) max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--record-line);
  background: #faf8f4;
  box-shadow: 0 -8px 16px #faf8f4d9;
}
.p-record-modal .p-form-actions button,
.p-category-modal form > button { min-width: 44px; min-height: 48px; margin: 0; padding: 11px 16px; border: 1px solid #d8e1e3; border-radius: 14px; background: #fffdf9; color: var(--record-ink); font-size: 16px; font-weight: 500; line-height: 1.5; }
.p-record-modal .p-form-actions .p-primary,
.p-category-modal form > .p-primary { border-color: var(--record-accent); background: var(--record-accent); color: #fff; }
.p-record-modal .p-form-actions button:disabled,
.p-category-modal button:disabled { opacity: .58; cursor: wait; }
.p-category-modal { width: min(420px, calc(100vw - 24px)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.p-category-modal form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(88px, .48fr); align-items: start; gap: 20px 10px; }
.p-category-modal form > :is(h2, label, p) { grid-column: 1 / -1; }
.p-category-modal input[type="color"] { height: 52px; padding: 5px; cursor: pointer; }
.p-category-modal input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.p-category-modal input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 8px; }

#life-tool-root .p-pin-gate { max-width: 380px; margin: 20px auto; padding: 24px 20px; gap: 18px; border: 1px solid var(--record-line); border-radius: 22px; background: var(--record-paper); }
#life-tool-root .p-pin-gate h2 { margin: 0; color: var(--record-ink); font-size: 22px; line-height: 1.5; }
#life-tool-root .p-pin-gate p { margin: 0; color: var(--record-muted); font-size: 14px; line-height: 1.75; }
#life-tool-root .p-pin-gate .p-field { display: grid; gap: 8px; margin: 0; }
#life-tool-root .p-pin-gate .p-field > span { color: var(--record-muted); font-size: 13px; }
#life-tool-root .p-pin-gate input { width: 100%; min-width: 0; height: 56px; padding: 10px 12px 10px 24px; border: 1px solid #d8e1e3; border-radius: 14px; background: #fffdfb; color: var(--record-ink); font-size: 24px; letter-spacing: .6em; box-sizing: border-box; }
#life-tool-root .p-pin-gate .p-primary { min-height: 48px; border: 1px solid var(--record-accent); border-radius: 14px; background: var(--record-accent); color: white; font-size: 16px; }
#life-tool-root .p-pin-gate [role="status"]:empty { display: none; }

#life-tool-root :is(.p-record-heading, .p-record-search, .p-record-actions, .p-todo-scopes, .p-record-views, .p-calendar-panel, .p-category-filter, .p-filter-details, .p-pin-gate) :is(button, input, select, summary):focus-visible,
.p-record-modal :is(button, input, textarea, select, summary):focus-visible,
.p-category-modal :is(button, input):focus-visible {
  outline: 3px solid #7ba2b9;
  outline-offset: 3px;
}

@media (min-width: 700px) {
  #life-tool-root .p-record { padding: 22px 24px; }
  #life-tool-root .p-calendar-panel { padding: 20px; }
  #life-tool-root .p-calendar-day { min-height: 50px; }
  .p-record-modal { --record-modal-pad: 24px; }
}
@media (max-width: 380px) {
  #life-tool-root .p-record { padding: 16px; }
  #life-tool-root .p-record-actions { gap: 4px; }
  #life-tool-root .p-record-actions button { padding-inline: 10px; font-size: 13px; }
  #life-tool-root .p-totals > div { padding: 14px 9px; }
  #life-tool-root .p-spending-bar { grid-template-columns: minmax(0, 1fr) auto; font-size: 12px; }
  .p-record-modal { --record-modal-pad: 16px; }
  .p-record-modal .p-form-row,
  .p-record-modal [data-todo-date] { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 520px) {
  .p-record-modal,
  .p-category-modal { max-height: calc(100dvh - 16px); }
  .p-record-modal .p-section-title { padding-block: 8px; }
  .p-record-modal .p-form-actions { padding-top: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
