:root{color-scheme:light;--paper:#fbf8f1;--white:#fffdfa;--ink:#352c29;--muted:#8d8178;--wine:#8e1b27;--wine-2:#b43e45;--line:#eadfd2;--gold:#bd8841;--shadow:0 13px 45px rgba(83,50,33,.07);font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Arial,sans-serif}*{box-sizing:border-box}html{background:var(--paper);scroll-behavior:smooth}body{margin:0;color:var(--ink)}button,input,select,textarea{font:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #c7a366;outline-offset:2px}.app-shell{max-width:850px;margin:0 auto;padding:0 24px 120px}.topbar{display:flex;align-items:center;gap:12px;min-height:96px}.brand-mark{width:45px;height:45px;border-radius:14px;display:grid;place-items:center;background:var(--wine);color:#f9e7b6;font-family:inherit;font-size:27px;box-shadow:0 8px 16px #8e1b272b}.brand-copy{display:flex;flex-direction:column;gap:1px}.brand-copy strong{font-size:19px;font-family:inherit;letter-spacing:.1px}.smallcaps{font-size:9px;letter-spacing:2.3px;color:var(--gold);font-weight:800}.topbar-pill{margin-left:auto;border:1px solid #e8d1c9;color:#a14b4e;padding:7px 10px;border-radius:100px;background:#fff9f5;font-size:11px;font-weight:650}.hero{position:relative;overflow:hidden;border-radius:24px;background:linear-gradient(116deg,#7a1727 0%,#9a2330 55%,#b3423e 100%);box-shadow:0 13px 32px rgba(123,30,43,.16);padding:27px 31px 29px;color:#fff7e9}.hero:after{content:' ';position:absolute;top:-70px;right:-25px;width:250px;height:250px;border:1px solid #ffffff26;border-radius:100%;box-shadow:0 0 0 42px #ffffff08,0 0 0 88px #ffffff06;pointer-events:none}.hero-pattern{position:absolute;font-size:180px;top:-69px;right:21px;color:#ffffff0e}.hero-subtitle{font-size:12px;font-weight:600;color:#f3cba8;letter-spacing:.8px}.hero h1{font-family:inherit;font-size:29px;font-weight:600;margin:9px 0 18px}.hero-content{display:flex;gap:30px;align-items:end}.hero-number{font-family:inherit;font-size:62px;letter-spacing:-1px;line-height:1}.hero-date{font-size:13px;margin-top:6px;color:#f3dbc9}.hero-divider{height:62px;width:1px;background:#ffffff46;align-self:center}.hero-label{color:#e9bea5;font-size:10px;letter-spacing:1.9px;font-weight:800}.hero-lunar{font-family:inherit;font-size:26px;margin:6px 0 3px}.hero-year{color:#f8ddc3;font-size:13px}.section-title{display:flex;justify-content:space-between;gap:12px;align-items:flex-end;margin:29px 0 16px}.section-title h2{margin:5px 0 0;font-size:27px;font-family:inherit;font-weight:600}.eyebrow{color:var(--gold);letter-spacing:1.65px;font-weight:800;font-size:10px;text-transform:uppercase}.text-btn{border:0;background:none;color:var(--wine);font-weight:700;padding:8px 0}.calendar-card,.day-card,.info-card,.summary-count{border:1px solid #f1e7d9;background:var(--white);box-shadow:var(--shadow);border-radius:22px}.calendar-card{padding:19px 18px 16px}.month-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}.month-heading{font-family:inherit;font-size:18px;font-weight:650}.nav-arrow{background:#f9f1e9;color:#8a4d3f;width:37px;height:37px;border:0;border-radius:12px;font-size:27px;line-height:20px}.weekday-grid,.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px}.weekday-grid{margin-bottom:6px}.weekday-grid span{text-align:center;color:#9b8a7b;font-size:12px;padding-bottom:8px;font-weight:700}.weekday-grid span:last-child{color:#af5758}.day-cell{border:1px solid transparent;border-radius:13px;background:transparent;min-height:67px;color:#3c332e;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;padding:5px 0 3px}.day-cell:hover{background:#fdf2e8}.day-cell.muted-day{opacity:.36}.day-cell.is-today{border-color:#d7ba88;background:#fff9ec}.day-cell.selected{background:var(--wine);color:white;box-shadow:0 6px 12px #8e1b272a}.day-cell.selected .lunar-digit{color:#f5d6af}.day-cell.sunday:not(.selected) .solar-digit{color:#bd444c}.solar-digit{font-size:18px;font-weight:700;line-height:1}.lunar-digit{font-size:11px;color:#a49586}.lunar-digit.month-start{font-weight:800;color:var(--wine)}.calendar-legend{display:flex;gap:18px;justify-content:flex-end;margin:18px 5px 0;color:#938679;font-size:11px}.calendar-legend span{display:flex;align-items:center;gap:6px}.legend-dot{display:inline-block;width:8px;height:8px;border-radius:20px;background:var(--wine)}.legend-dot.today-dot{background:#efd5aa}.day-card{margin-top:15px;padding:22px}.card-label{color:#b18a5b;font-size:10px;font-weight:800;letter-spacing:1.3px}.day-summary{display:flex;align-items:center;gap:16px;margin:13px 0 17px}.selected-day{width:59px;height:64px;border-radius:16px;background:#f5e8e4;display:flex;align-items:center;justify-content:center;color:var(--wine);font-family:inherit;font-size:32px;font-weight:700}.day-summary strong{font-size:17px}.muted{color:var(--muted);font-size:13px;margin-top:7px}.soft-divider{border-top:1px solid var(--line);margin-bottom:12px}.day-meta{display:flex;justify-content:space-between;gap:10px;padding:8px 0;font-size:13px}.day-meta span{color:var(--muted)}.day-meta strong{font-weight:700}.note-inline{background:#faf2e8;color:#9b6b3a;font-size:12px;border-radius:11px;padding:12px;line-height:1.65;margin-top:13px}.secondary-action{border:1px solid #dcc9b7;background:#fffdfa;color:#8b3b3a;border-radius:12px;min-height:42px;padding:10px 14px;font-weight:700;font-size:12px}.day-card>.secondary-action{margin-top:15px}.primary-small,.save-btn{background:var(--wine);border:1px solid var(--wine);color:white;border-radius:12px;padding:12px 16px;font-weight:700}.hidden{display:none!important}.info-strip{border-radius:15px;padding:16px 19px;background:#fff3e8;border:1px solid #eed5b8;color:#875d34;font-size:13px;line-height:1.6}.info-strip strong{font-size:13px}.info-strip p{margin:6px 0 0}.summary-count{display:flex;justify-content:space-between;align-items:center;margin-top:18px;padding:20px 22px}.big-count{font-size:35px;font-family:inherit;color:var(--wine);margin-top:8px}.tag{font-size:11px;background:#f7eadf;color:#9b7150;padding:8px 10px;border-radius:100px}.subheading{margin-top:28px;margin-bottom:12px}.subheading h3{font-family:inherit;margin:0;font-size:19px}.events{display:grid;gap:11px}.event-row{background:var(--white);border:1px solid var(--line);border-radius:17px;padding:15px;display:flex;align-items:center;gap:13px}.event-date{flex:none;width:57px;min-height:62px;background:#fbefe4;border-radius:12px;display:flex;justify-content:center;align-items:center;flex-direction:column;color:var(--wine)}.event-date strong{font-size:22px;font-family:inherit}.event-date small{font-size:10px}.event-detail{min-width:0;flex:1}.event-detail strong{display:block;font-size:14px}.event-detail small{color:#857a73;line-height:1.7;font-size:11px;display:block}.event-actions{display:flex;flex-direction:column;gap:5px}.icon-btn{border:0;background:#faf4eb;border-radius:8px;padding:6px 9px;color:#93553e;font-size:12px;font-weight:700}.empty-events{border:1px dashed #e0cbbb;border-radius:18px;padding:30px 18px;text-align:center;color:var(--muted);line-height:1.8;font-size:13px}.empty-events .empty-icon{font-size:34px;display:block;margin-bottom:7px}.tools-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:19px}.tools-row .secondary-action{flex:1}.intro-text{font-size:13px;color:#85786f;line-height:1.8;margin-bottom:22px}.prayers{display:grid;gap:12px}.prayer-card{border:1px solid var(--line);background:var(--white);border-radius:18px;padding:18px 19px}.prayer-card summary{cursor:pointer;font-weight:700;font-family:inherit;font-size:18px;color:#773b39}.prayer-card p{line-height:1.9;font-size:14px;color:#595049}.info-card{padding:25px;line-height:1.85;font-size:14px;color:#73675d}.info-card h3{font-size:21px;line-height:1.4;color:var(--ink);margin-bottom:4px;font-family:inherit}.info-card h4{color:#80363a;margin:19px 0 5px}.info-card p{margin:5px 0 10px}.stamp{width:60px;height:60px;border-radius:18px;background:var(--wine);font-size:34px;color:#efd8a3;display:grid;place-items:center;font-family:inherit}.bottom-nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(850px,100%);display:grid;grid-template-columns:repeat(4,1fr);background:#fffcf7f5;backdrop-filter:blur(17px);box-shadow:0 -5px 35px #69413012;border-top:1px solid #eee0d3;padding:8px max(12px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-bottom));z-index:10}.tab{display:flex;flex-direction:column;align-items:center;gap:3px;border:0;background:none;padding:6px 3px;color:#a18c7a;font-size:11px;font-weight:650}.tab-icon{font-size:24px;line-height:1.2}.tab.active{color:var(--wine)}.tab.active .tab-icon{background:#f9eee7;border-radius:12px;padding:3px 12px}dialog{border:none;border-radius:20px;box-shadow:0 22px 90px #2416134a;width:min(440px,calc(100vw - 24px));max-height:88vh;overflow:auto;padding:24px;color:var(--ink)}dialog::backdrop{background:#29191480}.dialog-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.dialog-title h2{font-family:inherit;font-size:23px;margin:0}.close-btn{border:0;background:#f5ede6;border-radius:10px;font-size:24px;line-height:32px;width:35px}form label{display:block;color:#69584d;font-size:12px;font-weight:700;margin-top:14px}form input:not([type=checkbox]),form select,form textarea{display:block;margin-top:7px;width:100%;padding:11px 13px;background:#fffefa;border:1px solid #dfd0c3;border-radius:10px;color:#332d28;font-size:15px}form textarea{resize:vertical}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.check-row{display:flex;align-items:center;gap:9px}.check-row input{width:18px;height:18px;accent-color:var(--wine)}.help-text{font-size:11px;line-height:1.6;color:#938578}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}#toast{position:fixed;bottom:90px;left:50%;transform:translateX(-50%);max-width:calc(100% - 20px);width:max-content;z-index:11;background:#392b27;color:white;padding:12px 20px;border-radius:13px;box-shadow:0 10px 30px #0002;font-size:13px;opacity:0;pointer-events:none;transition:opacity .16s}#toast.show{opacity:1}@media(max-width:500px){.app-shell{padding:0 13px 110px}.topbar{min-height:81px}.brand-copy strong{font-size:17px}.topbar-pill{font-size:9px;padding:6px}.hero{padding:23px;border-radius:20px}.hero h1{font-size:24px}.hero-number{font-size:52px}.hero-content{gap:20px}.hero-lunar{font-size:22px}.section-title h2{font-size:24px}.calendar-card{padding:14px 9px}.weekday-grid,.calendar-grid{gap:2px}.day-cell{min-height:58px;border-radius:10px;gap:3px}.solar-digit{font-size:16px}.lunar-digit{font-size:10px}.calendar-legend{font-size:10px}.day-card{padding:17px}.topbar-pill{white-space:nowrap}.tools-row{display:grid;grid-template-columns:repeat(2,1fr)}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
/* V0.2: trên desktop đặt menu dưới header, không che nội dung lịch. */
@media(min-width:701px){
  .app-shell{display:grid;grid-template-rows:auto auto minmax(0,1fr);padding-bottom:55px}
  .topbar{grid-row:1}
  .bottom-nav{grid-row:2;position:sticky;top:0;left:auto;bottom:auto;transform:none;width:100%;border:1px solid #eee0d3;border-radius:16px;box-shadow:0 5px 22px #69413010;margin-bottom:21px;padding:7px 15px;z-index:10}
  main{grid-row:3}
  .tab{flex-direction:row;justify-content:center;gap:10px;font-size:13px}
  .tab.active .tab-icon{padding:4px 9px}
}
/* Gia đình / đồng bộ */
.family-status-card{border:1px solid #e6d7c8;border-radius:16px;background:#fffdf8;padding:16px 18px;margin:12px 0 18px}
.family-status-card p{font-size:13px;line-height:1.65;color:#867a6f;margin:7px 0}
.family-status-card h3{font-family:inherit;margin:0 0 7px;font-size:20px}
.family-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:12px}
.family-actions button{flex:1;min-width:125px}
.family-note{font-size:12px;line-height:1.7;color:#7e7169}
.family-members{margin-top:16px;display:grid;gap:8px}
.family-member{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#faf5ec;padding:11px;border-radius:11px;font-size:12px}
.family-member button{border:0;background:#f1ded8;color:#9e2a31;border-radius:8px;padding:7px 10px}
#sync-state{font-size:12px;color:#84786d;margin:10px 0}
button:disabled{opacity:.45;cursor:not-allowed}

[hidden]{display:none!important}

/* V0.3: Typography first. Font hệ thống tối ưu tiếng Việt và dùng offline.
   Thay thế chữ chân (Georgia) vốn hiển thị dấu chưa ổn trên một số thiết bị.
   Không đổi cấu trúc HTML, dữ liệu hay logic đồng bộ D1. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hero h1, .section-title h2, .month-heading, .family-status-card h3,
.subheading h3, .brand-copy strong, .info-card h3, .prayer-card summary,
.dialog-title h2 {
  font-family: inherit;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -0.012em;
  overflow-wrap: break-word;
}
.hero-number, .hero-lunar, .selected-day, .big-count, .event-date strong {
  font-family: inherit;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.018em;
}
.hero-number {line-height: 1.1;}
.hero-subtitle, .hero-date, .hero-year {font-size: 13px;}
.smallcaps {font-size: 10px; letter-spacing: .13em;}
.eyebrow, .card-label {font-size: 11px; letter-spacing: .095em;}
.family-status-card p, .intro-text {font-size: 14px; line-height: 1.7;}
.family-status-card h3 {font-size: 20px;}
.family-note, #sync-state {font-size: 13px; line-height: 1.6;}
.section-title h2 {font-size: 26px;}
.subheading h3 {font-size: 20px;}
.event-detail strong {font-size: 15px; line-height: 1.45;}
.event-detail small {font-size: 12px; line-height: 1.6;}
.event-date small, .lunar-digit {font-size: 12px;}
.tag, .tab, .secondary-action {font-size: 12px;}
.month-heading {font-size: 17px;}
.solar-digit {line-height: 1.15;}
.day-cell {line-height: 1.2;}
button, input, select, textarea {letter-spacing: normal;}
@media(max-width:500px) {
  .hero h1 {font-size: 24px;}
  .section-title h2 {font-size: 23px;}
  .family-status-card h3 {font-size: 19px;}
  .day-cell .lunar-digit {font-size: 10px;}
  .tab {font-size: 12px;}
  .family-status-card {padding: 15px 14px;}
}

/* V0.4 - Văn khấn miền Bắc: dễ đọc trên điện thoại; không đổi bố cục tab khác. */
.prayer-setup{background:var(--white);border:1px solid var(--line);border-radius:18px;padding:17px 18px;margin:14px 0}
.prayer-setup-heading{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;align-items:center;margin-bottom:11px}
.prayer-setup-heading strong{font-size:16px;color:#753039}
.prayer-setup-heading span,.prayer-privacy{font-size:12px;color:#81746c;line-height:1.65}
.prayer-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.prayer-fields label{display:block;font-size:13px;font-weight:700;color:#65584e}
.prayer-fields input,.prayer-toolbar input,.prayer-toolbar select{width:100%;min-width:0;min-height:43px;padding:10px 12px;border:1px solid #decec2;border-radius:11px;background:#fffefa;color:var(--ink);font-size:14px;margin-top:6px}
.prayer-privacy{margin:12px 0 0}
.prayer-toolbar{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1.2fr) auto;gap:10px;align-items:end}
.prayer-toolbar input,.prayer-toolbar select{margin:0}
.prayer-font-controls{display:flex;align-items:center;gap:5px;white-space:nowrap}
.prayer-font-controls span{font-size:12px;color:var(--muted);margin-right:2px}
.prayer-font-controls button{border:1px solid #decbbd;border-radius:10px;background:#fffdf9;color:var(--wine);font-weight:800;padding:10px;min-height:43px}
.prayer-counter{font-size:13px;color:#81746c;margin:12px 3px}
.prayer-card{padding:0;overflow:hidden}
.prayer-card summary{list-style:none;display:flex;flex-direction:column;gap:4px;padding:17px 18px;position:relative;padding-right:45px}
.prayer-card summary::-webkit-details-marker{display:none}
.prayer-card summary:after{content:'⌄';position:absolute;right:20px;top:20px;color:var(--wine);font-size:20px}
.prayer-card[open] summary:after{transform:rotate(180deg)}
.prayer-name{font-size:17px;font-weight:750;line-height:1.45;color:#71343a}
.prayer-occasion{font-size:12px;font-weight:500;color:#8b7d70}
.prayer-card[open] summary{border-bottom:1px solid #f0e7dc;background:#fef9f3}
.prayer-note{margin:13px 18px 0!important;font-size:13px!important;line-height:1.6!important;color:#8a6d51!important}
.prayer-body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.85;color:#342d28;padding:12px 19px 17px;font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif}
.prayer-actions{display:flex;justify-content:flex-end;margin:0 17px 18px;padding-top:12px;border-top:1px solid #f0e5d8}
.sr-only{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
@media(max-width:620px){.prayer-fields{grid-template-columns:1fr}.prayer-toolbar{grid-template-columns:1fr 1fr}.prayer-toolbar>input{grid-column:1/-1}.prayer-font-controls{justify-content:end}.prayer-font-controls span{display:none}}
@media(max-width:360px){.prayer-toolbar{grid-template-columns:1fr}.prayer-toolbar>input{grid-column:1}.prayer-font-controls{justify-content:start}}

/* V0.5: nhắc ăn chay và ngày giỗ, ưu tiên người lớn tuổi */
.fasting-card{background:#fffdf8;border:1px solid #e6d7c8;border-radius:18px;padding:20px;margin:16px 0}
.fasting-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}
.fasting-heading h3{margin:6px 0;font-size:20px}
.fasting-time{background:#e4f3df;color:#326d35;border-radius:13px;padding:10px 13px;font-size:20px;font-weight:800;font-variant-numeric:tabular-nums}
.fasting-day-grid{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:5px;margin:17px 0}
.fasting-day{min-width:0;border:1px solid #d7d9cb;background:#fff;color:#384136;border-radius:11px;min-height:41px;font-size:14px;font-weight:700}
.fasting-day[aria-pressed="true"]{background:#417748;border-color:#417748;color:white}
.fasting-day:disabled{opacity:.5}
.fasting-switch{display:flex;gap:10px;align-items:center;font-size:15px;font-weight:650;color:#3d4738;margin:12px 0}
.fasting-switch input,.reminder-choices input{width:18px;height:18px;accent-color:#417748}
.fasting-actions{display:flex;gap:9px;flex-wrap:wrap;margin:16px 0 10px}
.fasting-actions button{min-height:44px;flex:1}
.device-push-card{background:linear-gradient(145deg,#f5fbf6,#fffdf8);border:1px solid #cde2d4;border-radius:18px;padding:20px;margin:16px 0 20px}
.device-push-preferences{display:grid;gap:11px;margin:15px 0;padding:13px;background:#fff;border:1px solid #dbe7df;border-radius:15px}
.device-push-preferences[hidden]{display:none}
.device-push-option{display:flex;align-items:center;justify-content:space-between;gap:14px;cursor:pointer;padding:7px 3px;color:#274d39}
.device-push-option+ .device-push-option{border-top:1px solid #ecf1ec;padding-top:14px}
.device-push-option span{display:flex;flex-direction:column;gap:5px}
.device-push-option strong{font-size:16px}
.device-push-option small{font-size:12px;line-height:1.5;color:#718273}
.device-push-option input{width:23px;height:23px;flex:none;accent-color:#08745d}
#save-push-preferences{width:100%;min-height:44px;margin-top:3px}
.memorial-reminders{border:1px solid #dfd8cc;border-radius:12px;padding:12px 13px;margin:14px 0;background:#fdf9f2}
.memorial-reminders strong{font-size:14px}
.reminder-choices{display:flex;gap:13px;flex-wrap:wrap;margin:9px 0}
.reminder-choices label{display:flex;align-items:center;gap:7px;margin:0;font-size:14px}
@media(max-width:580px){.fasting-card,.device-push-card{padding:14px}.fasting-heading h3{font-size:18px}.fasting-day-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}.fasting-actions{flex-direction:column}.fasting-actions button{width:100%}}

/* V0.5: six accessible visual palettes; all use the same lightweight layout. */
:root{--hero-a:#7a1727;--hero-b:#9a2330;--hero-c:#b3423e;--theme-bg:#fbf8f1}
:root[data-theme="dynamic"]{--wine:#08745d;--wine-2:#218b74;--gold:#7d9b32;--hero-a:#075e4e;--hero-b:#11795e;--hero-c:#4a9976;--paper:#f5faf3;--white:#fffefb}
:root[data-theme="ceremony"]{--wine:#b20e24;--wine-2:#e23145;--gold:#be8c38;--hero-a:#930619;--hero-b:#b5162c;--hero-c:#db394a;--paper:#fffbf4;--white:#fffef9}
:root[data-theme="classic"]{--wine:#855a35;--wine-2:#a77a51;--gold:#a37638;--hero-a:#684428;--hero-b:#855b35;--hero-c:#ad885c;--paper:#f9f1de;--white:#fff9ea}
:root[data-theme="lotus"]{--wine:#387a87;--wine-2:#5992a2;--gold:#a98c5b;--hero-a:#245b6c;--hero-b:#397c8f;--hero-c:#71a9ac;--paper:#f3f9f8;--white:#fffdfc}
:root[data-theme="night"]{--wine:#3b416f;--wine-2:#666fa8;--gold:#a18552;--hero-a:#242d55;--hero-b:#3b4379;--hero-c:#68679a;--paper:#f5f4fa;--white:#fff}
.hero{background:linear-gradient(116deg,var(--hero-a) 0%,var(--hero-b) 55%,var(--hero-c) 100%)}
.brand-mark,.selected-day,.day-cell.selected,.primary-small,.save-btn,.bottom-nav .tab.active{transition:background .2s,color .2s}
.calendar-mode{display:grid;grid-template-columns:1fr 1fr;gap:7px;padding:5px;background:#e9dcd2;border-radius:15px;margin:-3px 0 14px}
.calendar-mode-btn{border:0;background:none;border-radius:11px;min-height:42px;color:var(--ink);font-weight:750}
.calendar-mode-btn.active{background:var(--white);color:var(--wine);box-shadow:0 2px 7px #00000013}
.day-cell{position:relative}
.day-cell.has-memorial{border-color:#8ab1dd}
.day-memorial-marker{position:absolute;bottom:2px;width:8px;height:3px;border-radius:2px;background:var(--wine)}
.day-cell.selected .day-memorial-marker{background:#f8d99c}
.day-marker-strip{position:absolute;bottom:3px;left:0;right:0;display:flex;justify-content:center;align-items:center;gap:4px;pointer-events:none}
.day-marker{display:block;width:8px;height:5px;border-radius:4px;box-shadow:0 0 0 1px #fff8}
.day-marker-memorial{background:#a72b38}
.day-marker-fasting{background:#27865b}
.day-cell.selected .day-marker-memorial{background:#ffd8a2}
.day-cell.selected .day-marker-fasting{background:#97eed0}
.legend-fasting{display:inline-block;width:9px;height:9px;border-radius:50%;background:#27865b}
.day-cell:is(.has-fasting,.has-memorial){min-height:74px;gap:3px;border-width:2px;padding:5px 1px 4px}
.day-cell.has-fasting:not(.has-memorial){background:#b7e9c1;border-color:#34a361;color:#103e28}
.day-cell.has-memorial:not(.has-fasting){background:#b7d8ff;border-color:#3c83d4;color:#113b6b}
.day-cell.has-fasting.has-memorial{background:linear-gradient(130deg,#b7e9c1 0%,#b7e9c1 49%,#b7d8ff 51%,#b7d8ff 100%);border-color:#35747d;color:#153c3b}
.day-cell:is(.has-fasting,.has-memorial) .lunar-digit{color:#375d4c;font-weight:650}
.day-cell.has-memorial:not(.has-fasting) .lunar-digit{color:#31577e}
.day-cell:is(.has-fasting,.has-memorial) .lunar-digit.month-start{color:#8e1b27}
.day-event-labels{display:flex;align-items:center;justify-content:center;gap:3px;max-width:100%;pointer-events:none}
.day-event-badge{display:inline-block;border-radius:4px;padding:3px 4px 2px;color:#fff;font-size:9px;font-weight:850;letter-spacing:.15px;line-height:1;white-space:nowrap}
.day-event-badge-fasting{background:#17683e}
.day-event-badge-memorial{background:#175ca5}
.day-cell.selected:is(.has-fasting,.has-memorial){outline:3px solid #c17b20;outline-offset:-1px;box-shadow:0 4px 12px #73450f35}
.day-cell.selected:is(.has-fasting,.has-memorial) .solar-digit{color:#153b31}
.day-cell.selected:is(.has-fasting,.has-memorial) .lunar-digit{color:#365f50}
.day-cell.selected.has-memorial:not(.has-fasting) .solar-digit{color:#113b6b}
.day-cell.is-today:is(.has-fasting,.has-memorial)::before{content:'';position:absolute;right:4px;top:4px;width:7px;height:7px;border-radius:50%;background:#f7b636;box-shadow:0 0 0 1px #70440c}
.day-cell.muted-day:is(.has-fasting,.has-memorial){opacity:.63}
.legend-color{display:inline-block;width:17px;height:17px;flex:none;border-radius:5px;border:2px solid #b7b3a6}
.legend-color-fasting{background:#b7e9c1;border-color:#34a361}
.legend-color-memorial{background:#b7d8ff;border-color:#3c83d4}
.legend-color-both{background:linear-gradient(130deg,#b7e9c1 0 49%,#b7d8ff 51%);border-color:#35747d}
.calendar-legend .legend-entry{font-weight:750;color:#554a3c}
.device-push-option input:disabled{opacity:.5;cursor:not-allowed}
#push-preference-hint{margin:2px 0 0;font-size:12px}
.calendar-sync-note{display:flex;align-items:center;flex-wrap:wrap;gap:11px;justify-content:space-between;padding:14px;margin:0 0 15px;border:1px solid #e4cb9d;border-radius:15px;background:#fff7e7;color:#663d2d}
.calendar-sync-note[hidden]{display:none!important}
.calendar-sync-note strong{font-size:13px}
.calendar-sync-note p{font-size:12px;line-height:1.6;margin:5px 0 0;max-width:390px}
.calendar-sync-note .primary-small{font-size:12px;white-space:nowrap}
img.brand-mark{object-fit:cover;border:1px solid #e7cc94;padding:0}
@media(max-width:460px){.day-marker-strip{bottom:2px;gap:3px}.day-marker{width:7px;height:4px}.day-cell{padding-bottom:7px}.day-cell:is(.has-fasting,.has-memorial){min-height:70px;gap:2px;padding:4px 0}.day-event-badge{font-size:8px;padding:3px 3px 2px}.day-cell.has-fasting.has-memorial .day-event-labels{flex-direction:column;gap:2px}.calendar-legend{column-gap:11px;row-gap:9px}}
.legend-square{display:inline-block;width:9px;height:9px;border:2px solid var(--gold);border-radius:2px}
.calendar-legend{flex-wrap:wrap}
.selected-memorials{margin:-5px 0 14px;padding:10px 12px;border-radius:12px;background:#fff3df;color:#854220;font-size:13px;font-weight:700}
.upcoming-calendar{display:grid;gap:9px}
.upcoming-item{display:flex;align-items:center;gap:15px;text-align:left;background:var(--white);border:1px solid var(--line);border-radius:15px;padding:11px 14px;min-height:68px;color:var(--ink)}
.upcoming-date{flex:none;min-width:61px;text-align:center;border-radius:10px;padding:10px 6px;background:#f5e8df;color:var(--wine);font-size:17px;font-weight:800}
.upcoming-detail{display:flex;flex-direction:column;gap:4px;min-width:0}
.upcoming-detail strong{font-size:14px;overflow-wrap:anywhere}
.upcoming-detail small{font-size:12px;color:var(--muted)}
.utility-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.utility-tile{display:flex;flex-direction:column;align-items:flex-start;gap:7px;min-height:135px;padding:16px;border:1px solid var(--line);border-radius:18px;background:var(--white);text-align:left;color:var(--ink)}
.utility-tile>span{display:grid;place-items:center;font-size:26px;width:48px;height:48px;border-radius:13px;background:#f8eee2}
.utility-tile strong{font-size:15px}.utility-tile small{font-size:12px;color:var(--muted);line-height:1.5}
.theme-panel{margin-top:18px;border:1px solid var(--line);background:var(--white);padding:20px;border-radius:19px}
.theme-panel h3{margin:0;font-size:20px}.theme-panel p{font-size:13px;color:var(--muted);line-height:1.6}
.theme-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.theme-option{display:flex;gap:8px;align-items:center;border:1px solid var(--line);background:#fff;border-radius:12px;padding:10px 8px;color:var(--ink);min-width:0}
.theme-option strong{font-size:12px}.theme-option.chosen{border:2px solid var(--wine);padding:9px 7px}
.theme-swatch{width:24px;height:24px;border-radius:9px;flex:none;border:1px solid #00000014}
@media(max-width:460px){.theme-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.utility-tile{padding:12px;min-height:128px}.calendar-legend{justify-content:center}}
