:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #211d2f;
  background: var(--theme-bg);
  --purple: #6b4eff;
  --purple-dark: #5137d8;
  --ink: #211d2f;
  --muted: #736f80;
  --panel: rgba(255,255,255,.92);
  --line: #e7e2f2;
  --good: #248a63;
  --warn: #c66a1b;
  --danger: #b43e55;
  --theme-soft: #eee9ff;
  --theme-bg: #f6f4fb;
  --theme-accent: #aa74ff;
}

.brand-logo{display:block;object-fit:cover;border-radius:22%;box-shadow:0 6px 20px rgba(30,10,70,.22)}
.brand-logo-auth{width:88px;height:88px;margin:0 auto 14px}
.brand-logo-loading{width:72px;height:72px;flex:0 0 auto}
.brand-logo-header{width:46px;height:46px;float:left;margin:0 12px 0 0}
@media(max-width:640px){.brand-logo-header{width:40px;height:40px;margin-right:9px}.brand-logo-auth{width:76px;height:76px}}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background:
  radial-gradient(circle at 85% 0%, var(--theme-soft) 0, transparent 27rem),
  linear-gradient(180deg, #ffffff 0, var(--theme-bg) 100%); }
button, input, select, textarea { font: inherit; }
button { border: 0; border-radius: 12px; padding: .8rem 1rem; background: var(--purple); color: white; font-weight: 750; cursor: pointer; }
button:hover { background: var(--purple-dark); }
button.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: #fff0f3; color: var(--danger); }
.topbar, main { width: min(1180px, calc(100% - 28px)); margin-inline: auto; }
.topbar { padding: 34px 0 18px; display: flex; justify-content: space-between; gap: 20px; align-items: end; }
.topbar h1 { max-width: 700px; margin: 3px 0 0; font-size: clamp(1.65rem, 4vw, 3.1rem); line-height: 1.04; }
.eyebrow { margin: 0; font-size: .73rem; letter-spacing: .15em; font-weight: 850; color: var(--purple); }
.date-chip { background: white; border: 1px solid var(--line); border-radius: 999px; padding: .7rem 1rem; white-space: nowrap; }
.hero-card, .panel, .countdown-card, .profile-card { background: var(--panel); border: 1px solid rgba(221,216,235,.9); box-shadow: 0 16px 50px rgba(58,42,98,.06); }
.hero-card { border-radius: 24px; padding: clamp(18px,4vw,34px); display: grid; grid-template-columns: 1fr 1.25fr; gap: 28px; align-items: center; }
.hero-card h2, .section-heading h2 { margin: 5px 0; }
.muted { color: var(--muted); }
.quick-form { display: flex; gap: 10px; }
.quick-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: .95rem 1rem; background: white; }
.quick-result { grid-column: 1 / -1; border-radius: 15px; padding: 14px; background: #f0ecff; }
.quick-result{position:relative;padding-right:48px}
.quick-result-close{position:absolute;top:8px;right:8px;width:34px!important;min-width:34px!important;height:34px;padding:0!important;border-radius:999px!important;background:transparent!important;color:var(--text,#202028)!important;font-size:1.35rem;line-height:1}
.task-heading-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
#taskPrintSheet{display:none}
@media print{
  @page{size:letter portrait;margin:.32in}
  body.task-printing{background:#fff!important;color:#111!important}
  body.task-printing>*:not(#taskPrintSheet){display:none!important}
  body.task-printing #taskPrintSheet{display:block!important;box-sizing:border-box;width:100%;height:10.3in;overflow:hidden;font-family:Arial,sans-serif;font-size:var(--task-print-font-size,10pt);color:#111;background:#fff}
  #taskPrintSheet header{display:flex;align-items:baseline;gap:.15in .28in;border-bottom:2px solid #275f46;padding:0 0 .1in;margin:0 0 .12in;flex-wrap:wrap}
  #taskPrintSheet header p{margin:0;color:#275f46;font-weight:800;letter-spacing:.12em}
  #taskPrintSheet header h1{margin:0;font-size:1.55em;flex:1}
  #taskPrintSheet header small{white-space:nowrap}
  .task-print-list{column-count:var(--task-print-columns,1);column-gap:.25in;column-rule:1px solid #ccc}
  .task-print-item{break-inside:avoid;border-bottom:1px solid #bbb;padding:.055in 0 .07in;margin:0}
  .task-print-item h2{display:flex;gap:.07in;align-items:flex-start;margin:0;font-size:1.08em;line-height:1.16}
  .task-print-item p{margin:.025in 0 0 .22in;color:#444;font-size:.88em;line-height:1.15}
  .task-print-item ul{list-style:none;margin:.035in 0 0 .22in;padding:0;display:grid;gap:.015in}
  .task-print-item li{display:flex;gap:.06in;line-height:1.12}
  .task-print-checkbox{display:inline-grid;place-items:center;box-sizing:border-box;flex:0 0 .15in;width:.15in;height:.15in;border:1px solid #333;font-size:.75em}
}
@media(max-width:520px){.task-heading-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}.task-heading-actions button{width:100%}}
.quick-ai-notice { font-size: .82rem; line-height: 1.4; margin: .7rem 0 0; color: var(--muted, #666); }
.hidden { display: none !important; }
[hidden],html body [hidden]{display:none!important}
.tabs { display: flex; gap: 7px; overflow-x: auto; padding: 20px 0 10px; }
.tab { background: transparent; color: var(--muted); }
.tab.active { background: var(--ink); color: white; }
.view { display: none; padding: 14px 0 60px; }
.view.active { display: block; }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin: 14px 0 18px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { border-radius: 20px; padding: 18px; }
.panel h3 { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stat strong { display: block; font-size: 1.55rem; }
.stat span { color: var(--muted); font-size: .88rem; }
.task-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--purple); }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { font-weight: 750; }
.task-meta { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.mini-button { padding: .38rem .55rem; border-radius: 9px; font-size: .78rem; }
.countdown-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.countdown-card { border-radius: 22px; padding: 20px; }
.countdown-top { display: flex; justify-content: space-between; gap: 12px; }
.days { color: var(--purple); font-weight: 900; font-size: 1.15rem; white-space: nowrap; }
.progress-track { height: 10px; border-radius: 999px; background: #ece8f4; overflow: hidden; margin: 14px 0 7px; }
.progress-fill { height: 100%; background: linear-gradient(90deg,var(--purple),var(--theme-accent)); }
.countdown-task { display:flex; gap:9px; align-items:center; padding:7px 0; }
.countdown-actions { display:flex; justify-content:space-between; gap:8px; margin-top:14px; }
.profile-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.profile-card { border-radius: 19px; padding: 18px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display:grid; place-items:center; font-weight:900; background:var(--profile-soft,var(--theme-soft)); color:var(--profile-color,var(--purple)); margin-bottom:12px; }
.profile-card h3 { margin: 0; }
.profile-card p { margin-bottom: 0; }
.filters { margin-bottom: 12px; }
select, input, textarea { border:1px solid var(--line); background:white; color:var(--ink); border-radius:12px; padding:.8rem; width:100%; }
label { display:block; font-weight:750; margin: 13px 0 6px; }
dialog { width:min(560px,calc(100% - 24px)); border:0; border-radius:22px; padding:0; box-shadow:0 30px 100px rgba(30,20,55,.3); }
dialog::backdrop { background:rgba(25,18,40,.48); backdrop-filter:blur(3px); }
#modalForm { padding:22px; }
.modal-head, .modal-actions { display:flex; justify-content:space-between; gap:10px; align-items:center; }
.modal-head h2 { margin:0; }
.modal-actions { margin-top:20px; justify-content:flex-end; }
.icon-button { padding:.35rem .65rem; font-size:1.5rem; background:transparent; color:var(--ink); }
.empty { color:var(--muted); padding:18px 4px; }
.badge { display:inline-block; padding:.28rem .5rem; border-radius:999px; background:#f0ecff; color:var(--purple); font-size:.75rem; font-weight:800; }
@media (max-width: 760px) {
  .topbar { align-items:start; flex-direction:column; }
  .hero-card, .grid.two, .countdown-grid { grid-template-columns:1fr; }
  .quick-form { flex-direction:column; }
  .stats { grid-template-columns:repeat(2,1fr); }
  .profile-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 430px) {
  .profile-grid { grid-template-columns:1fr; }
  .section-heading { align-items:center; }
}

.assignee-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-top:8px; }
.assignee-option { display:flex; align-items:center; gap:8px; padding:10px; border:1px solid var(--line); border-radius:12px; background:white; }
.assignee-option input { width:auto; }
.profile-card { cursor:pointer; }
.profile-card:hover { transform:translateY(-1px); }
.profile-dashboard { margin-top:18px; }
.profile-dashboard-head { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:12px; }
.profile-section { margin-top:18px; }
.assignee-chips { display:flex; flex-wrap:wrap; gap:5px; margin-top:5px; }
.assignee-chip { font-size:.72rem; padding:.22rem .45rem; border-radius:999px; background:#f0ecff; color:var(--purple); font-weight:800; }
@media (max-width:430px){ .assignee-list{grid-template-columns:1fr;} }

.task-checklist { margin-top:10px; padding:9px 11px; border:1px solid var(--line); border-radius:12px; background:#faf9fd; }
.task-checklist-item { display:flex; align-items:center; gap:9px; margin:0; padding:5px 0; font-weight:600; }
.task-checklist-item input { width:18px !important; height:18px !important; flex:0 0 auto; }
.task-checklist-item.done span { text-decoration:line-through; color:var(--muted); }
.add-task-item { margin-top:9px; }


.signin-screen{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 80% 0,#e5dcff,transparent 30rem),#f6f4fb}
.signin-card{width:min(650px,100%);background:white;border:1px solid var(--line);border-radius:26px;padding:clamp(24px,5vw,42px);box-shadow:0 30px 90px rgba(58,42,98,.12)}
.signin-card h1{margin:.35rem 0;font-size:clamp(2rem,6vw,3.4rem)}
.signin-profiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:24px 0}
.signin-person{display:flex;align-items:center;text-align:left;gap:12px;background:#faf8ff;color:var(--ink);border:1px solid var(--line);padding:14px}
.signin-person:hover{background:#f0ecff;color:var(--ink)}
.signin-person .avatar{margin:0;flex:0 0 46px}
.signin-person strong,.signin-person small{display:block}
.signin-person small{color:var(--muted);margin-top:3px}
.security-note,.permission-note{font-size:.8rem;color:var(--muted)}
.account-area{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.task-card{padding:15px 4px;border-bottom:1px solid var(--line)}
.task-card:last-child{border-bottom:0}
.task-card.done>.task-mainline .task-title{text-decoration:line-through;color:var(--muted)}
.task-mainline{display:grid;grid-template-columns:auto 1fr;gap:12px;align-items:start}
.task-mainline input,.task-checklist-item input,.countdown-task input{width:20px;height:20px;accent-color:var(--purple)}
.task-checklist{margin:10px 0 0 31px;border-left:2px solid var(--line);padding-left:12px}
.task-checklist-item{display:flex;gap:9px;align-items:center;padding:6px 0}
.task-checklist-item.done span,.countdown-task.done>span{text-decoration:line-through;color:var(--muted)}
.item-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:10px}
button.mini{padding:.45rem .7rem;font-size:.78rem}
.assignee-chips{display:flex;gap:5px;flex-wrap:wrap;margin-top:6px}
.assignee-chip{display:inline-block;background:#eee9ff;color:var(--purple);border-radius:999px;padding:.2rem .48rem;font-size:.72rem;font-weight:800}
.assignee-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.assignee-option{margin:0;padding:9px;border:1px solid var(--line);border-radius:10px;background:white;font-weight:650}
.assignee-option input{width:auto;margin-right:6px}
@media(max-width:600px){.signin-profiles{grid-template-columns:1fr}.account-area{align-items:stretch;flex-direction:column}.assignee-list{grid-template-columns:1fr}}


.dashboard-priority{display:grid;grid-template-columns:1fr;gap:18px;margin-bottom:18px}
.priority-panel{padding:22px}
.priority-heading{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:8px}
.priority-heading h3{margin:.25rem 0 0;font-size:1.35rem}
.priority-count{display:grid;place-items:center;min-width:42px;height:42px;padding:0 12px;border-radius:999px;background:#eee9ff;color:var(--purple);font-weight:900;font-size:1.05rem}
@media(min-width:900px){
  .dashboard-priority{grid-template-columns:1.15fr .85fr}
}


.repeat-fields{margin-top:8px}
.weekday-picker{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.weekday-picker label{margin:0;padding:9px;border:1px solid var(--line);border-radius:10px;background:white;font-weight:650}
.weekday-picker input{width:auto;margin-right:5px}
@media(max-width:520px){.weekday-picker{grid-template-columns:repeat(2,minmax(0,1fr))}}


.template-card{display:flex;justify-content:space-between;gap:14px;align-items:center;padding:14px 0;border-bottom:1px solid var(--line)}
.template-card:last-child{border-bottom:0}

.theme-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px}
.theme-choice{display:flex;align-items:center;gap:10px;margin:0;padding:12px;border:2px solid var(--line);border-radius:14px;background:white;cursor:pointer}
.theme-choice:has(input:checked){border-color:var(--purple);box-shadow:0 0 0 3px var(--theme-soft)}
.theme-choice input{width:auto}
.theme-swatch{width:34px;height:34px;border-radius:50%;background:var(--swatch);box-shadow:inset 0 0 0 8px var(--swatch-soft);flex:0 0 auto}
@media(max-width:480px){.theme-grid{grid-template-columns:1fr}}

.avatar{overflow:hidden}
.avatar img{width:100%;height:100%;object-fit:cover;display:block}
.avatar-large{width:120px;height:120px;font-size:2.4rem;margin:0 auto}
.photo-editor-preview{display:grid;place-items:center;padding:12px}
.remove-photo-option{display:flex;align-items:center;gap:8px;margin-top:14px}
.remove-photo-option input{width:auto}

.template-section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:8px}
.template-section-head h3{margin:0}

.monthday-picker{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:7px;margin-top:8px}
.monthday-picker label{display:flex;align-items:center;justify-content:center;gap:4px;margin:0;padding:8px 4px;border:1px solid var(--line);border-radius:10px;background:white;font-size:.84rem;font-weight:700;cursor:pointer}
.monthday-picker label:has(input:checked){border-color:var(--purple);background:var(--theme-soft);color:var(--purple)}
.monthday-picker input{width:auto;margin:0}
@media(max-width:480px){.monthday-picker{grid-template-columns:repeat(5,minmax(0,1fr))}}

.date-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.date-grid label{margin-top:0}
@media(max-width:520px){.date-grid{grid-template-columns:1fr}}

.toggle-row{display:flex;align-items:center;gap:9px;margin-top:14px}
.toggle-row input{width:auto}


.account-area{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.profile-menu-wrap{position:relative}
.profile-menu-button{
  display:flex;
  align-items:center;
  gap:9px;
  min-height:48px;
  padding:6px 12px 6px 7px;
  border:1px solid var(--line);
  background:white;
  color:var(--ink);
  border-radius:999px;
  box-shadow:0 8px 24px rgba(58,42,98,.06);
}
.profile-menu-button:hover{background:var(--theme-bg);color:var(--ink)}
.header-avatar{width:36px;height:36px;margin:0;flex:0 0 36px;font-size:.95rem}
.header-profile-name{font-weight:800}
.menu-chevron{font-size:.8rem;color:var(--muted)}
.profile-menu{
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  z-index:50;
  width:220px;
  padding:8px;
  border:1px solid var(--line);
  border-radius:16px;
  background:white;
  box-shadow:0 22px 60px rgba(36,25,70,.18);
}
.menu-item{
  width:100%;
  display:block;
  text-align:left;
  padding:11px 12px;
  border-radius:10px;
  background:transparent;
  color:var(--ink);
  font-weight:700;
}
.menu-item:hover{background:var(--theme-bg);color:var(--ink)}
.danger-menu-item{color:var(--danger)}
@media(max-width:600px){
  .account-area{width:100%;justify-content:space-between}
  .header-profile-name{display:none}
}

.onboarding-card{width:min(720px,100%)}
.setup-add-buttons{display:flex;gap:10px;flex-wrap:wrap;margin:22px 0}
.setup-profile-list{display:grid;gap:10px;margin:16px 0}
.setup-profile-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:13px 14px;border:1px solid var(--line);border-radius:14px;background:var(--theme-bg)}
.setup-profile-row>div{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
@media(max-width:520px){.setup-add-buttons{flex-direction:column}.setup-add-buttons button{width:100%}}

.save-status{font-size:.82rem;font-weight:800;color:var(--muted);padding:.45rem .7rem;border-radius:999px;background:white;border:1px solid var(--line)}
.save-status.saving{color:var(--warn)}
.save-status.saved{color:var(--good)}
.save-status.error{color:var(--danger)}
.sync-status-cluster{display:grid;gap:6px;justify-items:center;flex:0 0 auto}
.connection-status-badge{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:max-content;max-width:100%;min-height:44px;padding:.3rem .75rem;border:1px solid color-mix(in srgb,var(--good) 42%,var(--line));border-radius:999px;background:#f1fbf5;color:#267046;font-size:.72rem;font-weight:850;line-height:1.2;cursor:pointer;transition:color .18s ease,background .18s ease,border-color .18s ease}
.connection-status-badge.synced{color:#267046;background:#f1fbf5}.connection-status-badge.offline{color:#b42318;background:#fff3f1;border-color:#e7a69f}
.connection-status-badge.syncing{color:#765600;background:#fff8d7;border-color:#dec96d;cursor:wait}.connection-status-badge:disabled{opacity:1}
.connection-status-badge.needs-attention,.connection-status-badge.error{color:var(--danger);background:#fff1f1;border-color:#e7aeba}
.connection-status-icon{display:inline-grid;place-items:center;width:1rem;height:1rem;font-size:.9rem}.connection-status-badge.syncing .connection-status-icon{animation:connection-sync-spin .8s linear infinite}
@keyframes connection-sync-spin{to{transform:rotate(360deg)}}
.filter-grid{display:grid;grid-template-columns:2fr 1fr 1fr 1fr;gap:10px}
.overdue-panel{margin-bottom:18px;border-color:#f1c5cd}
.history-row,.trash-row{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:13px 0;border-bottom:1px solid var(--line)}
.history-row:last-child,.trash-row:last-child{border-bottom:0}
.trash-row{min-width:0}
.trash-row-copy{min-width:0;overflow-wrap:anywhere}
.recycle-bin-actions{display:flex;flex-wrap:wrap;justify-content:flex-end}
.recycle-bin-state p{margin:.45rem 0 .8rem;overflow-wrap:anywhere}
.recycle-bin-state button{margin-top:.25rem}
.settings-actions{display:flex;gap:10px;flex-wrap:wrap}
.file-button{display:inline-flex;align-items:center;justify-content:center;padding:.8rem 1rem;border-radius:12px;cursor:pointer}
.file-button input{display:none}
.undo-bar{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);z-index:100;display:flex;gap:18px;align-items:center;background:#211d2f;color:white;padding:12px 16px;border-radius:14px;box-shadow:0 20px 60px rgba(0,0,0,.25)}
.undo-bar button{background:white;color:#211d2f;padding:.5rem .8rem}
@media(max-width:800px){.filter-grid{grid-template-columns:1fr 1fr}}
@media(max-width:520px){.filter-grid{grid-template-columns:1fr}.settings-actions{flex-direction:column}.settings-actions>*{width:100%}}


/* Family profile layout */
.profile-grid{
  grid-template-columns:repeat(auto-fit,minmax(280px,360px));
  justify-content:center;
  align-items:stretch;
  gap:20px;
}
.family-profile-card{
  width:100%;
  min-height:330px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  align-items:stretch;
  padding:24px;
  cursor:default;
  overflow:hidden;
}
.family-profile-main{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
}
.family-avatar{
  width:64px;
  height:64px;
  margin:0 0 14px;
  font-size:1.25rem;
}
.family-profile-card h3{
  margin:0 0 8px;
  font-size:1.35rem;
  text-transform:none;
}
.family-profile-card .badge{
  margin-bottom:12px;
}
.family-profile-card .muted{
  margin:0;
  text-align:center;
}
.family-profile-actions{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:22px;
}
.family-profile-actions button{
  width:100%;
  min-width:0;
  min-height:48px;
  padding:.7rem .55rem;
  white-space:normal;
  line-height:1.15;
}
@media(max-width:640px){
  .profile-grid{
    grid-template-columns:minmax(0,1fr);
  }
  .family-profile-card{
    min-height:auto;
  }
}
@media(max-width:380px){
  .family-profile-actions{
    grid-template-columns:1fr;
  }
}


/* Rounded modal scrolling */
dialog{
  overflow:hidden;
  border-radius:24px;
}
#modalForm{
  max-height:min(88vh,900px);
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  border-radius:24px;
}
#modalForm::-webkit-scrollbar{
  width:12px;
}
#modalForm::-webkit-scrollbar-track{
  background:transparent;
  margin:14px 0;
}
#modalForm::-webkit-scrollbar-thumb{
  background:rgba(115,111,128,.42);
  border-radius:999px;
  border:3px solid transparent;
  background-clip:padding-box;
}
#modalForm::-webkit-scrollbar-thumb:hover{
  background:rgba(115,111,128,.62);
  border:3px solid transparent;
  background-clip:padding-box;
}
#modalForm{
  scrollbar-width:thin;
  scrollbar-color:rgba(115,111,128,.5) transparent;
}
.modal-head{
  position:sticky;
  top:0;
  z-index:2;
  background:white;
  padding-bottom:10px;
}
.modal-actions{
  position:sticky;
  bottom:0;
  z-index:2;
  background:white;
  padding-top:12px;
}


/* Eggshell app background */
:root{
  --app-eggshell:#f7f3e8;
}
html,
body{
  background:var(--app-eggshell) !important;
}
main,
.app-shell{
  background:transparent;
}

/* Shareable logs */
.section-actions{display:flex;flex-wrap:wrap;gap:10px}.log-filters{display:grid;grid-template-columns:repeat(5,minmax(130px,1fr));gap:12px;margin-bottom:18px}.log-summary{display:flex;gap:12px;margin-bottom:16px}.log-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:16px}.log-card{padding:20px}.log-card-top{display:flex;justify-content:space-between;gap:14px;align-items:flex-start}.log-card h3{margin:10px 0}.log-card .task-meta{text-align:right}@media(max-width:850px){.log-filters{grid-template-columns:repeat(2,1fr)}}@media(max-width:520px){.log-filters{grid-template-columns:1fr}.section-actions button{width:100%}}


/* Mobile phone test edition */
html{
  -webkit-text-size-adjust:100%;
  scroll-behavior:smooth;
}
body{
  min-width:0;
  padding-bottom:env(safe-area-inset-bottom);
}
button,
input,
select,
textarea{
  touch-action:manipulation;
}
button{
  min-height:44px;
}
input,
select,
textarea{
  min-height:44px;
  font-size:16px; /* prevents iPhone zooming into fields */
}
textarea{
  min-height:110px;
}
.topbar,
main{
  width:min(1180px,calc(100% - 24px));
}
.tabs{
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.tabs::-webkit-scrollbar{
  display:none;
}

@media (max-width:760px){
  body{
    padding-bottom:calc(78px + env(safe-area-inset-bottom));
  }
  .topbar,
  main{
    width:calc(100% - 20px);
  }
  .topbar{
    padding:18px 0 10px;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:10px;
    align-items:center;
  }
  .topbar>div:first-child{
    min-width:0;
  }
  .topbar h1{
    font-size:1.55rem;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .topbar .eyebrow{
    font-size:.64rem;
  }
  .sync-status-cluster{
    grid-column:1/-1;
    grid-row:2;
    justify-self:start;
    justify-items:start;
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:7px;
  }
  .sync-status-cluster .save-status{
    grid-column:auto;
    grid-row:auto;
    font-size:.75rem;
  }
  .connection-status-badge{font-size:.7rem}
  .account-area{
    grid-column:2;
    grid-row:1;
    gap:7px;
  }
  .date-chip{
    display:none;
  }
  .profile-menu-button{
    min-height:46px;
    padding:5px 8px;
  }
  .header-profile-name{
    display:none;
  }
  .header-avatar{
    margin:0;
  }
  .profile-menu .menu-item{
    min-height:50px;
    text-align:left;
  }

  .hero-card{
    border-radius:20px;
    padding:18px;
    gap:16px;
    margin-top:5px;
  }
  .hero-card h2{
    font-size:1.35rem;
  }
  .quick-form{
    gap:8px;
  }
  .quick-form button{
    width:100%;
  }

  .tabs{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    z-index:80;
    display:grid;
    grid-auto-flow:column;
    grid-auto-columns:minmax(82px,1fr);
    gap:4px;
    overflow-x:auto;
    padding:8px 8px calc(8px + env(safe-area-inset-bottom));
    background:rgba(255,255,255,.96);
    border-top:1px solid var(--line);
    box-shadow:0 -10px 35px rgba(40,30,65,.12);
    backdrop-filter:blur(14px);
  }
  .tab{
    min-height:52px;
    padding:7px 8px;
    border-radius:12px;
    font-size:.73rem;
    line-height:1.12;
    white-space:normal;
  }
  .tab.active{
    background:var(--ink);
  }

  .view{
    padding:8px 0 24px;
  }
  .section-heading{
    align-items:center;
    margin:16px 0 12px;
  }
  .section-heading h2{
    font-size:1.35rem;
  }
  .section-heading>button{
    flex:0 0 auto;
  }
  .section-actions{
    width:100%;
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  .section-actions button:first-child{
    grid-column:1/-1;
  }

  .panel,
  .countdown-card,
  .profile-card,
  .log-card,
  .stat{
    border-radius:18px;
  }
  .panel,
  .countdown-card,
  .log-card{
    padding:16px;
  }
  .dashboard-priority,
  .grid.two,
  .countdown-grid,
  .log-grid,
  .profile-grid{
    grid-template-columns:1fr !important;
    gap:12px;
  }
  .stats{
    grid-template-columns:1fr 1fr;
    gap:9px;
  }
  .stat{
    padding:13px;
  }
  .stat strong{
    font-size:1.3rem;
  }

  .task-row{
    grid-template-columns:auto minmax(0,1fr);
    gap:10px;
    padding:14px 2px;
  }
  .task-row>button,
  .task-row>.mini-button,
  .task-row>.item-actions{
    grid-column:2;
    justify-self:start;
  }
  .task-row input[type=checkbox],
  .countdown-task input[type=checkbox]{
    width:24px;
    height:24px;
  }
  .task-title{
    overflow-wrap:anywhere;
  }
  .item-actions,
  .countdown-actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
    gap:8px;
  }
  .item-actions button,
  .countdown-actions button{
    width:100%;
  }
  .countdown-top,
  .log-card-top{
    align-items:flex-start;
  }

  .filters,
  .filter-grid,
  .log-filters{
    grid-template-columns:1fr !important;
    gap:9px;
  }
  .filters label,
  .log-filters label{
    margin-top:5px;
  }
  .assignee-list{
    grid-template-columns:1fr;
  }
  .assignee-option{
    min-height:48px;
  }

  dialog{
    width:100%;
    max-width:none;
    height:100dvh;
    max-height:100dvh;
    margin:0;
    border-radius:0;
  }
  #modalForm{
    height:100dvh;
    max-height:100dvh;
    padding:18px 16px calc(22px + env(safe-area-inset-bottom));
    border-radius:0;
  }
  .modal-head{
    top:-18px;
    margin:-18px -16px 0;
    padding:18px 16px 12px;
    border-bottom:1px solid var(--line);
  }
  .modal-head h2{
    font-size:1.45rem;
  }
  .modal-actions{
    bottom:calc(-22px - env(safe-area-inset-bottom));
    margin:18px -16px calc(-22px - env(safe-area-inset-bottom));
    padding:12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top:1px solid var(--line);
  }
  .modal-actions button{
    flex:1;
  }
  .two-col{
    grid-template-columns:1fr !important;
  }

  .signin-screen{
    padding:12px;
    align-items:flex-start;
    overflow-y:auto;
  }
  .signin-card,
  .onboarding-card{
    width:100%;
    max-width:none;
    margin-top:max(8px,env(safe-area-inset-top));
    border-radius:20px;
    padding:20px 16px;
  }
  .signin-card h1{
    font-size:1.7rem;
  }
  .setup-profile-grid{
    grid-template-columns:1fr;
  }
  .family-profile-actions{
    grid-template-columns:1fr 1fr;
  }
}

@media (max-width:390px){
  .topbar h1{
    font-size:1.35rem;
  }
  .stats{
    grid-template-columns:1fr;
  }
  .section-actions,
  .family-profile-actions,
  .item-actions,
  .countdown-actions{
    grid-template-columns:1fr;
  }
  .section-actions button:first-child{
    grid-column:auto;
  }
}

@media (display-mode:standalone){
  .topbar{
    padding-top:calc(18px + env(safe-area-inset-top));
  }
}


/* Compact section dropdown navigation */
.section-switcher{position:relative;width:min(340px,100%);margin:20px 0 10px;z-index:40}
.section-menu-button{width:100%;min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:0 18px;border-radius:16px;background:var(--ink);color:white;box-shadow:0 10px 28px rgba(33,29,47,.14);text-align:left}
.section-menu-button:hover{background:var(--ink)}
.section-menu-chevron{transition:transform .18s ease}
.section-menu-button[aria-expanded="true"] .section-menu-chevron{transform:rotate(180deg)}
.section-menu{position:absolute;left:0;right:0;top:calc(100% + 8px);display:grid;gap:4px;padding:8px;background:white;border:1px solid var(--line);border-radius:16px;box-shadow:0 22px 60px rgba(33,29,47,.2);max-height:min(60vh,430px);overflow-y:auto}
.section-menu .tab{width:100%;min-height:46px;display:flex;align-items:center;justify-content:flex-start;padding:10px 12px;border-radius:11px;background:transparent;color:var(--ink);text-align:left}
.section-menu .tab:hover{background:var(--theme-soft)}
.section-menu .tab.active{background:var(--ink);color:white}

@media(max-width:760px){
  body{padding-bottom:env(safe-area-inset-bottom)}
  .section-switcher{position:relative;top:auto;width:100%;margin:12px 0;z-index:40}
  .section-menu-button{min-height:52px;border-radius:15px}
  .section-menu{max-height:calc(100dvh - 160px)}
  .tabs{position:static;display:block;padding:0;background:transparent;border:0;box-shadow:none;backdrop-filter:none}
}


/* Styled PIN popups */
#modalForm input[type="password"][inputmode="numeric"]{
  letter-spacing:.28em;
  font-size:1.15rem;
  text-align:center;
}
#modalForm input[type="password"][inputmode="numeric"]::placeholder{
  letter-spacing:normal;
  font-size:1rem;
}


/* Supabase cloud authentication */
.cloud-auth-card{
  max-width:520px;
}
.auth-tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin:22px 0 8px;
  padding:5px;
  border:1px solid var(--line);
  border-radius:16px;
  background:rgba(255,255,255,.55);
}
.auth-tab{
  width:100%;
}
.cloud-auth-card form button[type="submit"]{
  width:100%;
  margin-top:20px;
}
.cloud-auth-card .quick-result,
#cloudHouseholdMessage{
  margin-top:16px;
}
@media(max-width:520px){
  .auth-tabs{
    grid-template-columns:1fr;
  }
}


.email-confirmation-card{
  max-width:520px;
  text-align:center;
}
.confirmation-icon{
  width:76px;
  height:76px;
  margin:0 auto 18px;
  display:grid;
  place-items:center;
  border-radius:24px;
  background:var(--theme-soft, #eee9ff);
  color:var(--purple);
  font-size:36px;
  box-shadow:0 12px 30px rgba(82,55,216,.12);
}
.confirmation-email{
  margin:10px 0 18px;
  padding:12px 16px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.75);
  font-weight:700;
  overflow-wrap:anywhere;
}
.email-confirmation-card > button{
  width:100%;
  margin-top:10px;
}


/* Two-step family onboarding */
.cloud-family-setup{
  max-width:680px;
}
.setup-progress{
  display:flex;
  align-items:center;
  justify-content:center;
  margin:0 auto 24px;
  max-width:240px;
}
.setup-dot{
  width:36px;
  height:36px;
  border-radius:50%;
  display:grid;
  place-items:center;
  border:2px solid var(--line);
  background:white;
  font-weight:800;
  color:var(--muted);
}
.setup-dot.active{
  border-color:var(--purple);
  background:var(--purple);
  color:white;
}
.setup-line{
  flex:1;
  height:2px;
  background:var(--line);
}
.family-member-form{
  margin-top:20px;
  padding:20px;
  border:1px solid var(--line);
  border-radius:18px;
  background:rgba(255,255,255,.62);
}
.family-member-form h2{
  margin-top:0;
  font-size:1.1rem;
}
.setup-family-members{
  display:grid;
  gap:10px;
  margin:18px 0;
}
.setup-member-card{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:12px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:16px;
  background:white;
}
.setup-member-card .avatar{
  width:48px;
  height:48px;
}
.setup-member-info{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.setup-member-info span{
  color:var(--muted);
  font-size:.9rem;
}
.setup-empty{
  text-align:center;
  padding:18px;
}
@media(max-width:560px){
  .setup-member-card{
    grid-template-columns:auto 1fr;
  }
  .setup-member-card button{
    grid-column:1/-1;
    width:100%;
  }
}



/* Three-shade full-app theme system */
:root{
  --theme-dark:#4d2db7;
  --theme-mid:#8d72d8;
  --theme-pale:#f0ebff;
}

body{
  background:var(--theme-pale) !important;
}

button,
.button,
input[type="submit"],
.primary,
.section-menu-button,
.profile-menu-button{
  border-color:var(--theme-mid);
}

button:not(.secondary):not(.danger):not(.danger-menu-item),
.primary,
input[type="submit"]{
  background:var(--theme-dark);
  color:#fff;
  border-color:var(--theme-dark);
}

button:not(.secondary):not(.danger):not(.danger-menu-item):hover,
.primary:hover,
input[type="submit"]:hover{
  filter:brightness(.94);
}

.secondary,
.auth-tab.secondary,
.menu-item,
.tab,
.theme-choice,
.panel,
.card,
.hero-card,
.signin-card,
.modal-card,
.task-row,
.countdown-card,
.log-card,
.template-card,
.setup-member-card,
.family-member-form,
input,
textarea,
select{
  border-color:var(--theme-mid) !important;
}

.secondary{
  background:#fff;
  color:var(--theme-dark);
}

.tab.active,
.auth-tab.active,
.section-menu .tab.active,
.theme-choice.selected,
.profile-menu-button[aria-expanded="true"],
.section-menu-button[aria-expanded="true"]{
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
}

.tab.active *,
.auth-tab.active *,
.theme-choice.selected *{
  color:#fff !important;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
.theme-choice:focus-within{
  outline:3px solid color-mix(in srgb, var(--theme-mid) 58%, transparent);
  border-color:var(--theme-dark) !important;
}

.panel,
.card,
.hero-card,
.signin-card,
.modal-card,
.task-row,
.countdown-card,
.log-card,
.template-card,
.setup-member-card,
.family-member-form{
  background:rgba(255,255,255,.88);
  box-shadow:0 10px 30px color-mix(in srgb, var(--theme-dark) 9%, transparent);
}

.eyebrow,
a,
.link-button,
.task-meta strong,
.priority-count{
  color:var(--theme-dark);
}

.theme-swatch{
  background:var(--swatch);
  box-shadow:
    inset 0 0 0 8px var(--swatch-soft),
    0 0 0 1px var(--theme-mid);
}

.topbar,
.section-switcher,
.profile-menu,
.section-menu,
.quick-result,
.security-note,
.date-chip,
.priority-panel,
.overdue-panel{
  border-color:var(--theme-mid);
}

.save-status.saved{
  color:var(--theme-dark);
  border-color:var(--theme-mid);
  background:var(--theme-pale);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked{
  accent-color:var(--theme-dark);
}

.setup-dot.active,
.confirmation-icon{
  background:var(--theme-dark);
  color:#fff;
  border-color:var(--theme-dark);
}

.setup-line{
  background:var(--theme-mid);
}



/* Visible three-shade theme picker */
.theme-choice{
  display:grid !important;
  grid-template-columns:auto 1fr;
  align-items:center;
  gap:14px;
  min-height:94px;
  padding:14px !important;
}
.theme-choice > input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.theme-palette{
  display:grid;
  grid-template-columns:repeat(3, 22px);
  height:54px;
  border-radius:16px;
  overflow:hidden;
  border:2px solid var(--theme-mid);
  box-shadow:0 4px 12px color-mix(in srgb, var(--theme-dark) 12%, transparent);
}
.palette-shade{
  display:block;
  width:22px;
  height:54px;
}
.theme-choice-copy{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}
.theme-choice-copy strong{
  font-size:1rem;
}
.theme-choice-copy small{
  color:var(--muted);
  font-size:.78rem;
}
.theme-choice.selected .theme-choice-copy small{
  color:rgba(255,255,255,.8) !important;
}
.theme-choice.selected .theme-palette{
  border-color:#fff;
  box-shadow:0 0 0 3px color-mix(in srgb, #fff 42%, transparent);
}



/* Theme the header account and cloud-save boxes */
.profile-menu-button{
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
  box-shadow:0 8px 22px color-mix(in srgb, var(--theme-dark) 18%, transparent);
}

.profile-menu-button .header-profile-name,
.profile-menu-button .menu-chevron{
  color:#fff !important;
}

.profile-menu-button .header-avatar{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border:2px solid var(--theme-mid);
}

.profile-menu-button:hover{
  filter:brightness(.96);
}

.save-status,
.save-status.saved{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border:1px solid var(--theme-mid) !important;
  box-shadow:0 6px 18px color-mix(in srgb, var(--theme-dark) 10%, transparent);
  font-weight:800;
}

.save-status.saving{
  background:color-mix(in srgb, var(--theme-pale) 78%, #fff) !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-mid) !important;
}

.save-status.error{
  background:#fff1f1 !important;
  color:#8e3041 !important;
  border-color:#cb7180 !important;
}



/* Complete theme coverage for remaining controls */
.date-chip{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border:1px solid var(--theme-mid) !important;
}

.section-menu-button,
#sectionMenuButton{
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
  box-shadow:0 8px 22px color-mix(in srgb, var(--theme-dark) 18%, transparent);
}

.section-menu-button *,
#sectionMenuButton *{
  color:#fff !important;
}

input[type="checkbox"],
input[type="radio"]{
  accent-color:var(--theme-dark) !important;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked{
  accent-color:var(--theme-dark) !important;
}

.checkbox-row input[type="checkbox"],
.settings-row input[type="checkbox"],
.toggle-row input[type="checkbox"]{
  filter:hue-rotate(0deg) saturate(1.1);
}

#downloadBackup,
#addLog,
#addLogEntry,
button[id*="Download"],
button[id*="download"],
button[id*="Add"],
button[id*="add"],
.primary-action{
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
}

#restoreBackup,
#exportTasksCsv,
#exportLogsCsv,
#printLogs,
button[id*="Export"],
button[id*="export"],
button[id*="Print"],
button[id*="print"],
button[id*="Restore"],
button[id*="restore"],
button[id*="Create"],
button[id*="create"],
.secondary-action{
  background:#fff !important;
  color:var(--theme-dark) !important;
  border:1px solid var(--theme-mid) !important;
}

#downloadBackup:hover,
#addLog:hover,
#addLogEntry:hover,
button[id*="Download"]:hover,
button[id*="download"]:hover,
button[id*="Add"]:hover,
button[id*="add"]:hover{
  filter:brightness(.95);
}

#restoreBackup:hover,
#exportTasksCsv:hover,
#exportLogsCsv:hover,
#printLogs:hover,
button[id*="Export"]:hover,
button[id*="export"]:hover,
button[id*="Print"]:hover,
button[id*="print"]:hover,
button[id*="Restore"]:hover,
button[id*="restore"]:hover,
button[id*="Create"]:hover,
button[id*="create"]:hover{
  background:var(--theme-pale) !important;
}

.template-card button,
.panel button.secondary,
.card button.secondary,
.backup-actions button,
.log-actions button,
.template-actions button{
  border-color:var(--theme-mid) !important;
}

.template-card button:not(.secondary),
.log-actions button:not(.secondary),
.backup-actions button:not(.secondary){
  background:var(--theme-dark) !important;
  color:#fff !important;
}

.template-card button.secondary,
.log-actions button.secondary,
.backup-actions button.secondary{
  background:#fff !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-mid) !important;
}

.priority-count{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border:1px solid color-mix(in srgb, var(--theme-mid) 55%, transparent);
}

.quick-form button,
#addTaskToday,
#addCountdown,
#createTaskTemplate,
#createCountdownTemplate{
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
}

.quick-form input,
input,
textarea,
select{
  border-color:color-mix(in srgb, var(--theme-mid) 62%, #fff) !important;
}

.quick-form input:focus,
input:focus,
textarea:focus,
select:focus{
  border-color:var(--theme-dark) !important;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--theme-mid) 35%, transparent);
}

.settings-section,
.backup-panel,
.template-card,
.log-panel,
.panel{
  border-color:color-mix(in srgb, var(--theme-mid) 72%, #fff) !important;
}

a,
.link-button{
  color:var(--theme-dark) !important;
}



/* Dashboard Family overview + Task button */
#addTaskToday{
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
  box-shadow:0 8px 20px color-mix(in srgb, var(--theme-dark) 16%, transparent);
}

#addTaskToday:hover{
  filter:brightness(.95);
}



/* Per-family-member theme cards */
.profile-card,
.family-card{
  background:var(--person-pale, #f0ebff) !important;
  border:2px solid var(--person-mid, #8d72d8) !important;
  box-shadow:0 12px 28px color-mix(in srgb, var(--person-dark, #4d2db7) 12%, transparent);
}

.profile-card h3,
.family-card h3,
.profile-card .profile-name,
.family-card .profile-name{
  color:var(--person-dark, #4d2db7) !important;
}

.profile-card .avatar,
.family-card .avatar{
  background:var(--person-pale, #f0ebff) !important;
  color:var(--person-dark, #4d2db7) !important;
  border:2px solid var(--person-mid, #8d72d8) !important;
}

.profile-card .role-badge,
.family-card .role-badge,
.profile-card .badge,
.family-card .badge{
  background:color-mix(in srgb, var(--person-pale, #f0ebff) 72%, #fff) !important;
  color:var(--person-dark, #4d2db7) !important;
  border:1px solid var(--person-mid, #8d72d8) !important;
}

.profile-card button,
.family-card button{
  background:#fff !important;
  color:var(--person-dark, #4d2db7) !important;
  border:1px solid var(--person-mid, #8d72d8) !important;
}

.profile-card button:hover,
.family-card button:hover{
  background:var(--person-dark, #4d2db7) !important;
  color:#fff !important;
  border-color:var(--person-dark, #4d2db7) !important;
}

.profile-card .primary,
.family-card .primary{
  background:var(--person-dark, #4d2db7) !important;
  color:#fff !important;
  border-color:var(--person-dark, #4d2db7) !important;
}



/* White dropdown menus with black text */
.profile-menu,
.section-menu{
  background:#fff !important;
  border:1px solid var(--theme-mid) !important;
}

.profile-menu .menu-item,
.section-menu .tab{
  background:#fff !important;
  color:#111 !important;
  border:1px solid transparent !important;
  box-shadow:none !important;
}

.profile-menu .menu-item:hover,
.section-menu .tab:hover{
  background:var(--theme-pale) !important;
  color:#111 !important;
  border-color:var(--theme-mid) !important;
}

.section-menu .tab.active{
  background:#fff !important;
  color:#111 !important;
  border-color:var(--theme-mid) !important;
}

.section-menu .tab.active *,
.profile-menu .menu-item *{
  color:#111 !important;
}

.profile-menu .danger-menu-item{
  color:#b42338 !important;
}

.profile-menu .danger-menu-item:hover{
  background:#fff1f2 !important;
  color:#b42338 !important;
  border-color:#f0a0aa !important;
}

/* Household profile switcher */
.profile-switch-card{
  max-width:620px;
}
.cloud-profile-choice{
  background:#fff !important;
  color:#111 !important;
  border:2px solid var(--person-mid) !important;
}
.cloud-profile-choice:hover{
  background:var(--person-pale) !important;
}
.cloud-profile-choice strong{
  color:var(--person-dark) !important;
}
.cloud-profile-choice small{
  color:#555 !important;
}

/* FINAL dropdown override: always white with black text */
body .profile-menu,
body .section-menu{
  background:#ffffff !important;
  color:#111111 !important;
  border:1px solid var(--theme-mid) !important;
}

body .profile-menu .menu-item,
body .section-menu .tab,
body .section-menu button,
body .profile-menu button{
  background:#ffffff !important;
  color:#111111 !important;
  border:1px solid transparent !important;
  box-shadow:none !important;
}

body .profile-menu .menu-item *,
body .section-menu .tab *,
body .section-menu button *,
body .profile-menu button *{
  color:#111111 !important;
}

body .profile-menu .menu-item:hover,
body .section-menu .tab:hover,
body .section-menu button:hover,
body .profile-menu button:hover{
  background:var(--theme-pale) !important;
  color:#111111 !important;
  border-color:var(--theme-mid) !important;
}

body .section-menu .tab.active,
body .section-menu button.active{
  background:#ffffff !important;
  color:#111111 !important;
  border-color:var(--theme-mid) !important;
}

body .profile-menu .danger-menu-item,
body .profile-menu .danger-menu-item *{
  color:#b42338 !important;
}

body .profile-menu .danger-menu-item:hover{
  background:#fff1f2 !important;
  color:#b42338 !important;
  border-color:#f0a0aa !important;
}



/* Rebuilt family profile chooser */
.family-profile-dialog{
  width:min(680px, calc(100vw - 24px));
  max-width:680px;
  border:0;
  padding:0;
  background:transparent;
}
.family-profile-dialog::backdrop{
  background:rgba(20,22,30,.58);
  backdrop-filter:blur(3px);
}
.family-profile-dialog .modal-card{
  width:100%;
  max-height:min(82vh,760px);
  overflow:auto;
}
.family-profile-choice{
  background:#fff !important;
  color:#111 !important;
  border:2px solid var(--person-mid) !important;
}
.family-profile-choice:hover{
  background:var(--person-pale) !important;
}
.family-profile-choice strong{
  color:var(--person-dark) !important;
}

/* Restyled family profile chooser */
.family-profile-dialog{
  width:min(920px, calc(100vw - 32px)) !important;
  max-width:920px !important;
  padding:0 !important;
  border:0 !important;
  background:transparent !important;
}

.family-profile-dialog .modal-card{
  width:100% !important;
  max-width:none !important;
  min-height:620px;
  max-height:min(88vh, 860px);
  padding:34px !important;
  border-radius:28px !important;
  overflow:auto;
  background:#fff !important;
  border:1px solid var(--theme-mid) !important;
  box-shadow:0 28px 70px rgba(20,22,30,.28) !important;
}

.family-profile-dialog .modal-heading{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  margin-bottom:8px;
}

.family-profile-dialog .modal-heading > div{
  flex:1;
}

.family-profile-dialog .eyebrow{
  margin-bottom:10px;
}

.family-profile-dialog h2{
  margin:0;
  font-size:clamp(2rem, 4vw, 3rem);
  line-height:1.05;
}

.family-profile-dialog .icon-button{
  flex:0 0 auto;
  width:48px;
  height:48px;
  display:grid;
  place-items:center;
  padding:0;
  margin:0;
  border-radius:14px;
  background:var(--theme-dark) !important;
  color:#fff !important;
  border:1px solid var(--theme-dark) !important;
  font-size:2rem;
  line-height:1;
}

.family-profile-dialog .muted{
  margin:10px 0 24px;
  font-size:1.05rem;
}

#familyProfileChoices{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:18px;
  margin-top:10px;
}

.family-profile-choice{
  min-height:120px;
  padding:20px !important;
  border-radius:22px !important;
  display:grid !important;
  grid-template-columns:auto 1fr;
  align-items:center;
  gap:18px;
  text-align:left;
  background:var(--person-pale) !important;
  color:#111 !important;
  border:2px solid var(--person-mid) !important;
  box-shadow:0 10px 24px color-mix(in srgb, var(--person-dark) 10%, transparent);
}

.family-profile-choice:hover{
  transform:translateY(-1px);
  background:#fff !important;
  border-color:var(--person-dark) !important;
}

.family-profile-choice .avatar{
  width:64px;
  height:64px;
  font-size:1.35rem;
  background:#fff !important;
  color:var(--person-dark) !important;
  border:2px solid var(--person-mid) !important;
}

.family-profile-choice strong{
  display:block;
  font-size:1.35rem;
  color:var(--person-dark) !important;
}

.family-profile-choice small{
  display:block;
  margin-top:4px;
  font-size:.95rem;
  color:#555 !important;
  text-transform:capitalize;
}

.family-profile-dialog .modal-actions{
  margin-top:28px;
  justify-content:flex-end;
}

.family-profile-dialog .modal-actions button{
  min-width:140px;
}

@media(max-width:700px){
  .family-profile-dialog{
    width:min(96vw, 920px) !important;
  }

  .family-profile-dialog .modal-card{
    min-height:auto;
    padding:22px !important;
    border-radius:22px !important;
  }

  #familyProfileChoices{
    grid-template-columns:1fr;
  }

  .family-profile-choice{
    min-height:96px;
  }
}

/* Match all log action buttons */
#addLog,
#addLogEntry,
#printLogs,
#exportLogsCsv,
.log-actions button{
  min-height:60px;
  padding:0 22px !important;
  border-radius:16px !important;
  background:var(--theme-dark) !important;
  color:#fff !important;
  border:1px solid var(--theme-dark) !important;
  font-weight:800;
  box-shadow:0 8px 20px color-mix(in srgb, var(--theme-dark) 16%, transparent);
}

#addLog:hover,
#addLogEntry:hover,
#printLogs:hover,
#exportLogsCsv:hover,
.log-actions button:hover{
  filter:brightness(.95);
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
}

.log-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
}

@media(max-width:560px){
  #addLog,
  #addLogEntry,
  #printLogs,
  #exportLogsCsv,
  .log-actions button{
    width:100%;
  }
}

/* Match all backup and export action buttons */
#downloadBackup,
#restoreBackup,
#exportCsv,
#exportTasksCsv,
.backup-actions button{
  min-height:60px;
  padding:0 22px !important;
  border-radius:16px !important;
  background:var(--theme-dark) !important;
  color:#fff !important;
  border:1px solid var(--theme-dark) !important;
  font-weight:800;
  box-shadow:0 8px 20px color-mix(in srgb, var(--theme-dark) 16%, transparent);
}

#downloadBackup:hover,
#restoreBackup:hover,
#exportCsv:hover,
#exportTasksCsv:hover,
.backup-actions button:hover{
  filter:brightness(.95);
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
}

.backup-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
}

@media(max-width:560px){
  #downloadBackup,
  #restoreBackup,
  #exportCsv,
  #exportTasksCsv,
  .backup-actions button{
    width:100%;
  }
}

/* Styled PIN dialog */
.styled-pin-dialog{
  width:min(560px, calc(100vw - 28px));
  max-width:560px;
  border:0;
  padding:0;
  background:transparent;
}

.styled-pin-dialog::backdrop{
  background:rgba(20,22,30,.58);
  backdrop-filter:blur(3px);
}

.styled-pin-dialog .modal-card{
  width:100%;
  padding:30px !important;
  border-radius:26px !important;
  background:#fff !important;
  border:1px solid var(--theme-mid) !important;
  box-shadow:0 28px 70px rgba(20,22,30,.28) !important;
}

.styled-pin-dialog .modal-heading{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  margin-bottom:12px;
}

.styled-pin-dialog .icon-button{
  width:44px;
  height:44px;
  min-width:44px;
  padding:0;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:var(--theme-dark) !important;
  color:#fff !important;
  border-color:var(--theme-dark) !important;
  font-size:1.8rem;
}

.styled-pin-dialog input{
  width:100%;
  min-height:56px;
  font-size:1.15rem;
  margin-top:8px;
}

.styled-pin-dialog .modal-actions{
  margin-top:24px;
  justify-content:flex-end;
}

.styled-pin-dialog .modal-actions button{
  min-width:130px;
}

.form-error{
  color:#b42338;
  font-weight:700;
  margin-top:10px;
}

/* Restore backup should match Export tasks CSV */
#restoreBackup,
#exportCsv,
#exportTasksCsv{
  min-height:60px;
  padding:0 22px !important;
  border-radius:16px !important;
  background:#fff !important;
  color:var(--theme-dark) !important;
  border:1px solid var(--theme-mid) !important;
  font-weight:800;
  box-shadow:none !important;
}

#restoreBackup:hover,
#exportCsv:hover,
#exportTasksCsv:hover{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-dark) !important;
  filter:none !important;
}

/* Final profile chooser sizing and layout fix */
.family-profile-dialog{
  width:min(980px, calc(100vw - 24px)) !important;
  max-width:980px !important;
  max-height:calc(100vh - 24px) !important;
  margin:auto !important;
  padding:0 !important;
  border:0 !important;
  background:transparent !important;
  overflow:visible !important;
}

.family-profile-dialog .modal-card{
  position:relative;
  box-sizing:border-box;
  width:100% !important;
  max-width:none !important;
  min-height:680px !important;
  max-height:calc(100vh - 32px) !important;
  padding:40px 42px 34px !important;
  border-radius:28px !important;
  overflow:auto !important;
  background:#fff !important;
}

.family-profile-dialog .modal-heading{
  display:block !important;
  padding-right:70px;
  margin-bottom:14px !important;
}

.family-profile-dialog .modal-heading > div{
  width:100%;
}

.family-profile-dialog .modal-heading .icon-button,
#closeFamilyProfileChooser{
  position:absolute !important;
  top:24px !important;
  right:24px !important;
  width:48px !important;
  height:48px !important;
  min-width:48px !important;
  margin:0 !important;
  z-index:2;
}

.family-profile-dialog h2{
  max-width:760px;
  margin:0 !important;
  line-height:1.12 !important;
}

.family-profile-dialog > .modal-card > .muted,
.family-profile-dialog .modal-card > .muted{
  max-width:760px;
  margin:16px 0 28px !important;
}

#familyProfileChoices{
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  gap:18px !important;
  align-items:stretch;
}

.family-profile-choice{
  box-sizing:border-box;
  min-width:0;
  min-height:126px !important;
  padding:22px !important;
}

.family-profile-dialog .modal-actions{
  position:sticky;
  bottom:-1px;
  margin-top:30px !important;
  padding-top:18px;
  padding-bottom:2px;
  background:linear-gradient(to bottom, rgba(255,255,255,0), #fff 24%);
}

@media(max-width:760px){
  .family-profile-dialog{
    width:min(96vw,980px) !important;
    max-height:96vh !important;
  }

  .family-profile-dialog .modal-card{
    min-height:auto !important;
    max-height:94vh !important;
    padding:28px 22px 24px !important;
  }

  .family-profile-dialog .modal-heading{
    padding-right:58px;
  }

  .family-profile-dialog .modal-heading .icon-button,
  #closeFamilyProfileChooser{
    top:18px !important;
    right:18px !important;
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
  }

  #familyProfileChoices{
    grid-template-columns:1fr !important;
  }
}

/* STRUCTURAL REBUILD: family profile chooser */
html body #familyProfileChooser.family-profile-chooser-dialog{
  box-sizing:border-box !important;
  width:min(1040px, calc(100vw - 40px)) !important;
  max-width:1040px !important;
  height:auto !important;
  max-height:calc(100vh - 40px) !important;
  margin:auto !important;
  padding:0 !important;
  border:0 !important;
  border-radius:30px !important;
  overflow:hidden !important;
  background:#fff !important;
  box-shadow:0 30px 90px rgba(16,18,24,.34) !important;
}

html body #familyProfileChooser::backdrop{
  background:rgba(17,20,28,.62) !important;
  backdrop-filter:blur(4px) !important;
}

html body #familyProfileChooser .family-profile-chooser-shell{
  box-sizing:border-box !important;
  display:grid !important;
  grid-template-rows:auto auto auto !important;
  width:100% !important;
  min-height:0 !important;
  max-height:calc(100vh - 40px) !important;
  padding:0 !important;
  overflow:hidden !important;
  background:#fff !important;
}

html body #familyProfileChooser .family-profile-chooser-header{
  box-sizing:border-box !important;
  display:grid !important;
  grid-template-columns:minmax(0,1fr) 56px !important;
  align-items:start !important;
  gap:24px !important;
  padding:38px 42px 24px !important;
  border-bottom:1px solid color-mix(in srgb, var(--theme-mid) 45%, #fff) !important;
  background:#fff !important;
}

html body #familyProfileChooser .family-profile-chooser-title{
  min-width:0 !important;
}

html body #familyProfileChooser .family-profile-chooser-title .eyebrow{
  margin:0 0 10px !important;
}

html body #familyProfileChooser .family-profile-chooser-title h2{
  margin:0 !important;
  font-size:clamp(2rem, 4vw, 3rem) !important;
  line-height:1.08 !important;
  color:#111 !important;
}

html body #familyProfileChooser .family-profile-chooser-title .muted{
  margin:16px 0 0 !important;
  max-width:760px !important;
  font-size:1.05rem !important;
  line-height:1.5 !important;
}

html body #familyProfileChooser .family-profile-chooser-close{
  box-sizing:border-box !important;
  position:static !important;
  width:56px !important;
  height:56px !important;
  min-width:56px !important;
  margin:0 !important;
  padding:0 !important;
  display:grid !important;
  place-items:center !important;
  border-radius:18px !important;
  border:1px solid var(--theme-dark) !important;
  background:var(--theme-dark) !important;
  color:#fff !important;
  font-size:2.15rem !important;
  line-height:1 !important;
  box-shadow:none !important;
}

html body #familyProfileChooser #familyProfileChoices.family-profile-chooser-grid{
  box-sizing:border-box !important;
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  align-content:start !important;
  gap:20px !important;
  padding:28px 42px !important;
  max-height:min(58dvh,560px) !important;
  overflow-y:auto !important;
  background:#fff !important;
}

html body #familyProfileChooser .family-profile-choice{
  box-sizing:border-box !important;
  width:100% !important;
  min-width:0 !important;
  min-height:138px !important;
  padding:24px !important;
  display:grid !important;
  grid-template-columns:76px minmax(0,1fr) !important;
  align-items:center !important;
  gap:20px !important;
  border-radius:24px !important;
  border:2px solid var(--person-mid) !important;
  background:var(--person-pale) !important;
  color:#111 !important;
  text-align:left !important;
  box-shadow:0 10px 26px color-mix(in srgb, var(--person-dark) 10%, transparent) !important;
}

html body #familyProfileChooser .family-profile-choice:hover{
  background:#fff !important;
  border-color:var(--person-dark) !important;
  transform:translateY(-1px) !important;
}

html body #familyProfileChooser .family-profile-choice .avatar{
  width:76px !important;
  height:76px !important;
  min-width:76px !important;
  font-size:1.5rem !important;
  background:#fff !important;
  color:var(--person-dark) !important;
  border:2px solid var(--person-mid) !important;
}

html body #familyProfileChooser .family-profile-choice strong{
  display:block !important;
  font-size:1.45rem !important;
  line-height:1.2 !important;
  color:var(--person-dark) !important;
}

html body #familyProfileChooser .family-profile-choice small{
  display:block !important;
  margin-top:6px !important;
  font-size:1rem !important;
  color:#555 !important;
  text-transform:capitalize !important;
}

html body #familyProfileChooser .family-profile-chooser-footer{
  box-sizing:border-box !important;
  display:flex !important;
  justify-content:flex-end !important;
  align-items:center !important;
  padding:20px 42px 28px !important;
  border-top:1px solid color-mix(in srgb, var(--theme-mid) 45%, #fff) !important;
  background:#fff !important;
}

html body #familyProfileChooser .family-profile-chooser-footer button{
  min-width:150px !important;
  min-height:56px !important;
}

html body #familyProfileChooser .profile-switch-status{
  margin:.25rem 0 0;
  padding:.75rem 1rem;
  border-radius:.8rem;
  background:color-mix(in srgb,var(--mid) 14%,white);
  color:var(--dark);
  font-weight:700;
  text-align:center;
}

@media(max-width:760px){
  html body #familyProfileChooser.family-profile-chooser-dialog{
    width:calc(100vw - 20px) !important;
    max-height:calc(100vh - 20px) !important;
  }

  html body #familyProfileChooser .family-profile-chooser-shell{
    min-height:auto !important;
    max-height:calc(100vh - 20px) !important;
  }

  html body #familyProfileChooser .family-profile-chooser-header{
    grid-template-columns:minmax(0,1fr) 48px !important;
    gap:16px !important;
    padding:24px 22px 20px !important;
  }

  html body #familyProfileChooser .family-profile-chooser-close{
    width:48px !important;
    height:48px !important;
    min-width:48px !important;
  }

  html body #familyProfileChooser #familyProfileChoices.family-profile-chooser-grid{
    grid-template-columns:1fr !important;
    padding:22px !important;
  }

  html body #familyProfileChooser .family-profile-choice{
    min-height:112px !important;
    grid-template-columns:62px minmax(0,1fr) !important;
    padding:18px !important;
  }

  html body #familyProfileChooser .family-profile-choice .avatar{
    width:62px !important;
    height:62px !important;
    min-width:62px !important;
  }

  html body #familyProfileChooser .family-profile-chooser-footer{
    padding:16px 22px 22px !important;
  }
}

/* STRUCTURAL REBUILD: dropdown menus */
html body .app-dropdown-menu{
  box-sizing:border-box !important;
  display:flex !important;
  flex-direction:column !important;
  gap:4px !important;
  padding:10px !important;
  background:#ffffff !important;
  color:#111111 !important;
  border:1px solid var(--theme-mid) !important;
  border-radius:18px !important;
  box-shadow:0 18px 42px rgba(20,22,30,.18) !important;
  overflow:hidden !important;
}

html body .app-dropdown-menu.hidden{
  display:none !important;
}

html body .app-dropdown-menu > button,
html body .app-dropdown-menu .menu-item,
html body .app-dropdown-menu .tab{
  box-sizing:border-box !important;
  width:100% !important;
  min-height:48px !important;
  margin:0 !important;
  padding:12px 14px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  text-align:left !important;
  border:1px solid transparent !important;
  border-radius:12px !important;
  background:#ffffff !important;
  color:#111111 !important;
  box-shadow:none !important;
  font-weight:700 !important;
}

html body .app-dropdown-menu > button *,
html body .app-dropdown-menu .menu-item *,
html body .app-dropdown-menu .tab *{
  color:#111111 !important;
}

html body .app-dropdown-menu > button:hover,
html body .app-dropdown-menu .menu-item:hover,
html body .app-dropdown-menu .tab:hover{
  background:var(--theme-pale) !important;
  color:#111111 !important;
  border-color:var(--theme-mid) !important;
}

html body .app-dropdown-menu .tab.active,
html body .app-dropdown-menu > button.active{
  background:#ffffff !important;
  color:#111111 !important;
  border-color:var(--theme-mid) !important;
}

html body .app-dropdown-menu .danger-menu-item,
html body .app-dropdown-menu .danger-menu-item *{
  color:#b42338 !important;
}

html body .app-dropdown-menu .danger-menu-item:hover{
  background:#fff1f2 !important;
  color:#b42338 !important;
  border-color:#f0a0aa !important;
}

/* Rebuilt log entry module */
.log-entry-dialog{width:min(760px,calc(100vw - 24px));max-width:760px;max-height:calc(100vh - 24px);padding:0;border:0;border-radius:28px;background:#fff;overflow:hidden;box-shadow:0 30px 80px rgba(20,22,30,.3)}
.log-entry-dialog::backdrop{background:rgba(20,22,30,.58);backdrop-filter:blur(4px)}
.log-entry-shell{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:fit-content;max-height:calc(100dvh - 24px);overflow:hidden}
.log-entry-header{display:grid;grid-template-columns:1fr auto;gap:20px;padding:30px 32px 22px;border-bottom:1px solid color-mix(in srgb,var(--theme-mid) 45%,#fff)}
.log-entry-header h2{margin:0;font-size:2rem}.log-entry-header .muted{margin:10px 0 0}
.log-entry-close{width:48px;height:48px;padding:0;display:grid;place-items:center;border-radius:15px;background:var(--theme-dark)!important;color:#fff!important;border-color:var(--theme-dark)!important;font-size:2rem}
.log-entry-body{padding:26px 32px;min-height:0;max-height:62dvh;overflow-y:auto;overscroll-behavior:contain}.log-entry-body label{display:block;margin:16px 0 7px;font-weight:800}
.log-entry-body .form-grid{display:grid;gap:16px}.log-entry-body .form-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.log-entry-body input,.log-entry-body select,.log-entry-body textarea{width:100%;box-sizing:border-box}
.log-entry-footer{display:flex;justify-content:flex-end;gap:12px;padding:20px 32px 26px;border-top:1px solid color-mix(in srgb,var(--theme-mid) 45%,#fff)}
.log-entry-footer button{min-width:140px}
@media(max-width:620px){.log-entry-header,.log-entry-body,.log-entry-footer{padding-left:20px;padding-right:20px}.log-entry-body .form-grid.two{grid-template-columns:1fr}.log-entry-footer{flex-direction:column-reverse}.log-entry-footer button{width:100%}}

/* Logbook layout */
.logbook-grid{display:grid;gap:18px}
.logbook-card{padding:22px!important}
.logbook-card-heading{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}
.logbook-card-heading h3{margin:8px 0 4px;font-size:1.45rem}
.logbook-entry-list{display:grid;gap:10px;margin:20px 0}
.logbook-entry-row{display:grid;grid-template-columns:1fr auto;gap:14px;padding:14px;border:1px solid var(--theme-mid);border-radius:14px;background:#fff}
.logbook-entry-row p{margin:6px 0 0;white-space:pre-wrap}
.logbook-card-actions{justify-content:flex-end}
.logbook-dialog{width:min(720px,calc(100vw - 24px));max-width:720px;max-height:calc(100vh - 24px);padding:0;border:0;border-radius:28px;background:#fff;overflow:hidden;box-shadow:0 30px 80px rgba(20,22,30,.3)}
.logbook-dialog::backdrop{background:rgba(20,22,30,.58);backdrop-filter:blur(4px)}
.logbook-shell{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:fit-content;max-height:calc(100dvh - 24px);overflow:hidden}
.logbook-header{display:grid;grid-template-columns:1fr auto;gap:20px;padding:30px 32px 22px;border-bottom:1px solid color-mix(in srgb,var(--theme-mid) 45%,#fff)}
.logbook-header h2{margin:0;font-size:2rem}
.logbook-close{width:48px;height:48px;padding:0;display:grid;place-items:center;border-radius:15px;background:var(--theme-dark)!important;color:#fff!important;border-color:var(--theme-dark)!important;font-size:2rem}
.logbook-body{padding:26px 32px;min-height:0;max-height:62dvh;overflow-y:auto;overscroll-behavior:contain}
.logbook-body label{display:block;margin:16px 0 7px;font-weight:800}
.logbook-body input,.logbook-body select,.logbook-body textarea{width:100%;box-sizing:border-box}
.logbook-footer{display:flex;justify-content:flex-end;gap:12px;padding:20px 32px 26px;border-top:1px solid color-mix(in srgb,var(--theme-mid) 45%,#fff)}
.log-category-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.log-category-grid button{min-height:86px;background:#fff!important;color:#111!important;border:2px solid var(--theme-mid)!important;font-size:1.1rem}
.log-category-grid button:hover{background:var(--theme-pale)!important;border-color:var(--theme-dark)!important}
@media(max-width:620px){
  .log-category-grid{grid-template-columns:1fr}
  .logbook-card-heading,.logbook-entry-row{grid-template-columns:1fr;display:grid}
  .logbook-header,.logbook-body,.logbook-footer{padding-left:20px;padding-right:20px}
  .logbook-footer{flex-direction:column-reverse}
  .logbook-footer button{width:100%}
}

/* Patch 105: warm visual polish, centered actions, and in-flow history navigation. */
:root{
  --polished-shadow:0 12px 34px color-mix(in srgb,var(--theme-dark) 8%,transparent),0 2px 8px rgba(64,48,31,.045);
  --polished-button-shadow:0 7px 18px color-mix(in srgb,var(--theme-dark) 16%,transparent);
}
body{
  background:
    radial-gradient(circle at 88% -8%,color-mix(in srgb,var(--theme-pale) 72%,#fff5df),transparent 32rem),
    linear-gradient(180deg,#fffdf8 0,var(--app-eggshell) 100%)!important;
}
button,
.file-button{
  text-align:center;
  line-height:1.25;
}
button:disabled,
button[aria-disabled="true"]{
  cursor:not-allowed;
  opacity:.58;
  box-shadow:none!important;
}
button.secondary{
  background:color-mix(in srgb,var(--panel,#fff) 94%,var(--theme-pale) 6%);
  border-color:color-mix(in srgb,var(--theme-mid) 38%,var(--line));
}
button:not(.secondary):not(.danger):not(.danger-menu-item):not(.menu-item):not(.tab):not(.icon-button):not(.app-popup-close):not(.logbook-close),
.file-button:not(.secondary){
  box-shadow:var(--polished-button-shadow);
}
:is(.hero-card,.panel,.countdown-card,.profile-card,.signin-card){
  border-color:color-mix(in srgb,var(--theme-mid) 22%,var(--line));
}
body:not([data-calm-mode="true"]) :is(.hero-card,.panel,.countdown-card,.profile-card,.signin-card){
  box-shadow:var(--polished-shadow);
}
.auth-help-actions{
  justify-content:center;
  align-items:center;
  text-align:center;
}
.auth-help-actions .link-button{
  min-height:44px;
  padding:.4rem .25rem!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
}
.app-primary-navigation{
  position:relative;
  z-index:40;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:20px 0 10px;
}
.app-primary-navigation .section-switcher{
  flex:1 1 340px;
  min-width:0;
  margin:0;
}
.app-history-controls{
  position:static;
  inset:auto;
  z-index:auto;
  display:inline-flex;
  flex:0 0 auto;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:5px;
  pointer-events:auto;
  border:1px solid color-mix(in srgb,var(--theme-mid) 30%,var(--line));
  border-radius:16px;
  background:color-mix(in srgb,var(--panel,#fff) 92%,var(--theme-pale) 8%);
  box-shadow:0 8px 24px rgba(64,48,31,.08);
}
.app-history-controls .app-history-button{
  width:auto!important;
  height:44px!important;
  min-width:44px!important;
  min-height:44px!important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:0 12px!important;
  border:0!important;
  border-radius:11px!important;
  background:transparent!important;
  color:var(--theme-dark)!important;
  box-shadow:none!important;
  backdrop-filter:none;
  font-size:.9rem!important;
  font-weight:850;
  line-height:1!important;
}
.app-history-button .app-history-arrow{
  display:grid;
  place-items:center;
  font-size:1.12rem;
  line-height:1;
}
.app-history-controls .app-history-button:hover{
  background:var(--theme-pale)!important;
  color:var(--theme-dark)!important;
}
@media(hover:hover) and (pointer:fine){
  button:not(:disabled):not([aria-disabled="true"]),
  .file-button{
    transition:transform .16s ease,box-shadow .16s ease,background-color .16s ease,border-color .16s ease;
  }
  button:not(:disabled):not([aria-disabled="true"]):not(.menu-item):not(.tab):not(.section-menu-button):not(.kinstead-control-button):not(.app-history-button):hover,
  .file-button:hover{
    transform:translateY(-1px);
  }
  button:not(:disabled):not([aria-disabled="true"]):active,
  .file-button:active{
    transform:translateY(0);
  }
}
@media(max-width:620px){
  .app-primary-navigation{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;
    margin:12px 0;
  }
  .app-primary-navigation .section-switcher{
    width:100%!important;
    margin:0!important;
  }
  .app-history-controls{
    gap:2px;
    padding:4px;
    border-radius:15px;
  }
  .app-history-controls .app-history-button{
    width:44px!important;
    padding:0!important;
  }
  .app-history-label{
    position:absolute;
    inline-size:1px;
    block-size:1px;
    overflow:hidden;
    clip-path:inset(50%);
    white-space:nowrap;
  }
}
@media(forced-colors:active){
  .app-history-controls{border:2px solid CanvasText;background:Canvas}
  .app-history-controls .app-history-button{color:ButtonText!important}
}

/* Patch 39: visually balanced Logs page. */
html body #logs>.section-heading{
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  width:100%;
  margin-bottom:8px!important;
}
html body #logs>.section-heading>div:first-of-type{grid-column:2;text-align:center}
html body #logs>.section-heading>.page-info-button,
html body #logs>.section-heading>.page-more-info-button{grid-column:1;justify-self:start}
html body #logs>.section-heading>.section-actions{grid-column:3;justify-self:end}
html body #logs .section-actions>#createLogbook{min-width:116px}
html body #logs>.area-sort-filter{width:min(680px,100%);margin-inline:auto!important}
html body #logs>.log-summary{justify-content:flex-start;align-items:stretch;margin:0}
html body #logs>.log-summary>*{min-width:92px;text-align:center}
html body #logs>.log-meta-row{
  display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%;margin:2px auto 16px
}
html body #logs .log-secondary-actions{display:flex;justify-content:flex-end;min-width:150px}
html body #logs .log-secondary-actions:empty{display:none}
html body #logs>.logbook-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start}
html body #logs .logbook-card{height:100%;box-sizing:border-box}
html body #logs .logbook-card-actions{justify-content:flex-end!important}
@media(max-width:700px){
  html body #logs>.section-heading{
    grid-template-columns:auto minmax(0,1fr) auto!important;
    grid-template-rows:auto;
    gap:8px;
    min-height:0;
    margin-bottom:14px!important
  }
  html body #logs>.section-heading>div:first-of-type{
    grid-column:2!important;grid-row:1!important;text-align:center;justify-self:center
  }
  html body #logs>.section-heading>.page-info-button,
  html body #logs>.section-heading>.page-more-info-button{
    grid-column:1!important;grid-row:1!important;justify-self:start!important;width:auto!important
  }
  html body #logs>.section-heading>.section-actions{
    grid-column:3!important;grid-row:1!important;justify-self:end!important;width:auto!important
  }
  html body #logs .section-actions>#createLogbook{min-width:0;padding-inline:10px!important}
  html body #logs>.section-heading>.section-actions>#createLogbook{width:auto!important}
  html body #logs>.logbook-grid{grid-template-columns:1fr}
  html body #logs>.log-meta-row{align-items:stretch}
html body #logs .log-secondary-actions{min-width:0;align-items:center}
}

/* Patch 42: filter pairs meet at the page center line. */
html body .area-sort-filter{
  width:100%!important;
  max-width:100%!important;
  grid-template-columns:repeat(2,minmax(0,325px))!important;
  justify-content:center!important;
  gap:12px!important;
}
html body .area-sort-filter>.kinstead-filter-slot{width:100%!important;min-width:0!important}
html body .area-sort-filter>.kinstead-filter-slot:first-child{grid-column:1}
html body .area-sort-filter>.kinstead-filter-slot:last-child{grid-column:2}
html body .area-sort-filter .kinstead-popup-select-button{width:100%!important}
@media(max-width:560px){
  html body .area-sort-filter{
    grid-template-columns:minmax(0,510px)!important;
    justify-content:center!important;
    gap:8px!important
  }
  html body .area-sort-filter>.kinstead-filter-slot{grid-column:1!important;justify-self:center!important}
}

/* Universal Kinstead popup system */
.app-popup-dialog{width:min(580px,calc(100vw - 24px));max-width:580px;padding:0;border:0;border-radius:28px;background:#fff;overflow:hidden;box-shadow:0 32px 90px rgba(20,22,30,.34)}
.app-popup-dialog::backdrop{background:rgba(20,22,30,.6);backdrop-filter:blur(4px)}
.app-popup-shell{display:grid;grid-template-rows:auto auto auto;height:fit-content;min-height:0;max-height:calc(100dvh - 24px);overflow:hidden}
.app-popup-header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:20px;padding:30px 32px 22px;border-bottom:1px solid color-mix(in srgb,var(--theme-mid) 45%,#fff)}
.app-popup-header h2{margin:0;font-size:clamp(1.65rem,4vw,2.2rem);line-height:1.12}
.app-popup-close{width:48px;height:48px;min-width:48px;padding:0;display:grid;place-items:center;border-radius:15px;background:var(--theme-dark)!important;color:#fff!important;border:1px solid var(--theme-dark)!important;font-size:2rem;line-height:1}
.app-popup-body{padding:26px 32px;min-height:0;max-height:58dvh;overflow-y:auto;overscroll-behavior:contain}.app-popup-body>p{margin:0;font-size:1.08rem;line-height:1.55;white-space:pre-wrap}
#appPopupInputWrap{margin-top:22px}#appPopupInputWrap label{display:block;margin-bottom:8px;font-weight:800}
#appPopupInput{width:100%;min-height:56px;box-sizing:border-box;font-size:1.05rem}
.app-popup-footer{display:flex;justify-content:flex-end;gap:12px;padding:20px 32px 26px;border-top:1px solid color-mix(in srgb,var(--theme-mid) 45%,#fff)}
.app-popup-footer button{min-width:130px;min-height:52px}.app-popup-footer .danger{background:#b42338!important;color:#fff!important;border-color:#b42338!important}
@media(max-width:560px){.app-popup-header,.app-popup-body,.app-popup-footer{padding-left:20px;padding-right:20px}.app-popup-footer{flex-direction:column-reverse}.app-popup-footer button{width:100%}}

/* GLOBAL BUTTON SYSTEM — matches + New log */
/* Dropdown menu buttons are intentionally excluded. */

html body button:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button):not(.link-button):not(.icon-button):not(.app-popup-close):not(.logbook-close):not(.app-history-button),
html body input[type="submit"],
html body input[type="button"]{
  box-sizing:border-box !important;
  min-height:52px !important;
  padding:0 20px !important;
  border-radius:16px !important;
  background:#ffffff !important;
  color:var(--theme-dark) !important;
  border:1px solid var(--theme-mid) !important;
  box-shadow:none !important;
  font-weight:800 !important;
  line-height:1.15 !important;
  text-decoration:none !important;
}

html body button:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button):not(.link-button):not(.icon-button):not(.app-popup-close):not(.logbook-close):not(.app-history-button) *,
html body input[type="submit"] *,
html body input[type="button"] *{
  color:inherit !important;
}

html body button:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button):not(.link-button):not(.icon-button):not(.app-popup-close):not(.logbook-close):not(.app-history-button):hover,
html body input[type="submit"]:hover,
html body input[type="button"]:hover{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-dark) !important;
  filter:none !important;
  transform:none !important;
}

html body button:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button):not(.link-button):not(.icon-button):not(.app-popup-close):not(.logbook-close):not(.app-history-button):focus-visible,
html body input[type="submit"]:focus-visible,
html body input[type="button"]:focus-visible{
  outline:3px solid color-mix(in srgb,var(--theme-mid) 38%,transparent) !important;
  outline-offset:2px !important;
  border-color:var(--theme-dark) !important;
}

html body button:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button):not(.link-button):not(.icon-button):not(.app-popup-close):not(.logbook-close):not(.app-history-button):disabled,
html body input[type="submit"]:disabled,
html body input[type="button"]:disabled{
  opacity:.55 !important;
  cursor:not-allowed !important;
  background:#f5f5f5 !important;
  color:#777 !important;
  border-color:#ccc !important;
}

/* Small buttons keep their compact size but use the same visual style. */
html body button.mini:not(.app-dropdown-menu button),
html body .mini button:not(.app-dropdown-menu button){
  min-height:40px !important;
  padding:0 14px !important;
  border-radius:12px !important;
}

/* Icon-only close buttons keep square dimensions but use the same white outlined look. */
html body .icon-button,
html body .app-popup-close,
html body .logbook-close,
html body .log-entry-close,
html body .family-profile-chooser-close,
html body #closeFamilyProfileChooser,
html body #closeStyledPinDialog{
  width:48px !important;
  height:48px !important;
  min-width:48px !important;
  padding:0 !important;
  display:grid !important;
  place-items:center !important;
  border-radius:15px !important;
  background:#ffffff !important;
  color:var(--theme-dark) !important;
  border:1px solid var(--theme-mid) !important;
  box-shadow:none !important;
  font-size:1.9rem !important;
}

html body .icon-button:hover,
html body .app-popup-close:hover,
html body .logbook-close:hover,
html body .log-entry-close:hover,
html body .family-profile-chooser-close:hover,
html body #closeFamilyProfileChooser:hover,
html body #closeStyledPinDialog:hover{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-dark) !important;
}

/* Destructive buttons remain outlined, but use red text and border. */
html body button.danger:not(.app-dropdown-menu button),
html body .danger button:not(.app-dropdown-menu button),
html body .app-popup-footer .danger{
  background:#ffffff !important;
  color:#b42338 !important;
  border-color:#d86f7c !important;
  box-shadow:none !important;
}

html body button.danger:not(.app-dropdown-menu button):hover,
html body .danger button:not(.app-dropdown-menu button):hover,
html body .app-popup-footer .danger:hover{
  background:#fff1f2 !important;
  color:#b42338 !important;
  border-color:#b42338 !important;
}

/* Preserve dropdown menu structure and styling exactly as already rebuilt. */
html body .app-dropdown-menu > button,
html body .app-dropdown-menu .menu-item,
html body .app-dropdown-menu .tab,
html body .profile-menu > button,
html body .section-menu > button{
  min-height:48px !important;
  padding:12px 14px !important;
  border-radius:12px !important;
  background:#ffffff !important;
  color:#111111 !important;
  border:1px solid transparent !important;
  box-shadow:none !important;
  font-weight:700 !important;
}

/* FINAL FULL BUTTON INVENTORY OVERRIDE
   Audited: 94 button tags, 52 IDs, 45 classes, 1 file-button label.
   Only buttons inside the two dropdown panels are excluded. */

html body :is(
  #appShell,
  #signinScreen,
  #cloudHouseholdScreen,
  #emailConfirmationScreen,
  #profileSwitchScreen,
  #onboardingScreen,
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) button:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button),
html body label.file-button,
html body input[type="submit"],
html body input[type="button"]{
  box-sizing:border-box !important;
  min-height:52px !important;
  padding:0 20px !important;
  border-radius:16px !important;
  background:#ffffff !important;
  color:var(--theme-dark) !important;
  border:1px solid var(--theme-mid) !important;
  box-shadow:none !important;
  filter:none !important;
  font-weight:800 !important;
  line-height:1.15 !important;
  text-decoration:none !important;
  transform:none !important;
}

html body :is(
  #appShell,
  #signinScreen,
  #cloudHouseholdScreen,
  #emailConfirmationScreen,
  #profileSwitchScreen,
  #onboardingScreen,
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) button:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button) *,
html body label.file-button *{
  color:inherit !important;
}

html body :is(
  #appShell,
  #signinScreen,
  #cloudHouseholdScreen,
  #emailConfirmationScreen,
  #profileSwitchScreen,
  #onboardingScreen,
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) button:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button):hover,
html body label.file-button:hover,
html body input[type="submit"]:hover,
html body input[type="button"]:hover{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-dark) !important;
  box-shadow:none !important;
  filter:none !important;
  transform:none !important;
}

html body :is(
  #appShell,
  #signinScreen,
  #cloudHouseholdScreen,
  #emailConfirmationScreen,
  #profileSwitchScreen,
  #onboardingScreen,
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) button.mini:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button){
  min-height:40px !important;
  padding:0 14px !important;
  border-radius:12px !important;
}

/* Close and icon buttons use the same style in a square shape. */
html body :is(
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) :is(
  .icon-button,
  .app-popup-close,
  .logbook-close,
  .log-entry-close,
  .family-profile-chooser-close,
  #closeFamilyProfileChooser,
  #closeStyledPinDialog,
  #closeCreateLogbook,
  #closeLogbookEntry,
  #appPopupClose,
  #closeModal
){
  width:48px !important;
  height:48px !important;
  min-width:48px !important;
  padding:0 !important;
  display:grid !important;
  place-items:center !important;
  border-radius:15px !important;
  background:#ffffff !important;
  color:var(--theme-dark) !important;
  border:1px solid var(--theme-mid) !important;
  box-shadow:none !important;
  font-size:1.9rem !important;
}

/* Delete/danger buttons now match the same button appearance too. */
html body :is(
  #appShell,
  #signinScreen,
  #cloudHouseholdScreen,
  #emailConfirmationScreen,
  #profileSwitchScreen,
  #onboardingScreen,
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) button.danger:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button),
html body #appPopupDialog .danger{
  background:#ffffff !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-mid) !important;
}

html body :is(
  #appShell,
  #signinScreen,
  #cloudHouseholdScreen,
  #emailConfirmationScreen,
  #profileSwitchScreen,
  #onboardingScreen,
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) button.danger:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button):hover,
html body #appPopupDialog .danger:hover{
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-dark) !important;
}

/* Selected controls still show selection using the pale shade, not a filled dark button. */
html body :is(
  #appShell,
  #signinScreen,
  #cloudHouseholdScreen,
  #emailConfirmationScreen,
  #profileSwitchScreen,
  #onboardingScreen,
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) button.active:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button),
html body :is(
  #appShell,
  #signinScreen,
  #cloudHouseholdScreen,
  #emailConfirmationScreen,
  #profileSwitchScreen,
  #onboardingScreen,
  #familyProfileChooser,
  #styledPinDialog,
  #createLogbookDialog,
  #logbookEntryDialog,
  #appPopupDialog,
  #modal
) button[aria-expanded="true"]:not(.app-dropdown-menu button):not(.profile-menu button):not(.section-menu button){
  background:var(--theme-pale) !important;
  color:var(--theme-dark) !important;
  border-color:var(--theme-dark) !important;
}

/* Dropdown panels and their menu items remain exactly white with black text. */
html body .app-dropdown-menu,
html body .profile-menu,
html body .section-menu{
  background:#ffffff !important;
  color:#111111 !important;
}

html body .app-dropdown-menu > button,
html body .app-dropdown-menu .menu-item,
html body .app-dropdown-menu .tab,
html body .profile-menu > button,
html body .section-menu > button{
  min-height:48px !important;
  padding:12px 14px !important;
  border-radius:12px !important;
  background:#ffffff !important;
  color:#111111 !important;
  border:1px solid transparent !important;
  box-shadow:none !important;
  font-weight:700 !important;
}

html body .app-dropdown-menu > button:hover,
html body .app-dropdown-menu .menu-item:hover,
html body .app-dropdown-menu .tab:hover,
html body .profile-menu > button:hover,
html body .section-menu > button:hover{
  background:var(--theme-pale) !important;
  color:#111111 !important;
  border-color:var(--theme-mid) !important;
}

/* Legal agreements and support */
.signup-legal{display:grid;gap:12px;margin:18px 0;padding:16px;border:1px solid var(--theme-mid);border-radius:16px;background:var(--theme-pale)}
.legal-check{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:start;line-height:1.4}
.legal-check input{margin-top:3px}
.auth-legal-links,.contact-legal-links{display:flex;flex-wrap:wrap;gap:12px;margin-top:18px}
.auth-legal-links a,.contact-legal-links a,.legal-doc-link{color:var(--theme-dark)!important;text-decoration:underline;font-weight:700}
.legal-settings-panel,.contact-support-panel{margin-top:20px}
.legal-link-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:16px 0}
.legal-doc-link{display:block;padding:14px;border:1px solid var(--theme-mid);border-radius:14px;background:#fff}
.contact-support-panel form{display:grid;gap:10px;margin-top:18px}
.contact-support-panel input,.contact-support-panel select,.contact-support-panel textarea{width:100%;box-sizing:border-box}
@media(max-width:650px){.legal-link-grid{grid-template-columns:1fr}}
.legal-update-dialog{width:min(680px,calc(100vw - 24px));max-width:680px}
.legal-update-dialog .app-popup-body{display:grid;gap:14px;overflow-y:auto;overscroll-behavior:contain}
.legal-update-dialog .app-popup-body>p{margin:0}
.legal-update-dialog .legal-link-grid{margin:2px 0}
.legal-update-dialog .legal-check{padding:12px;border:1px solid color-mix(in srgb,var(--theme-mid) 55%,#fff);border-radius:12px;background:color-mix(in srgb,var(--theme-pale) 55%,#fff)}
@media(max-width:650px){.legal-update-dialog{width:calc(100vw - 16px);border-radius:22px}.legal-update-dialog .app-popup-header{padding:22px 20px 16px}.legal-update-dialog .app-popup-body{padding:18px 20px}.legal-update-dialog .app-popup-footer{padding:16px 20px;flex-wrap:wrap}.legal-update-dialog .app-popup-footer button{flex:1 1 180px}}

/* Profile dropdown Contact & Legal page */
.contact-legal-layout{align-items:start}
.account-legal-history-panel,.privacy-dashboard-panel{grid-column:1/-1}
.legal-history-list{display:grid;gap:12px;margin:16px 0}
.legal-history-entry{padding:16px;border:1px solid var(--line);border-radius:16px;background:color-mix(in srgb,var(--theme-pale) 38%,#fff)}
.legal-history-heading{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:12px}
.legal-history-heading h4{margin:2px 0}
.legal-history-status{display:inline-flex;padding:.28rem .55rem;border-radius:999px;background:#e9f8f1;color:#176d4c;font-size:.78rem;font-weight:850;white-space:nowrap}
.legal-history-status.withdrawn,.legal-history-status.incomplete{background:#fff1f1;color:#8e3041}
.legal-history-entry dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 18px;margin:0}
.legal-history-entry dl div{min-width:0}
.legal-history-entry dt{color:var(--muted);font-size:.78rem;font-weight:750}
.legal-history-entry dd{margin:3px 0 0;overflow-wrap:anywhere}
.privacy-dashboard-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:16px}
.privacy-dashboard-grid>div{padding:16px;border:1px solid var(--line);border-radius:16px;background:#fff}
.privacy-dashboard-grid h4{margin:0 0 12px}
.privacy-data-list{display:grid;gap:10px;margin:0;padding:0;list-style:none}
.privacy-data-list li{display:grid;grid-template-columns:1.2rem 1fr;gap:7px;align-items:start}
.privacy-data-list li span{color:var(--good);font-weight:900}
.privacy-data-list-negative li span{color:var(--muted)}
.ai-transparency-note{margin-top:18px;padding:16px;border-left:4px solid var(--theme-dark);border-radius:12px;background:var(--theme-pale)}
.ai-transparency-note p{margin:.45rem 0 0}
#profileContactSupportForm{display:grid;gap:10px;margin-top:18px}
#profileContactSupportForm input,
#profileContactSupportForm select,
#profileContactSupportForm textarea{width:100%;box-sizing:border-box}
@media(max-width:650px){.legal-history-heading{display:grid}.legal-history-entry dl,.privacy-dashboard-grid{grid-template-columns:1fr}}

#appPopupMessage{white-space:pre-line}


.kinstead-install-footer{
  position:static !important;
  inset:auto !important;
  width:100%;
  max-width:760px;
  margin:32px auto 16px;
  padding:20px;
  border:1px solid color-mix(in srgb, var(--accent, #256843) 35%, transparent);
  border-radius:20px;
  background:color-mix(in srgb, var(--surface, #ffffff) 94%, var(--accent, #256843) 6%);
  box-shadow:none;
}
.kinstead-install-footer[hidden]{display:none !important}
.kinstead-install-footer__button{
  width:100%;
  min-height:52px;
  border:0;
  border-radius:14px;
  background:var(--accent, #256843);
  color:var(--accent-contrast, #ffffff);
  font:inherit;
  font-weight:800;
  cursor:pointer;
}
.kinstead-install-footer__note{
  margin:10px 2px 0;
  text-align:center;
  opacity:.76;
  font-size:.92rem;
}

.install-permissions-panel{margin-bottom:18px}
.profile-install-permissions{display:grid;gap:10px;margin-top:14px}
.profile-install-permission-row{
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:12px;border:1px solid color-mix(in srgb, var(--accent,#256843) 24%, transparent);
  border-radius:15px;background:color-mix(in srgb, var(--panel,#fff) 94%, var(--accent,#256843) 6%)
}
.profile-install-person{display:flex;align-items:center;gap:10px;min-width:0}
.profile-install-person span{display:grid;gap:2px;min-width:0}
.profile-install-person small{color:var(--muted)}
.install-permission-avatar{width:42px;height:42px;flex:0 0 42px}
.install-permission-state{font-weight:750;padding:7px 10px;border-radius:999px}
.install-permission-state.allowed{background:rgba(37,104,67,.12);color:#205b3b}
.toggle-profile-install.approved{border-color:rgba(145,42,42,.28);color:#812b2b}
@media(max-width:640px){
  .profile-install-permission-row{align-items:stretch;flex-direction:column}
  .profile-install-permission-row button{width:100%}
}


.notification-settings-card{
  position:static !important;
  margin:24px 0;
  padding:22px;
  border:1px solid color-mix(in srgb, var(--accent, #256843) 36%, transparent);
  border-radius:22px;
  background:var(--surface, #fff);
}
.notification-feature-summary{
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:14px 16px;margin-bottom:18px;border:1px solid rgba(127,127,127,.18);
  border-radius:16px;background:color-mix(in srgb,var(--panel,#fff) 96%,var(--accent,#256843) 4%)
}
.notification-feature-summary p{margin:0 0 3px}
.notification-info-dialog{
  width:min(720px,calc(100% - 24px));max-height:min(82vh,820px);padding:0;border:0;
  border-radius:22px;background:var(--panel,#fff);color:var(--text,#202028);
  box-shadow:0 24px 80px rgba(0,0,0,.3)
}
.notification-info-dialog::backdrop{background:rgba(12,16,20,.58)}
.notification-info-shell{padding:20px;overflow:auto;max-height:min(82vh,820px)}
.settings-section-switcher{position:relative;margin:14px 0 18px;max-width:420px}
.settings-section-switcher .section-menu{left:0;right:auto;width:min(360px,calc(100vw - 40px))}
.kinstead-picker-dialog{width:min(560px,calc(100% - 24px));max-height:82vh;padding:0;border:0;border-radius:22px;background:var(--panel,#fff);color:var(--text,#202028);box-shadow:0 24px 80px rgba(0,0,0,.34)}
.kinstead-picker-dialog::backdrop{background:rgba(12,16,20,.62)}
.kinstead-picker-shell{padding:18px;max-height:82vh;overflow:auto}
.kinstead-picker-head{display:flex;align-items:start;justify-content:space-between;gap:12px;margin-bottom:14px}
.kinstead-picker-head h2,.kinstead-picker-head p{margin:0}
.kinstead-picker-options{display:grid;gap:8px}
.kinstead-picker-option{width:100%;text-align:left;background:var(--panel,#fff);color:var(--text,#202028);border:1px solid rgba(127,127,127,.22)}
.kinstead-picker-option.selected,.kinstead-time-picker button.selected,.kinstead-calendar-grid button.selected{background:var(--accent,#256843);color:#fff;border-color:var(--accent,#256843)}
.kinstead-calendar-head{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;margin-bottom:10px;text-align:center}
.kinstead-calendar-head button{min-width:44px}.kinstead-calendar-week,.kinstead-calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;text-align:center}
.kinstead-calendar-week{font-weight:700;opacity:.7;margin-bottom:5px}.kinstead-calendar-grid button{padding:10px 2px;border:1px solid rgba(127,127,127,.2);background:transparent;color:inherit;border-radius:10px}
.kinstead-time-picker{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}.kinstead-time-picker>div{display:grid;gap:6px;max-height:320px;overflow:auto}.kinstead-time-picker button{background:transparent;color:inherit;border:1px solid rgba(127,127,127,.22)}
.kinstead-native-control-hidden{position:absolute!important;opacity:0!important;pointer-events:none!important;width:1px!important;height:1px!important}
.kinstead-multi-time{display:grid;gap:10px}.kinstead-saved-times{display:grid;gap:8px}.kinstead-saved-time{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px;border:1px solid rgba(127,127,127,.2);border-radius:12px}.kinstead-saved-time span{display:flex;gap:6px}
@media(max-width:640px){
  .notification-feature-summary{align-items:stretch;flex-direction:column}
  .notification-feature-summary button{width:100%}
}
.notification-settings-card[hidden]{display:none!important}
.quick-result-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 16px;margin:10px 0 0}
.quick-result-summary div{display:grid;gap:2px;padding:8px 10px;border-radius:10px;background:color-mix(in srgb,var(--surface,#fff) 88%,var(--accent,#256843) 12%)}
.quick-result-summary dt{font-size:.78rem;font-weight:750;opacity:.72;text-transform:uppercase;letter-spacing:.04em}
.quick-result-summary dd{margin:0;font-weight:700;overflow-wrap:anywhere}
@media(max-width:520px){.quick-result-summary{grid-template-columns:1fr}}
.notification-settings-card__header h2{margin:.15rem 0 .35rem}
.notification-settings-grid{display:grid;gap:14px;margin-top:18px}
.notification-toggle-row{
  display:flex;align-items:center;justify-content:space-between;gap:18px;
  padding:14px 0;border-bottom:1px solid rgba(127,127,127,.18)
}
.notification-toggle-row span{display:grid;gap:3px}
.notification-toggle-row small{opacity:.72;line-height:1.35}
.notification-toggle-row input[type="checkbox"]{
  width:22px;height:22px;flex:0 0 auto;accent-color:var(--accent,#256843)
}
.notification-time-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.notification-settings-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:20px}
.notification-settings-actions button{
  min-height:46px;padding:10px 14px;border-radius:13px;font:inherit;font-weight:750;
  border:1px solid color-mix(in srgb,var(--accent,#256843) 35%,transparent);
  background:var(--surface,#fff);color:inherit
}
.notification-settings-actions button:first-child,
.notification-settings-actions button:last-child{
  background:var(--accent,#256843);color:var(--accent-contrast,#fff);border-color:transparent
}
@media (max-width:640px){
  .notification-settings-card{padding:18px}
  .notification-time-row{grid-template-columns:1fr}
  .notification-settings-actions{display:grid}
  .notification-settings-actions button{width:100%}
}


#notificationSettingsPanel.notification-settings-card{
  display:block;
  visibility:visible;
  opacity:1;
  width:100%;
}
#notificationSettingsPanel .notification-settings-visible-marker{
  margin:.35rem 0 0;
  font-weight:700;
  color:var(--accent,#256843);
}


/* Notification settings rebuilt */
.notification-settings-card{
  position:static !important;
  display:block !important;
  width:100%;
  margin:18px 0 28px;
  padding:20px;
  border:1px solid color-mix(in srgb,var(--accent,#256843) 30%,transparent);
  border-radius:22px;
  background:var(--surface,#fff);
}
.notification-settings-header h2{margin:.15rem 0 .35rem}
.notification-section{
  margin-top:18px;
  padding-top:18px;
  border-top:1px solid rgba(127,127,127,.18);
}
.notification-section h3{margin:0 0 8px}
.notification-option{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:14px 0;
  border-bottom:1px solid rgba(127,127,127,.15);
}
.notification-option span{
  display:grid;
  gap:3px;
  min-width:0;
}
.notification-option small{
  opacity:.72;
  line-height:1.35;
}
.notification-option input[type="checkbox"]{
  width:24px;
  height:24px;
  flex:0 0 auto;
  accent-color:var(--accent,#256843);
}
.master-option{
  margin-top:12px;
  padding:16px;
  border:1px solid color-mix(in srgb,var(--accent,#256843) 30%,transparent);
  border-radius:16px;
}
.notification-subfield{
  margin:12px 0;
}
.notification-time-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:12px;
}
.notification-settings-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:22px;
}
.notification-settings-actions button{
  min-height:48px;
  padding:10px 14px;
  border-radius:13px;
  font:inherit;
  font-weight:750;
}
.notification-status{
  min-height:1.4em;
  margin:12px 0 0;
  font-weight:650;
}
@media (max-width:640px){
  .notification-settings-card{padding:16px}
  .notification-time-grid{grid-template-columns:1fr}
  .notification-settings-actions{display:grid}
  .notification-settings-actions button{width:100%}
}


.notification-panel-highlight{
  outline:3px solid var(--accent,#256843);
  outline-offset:4px;
  transition:outline-color .3s ease;
}


.parent-notification-option{
  border-left:4px solid var(--accent,#256843);
  padding-left:12px;
}


/* Family notification suite */
.notification-tabs{display:flex;gap:8px;overflow-x:auto;margin:18px 0;padding-bottom:4px}
.notification-tabs button{white-space:nowrap;border:1px solid rgba(127,127,127,.22);background:var(--surface,#fff);padding:10px 13px;border-radius:999px;font:inherit;font-weight:700}
.notification-tabs button.active{background:var(--accent,#256843);color:var(--accent-contrast,#fff);border-color:transparent}
.notification-tab-panel{display:none}
.notification-tab-panel.active{display:block}
.notification-list{display:grid;gap:10px;margin-top:14px}
.notification-list-card{display:flex;justify-content:space-between;gap:14px;align-items:center;padding:14px;border:1px solid rgba(127,127,127,.18);border-radius:16px;background:var(--surface,#fff)}
.notification-list-card p,.notification-list-card small{margin:.25rem 0 0;opacity:.75}
.approval-actions{display:flex;gap:8px;flex-wrap:wrap}
.notification-rule-grid{display:grid;gap:12px}
@media(max-width:640px){.notification-list-card{align-items:flex-start;flex-direction:column}.approval-actions{width:100%}.approval-actions button{flex:1}}


.legacy-profile-action-select{
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}

.profile-edit-action-buttons{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin:14px 0 18px;
}

.profile-edit-action-buttons button{
  min-height:48px;
  border-radius:14px;
  border:1px solid color-mix(in srgb,var(--accent,#256843) 30%,transparent);
  background:var(--surface,#fff);
  color:inherit;
  font:inherit;
  font-weight:750;
}

@media (max-width:520px){
  .profile-edit-action-buttons{grid-template-columns:1fr;}
}

.notification-feature-audit{margin:18px 0 22px;padding:18px;border:1px solid rgba(127,127,127,.2);border-radius:20px}
.notification-feature-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.notification-feature-grid article{display:flex;gap:12px;padding:13px;border:1px solid rgba(127,127,127,.16);border-radius:15px;background:var(--surface,#fff)}
.notification-feature-grid article>b{display:grid;place-items:center;flex:0 0 30px;height:30px;border-radius:999px;background:var(--accent,#256843);color:var(--accent-contrast,#fff)}
.notification-feature-grid span{display:grid;gap:3px}
.notification-feature-grid small{opacity:.72;line-height:1.3}
body.child-focus-mode .parent-only,
body.child-focus-mode #settings,
body.child-focus-mode #family,
body.child-focus-mode #logs,
body.child-focus-mode #templates,
body.child-focus-mode #history{display:none!important}
@media(max-width:640px){.notification-feature-grid{grid-template-columns:1fr}}

.dashboard-clickable{
  position:relative;
  cursor:pointer;
  padding-right:48px !important;
  transition:transform .16s ease, box-shadow .16s ease;
}
.dashboard-clickable:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 22px rgba(0,0,0,.08);
}
.dashboard-clickable:focus-visible{
  outline:3px solid var(--accent,#256843);
  outline-offset:3px;
}
.dashboard-clickable::after{
  content:"›";
  position:absolute;
  right:16px;
  top:50%;
  transform:translateY(-50%);
  font-size:1.65rem;
  font-weight:800;
  opacity:.55;
}


.verification-help{
  margin-top:14px;
  padding:14px;
  border:1px solid color-mix(in srgb,var(--accent,#256843) 28%,transparent);
  border-radius:14px;
  background:color-mix(in srgb,var(--surface,#fff) 94%,var(--accent,#256843) 6%);
}

.verification-help[hidden]{
  display:none !important;
}

.verification-help p{
  margin:0 0 10px;
}

.verification-help .auth-status{
  margin:10px 0 0;
  font-size:.92rem;
}

.auth-status.error{
  color:#a12626;
}

.auth-status.success{
  color:#1f6a3d;
}


.signup-freeze-status{
  min-height:1.35em;
  margin:10px 0 0;
  font-size:.92rem;
}

.signup-freeze-status.error{
  color:#a12626;
}

.signup-freeze-status.success{
  color:#1f6a3d;
}


.dashboard-family-actions{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  margin:24px 0 8px;
}

.dashboard-action-card{
  min-width:0;
}

.dashboard-action-card h3{
  margin-top:0;
}

#dashboardApprovalsCard .notification-list,
#dashboardAnnouncementsCard .notification-list{
  margin-top:12px;
}

#dashboardAnnouncementsCard textarea{
  width:100%;
  resize:vertical;
}

@media (max-width:760px){
  .dashboard-family-actions{
    grid-template-columns:1fr;
  }
}




/* Exact Backup and restore layout. */
#backupRestoreCard .button-row{
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  gap:12px !important;
  align-items:stretch !important;
}

#backupRestoreCard .button-row > *{
  width:100% !important;
  min-width:0 !important;
  min-height:82px !important;
  height:100% !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  text-align:center !important;
  box-sizing:border-box !important;
}

@media (max-width:760px){
  #backupRestoreCard .button-row{
    grid-template-columns:1fr !important;
  }

  #backupRestoreCard .button-row > *{
    min-height:58px !important;
  }
}


.kinstead-startup-overlay{
  position:fixed;
  inset:0;
  z-index:99999;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg,#f6f8fb);
  transition:opacity .18s ease, visibility .18s ease;
}

.kinstead-startup-overlay.is-hidden{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}

.kinstead-startup-card{
  display:flex;
  align-items:center;
  gap:12px;
  padding:16px 20px;
  border-radius:16px;
  background:var(--panel,#fff);
  box-shadow:0 12px 36px rgba(0,0,0,.12);
}

.kinstead-loader{
  width:22px;
  height:22px;
  border:3px solid rgba(0,0,0,.16);
  border-top-color:currentColor;
  border-radius:50%;
  animation:kinstead-spin .8s linear infinite;
}

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

.kinstead-reconnecting .kinstead-startup-card{
  min-width:min(320px,calc(100vw - 32px));
  justify-content:center;
}


#tasks .kinstead-native-filter{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  opacity:0 !important;
  pointer-events:none !important;
}

.kinstead-compact-select{
  position:relative;
  min-width:0;
}

.kinstead-compact-select-button{
  width:100%;
  min-height:44px;
  text-align:left;
  padding-right:38px;
  position:relative;
}

.kinstead-compact-select-button::after{
  content:"▾";
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
}

/* Patch 97: profile-specific Adaptive Experience and quiet encouragement. */
.kinstead-startup-tip{margin:.2rem 0 0;color:var(--muted,#62606a);font-size:.85rem;font-weight:500}
.encouragement-card{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:0 0 18px;background:color-mix(in srgb,var(--panel,#fff) 90%,var(--theme-soft,#f1edff) 10%)}
.encouragement-card h3{margin:.18rem 0}.encouragement-card p:last-child{margin:.25rem 0 0;max-width:72ch;line-height:1.55}
.encouragement-card button{flex:0 0 auto}
.adaptive-focus-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-bottom:18px}
.adaptive-focus-card{min-width:0}.adaptive-current-goal-progress{margin-top:10px}.adaptive-current-goal-progress p{margin:.35rem 0}
.adaptive-mode-hidden{display:none!important}
.adaptive-settings-panel{margin-bottom:16px}.adaptive-setting-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 18px}
.adaptive-select-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px}.adaptive-select-grid .field small{display:block;margin-top:6px;font-weight:500;line-height:1.4}
.encouragement-category-fieldset{margin:18px 0 0;border:1px solid var(--line);border-radius:16px;padding:14px}.encouragement-category-fieldset legend{font-weight:800;padding:0 7px}
.encouragement-category-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px 14px}.encouragement-category-grid label{display:flex;align-items:center;gap:9px;margin:0;padding:8px;border-radius:10px;font-weight:650}.encouragement-category-grid input{width:20px;height:20px;flex:0 0 auto}
.adaptive-celebration-toast{position:fixed;z-index:9000;left:50%;bottom:max(24px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(560px,calc(100% - 28px));display:flex;align-items:center;justify-content:center;gap:12px;padding:15px 20px;border:1px solid color-mix(in srgb,var(--theme-accent,#6f5ba8) 35%,transparent);border-radius:18px;background:var(--panel,#fff);color:var(--ink,#241f30);box-shadow:0 18px 55px rgba(30,20,55,.18);font-weight:750;text-align:center}
.adaptive-celebration-toast.is-animated{animation:adaptive-toast-in .24s ease-out}.adaptive-celebration-toast [aria-hidden=true]{letter-spacing:.25em;color:var(--purple)}
@keyframes adaptive-toast-in{from{opacity:0;transform:translate(-50%,12px)}to{opacity:1;transform:translate(-50%,0)}}
body[data-calm-mode="true"] .hero-card,body[data-calm-mode="true"] .panel,body[data-calm-mode="true"] .countdown-card,body[data-calm-mode="true"] .profile-card{box-shadow:0 5px 18px rgba(58,42,98,.035)}
body[data-calm-mode="true"] *,body[data-calm-mode="true"] *::before,body[data-calm-mode="true"] *::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
body[data-visual-density="relaxed"] .panel,body[data-visual-density="relaxed"] .task-card{padding:clamp(20px,3vw,28px)}
body[data-visual-density="relaxed"] .task-row{padding-block:17px}
body[data-visual-density="compact"] .panel,body[data-visual-density="compact"] .task-card{padding:13px}
body[data-visual-density="compact"] .task-row{padding-block:8px}body[data-visual-density="compact"] .section-heading{margin-block:9px 12px}
body[data-reading-style="simple"] .adaptive-reading-detail{display:none!important}
body[data-reading-style="detailed"] .adaptive-reading-detail{display:block}
body[data-icons-labels="icons-only"] .adaptive-action .adaptive-label{display:none}
body[data-icons-labels="text-only"] .adaptive-action .adaptive-icon{display:none}
body[data-icons-labels="icons-only"] .adaptive-action{min-width:46px;display:inline-grid;place-items:center}
@media(max-width:820px){.adaptive-setting-grid,.encouragement-category-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.adaptive-dashboard-actions{justify-content:flex-end}}
@media(max-width:640px){.encouragement-card{align-items:flex-start;flex-direction:column}.adaptive-focus-grid,.adaptive-setting-grid,.adaptive-select-grid,.encouragement-category-grid{grid-template-columns:1fr}.encouragement-card button{width:100%}}
@media(prefers-reduced-motion:reduce){.adaptive-celebration-toast.is-animated{animation:none}.kinstead-loader{animation-duration:1.8s}}
@media(forced-colors:active){.encouragement-card,.adaptive-celebration-toast,.adaptive-settings-panel,.adaptive-focus-card{border:1px solid CanvasText}.adaptive-celebration-toast [aria-hidden=true]{color:CanvasText}}

.kinstead-compact-select-menu{
  position:absolute;
  z-index:2500;
  top:calc(100% + 6px);
  left:0;
  right:0;
  max-height:280px;
  overflow:auto;
  padding:6px;
  border:1px solid rgba(0,0,0,.14);
  border-radius:12px;
  background:var(--panel,#fff);
  box-shadow:0 12px 28px rgba(0,0,0,.18);
}

.kinstead-compact-select-option{
  width:100%;
  min-height:42px;
  justify-content:flex-start;
  text-align:left;
  background:transparent;
  box-shadow:none;
}

.kinstead-compact-select-option[aria-selected="true"]{
  font-weight:700;
  background:rgba(0,0,0,.06);
}


.notification-device-actions{
  display:flex !important;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  justify-content:flex-start;
}

.notification-device-actions #registerNotificationDeviceBtn,
.notification-device-actions #refreshDevicesBtn{
  min-height:48px;
  width:auto;
}

@media (max-width:560px){
  .notification-device-actions #registerNotificationDeviceBtn,
  .notification-device-actions #refreshDevicesBtn{
    flex:1 1 0;
  }
}


.signup-freeze-status{
  min-height:1.3em;
  margin-top:10px;
}

.signup-freeze-status.error{
  color:#a12626;
  font-weight:600;
}


/* PATCH 07 — centered dialogs and stable Family Settings menu */
html body dialog[open]{
  position:fixed !important;
  inset:0 !important;
  margin:auto !important;
  max-width:calc(100vw - 24px) !important;
  max-height:calc(100dvh - 24px) !important;
}
html body .kinstead-picker-dialog[open],
html body .notification-info-dialog[open],
html body .app-popup-dialog[open],
html body .family-profile-dialog[open],
html body .styled-pin-dialog[open],
html body .log-entry-dialog[open],
html body .logbook-dialog[open],
html body #modal[open]{
  position:fixed !important;
  inset:0 !important;
  margin:auto !important;
}
.settings-section-switcher{
  position:relative !important;
  z-index:120 !important;
  max-width:100% !important;
}
html body #settingsSectionMenu{
  position:absolute !important;
  top:calc(100% + 8px) !important;
  left:0 !important;
  right:0 !important;
  width:100% !important;
  height:auto !important;
  min-height:0 !important;
  max-height:min(65dvh,520px) !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  align-items:stretch !important;
  justify-content:flex-start !important;
  z-index:9999 !important;
  background:#fff !important;
  opacity:1 !important;
}
html body #settingsSectionMenu > button{
  flex:0 0 auto !important;
  min-height:48px !important;
  height:auto !important;
  line-height:1.25 !important;
}
@media(max-width:640px){
  html body .kinstead-picker-dialog{width:min(560px,calc(100vw - 20px)) !important;max-height:calc(100dvh - 20px) !important;}
  html body .kinstead-picker-shell{max-height:calc(100dvh - 20px) !important;}
  html body #settingsSectionMenu{max-height:calc(100dvh - 170px) !important;}
}

/* PATCH 08: child profiles should never see parent-only settings. */
html body.child-settings-view [data-parent-settings-only],
html body.child-settings-view [data-notification-tab="preferences"],
html body.child-settings-view [data-notification-tab="child-safety"],
html body.child-settings-view [data-notification-tab="devices"],
html body.child-settings-view [data-notification-tab="rules"]{
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}

/* PATCH 10: keep Settings menu above page content on iPad/mobile */
.settings-section-switcher{position:relative;z-index:1200;isolation:isolate}
html body #settingsSectionMenu.app-dropdown-menu{
  position:absolute !important;
  z-index:9999 !important;
  left:0 !important;
  right:0 !important;
  top:calc(100% + 8px) !important;
  background:#fff !important;
  opacity:1 !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  box-shadow:0 24px 70px rgba(20,22,30,.30) !important;
}
html body #settingsSectionMenu.app-dropdown-menu::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:-1;
  background:#fff;
  border-radius:inherit;
}

/* Patch 11: attachment previews, proof review, menu layering, and touch safety */
.kinstead-attachment-image{display:block;width:100%;max-height:260px;object-fit:cover;border-radius:18px;margin:10px 0;border:1px solid color-mix(in srgb,var(--dark) 25%,transparent)}
.attachment-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px;margin:10px 0}
.attachment-grid .kinstead-attachment-image{height:130px;margin:0}
.kinstead-audio{width:100%;margin:8px 0}.kinstead-file-chip{display:inline-flex;padding:10px 12px;border:1px solid currentColor;border-radius:12px;text-decoration:none}
.proof-panel,.scratchpad{padding:12px;margin:12px 0;border:1px solid color-mix(in srgb,var(--dark) 25%,transparent);border-radius:16px;background:#fff}
.proof-panel input[type=file]{margin:8px 0}.scratchpad summary{cursor:pointer;font-weight:700}
#mainNavMenu,.app-nav-menu,.settings-menu,.settings-dropdown,[data-menu-panel]{position:relative;z-index:10020!important;background:#fff!important;isolation:isolate}
body.menu-open::before{content:"";position:fixed;inset:0;z-index:10000;background:rgba(0,0,0,.18);pointer-events:auto}
dialog[open]{z-index:20000!important}
@media (hover:none) and (pointer:coarse){button,select,input[type=checkbox],input[type=radio],.tab{touch-action:pan-y}}

/* Patch 12: reliable stacking, compact dialogs, scrolling menus, and touch behavior */
.section-switcher{position:relative;z-index:5000;isolation:isolate}
#sectionMenu,.section-menu,.app-dropdown-menu:not(#profileMenu){position:absolute!important;z-index:5100!important;background:var(--surface,#fff)!important;opacity:1!important;isolation:isolate;max-height:min(62vh,520px);overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;box-shadow:0 22px 60px rgba(22,18,30,.28)!important}
#sectionMenu::before,#sectionMenu::after,.scroll-fade-menu::before,.scroll-fade-menu::after{content:"";position:sticky;left:0;right:0;height:22px;display:block;z-index:3;pointer-events:none;opacity:0;transition:opacity .18s ease}
.scroll-fade-menu.can-scroll-up::before{top:0;margin-bottom:-22px;opacity:1;background:linear-gradient(var(--surface,#fff),transparent)}
.scroll-fade-menu.can-scroll-down::after{bottom:0;margin-top:-22px;opacity:1;background:linear-gradient(transparent,var(--surface,#fff))}
.section-switcher:has(#sectionMenu:not(.hidden))::after{content:"";position:fixed;inset:0;z-index:5000;background:transparent;pointer-events:none}
#sectionMenu{pointer-events:auto}
.settings-subnav,.settings-menu,.notification-settings-menu{z-index:300!important}

/* Dialogs fit their content. Only their content area scrolls when it is genuinely long. */
dialog{width:min(620px,calc(100% - 28px))!important;height:fit-content!important;min-height:0!important;max-height:calc(100dvh - 28px)!important;overflow:hidden!important;margin:auto!important}
dialog>.modal-card,dialog>.notification-info-shell,dialog>.image-viewer-shell,dialog>.family-profile-chooser-shell,dialog>.logbook-shell,dialog>.log-entry-shell,dialog>.app-popup-shell,dialog>#modalForm{height:fit-content!important;min-height:0!important;max-height:calc(100dvh - 28px)!important;overscroll-behavior:contain}
dialog>.modal-card,dialog>.notification-info-shell{overflow-y:auto!important;overflow-x:hidden!important}
dialog>.image-viewer-shell,dialog>.family-profile-chooser-shell,dialog>.logbook-shell,dialog>.log-entry-shell,dialog>.app-popup-shell,dialog>#modalForm{overflow:hidden!important}
#modalFields{max-height:min(68dvh,680px);overflow-y:auto;overscroll-behavior:contain;padding-right:4px}
@media(max-width:700px){dialog{width:calc(100% - 24px)!important;max-height:calc(100dvh - 24px)!important}.modal-card{padding-bottom:18px!important}}

.attachment-image-button{border:0;background:transparent;padding:0;display:inline-block;cursor:zoom-in}
.attachment-image-button img{display:block}
.image-viewer-dialog{background:transparent!important;box-shadow:none!important;max-width:96vw!important;width:auto!important}
.image-viewer-shell{position:relative;background:#111;border-radius:18px;padding:46px 12px 12px;display:flex;flex-direction:column;align-items:center}
.image-viewer-shell img{max-width:min(92vw,1100px);max-height:80dvh;object-fit:contain;border-radius:10px}
.image-viewer-close{position:absolute;right:10px;top:8px;background:#fff!important}
.image-viewer-name{color:#fff;margin:8px 0 0}
.existing-edit-image{max-width:220px}
.existing-edit-image img{max-height:160px;object-fit:contain}
.page-info-button{margin-left:auto;white-space:nowrap}
.compact-help-dialog .modal-card{max-width:520px}
.page-help-body{line-height:1.55;white-space:pre-wrap}

/* Suppress accidental control activation during touch scrolling. */
select,input[type="date"],input[type="time"],button,[role="button"]{touch-action:manipulation}
#modalFields,.section-menu,.settings-panel,main{touch-action:pan-y}

/* Patch 13: one interaction layer, compact editors, and stable menus. */
html,body{overscroll-behavior-y:none}
.app-shell,.app-main,main,.view,.section-heading{overflow:visible}
#sectionMenu,#profileMenu,.app-dropdown-menu{z-index:12000!important;max-height:min(68dvh,560px)!important;overflow-y:auto!important;overscroll-behavior:contain;background:var(--panel,#fff)!important;border:1px solid color-mix(in srgb,var(--dark) 18%,transparent)!important;border-radius:18px!important;box-shadow:0 20px 60px rgba(20,18,28,.3)!important}

.kinstead-enhanced-control{position:absolute!important;inline-size:1px!important;block-size:1px!important;opacity:0!important;pointer-events:none!important}
.kinstead-control-button{width:100%;min-height:48px;text-align:left;background:var(--panel,#fff);color:var(--text,#202028);border:2px solid color-mix(in srgb,var(--dark) 22%,transparent);border-radius:15px;padding:11px 42px 11px 13px;position:relative}
.kinstead-control-button::after{content:"▾";position:absolute;right:14px;top:50%;transform:translateY(-50%)}
.kinstead-picker-dialog{width:min(520px,calc(100% - 20px))!important;max-height:calc(100dvh - 20px)!important;border-radius:24px!important;overflow:hidden!important}
.kinstead-picker-shell{display:grid;grid-template-rows:auto minmax(0,1fr) auto;max-height:calc(100dvh - 20px);padding:16px!important;overflow:hidden!important}
.kinstead-picker-body{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:2px}
.kinstead-picker-options{max-height:min(62dvh,520px);overflow-y:auto;overscroll-behavior:contain}
.kinstead-picker-option{min-height:48px;border-radius:14px!important}
.kinstead-calendar{border:1px solid color-mix(in srgb,var(--dark) 18%,transparent);border-radius:20px;padding:12px;background:var(--panel,#fff)}
.kinstead-calendar-grid{gap:4px!important}.kinstead-calendar-grid button{aspect-ratio:1;min-height:38px;padding:3px!important;border-radius:50%!important}
.kinstead-calendar-head button{border-radius:50%;padding:8px!important}
.kinstead-time-picker{display:grid!important;grid-template-columns:1fr 1fr!important;gap:12px!important}
.kinstead-time-picker fieldset{min-width:0;margin:0;border:1px solid color-mix(in srgb,var(--dark) 18%,transparent);border-radius:16px;padding:8px}
.kinstead-time-picker fieldset:last-child{grid-column:1/-1}
.kinstead-time-values{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;max-height:210px;overflow-y:auto;overscroll-behavior:contain}
.kinstead-time-values button,.kinstead-period button{min-height:42px;padding:7px;background:var(--panel,#fff);color:inherit;border:1px solid color-mix(in srgb,var(--dark) 18%,transparent);border-radius:11px}
.kinstead-period{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.kinstead-time-values button.selected,.kinstead-period button.selected{background:var(--dark);color:#fff}
.kinstead-saved-time{border-radius:16px!important}.kinstead-add-time{width:100%}

#modal.task-editor-dialog{border-radius:26px!important;padding:0!important}
#modal.task-editor-dialog #modalForm{display:grid;grid-template-rows:auto minmax(0,1fr) auto;max-height:calc(100dvh - 24px);padding:18px;overflow:hidden}
#modal.task-editor-dialog #modalFields{display:grid;gap:10px;min-height:0;max-height:none!important;overflow-y:auto!important;padding:3px 5px 18px 2px}
#modal.task-editor-dialog input,#modal.task-editor-dialog textarea,#modal.task-editor-dialog .kinstead-control-button{border-radius:15px}

.section-heading>.page-info-button,.section-heading>.page-more-info-button,.notification-settings-header>.page-info-button{order:-10;margin:0!important;align-self:flex-start;flex:0 0 auto}
.section-heading{align-items:flex-start}.notification-settings-header{display:flex;align-items:flex-start;gap:12px}

#backupRestoreCard .button-row{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
#backupRestoreCard .button-row>*{box-sizing:border-box!important;width:100%!important;min-height:48px!important;margin:0!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:14px!important}
@media(max-width:560px){#backupRestoreCard .button-row{grid-template-columns:1fr!important}.kinstead-calendar-grid button{min-height:34px}.section-heading{gap:8px;flex-wrap:wrap}.section-heading>.page-info-button,.section-heading>.page-more-info-button{width:auto!important}.kinstead-picker-shell{padding:13px!important}}

/* Patch 14: compact wheel pickers and content-sized popups. */
.kinstead-picker-dialog{width:min(430px,calc(100% - 18px))!important;height:auto!important;max-height:calc(100dvh - 18px)!important}
.kinstead-picker-shell{display:block!important;height:auto!important;max-height:calc(100dvh - 18px)!important;overflow:hidden!important;padding:14px!important}
.kinstead-picker-head{margin-bottom:10px!important}
.kinstead-picker-body{height:auto!important;min-height:0!important;max-height:58dvh;overflow-y:auto!important}
.kinstead-picker-actions,.kinstead-picker-shell>.modal-actions{margin-top:10px!important}
.kinstead-wheel-picker{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;width:100%}
.kinstead-wheel-picker>div{min-width:0;text-align:center}
.kinstead-wheel-picker>div>strong{display:block;font-size:.78rem;margin:0 0 5px;color:var(--muted,#667);text-transform:uppercase;letter-spacing:.05em}
.kinstead-wheel{position:relative;display:grid;gap:4px;height:156px;overflow-y:auto;overscroll-behavior:contain;scroll-snap-type:y proximity;padding:56px 3px;mask-image:linear-gradient(transparent,#000 27%,#000 73%,transparent);-webkit-mask-image:linear-gradient(transparent,#000 27%,#000 73%,transparent)}
.kinstead-wheel button{scroll-snap-align:center;min-height:40px;padding:7px 3px!important;border:1px solid transparent!important;border-radius:11px!important;background:transparent!important;color:var(--text,#202028)!important;font-weight:750}
.kinstead-wheel button.selected{background:var(--dark,#245f48)!important;color:#fff!important;border-color:var(--dark,#245f48)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--dark,#245f48) 25%,transparent)!important}
.kinstead-wheel button:disabled{color:#9aa0a6!important;text-decoration:line-through;opacity:.48!important;background:#eef0f2!important;cursor:not-allowed}
.kinstead-picker-selection{margin:8px 0 0;padding:8px 10px;border-radius:11px;background:color-mix(in srgb,var(--dark,#245f48) 10%,white);color:var(--dark,#245f48);font-weight:800;text-align:center}
.kinstead-picker-option.selected{background:var(--dark,#245f48)!important;color:#fff!important;border-color:var(--dark,#245f48)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--dark,#245f48) 24%,transparent)!important}
.kinstead-control-button.has-value{border-color:var(--dark,#245f48)!important;background:color-mix(in srgb,var(--dark,#245f48) 9%,white)!important;color:var(--dark,#245f48)!important;font-weight:850}
.kinstead-saved-time{border-color:color-mix(in srgb,var(--dark,#245f48) 32%,transparent)!important;background:color-mix(in srgb,var(--dark,#245f48) 8%,white)!important}.kinstead-saved-time>strong{color:var(--dark,#245f48);font-weight:900}
.kinstead-picker-options{max-height:min(52dvh,430px)!important;overflow-y:auto!important}
.kinstead-picker-options:has(.kinstead-picker-option:nth-child(-n+7):last-child){overflow-y:visible!important;max-height:none!important}
.compact-help-dialog,.notification-info-dialog{height:auto!important;max-height:calc(100dvh - 24px)!important}
.compact-help-dialog>.modal-card,.notification-info-dialog>.notification-info-shell{height:auto!important;min-height:0!important;max-height:calc(100dvh - 24px)!important}
.page-more-info-button{white-space:nowrap}
@media(max-width:430px){.kinstead-picker-dialog{width:calc(100% - 12px)!important}.kinstead-wheel{height:138px;padding-block:49px}.kinstead-wheel button{min-height:38px}.kinstead-picker-shell{padding:11px!important}.kinstead-picker-shell>.modal-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.kinstead-picker-shell>.modal-actions button{padding:9px 5px!important}}

/* Patch 15: all page information uses the proven Settings information card. */
.page-help-dialog{
  width:min(680px,calc(100% - 24px))!important;
  padding:0!important;
  border:0!important;
  border-radius:32px!important;
  background:transparent!important;
  box-shadow:none!important;
  overflow:visible!important;
}
.page-help-dialog::backdrop{background:rgba(22,22,24,.58)!important;backdrop-filter:blur(2px)}
.page-help-shell{
  box-sizing:border-box;
  width:100%;
  max-height:calc(100dvh - 24px)!important;
  padding:30px!important;
  border-radius:32px!important;
  background:var(--panel,#fff)!important;
  color:var(--text,#202028)!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
  box-shadow:0 24px 70px rgba(20,18,28,.34)!important;
}
.page-help-heading{display:flex!important;justify-content:space-between!important;align-items:flex-start!important;gap:18px!important;margin:0 0 22px!important}
.page-help-heading>div{min-width:0}.page-help-heading .eyebrow{margin:0 0 12px!important}.page-help-heading h3{margin:0!important;font-size:clamp(1.65rem,5vw,2.2rem)!important;line-height:1.12!important}
.page-help-heading .icon-button{flex:0 0 64px!important;width:64px!important;height:64px!important;min-width:64px!important;margin:0!important;border-radius:22px!important;font-size:2.2rem!important}
.page-help-body{
  box-sizing:border-box;
  margin:0!important;
  padding:24px!important;
  border:1px solid color-mix(in srgb,var(--dark,#245f48) 16%,transparent)!important;
  border-radius:22px!important;
  background:var(--surface,#fff)!important;
  color:var(--muted,#62626b)!important;
  font-size:1.08rem!important;
  line-height:1.55!important;
  white-space:normal!important;
  overflow-wrap:anywhere;
}
@media(max-width:520px){
  .page-help-dialog{width:calc(100% - 20px)!important}
  .page-help-shell{padding:22px!important;border-radius:28px!important}
  .page-help-heading{gap:12px!important;margin-bottom:18px!important}
  .page-help-heading .icon-button{flex-basis:58px!important;width:58px!important;height:58px!important;min-width:58px!important;border-radius:20px!important}
  .page-help-body{padding:19px!important;border-radius:20px!important;font-size:1rem!important}
}
.area-sort-filter{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin:0 0 16px;
  max-width:760px;
}
.area-sort-filter .kinstead-compact-select{min-width:0;width:100%;}
.area-sort-filter .kinstead-compact-select-button{width:100%;text-align:left;}
@media(max-width:560px){.area-sort-filter{grid-template-columns:1fr 1fr;gap:8px}.area-sort-filter .kinstead-compact-select-button{padding-inline:14px;font-size:.95rem}}

/* Patch 19: every More info box uses the compact Family Settings card. */
html body dialog.page-help-dialog,
html body dialog.page-help-dialog[open]{
  box-sizing:border-box!important;
  position:fixed!important;
  inset:0!important;
  width:min(680px,calc(100vw - 24px))!important;
  height:auto!important;
  min-height:0!important;
  max-height:calc(100dvh - 24px)!important;
  margin:auto!important;
  padding:0!important;
  border:0!important;
  border-radius:32px!important;
  background:transparent!important;
  overflow:hidden!important;
  box-shadow:none!important;
}
html body dialog.page-help-dialog>.page-help-shell{
  box-sizing:border-box!important;
  display:block!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:calc(100dvh - 24px)!important;
  padding:30px!important;
  border-radius:32px!important;
  background:var(--panel,#fff)!important;
  overflow-y:auto!important;
  box-shadow:0 24px 70px rgba(20,18,28,.34)!important;
}
html body .page-help-intro{margin:0 0 20px!important;font-size:1.05rem;line-height:1.5}
html body .page-help-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important}
html body .page-help-grid article{padding:16px!important;border-radius:20px!important}
html body .page-help-grid article>b{flex-basis:40px!important;width:40px!important;height:40px!important;font-size:1.05rem}
html body .page-help-grid strong{font-size:1.08rem;line-height:1.25}
html body .page-help-grid small{font-size:.98rem;line-height:1.45}
@media(max-width:640px){html body .page-help-grid{grid-template-columns:1fr!important}}
@media(max-width:520px){html body dialog.page-help-dialog,html body dialog.page-help-dialog[open]{width:calc(100vw - 18px)!important;max-height:calc(100dvh - 18px)!important;border-radius:28px!important}html body dialog.page-help-dialog>.page-help-shell{padding:22px!important;max-height:calc(100dvh - 18px)!important;border-radius:28px!important}}

/* Short choice lists end after the final option instead of filling the screen. */
html body dialog.kinstead-picker-dialog[data-picker-kind="options"],
html body dialog.kinstead-picker-dialog[data-picker-kind="options"][open]{
  height:auto!important;
  min-height:0!important;
  max-height:min(70dvh,620px)!important;
  overflow:hidden!important;
}
html body dialog.kinstead-picker-dialog[data-picker-kind="options"]>.kinstead-picker-shell{
  display:block!important;
  height:auto!important;
  min-height:0!important;
  max-height:min(70dvh,620px)!important;
  overflow:hidden!important;
}
html body dialog.kinstead-picker-dialog[data-picker-kind="options"] .kinstead-picker-body{
  height:auto!important;
  min-height:0!important;
  max-height:min(52dvh,430px)!important;
  padding:2px!important;
  overflow-y:auto!important;
}
html body dialog.kinstead-picker-dialog[data-picker-kind="options"] .kinstead-picker-options{
  display:grid!important;
  height:auto!important;
  min-height:0!important;
  max-height:min(52dvh,430px)!important;
  overflow-y:auto!important;
}
html body dialog.kinstead-picker-dialog[data-picker-kind="options"] [data-picker-actions]:empty{display:none!important;margin:0!important;padding:0!important;height:0!important;min-height:0!important}

/* Do not stretch compact dialogs between top:0 and bottom:0. */
html body dialog.app-popup-dialog[open],
html body dialog.kinstead-picker-dialog[open],
html body dialog.page-help-dialog[open],
html body dialog.notification-info-dialog[open]{
  inset:auto!important;
  top:50%!important;
  left:50%!important;
  right:auto!important;
  bottom:auto!important;
  transform:translate(-50%,-50%)!important;
  margin:0!important;
  height:auto!important;
  min-height:0!important;
}
html body dialog.kinstead-picker-dialog[open]>.kinstead-picker-shell{
  display:block!important;
  height:auto!important;
  min-height:0!important;
  max-height:calc(100dvh - 24px)!important;
  overflow:hidden!important;
}
html body dialog.kinstead-picker-dialog[open] .kinstead-picker-body{
  height:auto!important;
  min-height:0!important;
  max-height:58dvh!important;
  overflow-y:auto!important;
}
html body dialog.kinstead-picker-dialog[open] [data-picker-actions]{
  height:auto!important;
  min-height:0!important;
}
html body dialog.app-popup-dialog[open]>.app-popup-shell{
  display:block!important;
  height:auto!important;
  min-height:0!important;
  max-height:calc(100dvh - 24px)!important;
}
html body dialog.app-popup-dialog[open]>.app-popup-shell>.app-popup-body{
  height:auto!important;
  min-height:0!important;
}

/* Backup actions stay compact and size to their labels. */
html body #backupRestoreCard .settings-actions{
  display:flex!important;
  flex-flow:row wrap!important;
  align-items:center!important;
  gap:10px!important;
}
html body #backupRestoreCard .settings-actions>#downloadBackup,
html body #backupRestoreCard .settings-actions>.file-button,
html body #backupRestoreCard .settings-actions>#exportCsv{
  box-sizing:border-box!important;
  width:fit-content!important;
  min-width:0!important;
  max-width:100%!important;
  min-height:48px!important;
  height:48px!important;
  padding:0 18px!important;
  margin:0!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  border-radius:14px!important;
  white-space:nowrap!important;
}

.setup-owner-form{border:2px solid color-mix(in srgb,var(--theme-dark) 28%,transparent)!important;background:color-mix(in srgb,var(--theme-pale) 42%,#fff)!important}
.log-output-quick-actions{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0 10px}
.log-output-choices{display:grid;gap:9px;max-height:min(48dvh,440px);overflow-y:auto;overscroll-behavior:contain}
.log-output-choice{display:flex!important;align-items:flex-start;gap:12px;padding:13px;border:1px solid color-mix(in srgb,var(--theme-dark) 18%,transparent);border-radius:15px;background:#fff;cursor:pointer}
.log-output-choice input{width:22px!important;height:22px!important;flex:0 0 22px;margin-top:2px}
.log-output-choice span{display:grid;gap:3px}.log-output-choice small{color:var(--muted);line-height:1.35}

/* The native selects remain as the data source, but only the single Kinstead control is visible. */
html body .area-sort-filter select.kinstead-native-filter,
html body .kinstead-compact-select>select[hidden]{display:none!important}

.section-switcher{display:block!important;width:min(340px,100%)!important}
.section-menu-button{flex:1;min-width:0}
.area-sort-filter .kinstead-popup-select-button{width:min(260px,100%);text-align:left;display:flex;align-items:center;justify-content:space-between}
.area-sort-filter .kinstead-popup-select-button::after{content:"Choose";font-size:.72rem;opacity:.68;margin-left:12px}
.compact-filter-dialog .kinstead-picker-shell{width:min(520px,calc(100vw - 24px))!important}
.compact-filter-dialog .kinstead-picker-options{max-height:min(60dvh,520px);overflow-y:auto}
.delete-logbook-entry{touch-action:manipulation}
/* Patch 25 authentication and mobile security-code controls */
.password-input-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:.55rem;
  align-items:stretch;
}
.password-input-row .password-toggle{min-width:4.6rem;margin:0}
.auth-help-actions{display:flex;flex-wrap:wrap;gap:.35rem 1rem;margin-top:.85rem}
.password-recovery-dialog{border:0;padding:0;background:transparent;width:min(34rem,calc(100% - 1.5rem));max-width:none;max-height:calc(100dvh - 1.5rem);overflow:visible}
.password-recovery-dialog::backdrop{background:rgba(15,25,20,.58);backdrop-filter:blur(3px)}

/* Patch 38: dashboard rhythm on every page with secondary actions in menus. */
html body .app-main{max-width:1120px;margin-inline:auto}
html body .view{max-width:100%;margin-inline:auto}
html body .view>.section-heading{
  display:grid!important;
  grid-template-columns:minmax(112px,1fr) minmax(220px,2fr) minmax(112px,1fr);
  align-items:center!important;
  gap:16px;
  min-height:64px;
  margin:18px 0 16px!important;
}
html body .view>.section-heading>div:first-of-type{text-align:center;grid-column:2}
html body .view>.section-heading>.page-info-button,
html body .view>.section-heading>.page-more-info-button{grid-column:1;grid-row:1;justify-self:start;align-self:center!important;order:initial}
html body .view>.section-heading>button,
html body .view>.section-heading>.section-actions{grid-column:3;grid-row:1;justify-self:end}
html body .view>.section-heading>.section-actions{width:auto!important;display:flex!important;align-items:center;gap:8px}
html body .area-sort-filter{width:min(760px,100%);margin:0 auto 18px!important}
html body .view>.panel,
html body .view>.grid,
html body .view>.countdown-grid,
html body .view>.logbook-grid,
html body .view>.profile-grid{width:100%;margin-inline:auto}

/* Patch 45: log security uses the same structured popup layout as the rest of Kinstead. */
.log-protection-dialog{width:min(680px,calc(100vw - 24px));max-width:680px}
.log-protection-fields{display:grid;gap:10px;margin-top:22px}
.log-protection-fields label{margin:0;font-weight:800}
.log-protection-fields select,
.log-protection-fields input{box-sizing:border-box;width:100%;min-height:56px}
.log-protection-fields .security-divider{text-align:center;color:var(--muted);font-weight:750}
#logProtectionStatus{margin:18px 0 0}
#logProtectionStatus:empty{display:none}

.compact-action-menu{position:relative;display:inline-block;min-width:0}
.compact-action-menu>summary{
  list-style:none;cursor:pointer;user-select:none;min-height:44px;box-sizing:border-box;
  display:flex;align-items:center;justify-content:center;padding:10px 16px;border:1.5px solid var(--mid);
  border-radius:14px;background:var(--panel,#fff);color:var(--dark);font-weight:850;white-space:nowrap
}
.compact-action-menu>summary::-webkit-details-marker{display:none}
.compact-action-menu>summary::after{content:"⋯";margin-left:9px;font-size:1.15rem;line-height:1}
.compact-action-menu[open]>summary{background:var(--pale)}
.compact-action-menu-panel{
  position:absolute;z-index:13000;right:0;top:calc(100% + 7px);width:min(260px,calc(100vw - 32px));
  display:grid;gap:7px;padding:10px;border:1px solid var(--line);border-radius:16px;background:var(--panel,#fff);
  box-shadow:0 18px 45px rgba(30,24,42,.2)
}
.compact-action-menu.opens-up>.compact-action-menu-panel{top:auto;bottom:calc(100% + 7px)}
.compact-action-menu-panel>*{width:100%!important;min-height:42px!important;margin:0!important;justify-content:center!important}
.item-actions:has(.compact-action-menu),.family-profile-actions:has(.compact-action-menu){display:flex!important;justify-content:flex-end!important;width:100%}
.family-profile-actions .compact-action-menu{width:100%}.family-profile-actions .compact-action-menu>summary{width:100%}
.settings-actions:has(.compact-action-menu),.section-actions:has(.compact-action-menu){display:flex!important;align-items:center;gap:8px!important}

@media(max-width:620px){
  html body .view>.section-heading{grid-template-columns:auto minmax(0,1fr) auto;gap:8px;min-height:58px}
  html body .view>.section-heading>div:first-of-type{text-align:center}
  html body .view>.section-heading h2{font-size:1.15rem!important}
  html body .view>.section-heading .eyebrow{font-size:.62rem}
  html body .view>.section-heading>button,
  html body .view>.section-heading>.section-actions{width:auto!important}
  html body .view>.section-heading button{padding-inline:12px!important;white-space:nowrap}
  .compact-action-menu>summary{padding-inline:12px}
  .compact-action-menu-panel{position:fixed;left:16px;right:16px;top:auto;bottom:calc(16px + env(safe-area-inset-bottom));width:auto}
}
.password-recovery-popup{box-sizing:border-box;width:100%;max-height:calc(100dvh - 1.5rem);overflow:auto;margin:0}
.password-recovery-popup form{display:grid;gap:.55rem}
.password-recovery-popup>button{width:100%;margin-top:.65rem}
.link-button{appearance:none;border:0;background:transparent;color:var(--theme-dark,#285c35);padding:.35rem 0;text-decoration:underline;font:inherit;font-weight:700;cursor:pointer}
.auth-confirmation-actions{flex-wrap:wrap}
.security-code-input{
  -webkit-text-security:disc;
  font-variant-numeric:tabular-nums;
  letter-spacing:.28em;
}
.profile-pin-label{white-space:nowrap;font-weight:700}
.styled-pin-dialog{max-height:min(92dvh,42rem);overflow:hidden}
.styled-pin-dialog .modal-card{max-height:min(92dvh,42rem);overflow:auto;overscroll-behavior:contain;padding-bottom:max(1rem,env(safe-area-inset-bottom))}
.styled-pin-dialog .modal-actions{position:sticky;bottom:0;background:inherit;padding-top:.75rem;padding-bottom:max(.25rem,env(safe-area-inset-bottom));z-index:1}

@media (max-width:700px){
  .signin-screen{min-height:100dvh;align-items:flex-start;padding-top:max(1rem,env(safe-area-inset-top));padding-bottom:max(1rem,env(safe-area-inset-bottom));overflow:auto}
  .signin-card{margin:auto 0;width:100%}
  .styled-pin-dialog{width:min(100% - 1rem,34rem);margin:auto auto max(.5rem,env(safe-area-inset-bottom));}
  .styled-pin-dialog .modal-card{max-height:calc(100dvh - 1rem - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
  .styled-pin-dialog .modal-actions{display:grid;grid-template-columns:1fr 1fr}
  .family-profile-chooser-shell{max-height:calc(100dvh - 1rem);overflow:auto;overscroll-behavior:contain}
  .password-input-row{grid-template-columns:minmax(0,1fr) 4.6rem}
}

/* Patch 28 protected logs */
.protected-log-locked{padding:28px 18px;text-align:center;border:1px dashed color-mix(in srgb,var(--accent,#6b4bb6) 45%,transparent);border-radius:18px;background:color-mix(in srgb,var(--surface,#fff) 92%,var(--accent,#6b4bb6) 8%)}
.protected-log-locked strong{display:block;margin-bottom:6px}
.log-protection-dialog .app-popup-card{width:min(92vw,430px)}
.log-protection-dialog #logProtectionFields{display:grid;gap:10px}
.log-protection-dialog input,.log-protection-dialog select{width:100%;box-sizing:border-box}
.security-divider{text-align:center;color:var(--muted,#6f6b78);font-size:.9rem;margin:4px 0}

/* Patch 26 mobile profile menu: one positioning source for phones only.
   Keep #profileMenu out of generic absolute dropdown positioning above. */
@media (max-width:700px){
  html body #profileMenu.profile-menu.app-dropdown-menu{
    box-sizing:border-box!important;
    position:fixed!important;
    inset-block-start:max(74px,calc(env(safe-area-inset-top,0px) + 62px))!important;
    inset-inline-start:max(14px,env(safe-area-inset-left,0px))!important;
    inset-inline-end:max(14px,env(safe-area-inset-right,0px))!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    max-height:calc(100dvh - max(88px,calc(env(safe-area-inset-top,0px) + 76px)) - env(safe-area-inset-bottom,0px))!important;
    margin:0!important;
    transform:none!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    z-index:12000!important;
  }
  html body #profileMenu.profile-menu.app-dropdown-menu>.menu-item{
    min-width:0!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
}
/* Patch 59: daily routine checklists, item logs, and dashboard pins. */
#routines>.section-heading{align-items:center}
.routine-summary{display:flex;align-items:center;gap:18px;width:min(680px,100%);margin:0 auto 22px}
.routine-summary .stat{min-width:132px}
.routine-progress{height:12px;flex:1;overflow:hidden;border:1px solid var(--line);border-radius:999px;background:color-mix(in srgb,var(--theme-pale) 72%,white)}
.routine-progress span{display:block;height:100%;border-radius:inherit;background:var(--theme-dark);transition:width .2s ease}
.routine-grid,.dashboard-routine-list{display:grid;gap:16px}
.dashboard-routines-panel{margin-top:24px}
.routine-card{display:grid;gap:18px;padding:22px!important}
.routine-card.is-complete{background:color-mix(in srgb,var(--theme-pale) 76%,white)}
.routine-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.routine-card-heading h3{margin:4px 0 6px;font-size:1.3rem}
.routine-card-copy .task-meta{margin:0}
.routine-checklist{display:grid;border:1px solid var(--line);border-radius:18px;overflow:hidden;background:color-mix(in srgb,var(--theme-pale) 35%,white)}
.routine-checklist-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:13px;align-items:center;padding:13px 15px;border-bottom:1px solid var(--line)}
.routine-checklist-row:last-child{border-bottom:0}
.routine-checklist-row.is-complete{background:color-mix(in srgb,var(--theme-pale) 76%,white)}
.routine-checklist-row.is-complete .routine-item-copy>strong{text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:var(--theme-mid)}
.routine-item-check{position:relative;display:grid;place-items:center;cursor:pointer}
.routine-item-check input{position:absolute;opacity:0;pointer-events:none}
.routine-item-check span{display:grid;place-items:center;width:32px;height:32px;border:2px solid var(--theme-mid);border-radius:10px;background:white;color:white;font-size:1rem;font-weight:900}
.routine-item-check input:checked+span{border-color:var(--theme-dark);background:var(--theme-dark)}
.routine-item-check input:focus-visible+span{outline:3px solid color-mix(in srgb,var(--theme-mid) 55%,transparent);outline-offset:3px}
.routine-item-check input:disabled+span{cursor:not-allowed;opacity:.55}
.routine-item-copy{display:grid;gap:3px;min-width:0}
.routine-item-copy small{color:var(--muted)}
.routine-card-footer{display:flex;align-items:center;justify-content:space-between;gap:16px}
.routine-streak{margin:0;color:var(--theme-dark);font-weight:800}
.routine-actions{justify-content:flex-end;max-width:270px}
.routine-editor-dialog{box-sizing:border-box;width:min(860px,calc(100vw - 32px));max-width:860px}
html body dialog.routine-editor-dialog[open]>.app-popup-shell{display:grid!important;grid-template-rows:auto minmax(0,1fr) auto!important;box-sizing:border-box;width:100%!important;max-width:100%!important;max-height:calc(100dvh - 32px)!important;overflow:hidden!important}
.routine-editor-dialog .app-popup-header,.routine-editor-dialog .app-popup-body,.routine-editor-dialog .app-popup-footer{box-sizing:border-box;width:100%;min-width:0}
.routine-editor-dialog .app-popup-header>div{min-width:0}
.routine-editor-dialog .app-popup-close{position:static;justify-self:end}
html body dialog.routine-editor-dialog[open]>.app-popup-shell>.routine-editor-body{display:grid;gap:10px;max-height:none!important;overflow-x:hidden!important;overflow-y:auto!important}
.routine-editor-body label{font-weight:800}
.routine-editor-body input,.routine-editor-body select{box-sizing:border-box;width:100%;min-width:0;max-width:100%}
.routine-editor-dialog .kinstead-popup-select,.routine-editor-dialog .kinstead-popup-select-button{box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important}
.routine-pin-option{display:flex!important;align-items:flex-start;gap:12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--theme-pale)}
.routine-pin-option input{width:auto!important;margin-top:4px}
.routine-pin-option span{display:grid;gap:3px}.routine-pin-option small{color:var(--muted);font-weight:500}
.routine-editor-items-heading{margin-top:8px}
.routine-editor-items-heading p{margin:4px 0 0}
.routine-items-editor{display:grid;gap:12px}
.routine-add-item{justify-self:end;margin-top:2px}
.routine-editor-item{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:end;min-width:0;padding:14px;border:1px solid var(--line);border-radius:16px;background:color-mix(in srgb,var(--theme-pale) 45%,white)}
.routine-editor-item label{display:grid;gap:6px;min-width:0}
.routine-editor-item-actions{grid-column:1/-1;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;align-items:center;min-width:0}
.routine-editor-dialog .app-popup-footer{flex-wrap:wrap}
.routine-editor-dialog .app-popup-footer button{flex:0 1 160px;min-width:0}
.dashboard-routine-card{box-shadow:none!important}
.dashboard-user-hidden{display:none!important}
.dashboard-widget-choices,.archive-category-list{display:grid;gap:12px}
.dashboard-customize-dialog{box-sizing:border-box;width:min(680px,calc(100vw - 24px))!important;max-width:680px!important}
.dashboard-customize-shell{box-sizing:border-box;width:100%;max-width:none}
.history-archive-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 16px}
.history-archive-tabs .active{background:var(--theme-dark);color:#fff}
.history-archive-panel{display:grid;gap:14px}
.archive-category-list{grid-template-columns:repeat(3,minmax(0,1fr))}
.archive-category-card{display:flex;align-items:center;justify-content:space-between;text-align:left;color:inherit;min-height:72px}
.archive-category-card strong{font-size:1.25rem}
.archive-information p{margin-bottom:0}
@media(max-width:700px){
  .archive-category-list{grid-template-columns:1fr}
  .trash-row{align-items:stretch;flex-direction:column}
  .recycle-bin-actions{justify-content:flex-start;width:100%}
  .recycle-bin-actions button{flex:1 1 10rem;min-width:0}
  .routine-summary{align-items:stretch;flex-direction:column;gap:10px}
  .routine-summary .stat{width:100%}
  .routine-card-footer{align-items:stretch;flex-direction:column}
  .routine-actions{justify-content:flex-end;max-width:none}
  .routine-card-heading{display:grid;gap:8px}
  .routine-card-heading .badge{justify-self:start}
  .routine-editor-dialog{width:calc(100vw - 18px);max-width:none;border-radius:24px}
  html body dialog.routine-editor-dialog[open]>.app-popup-shell{max-height:calc(100dvh - 18px)!important}
  .routine-editor-item{grid-template-columns:minmax(0,1fr)}
  .routine-editor-item-actions{grid-column:1;justify-content:flex-end}
  .routine-checklist-row{grid-template-columns:auto minmax(0,1fr)}
  .routine-checklist-row>.open-routine-item-log{grid-column:2;justify-self:start}
}
.offline-recovery-dialog{width:min(760px,calc(100vw - 24px));max-height:min(86vh,820px)}
.offline-recovery-changes{display:grid;gap:10px;max-height:40vh;overflow:auto;margin:14px 0;padding:4px}
.offline-recovery-group{border:1px solid var(--line,#d9d4c8);border-radius:12px;padding:10px;background:var(--surface,#fff)}
.offline-recovery-group h3{margin:0 0 6px;font-size:1rem}
.offline-recovery-group ul{margin:0;padding-left:20px}
.offline-recovery-conflict{color:#9f1f33;font-weight:700}

/* Patch 119: make sync recovery a clear two-save decision. */
html body dialog.offline-recovery-dialog{width:min(760px,calc(100vw - 24px));padding:0;overflow:hidden;border:0;border-radius:28px}
html body .offline-recovery-dialog>form{display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto;max-height:min(86dvh,820px);padding:0}
html body .offline-recovery-dialog .dialog-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:28px 30px 20px;border-bottom:1px solid var(--line)}
html body .offline-recovery-dialog .dialog-header>div{min-width:0}
html body .offline-recovery-dialog .dialog-header h2{margin:4px 0 0}
html body .offline-recovery-dialog #closeOfflineRecovery{flex:0 0 48px;width:48px;min-width:48px;height:48px;min-height:48px;margin:0;padding:0}
.offline-recovery-intro,.offline-recovery-dialog #offlineRecoverySummary{margin:16px 30px 0}
html body .offline-recovery-dialog .offline-recovery-changes{max-height:none;min-height:0;margin:14px 24px;padding:6px;overflow:auto}
html body .offline-recovery-dialog #offlineRecoveryStatus{min-height:0;margin:0 30px}
html body .offline-recovery-dialog #offlineRecoveryStatus:empty{display:none}
html body .offline-recovery-dialog .modal-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:20px 30px 24px;border-top:1px solid var(--line);background:var(--panel,#fff)}
html body .offline-recovery-dialog .modal-actions>button{width:100%;min-height:56px;margin:0;white-space:normal}
html body .offline-recovery-dialog .offline-recovery-download{grid-column:1/-1;min-height:36px;padding:4px;border-radius:8px}

/* Dashboard utilities use one shape, size, baseline, and visual weight. */
html body #today .section-title-row{gap:10px}
html body #today .section-title-row>.page-more-info-button,
html body #today .dashboard-settings-button{display:grid!important;place-items:center!important;box-sizing:border-box!important;flex:0 0 48px!important;width:48px!important;min-width:48px!important;max-width:48px!important;height:48px!important;min-height:48px!important;max-height:48px!important;margin:0!important;padding:0!important;border:1px solid color-mix(in srgb,var(--theme-dark) 28%,var(--line))!important;border-radius:16px!important;background:color-mix(in srgb,#fff 94%,var(--theme-pale))!important;font-size:1.15rem!important;line-height:1!important}
html body #today .section-title-row>.page-more-info-button>*,
html body #today .dashboard-settings-button>*{display:block;line-height:1!important;margin:0!important;transform:none!important}
html body #today>.section-heading .adaptive-dashboard-actions{align-self:center!important}

@media(max-width:620px){
  html body .offline-recovery-dialog .dialog-header{padding:22px 20px 16px}
  .offline-recovery-intro,.offline-recovery-dialog #offlineRecoverySummary{margin-inline:20px}
  html body .offline-recovery-dialog .offline-recovery-changes{margin-inline:14px}
  html body .offline-recovery-dialog .modal-actions{grid-template-columns:1fr;padding:16px 20px 20px}
  html body .offline-recovery-dialog .offline-recovery-download{grid-column:1}
}
.pending-recovery-notice{box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:18px;width:min(1180px,calc(100% - 32px));margin:16px auto 0;padding:16px 18px;border:1px solid color-mix(in srgb,var(--theme-mid) 55%,var(--line));border-radius:18px;background:color-mix(in srgb,var(--theme-pale) 68%,white);box-shadow:0 8px 22px rgba(31,47,41,.08)}
.pending-recovery-notice.hidden{display:none}
.pending-recovery-notice h2{margin:2px 0 5px;font-size:1.08rem}
.pending-recovery-notice p{margin:0}
.pending-recovery-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}
@media(max-width:700px){.pending-recovery-notice{align-items:stretch;flex-direction:column}.pending-recovery-actions{display:grid;grid-template-columns:1fr}.pending-recovery-actions button{width:100%}}

/* Patch 96 keyboard, touch, zoom, and motion hardening. */
:where(button,a,input,select,textarea,summary,[tabindex]):focus-visible{outline:3px solid color-mix(in srgb,var(--theme-dark,#285c35) 78%,white);outline-offset:3px}
:where(button,select,input:not([type="checkbox"]):not([type="radio"]),summary,[role="button"]){min-height:44px}
@media(prefers-reduced-motion:reduce){html:focus-within{scroll-behavior:auto}*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
@media(forced-colors:active){:where(button,a,input,select,textarea,summary,[tabindex]):focus-visible{outline:3px solid Highlight}.pending-recovery-notice{border:2px solid CanvasText}}

/* Patch 98 compact dashboard controls and bounded customization dialog. */
.adaptive-dashboard-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:nowrap}
.adaptive-dashboard-actions .dashboard-add-task{min-width:118px;padding:.68rem 1rem;white-space:nowrap}
.adaptive-dashboard-actions .dashboard-settings-button{display:grid;place-items:center;flex:0 0 46px;width:46px;min-width:46px;height:46px;min-height:46px;padding:0;font-size:1.2rem;line-height:1}
html body dialog.dashboard-customize-dialog[open]>.dashboard-customize-shell{display:grid!important;grid-template-rows:auto minmax(0,1fr) auto!important;height:auto!important;max-height:calc(100dvh - 24px)!important;overflow:hidden!important}
.dashboard-customize-header{align-items:center}.dashboard-customize-header>div{min-width:0}.dashboard-customize-header h2{overflow-wrap:anywhere}
.dashboard-customize-body{display:grid;gap:22px;max-height:none!important;overflow-x:hidden!important;overflow-y:auto!important}
.dashboard-customize-body>p{white-space:normal!important}.dashboard-customize-body section{display:grid;gap:12px;min-width:0}.dashboard-customize-body h3{margin:0}.dashboard-customize-body section>div>p{margin:4px 0 0}
.dashboard-mode-shortcuts{padding:16px;border:1px solid var(--line);border-radius:16px;background:color-mix(in srgb,var(--theme-pale) 52%,white)}
.dashboard-mode-actions{display:flex;flex-wrap:wrap;gap:8px}.dashboard-mode-actions button{flex:1 1 210px;min-width:0;white-space:normal}
.dashboard-widget-choices{gap:8px}.dashboard-widget-choices .notification-option{box-sizing:border-box;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:14px;min-height:0;margin:0;padding:14px 2px;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent}.dashboard-widget-choices .notification-option:last-child{border-bottom:0}.dashboard-widget-choices .notification-option span{min-width:0}.dashboard-widget-choices .notification-option strong,.dashboard-widget-choices .notification-option small{display:block;overflow-wrap:anywhere}.dashboard-widget-choices .notification-option input{width:24px;height:24px;margin:0}
body[data-calm-mode="true"]{background:linear-gradient(180deg,#fff 0,var(--theme-bg) 100%)}
body[data-calm-mode="true"] :is(.panel,.hero-card,.countdown-card,.profile-card){box-shadow:none;border-color:color-mix(in srgb,var(--line) 78%,transparent)}
body[data-calm-mode="true"] .eyebrow{letter-spacing:.1em}
body[data-reading-style="simple"] main{line-height:1.65}
body[data-reading-style="detailed"] main{line-height:1.5}
@media(max-width:620px){
  html body #today>.section-heading{grid-template-columns:1fr!important;grid-template-rows:auto auto!important;gap:12px!important}
  html body #today>.section-heading>div:first-of-type{grid-column:1!important;grid-row:1!important;text-align:center}
  html body #today>.section-heading>.adaptive-dashboard-actions{grid-column:1!important;grid-row:2!important;justify-self:center!important;width:auto!important;display:flex!important}
  html body #today>.section-heading>.adaptive-dashboard-actions .dashboard-add-task{width:auto!important;min-width:132px}
  html body #today>.section-heading>.adaptive-dashboard-actions .dashboard-settings-button{width:46px!important;min-width:46px!important}
  .dashboard-customize-dialog{width:calc(100vw - 16px)!important;max-width:none!important;border-radius:22px!important}
  html body dialog.dashboard-customize-dialog[open]{max-height:calc(100dvh - 16px)!important}
  html body dialog.dashboard-customize-dialog[open]>.dashboard-customize-shell{max-height:calc(100dvh - 16px)!important}
  .dashboard-customize-header,.dashboard-customize-body,.dashboard-customize-dialog .app-popup-footer{padding-left:18px;padding-right:18px}
  .dashboard-customize-header{gap:12px}.dashboard-customize-header h2{font-size:1.55rem}.dashboard-customize-header .app-popup-close{width:44px;height:44px;min-width:44px}
  .dashboard-mode-actions{display:grid;grid-template-columns:1fr}.dashboard-mode-actions button{width:100%}
}

/* Keep sign-in recovery actions visually light after the legacy button system. */
html body #forgotPasswordBtn,
html body #resendSigninVerificationBtn{
  width:auto!important;
  min-height:44px!important;
  height:auto!important;
  padding:.4rem .25rem!important;
  border:0!important;
  border-radius:8px!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--theme-dark)!important;
  text-decoration:underline!important;
}

/* Patch 106: Adaptive Settings produce clear, app-wide behavior. */
.adaptive-settings-preview{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:18px;
  margin-top:20px;
  padding:16px 18px;
  border:1px solid color-mix(in srgb,var(--theme-mid) 34%,var(--line));
  border-radius:16px;
  background:color-mix(in srgb,var(--theme-pale) 45%,white);
}
.adaptive-settings-preview p{margin:.35rem 0 0;max-width:78ch;line-height:1.55}
.adaptive-settings-preview button{white-space:nowrap}

body[data-calm-mode="true"]{
  background:#fbf8ef!important;
  background-image:none!important;
}
body[data-calm-mode="true"] :is(.hero-card,.panel,.countdown-card,.profile-card,.signin-card,.stat,.app-dropdown-menu,.adaptive-celebration-toast,dialog){
  box-shadow:none!important;
  filter:none!important;
}
body[data-calm-mode="true"] :is(button,.file-button,.compact-action-menu>summary){box-shadow:none!important}
body[data-calm-mode="true"] dialog::backdrop{backdrop-filter:none!important}
body[data-calm-mode="true"] .progress-fill{background:var(--theme-dark)!important;background-image:none!important}
body[data-calm-mode="true"] .adaptive-celebration-toast [aria-hidden="true"]{display:none!important}
body[data-calm-mode="true"] .eyebrow{letter-spacing:.08em!important}

body[data-visual-density="relaxed"] :is(.dashboard-priority,.grid.two,.countdown-grid,.profile-grid,.log-grid,.routine-grid,.adaptive-focus-grid){gap:24px!important}
body[data-visual-density="relaxed"] :is(.view>.panel,.view>.grid,.view>.countdown-grid,.view>.profile-grid,.adaptive-settings-panel){margin-bottom:24px}
body[data-visual-density="relaxed"] :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea,button:not(.icon-button):not(.app-popup-close):not(.logbook-close)){min-height:54px}
body[data-visual-density="relaxed"] :is(.task-meta,.muted,.permission-note){line-height:1.6}

body[data-visual-density="compact"] :is(.dashboard-priority,.grid.two,.countdown-grid,.profile-grid,.log-grid,.routine-grid,.adaptive-focus-grid){gap:10px!important}
body[data-visual-density="compact"] :is(.view>.panel,.view>.grid,.view>.countdown-grid,.view>.profile-grid,.adaptive-settings-panel){margin-bottom:10px}
body[data-visual-density="compact"] main :is(button:not(.icon-button):not(.app-popup-close):not(.logbook-close),input:not([type="checkbox"]):not([type="radio"]),select){min-height:44px!important}
body[data-visual-density="compact"] main button:not(.icon-button):not(.app-popup-close):not(.logbook-close){padding:.55rem .75rem!important;border-radius:12px!important}
body[data-visual-density="compact"] :is(.task-meta,.muted,.permission-note){line-height:1.35}

body[data-reading-style="simple"] main{font-size:1.015rem;line-height:1.68}
body[data-reading-style="simple"] :is(.task-meta,.permission-note,.muted){line-height:1.58}
body[data-reading-style="simple"] :is(.panel p,.hero-card p,.task-meta){max-width:68ch}
body[data-reading-style="detailed"] main{line-height:1.58}
body[data-reading-style="detailed"] :is(.task-meta,.permission-note,.muted){line-height:1.65}

.adaptive-celebration-toast[data-celebration-level="minimal"]{width:auto;max-width:calc(100% - 28px);padding:12px 16px;box-shadow:0 10px 28px rgba(30,20,55,.12)}
.adaptive-celebration-toast[data-celebration-level="standard"]{border-color:color-mix(in srgb,var(--theme-accent) 52%,var(--line))}
.adaptive-celebration-toast[data-celebration-level="extra-fun"]{border-width:2px;background:color-mix(in srgb,var(--theme-pale) 64%,white);box-shadow:0 20px 60px color-mix(in srgb,var(--theme-dark) 20%,transparent);font-weight:850}
.adaptive-celebration-toast[data-celebration-level="extra-fun"] [aria-hidden="true"]{font-size:1.12rem}
.task-card.is-overdue{outline:3px solid #d92d20;outline-offset:-3px}.task-overdue-count{color:inherit;font-weight:inherit}.task-overdue-count strong{color:#b42318;font-weight:900}
body[data-adaptive-presentation="bright-encouraging"] :is(.progress-fill,.success-indicator),.adaptive-preview-canvas[data-presentation="bright-encouraging"] .progress-fill{background:linear-gradient(90deg,var(--theme-accent),var(--adaptive-bright-accent))!important}
body[data-adaptive-presentation="bright-encouraging"] :is(.chip,.badge,.adaptive-preset-card.is-selected,.empty-state),.adaptive-preview-canvas[data-presentation="bright-encouraging"] :is(.adaptive-preview-row,.adaptive-preview-encouragement){border-color:var(--adaptive-bright-accent);background:var(--adaptive-bright-soft)}
.adaptive-celebration-toast[data-celebration-style="calm"]{box-shadow:0 0 26px color-mix(in srgb,var(--theme-accent) 18%,transparent)}
.adaptive-celebration-toast[data-celebration-style="focused"]{width:auto;padding:10px 14px;box-shadow:none}
.adaptive-celebration-toast[data-celebration-style="inline"]{width:auto;max-width:calc(100% - 28px);padding:10px 14px}
.adaptive-celebration-toast[data-celebration-style="bright"]{border-color:var(--adaptive-bright-accent);background:linear-gradient(135deg,color-mix(in srgb,var(--theme-pale) 72%,#fff),var(--adaptive-bright-soft))}
@media(forced-colors:active){.task-card.is-overdue{outline:3px solid CanvasText}.task-overdue-count strong{color:CanvasText}}
@media(prefers-reduced-motion:reduce){.connection-status-badge.syncing .connection-status-icon{animation:none!important}}

@media(max-width:640px){
  .adaptive-settings-preview{grid-template-columns:1fr;text-align:center}
  .adaptive-settings-preview button{width:100%;white-space:normal}
}
@media(forced-colors:active){.adaptive-settings-preview{border:1px solid CanvasText;background:Canvas}}

/* Patch 123: reduce repeated controls and center icon-only navigation. */
#saveStatus{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important}
.sync-status-cluster{display:flex;align-items:center;justify-content:center}
.section-title-row{justify-content:center;text-align:center}
html body .app-history-controls{padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
html body .app-history-button.ui-icon-button{display:grid!important;place-items:center!important;width:44px!important;min-width:44px!important;height:44px!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
html body .app-history-button.ui-icon-button:hover{background:var(--theme-pale)!important}
@media(forced-colors:active){html body .app-history-controls{border:0!important}.app-history-button.ui-icon-button:focus-visible{outline:2px solid Highlight!important}}

/* Patch 107: one quiet, content-first visual system. */
:root{
  --ui-control-size:44px;
  --ui-control-radius:12px;
  --ui-field-height:48px;
  --ui-card-radius:18px;
  --ui-space-1:8px;
  --ui-space-2:16px;
  --ui-space-3:24px;
  --ui-space-4:32px;
  --ui-space-5:48px;
}

/* All icon-only controls use this exact square component. */
html body .ui-icon-button{
  appearance:none!important;
  box-sizing:border-box!important;
  display:grid!important;
  place-items:center!important;
  flex:0 0 var(--ui-control-size)!important;
  width:var(--ui-control-size)!important;
  min-width:var(--ui-control-size)!important;
  max-width:var(--ui-control-size)!important;
  height:var(--ui-control-size)!important;
  min-height:var(--ui-control-size)!important;
  max-height:var(--ui-control-size)!important;
  margin:0!important;
  padding:0!important;
  border:1px solid color-mix(in srgb,var(--theme-dark) 22%,var(--line))!important;
  border-radius:var(--ui-control-radius)!important;
  background:#fff!important;
  box-shadow:none!important;
  color:var(--theme-dark)!important;
  font-size:1.2rem!important;
  font-weight:850!important;
  line-height:1!important;
  text-align:center!important;
  text-decoration:none!important;
  cursor:pointer;
  transition:background-color .16s ease,border-color .16s ease,transform .16s ease!important;
}
html body .ui-icon-button:hover{
  border-color:color-mix(in srgb,var(--theme-dark) 42%,var(--line))!important;
  background:color-mix(in srgb,var(--theme-pale) 58%,#fff)!important;
  color:var(--theme-dark)!important;
  transform:translateY(-1px);
}
html body .ui-icon-button:active{transform:translateY(0)}
html body .ui-icon-button:disabled{opacity:.42!important;transform:none!important;cursor:not-allowed}
html body summary.ui-icon-button{list-style:none}
html body summary.ui-icon-button::-webkit-details-marker{display:none}
html body :is(.app-popup-close,.logbook-close,.family-profile-chooser-close).ui-icon-button{font-size:1.55rem!important}
/* The ID specificity prevents older patch-era button selectors from resizing this component. */
html body button.ui-icon-button:not(#kinstead-icon-size-override),
html body summary.ui-icon-button:not(#kinstead-icon-size-override){
  width:var(--ui-control-size)!important;
  min-width:var(--ui-control-size)!important;
  max-width:var(--ui-control-size)!important;
  height:var(--ui-control-size)!important;
  min-height:var(--ui-control-size)!important;
  max-height:var(--ui-control-size)!important;
  padding:0!important;
  border-radius:var(--ui-control-radius)!important;
}
html body #familyProfileChooser .family-profile-chooser-close.ui-icon-button,
html body #closeFamilyProfileChooser.ui-icon-button,
html body #closeStyledPinDialog.ui-icon-button,
html body .page-help-heading .ui-icon-button{
  position:static!important;
  flex:0 0 var(--ui-control-size)!important;
  width:var(--ui-control-size)!important;
  min-width:var(--ui-control-size)!important;
  max-width:var(--ui-control-size)!important;
  height:var(--ui-control-size)!important;
  min-height:var(--ui-control-size)!important;
  max-height:var(--ui-control-size)!important;
  padding:0!important;
  border:1px solid color-mix(in srgb,var(--theme-dark) 22%,var(--line))!important;
  border-radius:var(--ui-control-radius)!important;
  background:#fff!important;
  color:var(--theme-dark)!important;
  font-size:1.55rem!important;
}

/* Back and forward now sit in the navigation flow as matching icon controls. */
.app-primary-navigation{gap:var(--ui-space-2)!important;margin-block:var(--ui-space-3)!important}
.app-history-controls{display:flex!important;align-items:center!important;gap:var(--ui-space-1)!important}
html body .app-history-button.ui-icon-button{position:static!important;inset:auto!important;transform:none!important}
.app-history-button .app-history-label{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.app-history-button .app-history-arrow{font-size:1.25rem;line-height:1}

/* More menus replace rows of equal-weight outlined actions. */
.compact-action-menu.ui-action-menu{position:relative;display:inline-block;min-width:0}
html body .compact-action-menu.ui-action-menu>summary.ui-icon-button::after{content:none!important;margin:0!important}
.compact-action-menu.ui-action-menu>.compact-action-menu-panel{
  display:grid;
  gap:2px;
  width:min(250px,calc(100vw - 32px));
  padding:8px;
  border:1px solid color-mix(in srgb,var(--theme-dark) 18%,var(--line));
  border-radius:14px;
  background:#fff;
  box-shadow:0 18px 48px rgba(33,29,47,.16);
}
html body .compact-action-menu-panel>:is(button,a,label){
  box-sizing:border-box!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  width:100%!important;
  min-height:42px!important;
  margin:0!important;
  padding:9px 11px!important;
  border:0!important;
  border-radius:9px!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--ink)!important;
  text-align:left!important;
  font-weight:720!important;
}
html body .compact-action-menu-panel>:is(button,a,label):hover{background:var(--theme-pale)!important;color:var(--theme-dark)!important}
html body .compact-action-menu-panel>.danger{background:transparent!important;color:var(--danger)!important}
html body .compact-action-menu-panel>.danger:hover{background:#fff0f3!important;color:var(--danger)!important}
html body .compact-action-menu-panel button:not(#kinstead-menu-item-override),
html body .compact-action-menu-panel a:not(#kinstead-menu-item-override),
html body .compact-action-menu-panel label:not(#kinstead-menu-item-override){
  min-height:42px!important;
  padding:9px 11px!important;
  border:0!important;
  border-radius:9px!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--ink)!important;
  justify-content:flex-start!important;
  text-align:left!important;
}
html body .compact-action-menu-panel button.danger:not(#kinstead-menu-item-override){color:var(--danger)!important}
.item-actions:has(.ui-action-menu),.family-profile-actions:has(.ui-action-menu),.journal-card-actions:has(.ui-action-menu){align-items:center!important;justify-content:flex-end!important;gap:8px!important}
.family-profile-actions:has(.ui-action-menu),.journal-card-actions:has(.ui-action-menu){width:100%}

/* Clear action hierarchy: one visible filled action, one More button. */
html body :is(#addTaskToday,#addTask,#addCountdown,#addRoutine,#newJournal,#createLogbook,#addProfile,#createTaskTemplate,#createCountdownTemplate,#appPopupConfirm,#submitStyledPinDialog,#enableNotifications,#retryOfflineRecovery),
html body .dashboard-add-task,
html body form button[type="submit"]:not(#kinstead-primary-submit-override){
  border:1px solid var(--theme-dark)!important;
  background:var(--theme-dark)!important;
  box-shadow:none!important;
  color:#fff!important;
}
html body :is(#addTaskToday,#addTask,#addCountdown,#addRoutine,#newJournal,#createLogbook,#addProfile,#createTaskTemplate,#createCountdownTemplate,#appPopupConfirm,#submitStyledPinDialog,#enableNotifications,#retryOfflineRecovery):hover,
html body .dashboard-add-task:hover,
html body form button[type="submit"]:not(#kinstead-primary-submit-override):hover{background:color-mix(in srgb,var(--theme-dark) 86%,#000)!important}
html body :is(.journal-card-actions,.family-profile-actions,.template-actions)>button:first-child{
  min-height:44px!important;
  padding:.65rem 1rem!important;
  border:1px solid var(--theme-dark)!important;
  border-radius:12px!important;
  background:var(--theme-dark)!important;
  box-shadow:none!important;
  color:#fff!important;
}
html body :is(.journal-card-actions,.family-profile-actions,.template-actions)>button:first-child:hover{background:color-mix(in srgb,var(--theme-dark) 86%,#000)!important}
html body :is(.journal-card-actions,.family-profile-actions,.template-actions)>button:first-child:not(#kinstead-primary-action-override){
  min-height:44px!important;
  padding:.65rem 1rem!important;
  border:1px solid var(--theme-dark)!important;
  border-radius:12px!important;
  background:var(--theme-dark)!important;
  box-shadow:none!important;
  color:#fff!important;
}

/* Lighter cards and a calmer spacing rhythm. */
html body main{width:min(1180px,calc(100% - 32px))}
html body .view{padding-block:var(--ui-space-2) var(--ui-space-5)}
html body .view>.section-heading{margin-block:var(--ui-space-3)!important}
html body :is(.dashboard-priority,.grid.two,.countdown-grid,.profile-grid,.log-grid,.routine-grid,.journal-library,.adaptive-focus-grid){gap:var(--ui-space-3)!important}
html body :is(.hero-card,.panel,.countdown-card,.profile-card,.signin-card){
  border:1px solid color-mix(in srgb,var(--theme-dark) 12%,var(--line))!important;
  border-radius:var(--ui-card-radius)!important;
  background:color-mix(in srgb,#fff 96%,var(--theme-pale))!important;
  box-shadow:0 10px 34px rgba(42,36,55,.045)!important;
}
html body :is(.panel,.countdown-card,.profile-card){padding:var(--ui-space-3)!important}
html body :is(.panel,.countdown-card,.profile-card):hover{box-shadow:0 14px 38px rgba(42,36,55,.065)!important}
html body :is(.panel h3,.countdown-card h3,.profile-card h3){line-height:1.18}
.task-title{font-size:1rem;line-height:1.35}
.task-meta{margin-top:5px;color:color-mix(in srgb,var(--muted) 90%,var(--ink));font-size:.8rem;line-height:1.45}
.eyebrow{font-size:.68rem;letter-spacing:.12em}
.badge,.assignee-chip{border:0;background:color-mix(in srgb,var(--theme-pale) 72%,#fff)}
.stat{border:0!important;background:color-mix(in srgb,#fff 95%,var(--theme-pale))!important;box-shadow:none!important}

/* Whitespace replaces repeated separators and nested boxes. */
#taskList{display:grid;gap:10px}
#taskList>.task-card{padding:16px!important;border:0!important;border-radius:14px;background:color-mix(in srgb,var(--theme-pale) 28%,#fff)}
:is(#todayTasks,#dashboardOverdueTasks,#adaptiveTodaySchedule)>.task-card{padding:14px 0!important;border:0!important;background:transparent}
.task-checklist{margin-top:12px;padding:8px 0 0;border:0;background:transparent}
.task-checklist-item{padding:7px 0}
.routine-checklist{display:grid;gap:4px;border:0!important;border-radius:14px;background:color-mix(in srgb,var(--theme-pale) 28%,#fff)!important;overflow:visible}
.routine-checklist-row{border:0!important;border-radius:11px;padding:12px 14px!important}
.routine-checklist-row.is-complete{background:color-mix(in srgb,var(--theme-pale) 58%,#fff)!important}
.countdown-task{padding:10px 0}
.logbook-entry-row{border-bottom:0!important;padding-block:16px!important}
.logbook-entry-row+.logbook-entry-row{margin-top:4px}

/* Forms share one size, corner radius, and alignment system. */
html body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),select,textarea){
  box-sizing:border-box;
  width:100%;
  min-height:var(--ui-field-height);
  border:1px solid color-mix(in srgb,var(--theme-dark) 18%,var(--line));
  border-radius:12px;
  background:#fff;
  box-shadow:none;
}
html body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),select,textarea):focus{
  border-color:var(--theme-dark);
  outline:3px solid color-mix(in srgb,var(--theme-mid) 24%,transparent);
  outline-offset:1px;
}
html body :is(input[type="checkbox"],input[type="radio"]){accent-color:var(--theme-dark)}
.area-sort-filter{gap:12px!important}

@media(max-width:700px){
  html body main{width:min(100% - 20px,1180px)}
  html body .topbar{width:min(100% - 24px,1180px);padding-top:24px}
  html body .topbar h1{max-width:18ch;white-space:normal;overflow:visible;text-overflow:clip;line-height:1.14}
  html body .view>.section-heading{margin-block:18px!important}
  html body :is(.dashboard-priority,.grid.two,.countdown-grid,.profile-grid,.log-grid,.routine-grid,.journal-library,.adaptive-focus-grid){gap:16px!important}
  html body :is(.panel,.countdown-card,.profile-card){padding:18px!important}
  .compact-action-menu.ui-action-menu>.compact-action-menu-panel{padding:10px;border-radius:16px 16px 12px 12px}
}
@media(hover:none){html body .ui-icon-button:hover{transform:none}}
@media(prefers-reduced-motion:reduce){html body .ui-icon-button{transition:none!important}}
@media(forced-colors:active){html body .ui-icon-button,.compact-action-menu.ui-action-menu>.compact-action-menu-panel{border:1px solid ButtonText!important}}

/* Patch 112: Adaptive Experience personalization center. */
.adaptive-page-heading{align-items:end}
.adaptive-profile-field{width:min(280px,100%);margin:0}
.adaptive-profile-field>span{font-size:.78rem;color:var(--muted)}
.adaptive-personalization-center{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(300px,.78fr);gap:24px;align-items:start}
.adaptive-editor-column,.adaptive-settings-groups{display:grid;gap:16px;min-width:0}
.adaptive-presets-panel{margin:0!important}
.adaptive-group-heading>div{display:flex;gap:12px;align-items:flex-start}
.adaptive-group-heading h3,.adaptive-group-heading p{margin:0}
.adaptive-group-heading p{margin-top:4px}
.adaptive-step{display:grid;place-items:center;flex:0 0 30px;width:30px;height:30px;border-radius:10px;background:var(--theme-dark);color:#fff;font-size:.8rem;font-weight:800}
.adaptive-preset-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin-top:18px}
html body .adaptive-preset-card{display:flex;align-items:flex-start;flex-direction:column;gap:7px;min-width:0;min-height:154px;padding:12px;border:1px solid color-mix(in srgb,var(--theme-dark) 14%,var(--line));border-radius:16px;background:#fff;box-shadow:none;color:var(--ink);text-align:left}
html body .adaptive-preset-card:hover{border-color:color-mix(in srgb,var(--theme-dark) 38%,var(--line));transform:translateY(-1px)}
html body .adaptive-preset-card.is-selected{border:2px solid var(--theme-dark);padding:11px;background:color-mix(in srgb,var(--theme-pale) 45%,#fff)}
.adaptive-preset-card strong{font-size:.88rem;line-height:1.25}
.adaptive-preset-card small{color:var(--muted);font-size:.72rem;line-height:1.35}
.adaptive-preset-art{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:10px 17px;width:100%;gap:4px;padding:9px;border-radius:10px;background:color-mix(in srgb,var(--theme-pale) 56%,#fff)}
.adaptive-preset-art i{display:block;border-radius:4px;background:color-mix(in srgb,var(--theme-dark) 19%,#fff)}
.adaptive-preset-art i:first-child{grid-column:1/-1;background:color-mix(in srgb,var(--theme-dark) 58%,#fff)}
.preset-focused i:last-child,.preset-calm i:last-child{opacity:.22}
.preset-compact{gap:2px;padding:7px}
.preset-playful{background:color-mix(in srgb,#f7c9de 35%,var(--theme-pale))}
.preset-playful i:first-child{background:#b35f88}

.adaptive-settings-group{margin:0!important;padding:0!important;overflow:hidden}
.adaptive-settings-group>summary{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:12px;align-items:center;min-height:76px;padding:16px 18px;cursor:pointer;list-style:none}
.adaptive-settings-group>summary::-webkit-details-marker{display:none}
.adaptive-settings-group>summary:after{content:"›";grid-column:4;color:var(--muted);font-size:1.45rem;transform:rotate(90deg)}
.adaptive-settings-group[open]>summary:after{transform:rotate(-90deg)}
.adaptive-settings-group>summary span:nth-child(2){display:grid;gap:3px}
.adaptive-settings-group>summary small{color:var(--muted);font-weight:500}
.adaptive-group-value{padding:5px 8px;border-radius:999px;background:color-mix(in srgb,var(--theme-pale) 68%,#fff);color:var(--theme-dark);font-size:.72rem;font-weight:750;white-space:nowrap}
.adaptive-group-content{padding:0 18px 18px;border-top:1px solid color-mix(in srgb,var(--theme-dark) 8%,var(--line))}
.adaptive-group-content>.field,.adaptive-group-content>.notification-option{margin-top:16px}
.adaptive-group-content .adaptive-select-grid{margin-top:8px}

.adaptive-preview-column{position:sticky;top:88px;min-width:0}
.adaptive-live-preview{overflow:hidden;border:1px solid color-mix(in srgb,var(--theme-dark) 14%,var(--line));border-radius:22px;background:#fff;box-shadow:0 18px 50px rgba(42,36,55,.08)}
.adaptive-preview-header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;padding:18px 18px 12px}
.adaptive-preview-header h3{margin:4px 0 0}
.adaptive-preview-live{color:var(--muted);font-size:.72rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em}
.adaptive-preview-live i{display:inline-block;width:7px;height:7px;margin-right:5px;border-radius:50%;background:#4e9b70}
.adaptive-preview-canvas{display:grid;gap:10px;margin:0 14px;padding:18px;border-radius:18px;background:color-mix(in srgb,var(--theme-pale) 48%,#fff);transition:padding .18s ease,gap .18s ease}
.adaptive-preview-greeting{display:grid;gap:2px;margin-bottom:4px}
.adaptive-preview-greeting span{color:var(--muted);font-size:.73rem}
.adaptive-preview-greeting strong{font-size:1.25rem}
.adaptive-preview-priority{display:grid;gap:3px;padding:14px;border-radius:14px;background:var(--theme-dark);color:#fff}
.adaptive-preview-priority small{opacity:.7;font-size:.62rem;letter-spacing:.1em}
.adaptive-preview-priority span{opacity:.78;font-size:.7rem}
.adaptive-preview-row{display:grid;grid-template-columns:30px 1fr;gap:9px;align-items:center;padding:10px;border-radius:12px;background:#fff}
.adaptive-preview-row>span:last-child{display:grid;gap:2px}
.adaptive-preview-row small{color:var(--muted);font-size:.68rem}
.adaptive-preview-check{display:grid;place-items:center;width:28px;height:28px;border:1px solid color-mix(in srgb,var(--theme-dark) 18%,var(--line));border-radius:9px;color:var(--theme-dark);font-weight:900}
.adaptive-preview-encouragement{padding:10px 12px;border-radius:12px;background:color-mix(in srgb,var(--theme-accent) 9%,#fff);color:var(--theme-dark);font-size:.78rem;font-weight:650;text-align:center}
.adaptive-preview-canvas[data-density="relaxed"]{gap:15px;padding:24px}
.adaptive-preview-canvas[data-density="compact"]{gap:5px;padding:12px}
.adaptive-preview-canvas[data-density="compact"] .adaptive-preview-row{padding:7px}
.adaptive-preview-canvas[data-reading="simple"] .adaptive-preview-row small{display:none}
.adaptive-preview-canvas[data-reading="detailed"] .adaptive-preview-row small{font-size:.72rem}
.adaptive-preview-canvas.is-minimal .adaptive-preview-extra,.adaptive-preview-canvas.is-focused .adaptive-preview-extra{display:none}
.adaptive-preview-canvas.is-calm{background:#f7f5ef;transition:none}
.adaptive-preview-detail,.adaptive-preview-reminder{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:9px 11px;border-radius:11px;background:color-mix(in srgb,var(--theme-pale) 38%,#fff);font-size:.7rem}
#adaptivePreviewCanvas [hidden]{display:none!important}
.adaptive-preview-detail span,.adaptive-preview-reminder small{color:var(--muted)}
.adaptive-preview-reminder>span:last-child{display:grid;flex:1;gap:1px}
.adaptive-preview-reminder>span:first-child{display:grid;place-items:center;width:27px;height:27px;border-radius:8px;background:#fff}
.adaptive-live-preview[data-notification="gentle"] .adaptive-preview-reminder{opacity:.7;border:1px dashed color-mix(in srgb,var(--theme-dark) 16%,transparent)}
.adaptive-live-preview[data-notification="persistent"] .adaptive-preview-reminder{border:2px solid color-mix(in srgb,var(--theme-dark) 46%,var(--line));background:color-mix(in srgb,var(--theme-pale) 68%,#fff)}
.adaptive-live-preview[data-icons-labels="icons-only"] .adaptive-action .adaptive-label{display:none}
.adaptive-live-preview[data-icons-labels="icons-only"] .adaptive-action{width:48px;min-width:48px;margin-inline:auto}
.adaptive-live-preview[data-icons-labels="text-only"] .adaptive-action .adaptive-icon{display:none}
.adaptive-preview-canvas[data-celebration="extra-fun"] .adaptive-preview-encouragement{border:2px solid color-mix(in srgb,var(--theme-accent) 52%,var(--line));background:color-mix(in srgb,#f7c9de 34%,#fff)}
.adaptive-live-preview.is-calm{box-shadow:none}
.adaptive-live-preview .adaptive-settings-preview{grid-template-columns:1fr;margin:14px 0 0;border:0;border-top:1px solid var(--line);border-radius:0;background:#fff}
.adaptive-live-preview .adaptive-settings-preview p{font-size:.76rem;line-height:1.45}
.adaptive-live-preview .adaptive-settings-preview button{width:100%}
.adaptive-category-details{margin-top:14px}
.adaptive-category-details>summary{cursor:pointer;color:var(--theme-dark);font-weight:750}

.adaptive-save-bar{position:relative;z-index:1;display:flex;justify-content:space-between;gap:18px;align-items:center;margin-top:18px;padding:14px 16px;border:1px solid color-mix(in srgb,var(--theme-dark) 16%,var(--line));border-radius:18px;background:color-mix(in srgb,#fff 92%,var(--theme-pale));box-shadow:0 10px 30px rgba(42,36,55,.09)}
.adaptive-save-bar p{min-height:1.2em;margin:3px 0 0;font-size:.75rem}
.adaptive-save-bar .notification-settings-actions{margin:0;flex-wrap:nowrap}
#saveAdaptiveSettingsBtn.has-changes{box-shadow:0 0 0 4px color-mix(in srgb,var(--theme-accent) 16%,transparent)}

@media(max-width:1040px){
  .adaptive-personalization-center{grid-template-columns:1fr}
  .adaptive-preview-column{position:relative;top:auto;grid-row:1}
  .adaptive-live-preview{display:grid;grid-template-columns:minmax(260px,.85fr) minmax(340px,1.15fr);align-items:center}
  .adaptive-preview-header{align-self:start}
  .adaptive-preview-canvas{grid-column:2;grid-row:1/3;margin:14px}
  .adaptive-live-preview .adaptive-settings-preview{align-self:end;border-top:1px solid var(--line)}
}
@media(max-width:780px){
  .adaptive-preset-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  html body .adaptive-preset-card{min-height:132px}
  .adaptive-live-preview{display:block}
  .adaptive-preview-canvas{margin:0 14px}
  .adaptive-save-bar{margin-top:16px}
}
@media(max-width:620px){
  html body .view>.section-heading.adaptive-page-heading{display:grid!important;grid-template-columns:1fr!important;grid-template-rows:auto auto!important;align-items:stretch}
  html body .view>.section-heading.adaptive-page-heading>div:first-of-type{grid-column:1!important;grid-row:1!important;text-align:center}
  html body .view>.section-heading.adaptive-page-heading>.adaptive-profile-field{grid-column:1!important;grid-row:2!important;justify-self:stretch}
  .adaptive-profile-field{width:100%}
  .adaptive-settings-group>summary{grid-template-columns:auto minmax(0,1fr);padding:15px}
  .adaptive-settings-group>summary:after{grid-column:1;grid-row:2;display:none}
  .adaptive-group-value{grid-column:2;justify-self:start}
  .adaptive-save-bar{align-items:stretch;flex-direction:column}
  .adaptive-save-bar .notification-settings-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
}
@media(prefers-reduced-motion:reduce){
  .adaptive-preset-card,.adaptive-preview-canvas{transition:none!important}
}
@media(forced-colors:active){
  .adaptive-preset-card.is-selected,.adaptive-live-preview,.adaptive-save-bar{border:2px solid Highlight!important}
  .adaptive-preview-priority{border:1px solid CanvasText}
}
/* Patch 134: journal covers and compact tablet editor */
html body #journals .journal-cover {
  position: relative !important;
  padding: 0 !important;
  overflow: hidden !important;
  line-height: 0 !important;
  background-color: var(--journal-cover, #5B3FA3) !important;
}

html body #journals .journal-cover > img {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: inherit !important;
  object-fit: cover !important;
  object-position: center !important;
}

@media (min-width: 621px) and (max-width: 900px) {
  html body #journals .journal-editor-menu {
    display: block !important;
    width: 100% !important;
  }

  html body #journals .journal-editor-menu > summary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 50px !important;
    width: 100% !important;
    border: 1px solid var(--line) !important;
    border-radius: 14px !important;
    background: var(--panel) !important;
    color: var(--green) !important;
    font-weight: 800 !important;
  }

  html body #journals .journal-editor-menu > .journal-editor-categories {
    display: none !important;
  }

  html body #journals .journal-editor-menu[open] > .journal-editor-categories {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    padding-top: 8px !important;
  }

  html body #journals .journal-category-summary {
    width: 100% !important;
    justify-content: space-between !important;
  }

  html body #journals #journalLayerPanel {
    width: min(760px, calc(100vw - 20px)) !important;
    max-width: calc(100vw - 20px) !important;
    grid-template-columns: minmax(230px, 38%) minmax(0, 62%) !important;
  }
}

@media (max-width: 620px) {
  html body #journals #journalLayerPanel {
    width: calc(100vw - 12px) !important;
    max-width: calc(100vw - 12px) !important;
    grid-template-columns: minmax(168px, 44%) minmax(0, 56%) !important;
    gap: 8px !important;
  }

  html body #journals #journalLayerPanel .journal-layer-list,
  html body #journals #journalLayerPanel .journal-layer-properties {
    min-width: 0 !important;
  }

  html body #journals #journalLayerPanel .journal-layer-row {
    padding: 8px !important;
  }

  html body #journals #journalLayerPanel .journal-layer-row-main {
    grid-template-columns: 38px minmax(0, 1fr) !important;
  }
}
