:root {
  --app-font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --bg: #f6f7f4;
  --fg: #1d2521;
  --muted: #65746d;
  --line: #d8dfda;
  --line-soft: #e7ebe7;
  --surface: #ffffff;
  --surface-soft: #fbfcfa;
  --sidebar-bg: #fbfcfa;
  --content-bg: transparent;
  --accent: #2f8f7f;
  --accent-strong: #176557;
  --accent-soft: #e7f5f1;
  --warn: #c56b3e;
  --warn-soft: #fff0e9;
  --info: #5768c9;
  --info-soft: #eef0ff;
  --gold: #ad8420;
  --gold-soft: #fff6d8;
  --danger: #a94131;
  --danger-soft: #fff0ef;
  --shadow: 0 12px 34px rgba(31, 43, 37, .08);
  --shadow-soft: 0 4px 14px rgba(31, 43, 37, .05);
  --radius: 10px;
  --radius-lg: 16px;
  /* Firma visual: dos tonos que representan los dos hogares */
  --duo-a: #2f8f7f;
  --duo-b: #ad8420;
}

:root[data-color="azul"] {
  --accent: #466dcc;
  --accent-strong: #24448f;
  --accent-soft: #edf2ff;
  --sidebar-bg: #eef4ff;
  --content-bg: linear-gradient(180deg, #ffffff 0%, #f6f8ff 100%);
}

:root[data-color="terracota"] {
  --accent: #b86349;
  --accent-strong: #7f3826;
  --accent-soft: #fff0eb;
  --sidebar-bg: #fff3ed;
  --content-bg: linear-gradient(180deg, #fffdfb 0%, #fff7f1 100%);
}

:root[data-color="uva"] {
  --accent: #7654b7;
  --accent-strong: #4d3382;
  --accent-soft: #f3efff;
  --sidebar-bg: #f4f0ff;
  --content-bg: linear-gradient(180deg, #ffffff 0%, #f8f4ff 100%);
}

:root[data-color="verde"] {
  --sidebar-bg: #eefaf6;
  --content-bg: linear-gradient(180deg, #ffffff 0%, #f4faf7 100%);
}

:root[data-color="oceano"] {
  --accent: #0f7ea8;
  --accent-strong: #075979;
  --accent-soft: #e5f8ff;
  --sidebar-bg: #e8f7fb;
  --content-bg: linear-gradient(180deg, #ffffff 0%, #eff8ff 100%);
}

:root[data-color="menta"] {
  --accent: #20a67a;
  --accent-strong: #0b6f52;
  --accent-soft: #e9fbf4;
  --sidebar-bg: #e9fbf1;
  --content-bg: linear-gradient(180deg, #ffffff 0%, #f3fbf7 100%);
}

:root[data-color="coral"] {
  --accent: #e05f54;
  --accent-strong: #a5322d;
  --accent-soft: #fff0ef;
  --sidebar-bg: #fff1ec;
  --content-bg: linear-gradient(180deg, #fffdfb 0%, #fff6f4 100%);
}

:root[data-color="lavanda"] {
  --accent: #8b5cf6;
  --accent-strong: #5b34b1;
  --accent-soft: #f4f0ff;
  --sidebar-bg: #f2efff;
  --content-bg: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
}

:root[data-color="grafito"] {
  --accent: #475569;
  --accent-strong: #1f2937;
  --accent-soft: #eef2f7;
  --sidebar-bg: #eef2f4;
  --content-bg: linear-gradient(180deg, #ffffff 0%, #f5f7f8 100%);
}

:root[data-theme="dark"] {
  --bg: #07111f;
  --fg: #edf5ff;
  --muted: #9fb2cf;
  --line: #21334d;
  --line-soft: #172741;
  --surface: #0d1b2f;
  --surface-soft: #091729;
  --sidebar-bg: #081424;
  --content-bg: transparent;
  --accent: #67d3ff;
  --accent-strong: #a9e7ff;
  --accent-soft: #123451;
  --warn: #f7b267;
  --warn-soft: #3b2a1c;
  --info: #9aa7ff;
  --info-soft: #1b2448;
  --gold: #f4d35e;
  --gold-soft: #342d16;
  --danger: #ff8ba0;
  --danger-soft: #351b28;
  --shadow: 0 18px 48px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--app-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif);
  font-size: var(--base-font-size, 16px);
  letter-spacing: 0;
}

:root[data-theme="dark"] body {
  background: linear-gradient(180deg, #07111f 0%, #0a1729 48%, #07111f 100%);
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .login-card,
:root[data-theme="dark"] .install-card {
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .sidebar {
  background: #081424;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}
a { color: var(--accent-strong); }

.login-shell,
.install-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card,
.install-card {
  width: min(100%, 480px);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.premium-login-shell {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(7, 17, 31, .98), rgba(18, 39, 70, .96) 46%, rgba(11, 28, 49, .98)),
    var(--bg);
}

.premium-login-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(135deg, transparent, #000 18%, #000 72%, transparent);
  mask-image: linear-gradient(135deg, transparent, #000 18%, #000 72%, transparent);
  opacity: .55;
}

.premium-login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  min-height: 580px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-color: rgba(255,255,255,.18);
  background: rgba(9, 23, 41, .72);
  color: #edf5ff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .42);
  backdrop-filter: blur(18px);
}

.premium-login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(103, 211, 255, .22), transparent 32%),
    linear-gradient(310deg, rgba(154, 167, 255, .18), transparent 38%);
  pointer-events: none;
}

.premium-login-copy,
.premium-login-panel {
  position: relative;
  z-index: 1;
}

.premium-login-copy {
  display: grid;
  align-content: end;
  gap: 18px;
  padding: clamp(28px, 6vw, 54px);
  border-right: 1px solid rgba(255,255,255,.14);
}

.login-photo-panel {
  min-height: 580px;
  padding: 0;
  background:
    linear-gradient(135deg, rgba(103, 211, 255, .18), rgba(118, 84, 183, .12)),
    var(--login-photo, linear-gradient(135deg, #11283d, #08172a));
  background-size: cover;
  background-position: center;
}

.login-photo-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 14, 27, .12), rgba(5, 14, 27, .44)),
    linear-gradient(180deg, transparent, rgba(5, 14, 27, .22));
  pointer-events: none;
}

.premium-login-copy h1 {
  font-size: clamp(38px, 7vw, 64px);
  max-width: 9ch;
  margin-bottom: 0;
  color: #fff;
}

.premium-login-copy p {
  max-width: 48ch;
  color: #bfd0ea;
  line-height: 1.7;
}

.login-security-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-security-strip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,.07);
  color: #d9e9ff;
  font-size: 13px;
  font-weight: 800;
}

.premium-login-panel {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(24px, 5vw, 48px);
  background: rgba(255,255,255,.08);
}

.premium-login-panel h2,
.premium-login-panel label,
.premium-login-panel .small {
  color: #edf5ff;
}

.premium-login-panel input,
.premium-login-panel select {
  border-color: rgba(255,255,255,.18);
  background: rgba(5, 14, 27, .7);
  color: #fff;
}

.premium-login-panel input::placeholder {
  color: #8fa7c5;
}

.premium-submit {
  min-height: 48px;
  background: linear-gradient(135deg, #67d3ff, #7654b7);
  border-color: transparent;
  box-shadow: 0 14px 34px rgba(103, 211, 255, .24);
}

.link-btn {
  border: 0;
  background: transparent;
  color: #a9e7ff;
  padding: 0;
  width: fit-content;
  font-weight: 900;
}

.reset-panel {
  border-top: 1px solid rgba(255,255,255,.14);
  padding-top: 16px;
}

.status-pill {
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.premium-login-panel .status-pill {
  color: #a9e7ff;
  background: rgba(103,211,255,.12);
  border-color: rgba(103,211,255,.34);
}

.reset-card {
  position: relative;
  z-index: 1;
}

.login-top,
.app-header,
.section-title,
.row-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--app-font-display); letter-spacing: -.01em; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 6vw, 38px); font-weight: 600; line-height: 1.05; }
h2 { margin: 8px 0 0; font-size: clamp(24px, 5vw, 32px); font-weight: 600; line-height: 1.1; }
h3 { margin-bottom: 0; font-size: 19px; line-height: 1.2; }
.gradient-title {
  width: fit-content;
  max-width: 100%;
  font-family: var(--app-font-display);
  letter-spacing: -.01em;
  background: linear-gradient(100deg, var(--title-start, #6d5dfc) 0%, var(--title-end, #ca3f93) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

:root[data-title-gradient="on"] .card h3,
:root[data-title-gradient="on"] .app-header h2 {
  width: fit-content;
  max-width: 100%;
  font-family: var(--app-font-display);
  letter-spacing: -.01em;
  background: linear-gradient(100deg, var(--title-start, #6d5dfc) 0%, var(--title-end, #ca3f93) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.small { color: var(--muted); font-size: 13px; line-height: 1.5; }
.mt { margin-top: 16px; }
.stack { display: grid; gap: 12px; }
.wide { grid-column: 1 / -1; }
.fit { width: fit-content; }

.notice {
  border-radius: 8px;
  margin: 16px 0;
  padding: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.success { background: var(--accent-soft); color: var(--accent-strong); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); }
.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent); }

.app-shell {
  position: relative;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
}

.app-shell::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 40;
  background: linear-gradient(90deg, var(--duo-a) 0%, var(--duo-a) 49%, var(--duo-b) 51%, var(--duo-b) 100%);
}

.sidebar {
  position: sticky;
  top: 0;
  width: 318px;
  height: 100vh;
  flex: 0 0 318px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg, var(--surface-soft));
  padding: 24px 18px;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: width .22s ease, flex-basis .22s ease, padding .22s ease;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 12px;
}

.brand-identity {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.child-profile-mini {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface));
  padding: 12px;
}

.child-profile-mini > div {
  min-width: 0;
}

.child-profile-mini span:not(.badge-icon) {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.child-name {
  margin: 5px 0 2px;
  font-family: var(--app-font-display);
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -.01em;
  overflow-wrap: break-word;
  word-break: normal;
  display: inline-block;
  animation: childNameFloat 3.4s ease-in-out infinite;
  transform-origin: left center;
}

.logout-mini {
  color: var(--danger);
}

@keyframes childNameFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
    text-shadow: 0 0 0 transparent;
  }
  45% {
    transform: translateY(-2px) scale(1.015);
    text-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 28%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .child-name { animation: none; }
}

.side-actions {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.nav-grid {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 800;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.switch-btn,
.nav-btn,
.pill-btn,
.theme-mini-btn,
.primary-btn,
.outline-btn,
.ghost-btn,
.danger-btn {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
}

.switch-btn,
.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.switch-btn {
  border-color: var(--line);
  background: var(--surface);
  font-size: 13px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  position: relative;
}

.sidebar.collapsed {
  width: 76px;
  flex-basis: 76px;
  padding: 18px 10px;
}

.sidebar.collapsed .brand-row {
  justify-content: center;
}

.sidebar.collapsed .brand-row > div,
.sidebar.collapsed .pill-btn,
.sidebar.collapsed .switch-grid,
.sidebar.collapsed .nav-grid,
.sidebar.collapsed .custody-card,
.sidebar.collapsed .nav-toggle span {
  display: none;
}

.sidebar.collapsed .nav-toggle {
  margin-top: 12px;
}

.switch-btn.active,
.nav-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pill-btn,
.outline-btn,
.theme-mini-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent-strong);
}

.theme-mini-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.notification-bubble {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  background: #ff4d5a;
  color: #fff;
  border: 2px solid var(--surface);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.notification-dot {
  min-width: 12px;
  width: 12px;
  height: 12px;
  padding: 0;
  top: -2px;
  right: -2px;
  box-shadow: 0 0 0 3px color-mix(in srgb, #ff4d5a 18%, transparent);
}

.nav-btn .notification-bubble {
  top: 8px;
  right: 8px;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-btn:hover,
.switch-btn.active:hover,
.nav-btn.active:hover { filter: brightness(.96); }

.small-btn {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 13px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.danger-btn {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #fff;
}

.custody-card {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.progress.alt span { background: var(--warn); }

.content {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 36px;
  background: var(--content-bg);
}

.app-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 8px;
  text-align: center;
}

.stat,
.metric-card,
.status-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.stat strong,
.metric-card strong {
  display: block;
  font-size: 20px;
}

.stat span,
.metric-card span,
.muted { color: var(--muted); }

.section-shell { margin-top: 24px; }
.panel-stack { display: grid; gap: 20px; align-content: start; }

.online-footer {
  margin-top: 22px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, .12);
}

.dashboard-grid,
.two-grid,
.form-grid,
.setting-grid,
.status-grid {
  display: grid;
  gap: 12px;
}

.dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid,
.setting-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

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

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.metric-card strong {
  margin-top: 6px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1;
}

.summary-box {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--fg);
  padding: 16px;
  line-height: 1.6;
}

.summary-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.summary-list li::marker {
  color: var(--accent);
  font-weight: 900;
}

.quick-search-card input[type="search"] {
  margin-top: 14px;
}

.compact-search-card {
  padding: 12px;
}

.compact-search-card input[type="search"] {
  min-height: 40px;
  margin-top: 0;
}

.search-results {
  display: grid;
  gap: 8px;
}

.search-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--fg);
  padding: 10px;
  text-align: left;
}

.search-result small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.theme-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.event-card,
.item-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-soft);
}

.past-event {
  --section-color: #8a9390;
  background: color-mix(in srgb, #9ca3af 24%, var(--surface)) !important;
  border-color: color-mix(in srgb, #9ca3af 42%, var(--line)) !important;
  filter: grayscale(.62);
  opacity: .76;
}

.past-event .date-large,
.past-event .time-large,
.past-event .event-title {
  color: color-mix(in srgb, var(--muted) 78%, var(--fg));
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.badge-card {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 190px;
}

.visual-card {
  gap: 12px;
}

.visual-hero {
  display: none;
}

.visual-card .visual-hero {
  min-height: 132px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 70% 30%, color-mix(in srgb, var(--section-color) 26%, transparent), transparent 34%),
    color-mix(in srgb, var(--section-color) 14%, var(--surface));
}

.visual-orb {
  width: 78px;
  height: 78px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: var(--section-color);
  background: color-mix(in srgb, var(--section-color) 14%, var(--surface));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--section-color) 18%, transparent);
}

.visual-orb .nav-icon {
  width: 38px;
  height: 38px;
}

.event-title {
  display: block;
  margin-top: 2px;
  color: var(--fg);
  font-size: 16px;
  line-height: 1.25;
}

.upcoming-card .event-title {
  min-height: 0;
}

.upcoming-card {
  gap: 7px;
  min-height: 0;
  padding: 12px;
}

.upcoming-card.visual-card .visual-hero {
  min-height: 76px;
}

.upcoming-card .visual-orb {
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

.upcoming-card .visual-orb .nav-icon {
  width: 28px;
  height: 28px;
}

.upcoming-card .date-large {
  font-size: clamp(22px, 2.6vw, 28px);
}

.upcoming-card .time-large {
  font-size: 17px;
}

.date-large {
  color: var(--fg);
  font-size: clamp(22px, 3.2vw, 30px);
  line-height: 1;
  font-weight: 900;
}

.time-large {
  color: var(--accent-strong);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
}

.event-detail,
.medication-line {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.health-badge {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 14px;
}

.health-badge p { margin-bottom: 8px; }
.health-badge strong {
  display: block;
  margin-bottom: 5px;
  color: var(--fg);
  font-size: 22px;
}

.today-reminder-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid color-mix(in srgb, #f97316 48%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 92% 18%, rgba(255, 191, 87, .34), transparent 30%),
    linear-gradient(135deg, color-mix(in srgb, #f97316 16%, var(--surface)), color-mix(in srgb, #f59e0b 10%, var(--surface)));
  color: var(--fg);
  padding: 14px;
  box-shadow: 0 12px 28px rgba(249, 115, 22, .12);
  animation: todayReminderPulse 2.6s ease-in-out infinite;
}

.today-reminder-card strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.today-reminder-card span,
.today-reminder-card em {
  display: block;
  margin-top: 3px;
  color: color-mix(in srgb, #c2410c 78%, var(--fg));
  font-style: normal;
  font-weight: 900;
}

.today-reminder-card .badge-icon {
  color: #f97316;
  border-color: rgba(249, 115, 22, .34);
  background: rgba(255, 255, 255, .68);
}

@keyframes todayReminderPulse {
  0%, 100% { box-shadow: 0 12px 28px rgba(249, 115, 22, .12); }
  50% { box-shadow: 0 18px 34px rgba(249, 115, 22, .24); }
}

@media (prefers-reduced-motion: reduce) {
  .today-reminder-card {
    animation: none;
  }
}

.badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  border: 1px solid var(--line);
}

.badge-icon.mini {
  width: 32px;
  height: 32px;
}

.badge-icon .nav-icon {
  width: 20px;
  height: 20px;
}

.custom-section-icon {
  object-fit: cover;
  border-radius: 6px;
}

.badge-icon[style] {
  color: var(--section-color);
  background: color-mix(in srgb, var(--section-color) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--section-color) 35%, var(--line));
}

.animated-icon .nav-icon,
.badge-icon .nav-icon,
.visual-orb .nav-icon {
  animation: badgeIconFloat 2.8s ease-in-out infinite;
  transform-origin: center;
}

.custom-badge {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--badge-start), var(--badge-end));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--badge-start) 18%, transparent);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
}

.logbook-tone-feeling {
  --badge-start: #ec4899;
  --badge-end: #8b5cf6;
}

.logbook-tone-enjoyed {
  --badge-start: #06b6d4;
  --badge-end: #2563eb;
}

.logbook-tone-behavior {
  --badge-start: #10b981;
  --badge-end: #0f766e;
}

.finance-status.status-paid { --badge-start: #16a34a; --badge-end: #22c55e; }
.finance-status.status-pending { --badge-start: #f97316; --badge-end: #facc15; }
.finance-status.status-compensated { --badge-start: #2563eb; --badge-end: #38bdf8; }

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.finance-history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.finance-history-table th,
.finance-history-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.finance-history-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
}

.finance-history-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

@keyframes badgeIconFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .animated-icon .nav-icon,
  .badge-icon .nav-icon,
  .visual-orb .nav-icon {
    animation: none;
  }
}

.health-status-card {
  display: grid;
  gap: 14px;
}

.personal-dossier-card {
  background:
    radial-gradient(circle at 86% 10%, color-mix(in srgb, var(--section-color) 18%, transparent), transparent 32%),
    var(--surface);
}

.dossier-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.dossier-head strong {
  display: block;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1;
}

.dossier-head span:not(.badge-icon) {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 900;
}

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

.dossier-group {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.dossier-group h4 {
  margin: 0 0 10px;
  color: var(--section-color);
}

.dossier-group div {
  display: grid;
  grid-template-columns: minmax(90px, .55fr) minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
}

.dossier-group span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.dossier-group strong {
  overflow-wrap: anywhere;
}

.form-divider {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--accent-strong);
}

.notification-modal-content,
.personal-modal-content {
  width: min(100%, 760px);
}

.config-modal-content {
  width: min(100%, 1040px);
}

.config-modal-content .parent-badge-setting-grid,
.config-modal-content .icon-setting-grid {
  max-height: min(58vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.icon-modal-content {
  width: min(100%, 760px);
}

.family-name-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--section-color) 32%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 94% 0%, color-mix(in srgb, var(--section-color) 14%, transparent), transparent 34%),
    var(--surface-soft);
  padding: 16px;
}

.family-name-card > div {
  min-width: 0;
}

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

.unread-notification {
  border-color: color-mix(in srgb, #ff4d5a 34%, var(--line));
  background:
    linear-gradient(90deg, color-mix(in srgb, #ff4d5a 9%, transparent), transparent),
    var(--surface-soft);
}

.unread-notification span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.section-icon-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.section-icon-preview-grid div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.icon-upload-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  border: 1px dashed color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.icon-upload-card input {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.section-icon-upload-list {
  display: grid;
  gap: 10px;
  max-height: min(62vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.icon-upload-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(180px, 260px);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.icon-upload-meta {
  min-width: 0;
}

.icon-upload-meta strong,
.icon-upload-meta small {
  display: block;
}

.icon-upload-meta small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.icon-upload-row label {
  font-size: 12px;
}

.icon-upload-row .file-drop-zone {
  padding: 8px;
}

.section-icon-preview-grid .badge-icon {
  grid-row: span 2;
}

.section-icon-preview-grid small {
  color: var(--muted);
  font-size: 12px;
}

.success-burst {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.success-burst-card {
  position: relative;
  min-width: 210px;
  border: 1px solid color-mix(in srgb, #22c55e 42%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, #ffffff 92%, #dcfce7);
  color: #14532d;
  padding: 22px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(20, 83, 45, .22);
  animation: successPop .42s ease-out both;
}

:root[data-theme="dark"] .success-burst-card {
  background: #0f2c25;
  color: #bbf7d0;
}

.success-paid .success-burst-card {
  border-color: color-mix(in srgb, #06b6d4 45%, #22c55e);
  background:
    radial-gradient(circle at 80% 0%, rgba(6, 182, 212, .24), transparent 38%),
    color-mix(in srgb, #ecfdf5 88%, #dbeafe);
  color: #064e3b;
}

:root[data-theme="dark"] .success-paid .success-burst-card {
  background:
    radial-gradient(circle at 80% 0%, rgba(6, 182, 212, .22), transparent 38%),
    #082f2a;
  color: #bbf7d0;
}

.success-check {
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #22c55e;
  color: #fff;
}

.success-check .nav-icon {
  width: 30px;
  height: 30px;
}

.success-pig {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f9a8d4, #fef3c7);
  box-shadow: 0 16px 34px rgba(236, 72, 153, .25);
  font-size: 34px;
  animation: pigPaidBounce .72s ease-out both;
}

.cash-flow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cash-flow b {
  position: absolute;
  border-radius: 999px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: #22c55e;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(34, 197, 94, .24);
  animation: cashFloat 1.2s ease-out both;
}

.cash-flow b:nth-child(1) { left: 18px; top: 52px; }
.cash-flow b:nth-child(2) { right: 26px; top: 42px; animation-delay: .1s; }
.cash-flow b:nth-child(3) { left: 50%; bottom: 24px; animation-delay: .18s; }

.success-burst-card i {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  animation: confettiFloat 1.1s ease-out both;
}

.success-burst-card i:nth-child(3) { top: 10px; left: 24px; background: #f97316; }
.success-burst-card i:nth-child(4) { top: 18px; right: 28px; background: #38bdf8; animation-delay: .05s; }
.success-burst-card i:nth-child(5) { bottom: 18px; left: 34px; background: #a78bfa; animation-delay: .08s; }
.success-burst-card i:nth-child(6) { bottom: 12px; right: 38px; background: #facc15; animation-delay: .12s; }
.success-burst-card i:nth-child(7) { top: 50%; left: 8px; background: #22c55e; animation-delay: .16s; }
.success-burst-card i:nth-child(8) { top: 50%; right: 8px; background: #ef4444; animation-delay: .2s; }

@keyframes successPop {
  from { transform: translateY(12px) scale(.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes confettiFloat {
  from { transform: translateY(0) scale(.7); opacity: 0; }
  30% { opacity: 1; }
  to { transform: translateY(-28px) scale(1.1); opacity: 0; }
}

@keyframes pigPaidBounce {
  0% { transform: translateY(12px) scale(.72) rotate(-4deg); opacity: 0; }
  55% { transform: translateY(-5px) scale(1.08) rotate(3deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}

@keyframes cashFloat {
  from { transform: translateY(14px) scale(.75); opacity: 0; }
  30% { opacity: 1; }
  to { transform: translateY(-34px) scale(1.08); opacity: 0; }
}

.logbook-form-card {
  background:
    radial-gradient(circle at 90% 0%, color-mix(in srgb, var(--section-color) 18%, transparent), transparent 34%),
    color-mix(in srgb, var(--section-color) 8%, var(--surface));
}

.choice-block {
  display: grid;
  gap: 10px;
}

.choice-block > strong {
  font-size: 15px;
}

.mood-picker,
.chip-grid,
.logbook-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mood-choice,
.choice-chip {
  position: relative;
}

.mood-choice input,
.choice-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mood-choice span {
  min-width: 86px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 8px;
  color: var(--muted);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .04);
}

.mood-choice b {
  font-size: 28px;
  line-height: 1;
}

.mood-choice small {
  font-size: 11px;
  font-weight: 900;
}

.mood-choice input:checked + span {
  border-color: color-mix(in srgb, var(--section-color) 58%, var(--line));
  background: color-mix(in srgb, var(--section-color) 13%, var(--surface));
  color: var(--section-color);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--section-color) 16%, transparent);
}

.choice-chip span,
.logbook-tags .tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--chip-color, var(--accent)) 40%, var(--line));
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 10%, var(--surface));
  color: var(--chip-color, var(--accent-strong));
  font-weight: 900;
  font-size: 13px;
}

.choice-chip input:checked + span {
  background: var(--chip-color, var(--accent));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--chip-color, var(--accent)) 24%, transparent);
}

.tone-a,
.tag-a { --chip-color: #d15b8f; }
.tone-b,
.tag-b { --chip-color: #4f8dd8; }
.tone-c,
.tag-c { --chip-color: #22a06b; }

.logbook-card .small {
  line-height: 1.55;
}

.finance-record-card select {
  margin-top: 0;
}

.finance-split-panel {
  border: 1px solid color-mix(in srgb, var(--section-color, var(--accent)) 45%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 90% 8%, color-mix(in srgb, var(--section-color, var(--accent)) 20%, transparent), transparent 34%),
    color-mix(in srgb, var(--section-color, var(--accent)) 9%, var(--surface));
  padding: 16px;
  box-shadow: 0 14px 34px color-mix(in srgb, var(--section-color, var(--accent)) 14%, transparent);
}

.finance-split-panel input[type="range"] {
  padding: 0;
  min-height: 34px;
  accent-color: var(--section-color, var(--accent));
}

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

.finance-split-results div {
  border: 1px solid color-mix(in srgb, var(--section-color, var(--accent)) 34%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.finance-split-results span,
.finance-split-line {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.finance-split-results strong {
  display: block;
  margin-top: 4px;
  color: var(--fg);
}

.finance-split-line {
  margin: 0;
}

.finance-chart-card {
  overflow: hidden;
}

.compact-select {
  max-width: 220px;
}

.finance-chart-layout {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-top: 18px;
}

.donut-chart {
  width: min(100%, 250px);
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--donut-gradient);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--section-color, var(--accent)) 25%, transparent);
  position: relative;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: inherit;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.donut-chart > div {
  position: relative;
  z-index: 1;
  text-align: center;
}

.donut-chart span,
.chart-legend-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.donut-chart strong {
  display: block;
  font-size: 22px;
}

.chart-legend {
  display: grid;
  gap: 8px;
}

.chart-legend-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
}

.chart-legend-row > span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--legend-color);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--legend-color) 18%, transparent);
}

.growth-form-card {
  overflow: hidden;
}

.growth-timeline-card {
  overflow: hidden;
}

.growth-analysis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.growth-analysis div {
  border: 1px solid color-mix(in srgb, var(--section-color, var(--accent)) 35%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.growth-analysis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.growth-analysis strong {
  display: block;
  margin: 5px 0 10px;
  font-size: 18px;
}

.growth-analysis i {
  display: block;
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #67d3ff, #8b5cf6, #22c55e) 0 0 / var(--trend, 40%) 100% no-repeat,
    var(--line-soft);
  animation: trendPulse 2.2s ease-in-out infinite;
}

.growth-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.growth-timeline::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 18px;
  height: 2px;
  background: linear-gradient(90deg, #67d3ff, #8b5cf6, #22c55e);
}

.growth-point {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 16px 34px color-mix(in srgb, var(--section-color, var(--accent)) 12%, transparent);
}

.growth-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--section-color, var(--accent));
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--section-color, var(--accent)) 16%, transparent);
  animation: badgeIconFloat 2.2s ease-in-out infinite;
}

.growth-values {
  display: grid;
  gap: 8px;
}

.growth-values span {
  display: grid;
  gap: 2px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--section-color, var(--accent)) 9%, var(--surface-soft));
  padding: 8px;
  color: var(--fg);
}

.growth-values b,
.growth-values small {
  color: var(--muted);
  font-size: 12px;
}

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

.backup-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.backup-card h3 {
  margin: 0;
}

.backup-console {
  border: 1px solid color-mix(in srgb, #67d3ff 28%, var(--line));
  border-radius: 8px;
  background: #06111f;
  color: #a9e7ff;
  padding: 14px;
  display: grid;
  gap: 6px;
  font-family: Consolas, "Courier New", monospace;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

.backup-console code {
  color: inherit;
  white-space: pre-wrap;
}

@keyframes trendPulse {
  0%, 100% { opacity: .78; }
  50% { opacity: 1; }
}

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

.learned-memory-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.learned-memory-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(100%, 460px);
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  padding: 5px 7px 5px 5px;
  box-shadow: none;
}

.learned-memory-badge .badge-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 12px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--fg) 10%, var(--surface));
  color: var(--accent-strong);
  box-shadow: none;
}

:root[data-theme="dark"] .learned-memory-badge .badge-icon {
  background: #071827;
  color: #8bd7ff;
}

.learned-memory-badge strong {
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  font-size: 14px;
  line-height: 1.25;
}

.learned-memory-badge button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--muted);
  font-weight: 900;
  line-height: 1;
}

.learned-memory-badge button:hover {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
}

.section-accent {
  --section-color: var(--accent);
}

.event-card.section-accent,
.item-card.section-accent,
.gallery-card.section-accent,
.health-badge.section-accent {
  border-color: color-mix(in srgb, var(--section-color) 50%, var(--line));
  background: color-mix(in srgb, var(--section-color) 14%, var(--surface));
}

.section-accent .time-large,
.section-accent .config-chevron,
.section-accent .file-link {
  color: var(--section-color);
}

.section-accent .tag-blue,
.section-accent .tag-green,
.section-accent .tag-gold,
.section-accent .tag-soft {
  background: color-mix(in srgb, var(--section-color) 15%, var(--surface));
  color: var(--section-color);
  border-color: color-mix(in srgb, var(--section-color) 55%, var(--line));
}

.section-accent .badge-icon {
  color: var(--section-color);
  border-color: color-mix(in srgb, var(--section-color) 45%, var(--line));
}

.color-setting-grid,
.icon-setting-grid,
.parent-badge-setting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.color-setting-grid input[type="color"] {
  padding: 4px;
  min-height: 42px;
}

.parent-badge-control {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.parent-badge-control legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.parent-badge,
.switch-btn.parent-switch.active {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--parent-start), var(--parent-end));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--parent-end) 22%, transparent);
}

.switch-btn.parent-switch {
  border-color: color-mix(in srgb, var(--parent-start) 42%, var(--line));
  background: color-mix(in srgb, var(--parent-start) 8%, var(--surface));
  color: color-mix(in srgb, var(--parent-start) 70%, var(--fg));
}

.event-tags {
  align-items: flex-start;
  min-height: 32px;
}

.upcoming-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.row-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(140px, 170px) auto;
  align-items: center;
  gap: 12px;
}

.kind-Medico { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.kind-Escuela { border-color: var(--info); background: var(--info-soft); color: var(--info); }
.kind-Custodia { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.kind-Recordatorio { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag-blue { background: var(--info-soft); color: var(--info); }
.tag-green { background: var(--accent-soft); color: var(--accent-strong); border: 1px solid var(--accent); }
.tag-soft { background: var(--surface-soft); color: var(--muted); border: 1px solid var(--line-soft); }
.tag-gold { background: var(--gold-soft); color: var(--gold); }

.event-card.section-accent,
.item-card.section-accent,
.gallery-card.section-accent,
.health-badge.section-accent {
  border-color: color-mix(in srgb, var(--section-color) 50%, var(--line));
  background: color-mix(in srgb, var(--section-color) 14%, var(--surface));
  color: var(--fg);
}

.section-accent .time-large,
.section-accent .file-link {
  color: var(--section-color);
}

.section-accent .tag-blue,
.section-accent .tag-green,
.section-accent .tag-gold,
.section-accent .tag-soft {
  background: color-mix(in srgb, var(--section-color) 15%, var(--surface));
  color: var(--section-color);
  border-color: color-mix(in srgb, var(--section-color) 55%, var(--line));
}

.config-panel {
  padding: 0;
  overflow: hidden;
}

.config-button {
  width: 100%;
  min-height: 64px;
  border: 0;
  background: transparent;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  text-align: left;
}

.config-button strong,
.config-button small {
  display: block;
}

.config-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.config-chevron {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.config-body {
  border-top: 1px solid var(--line-soft);
  padding: 18px;
}

.personalization-launchers,
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.choice-card,
.album-card {
  width: 100%;
  min-height: 138px;
  border: 1px solid color-mix(in srgb, var(--section-color, var(--accent)) 38%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 80% 8%, color-mix(in srgb, var(--section-color, var(--accent)) 18%, transparent), transparent 36%),
    var(--surface-soft);
  color: var(--fg);
  padding: 16px;
  text-align: left;
  display: grid;
  align-content: center;
  gap: 8px;
}

.choice-card {
  cursor: pointer;
}

.choice-card .nav-icon {
  color: var(--section-color, var(--accent));
}

.choice-card strong,
.album-card strong {
  font-size: 18px;
}

.compact-tabs {
  padding: 12px;
}

.ai-analysis-card {
  background:
    radial-gradient(circle at 94% 0%, color-mix(in srgb, var(--section-color) 22%, transparent), transparent 34%),
    var(--surface);
}

.memory-card {
  min-height: 230px;
}

.past-events-section {
  background: color-mix(in srgb, var(--muted) 7%, var(--surface));
}

.notification-feed {
  display: grid;
  gap: 8px;
}

.notification-item {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.security-alerts {
  display: grid;
  gap: 8px;
}

.security-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: color-mix(in srgb, var(--danger) 38%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.brand-preview-row {
  display: grid;
  grid-template-columns: auto 44px auto 54px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.brand-preview-row img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.brand-preview-row img:last-child {
  width: 54px;
  height: 54px;
}

.login-image-preview {
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
    var(--login-photo, var(--surface-soft));
  background-size: cover;
  background-position: center;
  font-weight: 800;
}

.check-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: auto;
  min-height: auto;
  margin: 0;
}

label {
  display: block;
  color: var(--fg);
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  padding: 11px 12px;
  margin-top: 8px;
}

input[type="file"] {
  padding: 9px;
  background: var(--surface-soft);
}

.money-field {
  position: relative;
}

.money-field::after {
  content: "$";
  position: absolute;
  left: 12px;
  bottom: 13px;
  color: var(--accent-strong);
  font-weight: 900;
  pointer-events: none;
}

.money-field input {
  padding-left: 30px;
}

.file-drop-zone {
  border: 1px dashed color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent),
    var(--surface-soft);
  padding: 12px;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.file-drop-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  transform: translateY(-1px);
}

.file-drop-zone input[type="file"] {
  border: 0;
  background: transparent;
  padding: 0;
}

.file-drop-hint,
.file-drop-name {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.file-drop-name {
  color: var(--accent-strong);
}

.upload-progress {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.upload-progress span {
  position: relative;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--line-soft));
}

.upload-progress span::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--upload-progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width .18s ease;
}

.upload-progress strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.upload-progress small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}

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

textarea.compact { min-height: 132px; }

.form-action {
  display: flex;
  align-items: end;
  justify-content: flex-start;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.inline-reset {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.full { width: 100%; }
.file-link {
  display: inline-flex;
  margin-top: 8px;
  font-weight: 800;
  text-decoration: none;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(56px, 1fr));
  gap: 0;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.day-name {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  padding: 10px 8px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.day {
  min-height: 96px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 9px;
  font-size: 14px;
}

.clickable-day {
  cursor: pointer;
  transition: background .16s ease, transform .16s ease;
}

.clickable-day:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.day:nth-child(7n) { border-right: 0; }
.day.blank { background: var(--surface-soft); }
.day.today { box-shadow: inset 0 0 0 2px var(--accent); }

.day strong {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
}

.day.today strong {
  color: #fff;
  background: var(--accent);
}

.day-event {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 6px;
  margin-top: 6px;
  padding: 5px 6px;
  font-size: 12px;
}

.day-event[style] {
  border: 1px solid color-mix(in srgb, var(--section-color) 42%, transparent);
  background: color-mix(in srgb, var(--section-color) 15%, var(--surface));
  color: var(--section-color);
}

.day-more {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.mini-checklist {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mini-checklist li::marker {
  color: var(--section-color, var(--accent));
}

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

.gallery-view-large .gallery-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.gallery-view-large .gallery-card img {
  aspect-ratio: 16 / 10;
}

.gallery-view-thumbs .gallery-card {
  display: grid;
  align-content: start;
}

.gallery-view-thumbs .gallery-card img {
  aspect-ratio: 1 / 1;
}

.gallery-view-thumbs .gallery-card > div {
  padding: 9px;
}

.gallery-view-thumbs .gallery-card .button-row {
  gap: 5px;
}

.gallery-view-thumbs .gallery-card .outline-btn,
.gallery-view-thumbs .gallery-card .ghost-btn {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.gallery-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.gallery-card.selected {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--section-color, var(--accent)) 24%, transparent);
}

.gallery-select {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .92);
  background: rgba(5, 11, 20, .42);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .22);
}

.gallery-select.checked {
  background: linear-gradient(135deg, var(--section-color, var(--accent)), var(--accent-strong));
}

.gallery-select .nav-icon {
  width: 17px;
  height: 17px;
}

.album-card {
  position: relative;
  width: 100%;
  max-width: 220px;
  min-height: 0;
  aspect-ratio: 1;
  padding: 14px;
  align-content: end;
  overflow: hidden;
}

.album-grid {
  grid-template-columns: repeat(auto-fill, minmax(158px, 220px));
  justify-content: start;
}

.album-card::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 12px;
  width: 42%;
  height: 24px;
  border-radius: 8px 8px 0 0;
  background: color-mix(in srgb, var(--section-color, var(--accent)) 24%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--section-color, var(--accent)) 34%, var(--line));
  border-bottom: 0;
}

.album-folder {
  position: relative;
  min-height: 0;
  height: 82px;
  border: 1px solid color-mix(in srgb, var(--section-color, var(--accent)) 40%, var(--line));
  border-radius: 8px;
  margin-top: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--section-color, var(--accent)) 18%, var(--surface)), var(--surface-soft));
  display: grid;
  place-items: center;
  overflow: hidden;
}

.album-folder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .82;
}

.gallery-image-btn {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  display: block;
  overflow: hidden;
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--line-soft);
}

.gallery-card div { padding: 12px; }

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
}

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgba(2, 8, 18, .74);
  backdrop-filter: blur(4px);
}

.gallery-modal-content {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  max-height: calc(100vh - 44px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--section-color) 38%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
  display: grid;
}

.gallery-modal-content img {
  width: 100%;
  max-height: min(72vh, 720px);
  object-fit: contain;
  background: #050b14;
}

.gallery-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  color: #fff;
  background: rgba(5, 11, 20, .72);
  border-color: rgba(255, 255, 255, .18);
}

.gallery-modal-caption {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.share-modal-content,
.day-modal-content {
  position: relative;
  z-index: 1;
  width: min(100%, 820px);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--section-color, var(--accent)) 38%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
  padding: 20px;
}

.day-modal-content {
  width: min(100%, 720px);
}

.day-modal-content .record-grid {
  grid-template-columns: minmax(0, 420px);
  justify-content: center;
}

.day-modal-content .empty-state {
  text-align: center;
}

.day-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.day-event-form {
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.share-result input {
  font-size: 13px;
}

.font-preview-light {
  border: 1px solid #dce3ea;
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  color: #182536;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

.font-preview-light span {
  display: block;
  margin-bottom: 8px;
  color: #5f6f86;
  font-size: 13px;
  font-weight: 800;
}

.font-preview-light strong {
  display: block;
  font-size: 1.25em;
  line-height: 1.2;
}

.font-preview-light p {
  margin: 8px 0 0;
  color: #526174;
}
.audit-list { max-height: calc(100vh - 220px); overflow: auto; padding-right: 4px; }

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.empty-state {
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  padding: 16px;
}

.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  background: var(--danger-soft);
}

.hidden { display: none !important; }

@media (max-width: 1100px) {
  .app-shell { display: block; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-btn { justify-content: center; text-align: center; }
  .custody-card { display: none; }
  .content { padding: 24px 20px 32px; }
  .sidebar.collapsed {
    width: 100%;
    height: auto;
    flex-basis: auto;
    padding: 18px;
  }
  .sidebar.collapsed .brand-row {
    justify-content: space-between;
  }
  .sidebar.collapsed .brand-row > div,
  .sidebar.collapsed .pill-btn,
  .sidebar.collapsed .nav-toggle span {
    display: block;
  }
  .sidebar.collapsed .brand-identity {
    display: grid;
  }
  .sidebar.collapsed .brand-actions {
    display: flex;
  }
  .sidebar.collapsed .switch-grid,
  .sidebar.collapsed .nav-grid,
  .sidebar.collapsed .custody-card {
    display: none;
  }
}

@media (max-width: 820px) {
  .premium-login-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .premium-login-copy {
    align-content: start;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.14);
    padding: 28px;
  }
  .login-photo-panel {
    min-height: 260px;
    padding: 0;
  }
  .premium-login-copy h1 {
    max-width: none;
    font-size: 34px;
  }
  .premium-login-copy p {
    margin-bottom: 0;
  }
  .premium-login-panel {
    padding: 24px;
  }
  .app-header {
    display: grid;
  }
  .stats-grid,
  .dashboard-grid,
  .dashboard-grid.four,
  .two-grid,
  .form-grid,
  .setting-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }
  .record-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .finance-chart-layout {
    grid-template-columns: 1fr;
  }
  .growth-analysis,
  .growth-timeline,
  .backup-layout {
    grid-template-columns: 1fr;
  }
  .growth-timeline::before {
    display: none;
  }
  .donut-chart {
    justify-self: center;
  }
  .color-setting-grid,
  .icon-setting-grid,
  .parent-badge-setting-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .icon-upload-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .icon-upload-row label {
    grid-column: 1 / -1;
  }
  .dossier-grid,
  .section-icon-preview-grid {
    grid-template-columns: 1fr;
  }
  .row-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-view-large .gallery-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .login-shell,
  .install-body { padding: 16px; }
  .login-card,
  .install-card,
  .card { padding: 16px; }
  .premium-login-card { padding: 0; }
  .premium-login-copy,
  .premium-login-panel { padding: 20px; }
  .login-photo-panel {
    min-height: 220px;
    padding: 0;
  }
  .login-security-strip { display: none; }
  .premium-login-panel .login-top { display: grid; }
  .sidebar { padding: 12px; }
  .content { padding: 14px 12px 24px; }
  .brand-row { display: grid; align-items: stretch; }
  .child-name { font-size: 18px; }
  .brand-row .small { margin-bottom: 0; }
  .switch-grid { grid-template-columns: 1fr; }
  .nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-btn {
    min-height: 40px;
    padding: 8px;
    font-size: 13px;
    text-align: center;
  }
  .nav-icon { width: 16px; height: 16px; }
  .app-header { padding-bottom: 12px; }
  .section-shell { margin-top: 14px; }
  .panel-stack { gap: 12px; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding: 8px; }
  .stat strong { font-size: 16px; }
  .stat span { font-size: 11px; }
  h2 { font-size: 22px; }
  .calendar { grid-template-columns: repeat(7, minmax(32px, 1fr)); gap: 4px; }
  .day-name { padding: 4px; font-size: 12px; }
  .day { min-height: 46px; padding: 5px; font-size: 12px; }
  .day-event { display: none; }
  .day-more { display: none; }
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-view-large .gallery-grid { grid-template-columns: 1fr; }
  .gallery-modal { padding: 10px; }
  .gallery-modal-content { max-height: calc(100vh - 20px); }
  .gallery-modal-content img { max-height: 64vh; }
  .share-modal-content,
  .day-modal-content {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }
  .record-grid { grid-template-columns: 1fr; }
  .learned-memory-form { grid-template-columns: 1fr; }
  .chart-legend-row { grid-template-columns: 14px minmax(0, 1fr); }
  .chart-legend-row em { grid-column: 2; }
  .color-setting-grid,
  .icon-setting-grid,
  .parent-badge-setting-grid { grid-template-columns: 1fr; }
  .child-profile-mini,
  .family-name-card,
  .icon-upload-row {
    grid-template-columns: 1fr;
  }
  .icon-upload-row .badge-icon,
  .family-name-card .badge-icon {
    justify-self: start;
  }
  .dossier-group div { grid-template-columns: 1fr; gap: 2px; }
  .inline-reset { grid-template-columns: 1fr; }
  .section-title,
  .row-between,
  .theme-card,
  .section-toolbar {
    display: grid;
  }
  .button-row { align-items: stretch; }
  .button-row > * { flex: 1 1 auto; }
}
