:root {
  --green: #1f3b33;
  --green-2: #2b5246;
  --green-soft: #e7efeb;
  --bg: #f4f5f3;
  --card: #ffffff;
  --line: #e7e9e6;
  --text: #17201c;
  --text-2: #66706b;
  --text-3: #9aa29e;
  --blue: #2f7fe0;
  --mint: #2e9a6b;
  --purple: #7a5ab8;
  --orange: #e2733f;
  --red: #e5483d;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .04), 0 2px 10px rgba(20, 30, 25, .05);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .85, .25, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
svg { display: block; flex-shrink: 0; }

/* ---------- Phone vs desktop presentation ---------- */
.stage { height: 100%; }
.intro { display: none; }
.device { position: fixed; inset: 0; background: var(--bg); }
.device-status { display: none; }
.app { position: relative; height: 100%; overflow: hidden; }

@media (min-width: 860px) and (hover: hover) {
  body { background: radial-gradient(1200px 700px at 70% 10%, #e9f0ec, #dfe6e2 60%, #d6dfda); }
  .stage { display: flex; align-items: center; justify-content: center; gap: 72px; min-height: 100%; padding: 32px; }
  .intro { display: block; max-width: 340px; }
  .intro-logo { width: 240px; }
  .intro-tag { font-size: 20px; font-weight: 600; margin: 14px 0 10px; }
  .intro-text { color: var(--text-2); line-height: 1.5; margin: 0 0 22px; }
  .intro-qr:empty { display: none; }
  .intro-qr { width: 260px; padding: 4px; background: #fff; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
  .intro-qr img, .intro-qr svg { width: 100%; height: auto; display: block; }
  .device {
    position: relative; inset: auto; flex-shrink: 0;
    width: 393px; height: 852px; border-radius: 58px;
    border: 12px solid #111; box-shadow: 0 0 0 2px #3a3a3a, 0 30px 80px rgba(0, 0, 0, .28);
    overflow: hidden; --sat: 54px; --sab: 22px;
  }
  .device-status {
    display: flex; align-items: center; justify-content: space-between;
    position: absolute; top: 0; left: 0; right: 0; height: 54px; padding: 4px 30px 0 44px;
    z-index: 50; pointer-events: none; font-weight: 600; font-size: 16px;
  }
  .device-island { position: absolute; left: 50%; top: 11px; width: 124px; height: 36px; margin-left: -62px; background: #000; border-radius: 20px; }
  .device-icons { width: 70px; height: 13px; background: no-repeat right center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 70 13'%3E%3Cg fill='%2317201c'%3E%3Crect x='0' y='8' width='3' height='5' rx='1'/%3E%3Crect x='5' y='5.5' width='3' height='7.5' rx='1'/%3E%3Crect x='10' y='3' width='3' height='10' rx='1'/%3E%3Crect x='15' y='0' width='3' height='13' rx='1'/%3E%3Cpath d='M30 3.2a10 10 0 0 1 13 0l-1.5 1.6a7.8 7.8 0 0 0-10 0zM32.6 6a6.2 6.2 0 0 1 7.8 0l-1.6 1.7a3.8 3.8 0 0 0-4.6 0zM35 8.7a2.4 2.4 0 0 1 3 0L36.5 10.4z'/%3E%3Crect x='47' y='1' width='20' height='11' rx='3' fill='none' stroke='%2317201c' stroke-opacity='.4'/%3E%3Crect x='49' y='3' width='16' height='7' rx='1.6'/%3E%3Crect x='68' y='4.5' width='1.6' height='4' rx='.8' opacity='.4'/%3E%3C/g%3E%3C/svg%3E"); }
  .device-status.on-dark { color: #fff; }
  .device-status.on-dark .device-icons { filter: invert(1); }
}

/* ---------- Screens & navigation ---------- */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--bg); will-change: transform;
  transition: transform .42s var(--ease), filter .42s var(--ease);
}
.screen.is-right { transform: translateX(100%); }
.screen.is-left { transform: translateX(-28%); filter: brightness(.94); }
.screen.no-anim { transition: none; }
.screen.push-shadow { box-shadow: -8px 0 24px rgba(0, 0, 0, .08); }

.header {
  flex-shrink: 0; display: grid; grid-template-columns: 52px 1fr 52px; align-items: center;
  padding: var(--sat) 6px 0; min-height: calc(var(--sat) + 52px);
  background: rgba(244, 245, 243, .86); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: relative; z-index: 5;
}
.header.white { background: rgba(255, 255, 255, .9); }
.header h1 { margin: 0; text-align: center; font-size: 19px; font-weight: 650; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 22px; color: var(--text); position: relative; justify-self: center; }
.icon-btn:active { background: rgba(0, 0, 0, .06); }
.badge-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 5px; background: var(--red); border: 2px solid var(--bg); }

.content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px 16px 24px; }
.content.flush { padding: 0; }
.footer { flex-shrink: 0; padding: 12px 16px calc(var(--sab) + 12px); background: linear-gradient(to top, var(--bg) 70%, rgba(244, 245, 243, 0)); }

/* ---------- Common pieces ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .025); }
.pressable { transition: transform .15s ease, background-color .15s ease; cursor: pointer; }
.pressable:active { transform: scale(.98); background-color: #f6f7f5; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 10px; }
.section-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.link { color: var(--text-2); font-size: 14px; font-weight: 500; padding: 6px 0 6px 10px; }
.chev { color: var(--text-3); margin-left: auto; }
.muted { color: var(--text-2); }

.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 54px; border-radius: 14px; font-size: 17px; font-weight: 600; transition: transform .15s ease, opacity .15s ease; }
.btn:active { transform: scale(.98); opacity: .9; }
.btn-primary { background: var(--green); color: #fff; }
.btn-outline { background: #fff; color: var(--text); border: 1.5px solid #cfd5d1; }
.btn + .btn { margin-top: 12px; }

.list-row { display: flex; align-items: center; gap: 14px; padding: 15px 16px; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row .t { font-weight: 600; font-size: 16px; }
.list-row .s { color: var(--text-2); font-size: 14px; margin-top: 2px; line-height: 1.35; }

/* ---------- Login ---------- */
.login { background: #fff; overflow-y: auto; }
.login-top { padding: calc(var(--sat) + 28px) 28px 0; text-align: center; position: relative; z-index: 2; }
.logo-mark { width: 104px; margin: 0 auto; color: var(--green); }
.wordmark { font-family: Poppins, var(--font); font-weight: 700; font-size: 50px; letter-spacing: -1.5px; line-height: 1; margin: 10px 0 10px; color: var(--green); }
.tagline { margin: 0 0 30px; font-size: 16px; color: #3c4642; font-weight: 500; }
.field { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); color: var(--text-2); transition: border-color .15s; }
.field:focus-within { border-color: var(--green); }
.field + .field { margin-top: 14px; }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; height: 100%; color: var(--text); }
.field input::placeholder { color: var(--text-3); }
.field .icon-btn { width: 36px; height: 36px; margin-right: -8px; color: var(--text-2); }
.login form .btn-primary { margin-top: 20px; }
.text-link { display: inline-block; margin: 16px 0; font-size: 15px; color: #3c4642; font-weight: 500; }
.signup { font-size: 15px; color: #3c4642; margin: 16px 0 0; }
.signup button { font-weight: 700; color: var(--green); }
.login-bottom { position: relative; margin-top: -10px; height: 260px; flex-shrink: 0; }
.login-bottom::before { content: ""; position: absolute; inset: 40px 0 0; background: var(--green); border-radius: 50% 50% 0 0 / 70px 70px 0 0; }
.login-bottom img { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 220px; object-fit: cover; object-position: center bottom; -webkit-mask-image: linear-gradient(to top, #000 75%, transparent); mask-image: linear-gradient(to top, #000 75%, transparent); }
.login .spacer { flex: 1; min-height: 18px; }

/* ---------- Home ---------- */
.hero { position: relative; height: 212px; border-radius: 20px; overflow: hidden; background: #8a9a7b center / cover; box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 20, 15, .72), rgba(10, 20, 15, .1) 55%, transparent); }
.hero-text { position: absolute; left: 18px; bottom: 16px; color: #fff; z-index: 1; }
.hero-text .name { font-size: 30px; font-weight: 700; letter-spacing: -.4px; }
.hero-text .meta { font-size: 15px; opacity: .92; margin-top: 2px; }
.hero-pill { position: absolute; right: 14px; bottom: 16px; z-index: 1; color: #fff; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 7px 12px; border-radius: 20px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.summary { display: flex; gap: 10px; align-items: flex-start; padding: 15px 14px; }
.summary .t { font-weight: 650; font-size: 15px; }
.summary .s { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.summary .ok { color: var(--mint); }
.next-appt { display: flex; align-items: center; padding: 16px 16px 16px 18px; margin-top: 12px; }
.next-appt .label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.next-appt .date { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin: 6px 0 8px; }
.next-appt .what { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.reminder { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.reminder + .reminder { border-top: 1px solid var(--line); }
.reminder .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #eaf2fc; color: var(--blue); }
.reminder .t { font-weight: 600; font-size: 15px; }
.reminder .s { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.reminder .s.due { color: var(--orange); font-weight: 600; }
.check { margin-left: auto; width: 28px; height: 28px; border-radius: 14px; border: 2px solid #c8cfcb; display: grid; place-items: center; color: transparent; transition: all .2s; flex-shrink: 0; }
.check.on { background: var(--mint); border-color: var(--mint); color: #fff; }
.reminder.done .t { text-decoration: line-through; color: var(--text-3); }

/* Tab bar */
.tabbar { flex-shrink: 0; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 8px 6px calc(var(--sab) + 6px); background: rgba(255, 255, 255, .94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: #8b938f; padding: 2px 0; }
.tab.on { color: var(--green); }
.tab-plus { width: 56px; height: 56px; border-radius: 28px; background: var(--green); color: #fff; display: grid; place-items: center; margin: -22px auto 0; box-shadow: 0 6px 16px rgba(31, 59, 51, .35); justify-self: center; transition: transform .15s; }
.tab-plus:active { transform: scale(.94); }
.tab .dot { position: relative; }
.tab .dot[data-n]::after { content: attr(data-n); position: absolute; top: -5px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 17px; text-align: center; }

/* ---------- Health record ---------- */
.segments { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); background: rgba(244, 245, 243, .86); flex-shrink: 0; }
.segment { flex: 1; padding: 12px 0 13px; font-size: 15px; font-weight: 600; color: var(--text-2); position: relative; }
.segment.on { color: var(--text); }
.segment.on::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: -1px; height: 3px; border-radius: 3px; background: var(--green); }
.record { display: flex; align-items: center; gap: 14px; padding: 14px; margin-top: 12px; }
.record .thumb { width: 66px; height: 66px; border-radius: 12px; background: center / cover; flex-shrink: 0; }
.record .ico { width: 50px; height: 66px; display: grid; place-items: center; color: var(--text); flex-shrink: 0; }
.record .t { font-weight: 650; font-size: 16px; }
.record .s { font-size: 14px; color: var(--text-2); margin-top: 4px; line-height: 1.4; }
.record.new { animation: pop-in .5s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
.empty { text-align: center; color: var(--text-2); padding: 60px 20px; }

.detail-hero { height: 230px; background: center / cover; border-radius: 18px; margin-top: 6px; }
.detail-head { display: flex; align-items: center; gap: 14px; padding: 18px; }
.detail-head .big-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.detail-head h2 { margin: 0; font-size: 21px; letter-spacing: -.3px; }
.kv { display: flex; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); }
.kv .k { width: 96px; color: var(--text-2); font-size: 15px; flex-shrink: 0; }
.kv .v { font-size: 15px; font-weight: 500; line-height: 1.4; }
.notes-text { padding: 16px 18px; font-size: 16px; line-height: 1.5; }
.xray-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.xray { aspect-ratio: 1; border-radius: 14px; background: radial-gradient(circle at 50% 45%, #6b7479, #1b1f22 70%); display: grid; place-items: center; color: rgba(255, 255, 255, .7); overflow: hidden; position: relative; }
.xray span { position: absolute; left: 10px; bottom: 8px; font-size: 12px; font-weight: 600; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; display: block; }

/* ---------- Add entry ---------- */
.entry-type { display: flex; align-items: center; gap: 16px; padding: 18px 16px; margin-top: 12px; }
.entry-type .circle { width: 46px; height: 46px; border-radius: 23px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.entry-type .t { font-weight: 650; font-size: 17px; }
.entry-type .s { font-size: 14px; color: var(--text-2); margin-top: 3px; }

/* ---------- Appointments ---------- */
.appt-card { background: var(--green); color: #fff; border-radius: 20px; padding: 20px; margin-top: 6px; box-shadow: 0 10px 24px rgba(31, 59, 51, .25); }
.appt-card .ring { width: 66px; height: 66px; border-radius: 33px; border: 2px solid rgba(255, 255, 255, .7); display: grid; place-items: center; margin-bottom: 16px; }
.appt-card .up { font-size: 14px; opacity: .75; font-weight: 500; }
.appt-card .title { font-size: 25px; font-weight: 700; letter-spacing: -.3px; margin: 4px 0 8px; }
.appt-card .when { font-size: 16px; opacity: .92; }
.appt-card .where { font-size: 16px; opacity: .8; margin-top: 4px; }
.info-row { display: flex; gap: 16px; padding: 15px 16px; align-items: flex-start; }
.info-row + .info-row { border-top: 1px solid var(--line); }
.info-row .k { font-weight: 650; font-size: 15px; }
.info-row .v { font-size: 15px; color: var(--text-2); margin-top: 2px; line-height: 1.35; }
.info-row svg { margin-top: 2px; color: var(--text); }
.mini-appt { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.mini-appt + .mini-appt { border-top: 1px solid var(--line); }
.cal-chip { width: 48px; text-align: center; border-radius: 12px; background: var(--green-soft); color: var(--green); padding: 6px 0; flex-shrink: 0; }
.cal-chip .m { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.cal-chip .d { font-size: 20px; font-weight: 700; line-height: 1.1; }

/* ---------- Messages ---------- */
.convo { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.convo + .convo { border-top: 1px solid var(--line); }
.avatar { width: 50px; height: 50px; border-radius: 25px; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--green-2); flex-shrink: 0; font-size: 18px; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.convo .top { display: flex; justify-content: space-between; gap: 8px; }
.convo .t { font-weight: 650; font-size: 16px; }
.convo .time { font-size: 13px; color: var(--text-3); }
.convo .s { font-size: 14px; color: var(--text-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.convo .unread { width: 10px; height: 10px; border-radius: 5px; background: var(--blue); flex-shrink: 0; }
.chat { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 16px; }
.chat .day { text-align: center; font-size: 12px; color: var(--text-3); font-weight: 600; margin: 8px 0; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 20px; font-size: 16px; line-height: 1.35; animation: bubble-in .3s var(--ease); }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.bubble.them { background: #fff; align-self: flex-start; border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.bubble.me { background: var(--green); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 4px; background: #b5bcb8; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.composer { flex-shrink: 0; display: flex; align-items: flex-end; gap: 10px; padding: 8px 12px calc(var(--sab) + 8px); background: rgba(255, 255, 255, .94); border-top: 1px solid var(--line); }
.composer input { flex: 1; height: 40px; border-radius: 20px; border: 1px solid var(--line); padding: 0 16px; background: var(--bg); outline: 0; font-size: 16px; }
.composer .send { width: 40px; height: 40px; border-radius: 20px; background: var(--green); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.composer .send:disabled { opacity: .35; }
.chat-title { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.chat-title small { font-size: 12px; color: var(--mint); font-weight: 600; }

/* ---------- Profile ---------- */
.profile-top { text-align: center; padding: 10px 0 6px; }
.profile-top .avatar { width: 84px; height: 84px; border-radius: 42px; font-size: 32px; margin: 0 auto 12px; }
.profile-top .name { font-size: 22px; font-weight: 700; }
.pet-row .pet-img { width: 52px; height: 52px; border-radius: 14px; background: center / cover; flex-shrink: 0; }
.toggle { margin-left: auto; width: 51px; height: 31px; border-radius: 16px; background: #dfe3e0; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 14px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.toggle.on { background: var(--mint); }
.toggle.on::after { transform: translateX(20px); }
.row-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); flex-shrink: 0; }
.danger { color: var(--red); font-weight: 600; }

/* ---------- Vet ---------- */
.vet-hello { padding: 4px 2px 2px; }
.vet-hello .hi { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { padding: 14px; text-align: left; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.patient .time { width: 52px; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); margin-top: 5px; }
.tag.warn { background: #fdeee6; color: #b4511f; }
.vet-banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin: 0 16px 4px; background: var(--green-soft); color: var(--green); border-radius: 12px; font-size: 14px; font-weight: 600; }

/* ---------- Drawer ---------- */
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); z-index: 60; opacity: 0; transition: opacity .3s; }
.drawer { position: absolute; top: 0; bottom: 0; left: 0; width: 80%; max-width: 320px; background: #fff; z-index: 61; transform: translateX(-100%); transition: transform .35s var(--ease); padding: calc(var(--sat) + 20px) 16px 20px; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-backdrop.open { opacity: 1; }
.drawer .logo-row { display: flex; align-items: center; gap: 10px; margin: 0 6px 24px; }
.drawer .logo-row .logo-mark { width: 40px; margin: 0; }
.drawer .logo-row span { font-family: Poppins, var(--font); font-weight: 700; font-size: 26px; color: var(--green); letter-spacing: -.6px; }
.drawer-item { display: flex; align-items: center; gap: 14px; padding: 14px 10px; border-radius: 12px; font-size: 17px; font-weight: 550; width: 100%; text-align: left; }
.drawer-item:active { background: var(--bg); }

/* ---------- Sheets, alerts, toasts ---------- */
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .3); z-index: 70; opacity: 0; transition: opacity .35s; }
.sheet-backdrop.open { opacity: 1; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; top: calc(var(--sat) + 10px); z-index: 71; background: var(--bg); border-radius: 14px 14px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .45s var(--ease); box-shadow: 0 -6px 30px rgba(0, 0, 0, .12); }
.sheet.open { transform: none; }
.sheet.dragging { transition: none; }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: #c9cecb; margin: 7px auto 0; }
.sheet-head { display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; padding: 4px 8px 8px; touch-action: none; }
.sheet-head h2 { margin: 0; text-align: center; font-size: 17px; font-weight: 650; }
.sheet-head button { height: 40px; font-size: 17px; color: var(--green); padding: 0 8px; }
.sheet-head .save { font-weight: 700; text-align: right; }
.sheet-head .save:disabled { color: var(--text-3); }
.sheet-head .cancel { text-align: left; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 16px calc(var(--sab) + 30px); -webkit-overflow-scrolling: touch; }
.form-group { background: #fff; border-radius: 14px; margin-top: 18px; overflow: hidden; box-shadow: var(--shadow); }
.form-label { font-size: 13px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; margin: 22px 4px -10px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; border: 0; outline: 0; background: none; padding: 15px 16px; font-size: 16px; display: block; }
.form-group textarea { resize: none; min-height: 120px; line-height: 1.4; }
.form-group > * + * { border-top: 1px solid var(--line); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-3); }
.inline-field { display: flex; align-items: center; padding-right: 16px; }
.inline-field input { flex: 1; }
.inline-field .unit { color: var(--text-2); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip { padding: 10px 15px; border-radius: 20px; background: #fff; font-size: 15px; font-weight: 550; box-shadow: var(--shadow); border: 1.5px solid transparent; transition: all .15s; }
.chip.on { background: var(--green); color: #fff; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 2px 16px 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.date-chip { display: flex; flex-direction: column; align-items: center; min-width: 62px; padding: 10px 0; border-radius: 16px; }
.date-chip .dw { font-size: 12px; opacity: .7; font-weight: 600; }
.date-chip .dd { font-size: 20px; font-weight: 700; }
.photo-pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 190px; margin-top: 18px; border-radius: 16px; border: 2px dashed #c9d1cc; color: var(--text-2); font-weight: 600; background: #fff; width: 100%; overflow: hidden; position: relative; }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick input { display: none; }
.switch-row { display: flex; align-items: center; padding: 12px 16px; font-size: 16px; }

.alert-backdrop { position: absolute; inset: 0; z-index: 90; background: rgba(0, 0, 0, .3); display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
.alert-backdrop.open { opacity: 1; }
.alert { width: 272px; background: rgba(248, 248, 248, .96); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-radius: 16px; text-align: center; overflow: hidden; transform: scale(1.1); transition: transform .25s var(--ease); }
.alert-backdrop.open .alert { transform: none; }
.alert .body { padding: 20px 16px 16px; }
.alert h3 { margin: 0 0 4px; font-size: 17px; font-weight: 650; }
.alert p { margin: 0; font-size: 13px; line-height: 1.35; }
.alert .actions { display: flex; border-top: 1px solid rgba(0, 0, 0, .12); }
.alert .actions button { flex: 1; height: 46px; font-size: 17px; color: #0a7aff; }
.alert .actions button + button { border-left: 1px solid rgba(0, 0, 0, .12); }
.alert .actions .bold { font-weight: 650; }
.alert .actions .destructive { color: #ff3b30; }

.toast { position: absolute; left: 50%; top: calc(var(--sat) + 8px); z-index: 95; transform: translate(-50%, -140%); background: rgba(30, 40, 36, .94); color: #fff; padding: 12px 18px; border-radius: 22px; font-size: 15px; font-weight: 550; display: flex; align-items: center; gap: 10px; transition: transform .45s var(--ease); max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.show { transform: translate(-50%, 0); }
.toast svg { color: #7fe0b0; }

/* Home-screen install hint */
.hint { margin: 0 16px; padding: 12px 14px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); font-size: 14px; color: var(--text-2); display: flex; gap: 10px; align-items: center; }

/* Small fixes */
.toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content, .sheet-body { scrollbar-width: none; }
.content::-webkit-scrollbar, .sheet-body::-webkit-scrollbar { display: none; }
.chips[data-group="bcs"] { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.chips[data-group="bcs"] .chip { padding: 10px 0; text-align: center; }

/* Log-in photo fills the curved area at the bottom */
.login-bottom { height: 250px; margin-top: 0; }
.login-bottom::before { display: none; }
.login-bottom img { top: 0; height: 100%; object-position: center 30%; border-radius: 50% 50% 0 0 / 64px 64px 0 0; -webkit-mask-image: none; mask-image: none; }
.login-bottom::after { content: ""; position: absolute; inset: 0; border-radius: 50% 50% 0 0 / 64px 64px 0 0; background: linear-gradient(to bottom, rgba(31, 59, 51, .35), transparent 40%); pointer-events: none; }
