:root {
  --ink: #1d302b;
  --muted: #66756e;
  --green: #18775d;
  --green2: #dff2e9;
  --lime: #d8ed9f;
  --bg: #f3f6f1;
  --line: #e6ece5;
  --red: #ad5751;
  --shadow: 0 12px 35px #15352a0b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'DM Sans', sans-serif; font-size: 16px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Manrope, sans-serif; letter-spacing: -.04em; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; margin-bottom: 8px; }
h2 { font-size: 24px; margin-bottom: 5px; }
h3 { font-size: 18px; margin-bottom: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 27px 18px; display: flex; flex-direction: column; gap: 34px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; }
.brandmark { width: 40px; height: 40px; background: var(--green); color: #fff; border-radius: 14px; display: grid; place-items: center; font-size: 21px; }
.brandname { font: 800 19px Manrope, sans-serif; }
.brandname span { color: var(--green); }
.brand-copy { display: grid; gap: 1px; }
.brand-by { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.nav { display: grid; gap: 7px; }
.nav button { border: 0; background: transparent; color: #63726a; padding: 12px 13px; border-radius: 13px; text-align: left; display: flex; gap: 13px; align-items: center; font-weight: 600; }
.nav button.active { background: var(--green2); color: var(--green); }
.nav .icon { font-size: 19px; width: 22px; text-align: center; }
.profile { margin-top: auto; border-top: 1px solid var(--line); padding: 20px 7px 0; display: flex; align-items: center; gap: 11px; }
.avatar { width: 39px; height: 39px; border-radius: 50%; background: #f2dfc4; color: #73512d; display: grid; place-items: center; font-weight: 800; }
.main { max-width: 1440px; width: 100%; margin: auto; padding: 32px clamp(22px, 4vw, 58px) 70px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; gap: 15px; }
.date { font-weight: 600; color: var(--muted); }
.top-actions { display: flex; gap: 10px; }
.btn { border: 0; border-radius: 12px; padding: 12px 17px; font-weight: 700; transition: .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-soft { background: var(--green2); color: var(--green); }
.btn-danger { background: #fff0ed; color: #a95048; }
.welcome { display: flex; justify-content: space-between; align-items: end; margin-bottom: 27px; gap: 18px; }
.welcome p { color: var(--muted); margin-bottom: 0; font-size: 17px; }
.hero { background: var(--green); color: #fff; border-radius: 22px; padding: 24px 27px; display: flex; justify-content: space-between; align-items: center; position: relative; overflow: hidden; margin-bottom: 23px; min-height: 115px; }
.hero:after { content: '✳'; position: absolute; right: 20%; top: -58px; font-size: 170px; color: #ffffff0d; }
.hero p { color: #d6ece3; margin: 4px 0 0; }
.hero .btn { background: var(--lime); color: #284839; position: relative; z-index: 1; }
.hero-count { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.count { font: 800 36px Manrope, sans-serif; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 27px 0 14px; gap: 10px; }
.section-head p { margin: 0; color: var(--muted); }
.dayline { display: flex; align-items: center; gap: 10px; overflow: auto; padding: 2px 0 12px; }
.daypill { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 10px 15px; min-width: 87px; text-align: center; color: inherit; font-family: inherit; cursor: pointer; }
.daypill.active { background: var(--green); color: #fff; border-color: var(--green); }
.daypill b { display: block; font-size: 14px; }
.daypill span { font-size: 12px; opacity: .75; }
.daypill em { display: block; margin-top: 3px; color: #b5413d; font-size: 9px; font-style: normal; font-weight: 800; letter-spacing: .04em; }
.daypill.today:not(.active) { border: 2px solid #c84b46; color: #a53834; padding: 9px 14px; }
.daypill.today.active em { color: #fff1b6; }
.grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(275px, .8fr); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 21px; box-shadow: var(--shadow); }
.schedule { display: grid; gap: 11px; }
.dose { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 15px; padding: 14px; min-width: 0; }
.dose-missed { border-color: #eac7c1; background: #fffafa; }
.dose-overdue { border-color: #e8c8a3; background: #fffdf8; }
.dose-time { font: 800 17px Manrope, sans-serif; }
.dose-icon { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 14px; background: #eff5eb; display: grid; place-items: center; overflow: hidden; font-size: 27px; }
.dose-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dose-info { display: flex; gap: 12px; align-items: center; min-width: 0; }
.dose-info > div:last-child { min-width: 0; }
.dose-info p { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.dose-title { font-weight: 800; margin-bottom: 3px; }
.dose-note { font-size: 12px; color: #8a765f; margin-top: 4px; }
.taken, .not-taken { border: 0; border-radius: 11px; padding: 11px 12px; font-weight: 800; white-space: nowrap; }
.taken { background: var(--green2); color: var(--green); }
.not-taken { background: #f8e8e5; color: var(--red); }
.dose-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.status-label { display: inline-flex; align-items: center; }
.notify-caregiver { padding: 8px 10px; font-size: 12px; }
.overdue-label { color: #8b5a1e; font-weight: 700; }
.pending { background: #fbf2df; color: #906222; }
.missed { background: #f8e8e5; color: var(--red); }
.side-stack { display: grid; gap: 16px; align-content: start; }
.week-card { background: #fbfdf8; }
.weekdays { display: flex; justify-content: space-between; margin-top: 18px; }
.weekday { text-align: center; color: var(--muted); font-size: 12px; }
.weekday i { display: block; width: 29px; height: 29px; border-radius: 50%; background: #e8f3e7; margin: 7px auto 0; }
.weekday i.on { background: var(--green); box-shadow: 0 0 0 4px #d9ecdf; }
.voice-toggle { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); gap: 14px; }
.switch { appearance: none; width: 45px; height: 26px; flex: 0 0 45px; background: #dce4df; border-radius: 20px; position: relative; cursor: pointer; transition: .2s; }
.switch:after { content: ''; width: 20px; height: 20px; background: #fff; border-radius: 50%; position: absolute; top: 3px; left: 3px; box-shadow: 0 1px 4px #0002; transition: .2s; }
.switch:checked { background: var(--green); }
.switch:checked:after { left: 22px; }
.medicine-list { display: grid; gap: 11px; }
.med-item { border: 1px solid var(--line); border-radius: 15px; padding: 13px; display: flex; gap: 12px; align-items: center; }
.med-photo { height: 47px; width: 47px; flex: 0 0 47px; object-fit: cover; border-radius: 13px; background: #f2f4ef; display: grid; place-items: center; font-size: 23px; }
.med-item div:nth-child(2) { flex: 1; min-width: 0; }
.med-item p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.tag { font-size: 11px; font-weight: 700; background: #f0f4ed; color: #55705f; border-radius: 20px; padding: 5px 8px; }
.tag-missed { background: #f8e8e5; color: var(--red); }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tab { border: 0; background: transparent; padding: 11px 14px; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; }
.tab.active { color: var(--green); border-color: var(--green); }
.med-list-row { display: flex; align-items: center; gap: 15px; padding: 16px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.med-list-row:last-child { border: 0; }
.med-list-row .grow { flex: 1; min-width: 0; }
.med-list-row p { margin: 4px 0 0; color: var(--muted); }
.big-pill { width: 57px; height: 57px; flex: 0 0 57px; border-radius: 18px; background: #f0f5e9; display: grid; place-items: center; overflow: hidden; font-size: 27px; }
.big-pill img.med-photo { width: 100%; height: 100%; flex-basis: auto; border-radius: inherit; }
.modal-backdrop { position: fixed; inset: 0; background: #10281f91; z-index: 5; display: none; align-items: center; justify-content: center; padding: 18px; }
.modal-backdrop.open { display: flex; }
.modal { width: min(670px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 22px; padding: 26px; box-shadow: 0 30px 80px #10281f44; }
.modal-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; gap: 12px; }
.close { border: 0; background: #f2f5f2; border-radius: 10px; width: 38px; height: 38px; flex: 0 0 38px; font-size: 20px; }
.steps { display: flex; gap: 7px; margin: 0 0 22px; }
.step { height: 4px; background: #e7eee8; border-radius: 6px; flex: 1; }
.step.done { background: var(--green); }
.upload { border: 2px dashed #b8d4c4; background: #f8fbf7; border-radius: 17px; padding: 28px; text-align: center; margin: 17px 0; }
.upload .upicon { font-size: 35px; }
.upload label { cursor: pointer; }
.upload input { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: grid; gap: 6px; margin-bottom: 13px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: 14px; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid #dce5dc; border-radius: 11px; padding: 12px; background: #fff; color: var(--ink); }
.field textarea { min-height: 72px; resize: vertical; }
.check-field { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.check-field input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--green); }
.duration-fields { display: none; }
.course-estimate { padding: 10px 12px; background: #f4f8ef; border-radius: 10px; color: var(--green); font-weight: 700; }
.review-banner { display: flex; gap: 11px; background: #fff7e8; border-radius: 12px; padding: 12px; margin: 15px 0; color: #7a5d2d; font-size: 14px; }
.review-summary { display: grid; gap: 8px; border: 1px solid #dce9dd; background: #f7fbf6; border-radius: 14px; padding: 15px; margin: 12px 0 18px; }
.review-summary > b { margin-bottom: 3px; }
.review-summary > div { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 1.5fr); gap: 10px; font-size: 13px; }
.review-summary > div span { color: var(--muted); }
.caregiver-settings { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.caregiver-settings .check-field { display: flex; align-items: flex-start; gap: 10px; }
.caregiver-settings .check-field span { display: grid; gap: 4px; }
.photo-choices { display: flex; gap: 9px; flex-wrap: wrap; margin: 5px 0 8px; }
.preview { max-width: 90px; max-height: 90px; border-radius: 12px; object-fit: cover; }
.modal-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 19px; }
.toast { position: fixed; bottom: 23px; left: 50%; transform: translate(-50%, 100px); opacity: 0; background: #193d30; color: #fff; padding: 14px 20px; border-radius: 13px; z-index: 8; transition: .25s; box-shadow: 0 8px 30px #1236; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.auth-overlay[hidden] { display: none; }
.auth-overlay { position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 22px; overflow-y: auto; background: #f3f6f1; }
.auth-card { width: min(100%, 510px); padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 20px 70px #15352a16; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 27px; }
.auth-card h1 { font-size: 30px; margin-bottom: 8px; }
.auth-card > .muted { line-height: 1.55; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 21px 0; padding: 5px; border-radius: 13px; background: #f2f6f1; }
.auth-tabs button { border: 0; border-radius: 10px; background: transparent; padding: 11px 8px; color: var(--muted); font-weight: 700; }
.auth-tabs button.active { background: #fff; color: var(--green); box-shadow: 0 2px 8px #15352a10; }
.auth-fields { display: grid; gap: 15px; }
.auth-fields .form-grid { gap: 12px; }
.auth-submit { width: 100%; min-height: 50px; margin-top: 3px; }
.auth-submit:disabled { opacity: .65; cursor: wait; }
.auth-link { border: 0; padding: 7px; background: transparent; color: var(--green); font-weight: 700; }
.auth-message { min-height: 22px; margin: 13px 0 4px; color: var(--green); font-weight: 600; line-height: 1.45; }
.auth-message.error { color: var(--red); }
.auth-privacy { margin: 8px 0 0; line-height: 1.5; }
body:has(.auth-overlay:not([hidden])) { overflow: hidden; }
@media (max-width: 520px) { .auth-overlay { padding: 12px; align-items: start; } .auth-card { padding: 23px 19px; border-radius: 19px; margin: auto 0; } .auth-card h1 { font-size: 27px; } }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.history-controls { display: flex; align-items: end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.history-controls .field { flex: 1 1 180px; margin: 0; }
.history-controls input { border: 1px solid var(--line); border-radius: 11px; padding: 11px; color: var(--ink); background: #fff; width: 100%; }
.view { display: none; }
.view.active { display: block; }
.footer { margin: 30px 0 0; text-align: center; padding: 19px 12px; border-top: 1px solid var(--line); color: #68766e; font-size: 13px; line-height: 1.7; }
.footer a { color: var(--green); font-weight: 700; text-decoration: none; }
.footer strong { color: #344b40; }
.install-hint { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 74px minmax(0, 1fr); }
  .sidebar { padding: 22px 10px; align-items: center; }
  .brand { padding: 0; }
  .brand-copy, .nav .label, .profile .person { display: none; }
  .nav button { justify-content: center; width: 50px; padding: 13px 0; }
  .profile { padding: 16px 0; }
  .grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .app { display: block; padding-bottom: 72px; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 3; height: 67px; padding: 6px 5px; border: 0; border-top: 1px solid var(--line); flex-direction: row; justify-content: center; }
  .brand, .profile { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; gap: 0; }
  .nav button { width: auto; min-width: 0; flex: 1; display: grid; gap: 0; padding: 6px 1px; }
  .nav .icon { font-size: 18px; }
  .nav .label { display: block; font-size: 10px; }
  .main { padding: 20px 15px 30px; }
  .topbar { margin-bottom: 22px; align-items: start; }
  .top-actions { gap: 6px; }
  .top-actions .btn { padding: 10px 9px; font-size: 12px; }
  .welcome { align-items: start; display: block; }
  .welcome .btn { margin-top: 14px; }
  .hero { padding: 19px; min-height: 102px; }
  .hero-count { gap: 9px; }
  .hero-count .btn { padding: 10px; }
  .grid { gap: 13px; }
  .side-stack { grid-template-columns: 1fr; }
  .dose { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 7px; padding: 10px 8px; }
  .dose-info { gap: 8px; }
  .dose-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .dose-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .dose-time { font-size: 14px; }
  .dose-info p { font-size: 12px; }
  .dose-title { font-size: 14px; }
  .taken, .not-taken { padding: 9px 8px; font-size: 11px; }
  .card { padding: 16px; }
  .history-controls { align-items: stretch; }
  .history-controls .field { flex-basis: 100%; }
  .history-controls .btn { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .modal { padding: 21px; }
  .modal-footer .btn { padding: 12px; }
  .med-list-row { gap: 8px; flex-wrap: wrap; }
  .med-list-row .grow { flex: 1 1 calc(100% - 75px); }
  .med-list-row label, .med-list-row > button { margin-left: 65px; }
}
.contribution-overlay[hidden] { display: none; }
.contribution-overlay { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 18px; background: rgba(15, 33, 27, .58); }
.contribution-dialog { position: relative; width: min(100%, 510px); padding: 30px; border: 1px solid var(--line, #dce5dc); border-radius: 24px; background: #fff; box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.contribution-close { position: absolute; top: 13px; right: 13px; }
.contribution-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 15px; border-radius: 16px; background: #e3f3e9; font-size: 25px; }
.contribution-dialog h2 { margin: 0 35px 12px 0; color: var(--ink, #17231f); }
.contribution-dialog p { color: var(--muted, #63736b); line-height: 1.65; }
.contribution-pix { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0; padding: 14px 16px; border: 1px solid var(--line, #dce5dc); border-radius: 14px; background: #f7faf6; }
.contribution-pix span { color: var(--muted, #63736b); }
.contribution-pix strong { color: var(--green, #167b60); font-size: 19px; }
.contribution-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.contribution-actions .btn { min-height: 48px; white-space: normal; }
@media (max-width: 520px) { .contribution-dialog { padding: 25px 20px 20px; border-radius: 19px; } .contribution-actions .btn { width: 100%; } }
