/* =========================================================
   핑크젤리 — app pages (today / records / health / cat)
   Desktop-first; responsive pass comes later.
   Builds on tokens + components in styles.css.
   ========================================================= */
:root { --attn: #C24E37; }
.v-attn { color: var(--attn); }

/* `hidden` must win over component display rules (.btn-line, .btn-text …) */
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.d-app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { margin-bottom: 22px; }
.d-main { flex: 1; min-width: 0; }
.page { flex: 1; min-width: 0; padding: 20px 36px 48px; max-width: 1320px; }
/* top bar: 뒤로 on the left, 핑크젤리 홈 · 로그아웃 on the right — big and always in view */
.app-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1320px; padding: 14px 36px; background: color-mix(in srgb, var(--sky) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.app-bar-right { display: flex; align-items: center; gap: 10px; }
.bar-btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 999px;
  font-family: var(--font-brand); font-size: 17px; color: var(--text); background: rgba(255,255,255,.9); box-shadow: var(--shadow-soft); transition: transform .12s; }
.bar-btn:hover { background: #fff; }
.bar-btn:active { transform: scale(.95); }
.bar-btn svg.lucide { width: 20px; height: 20px; }
.bar-btn.home { background: var(--jelly); box-shadow: var(--jelly-shadow); color: var(--tuxedo); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title { font-size: 30px; letter-spacing: -.6px; position: relative; display: inline-block; z-index: 0; }
/* a soft highlighter swipe under page titles, like a marked diary heading */
.page-title::after { content: ''; position: absolute; z-index: -1; left: -4px; right: -6px; bottom: 3px; height: 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--blush) 75%, transparent); transform: rotate(-1deg); }
.page-sub { font-size: 14px; color: var(--text-3); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- sidebar extras ---------- */
.cat-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px; border-radius: 999px; background: rgba(255,255,255,.7); color: var(--text); box-shadow: var(--shadow-soft); }
.cat-chip:hover { background: #fff; }
.cat-chip .avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
.cat-chip .avatar::before { font-size: 16px; }
.cat-chip-name { font-family: var(--font-brand); font-size: 17px; color: var(--text); }
.cat-switch select { width: 100%; height: 36px; margin-bottom: 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.75); padding: 0 12px; font: inherit; font-size: 13px; color: var(--text); }
.cat-switch option { color: var(--text); }
.sidebar .nav { margin-top: 12px; }
.sidebar-foot { padding-bottom: 8px; }
.account-box { border-top: 1px dashed var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.account-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 999px; font-family: var(--font-brand); font-size: 15px; color: var(--text-2); min-width: 0; }
.account-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-link:hover, .account-link.active { background: rgba(255,255,255,.7); color: var(--text); }
.account-box .btn-text { justify-content: flex-start; padding: 6px 10px; color: var(--text-2); }
.account-box .btn-text:hover { background: rgba(255,255,255,.7); color: var(--text); }
.nav-admin { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons ---------- */
.btn-primary:disabled { opacity: .55; cursor: default; transform: none; }
.btn-line { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 38px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--primary-soft); font-size: 13px; font-weight: 700; color: var(--text); transition: transform .12s, background .12s; }
.btn-line:active, .chip:active, .btn-text:active { transform: scale(.94); }
.btn-line:hover { border-color: var(--primary-2); background: var(--primary-soft); }
.btn-line svg.lucide, .btn-text svg.lucide { width: 15px; height: 15px; }
.btn-text { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); padding: 5px 9px; border-radius: 999px; }
.btn-text:hover { color: var(--text); background: var(--surface-2); }
.btn-text.danger:hover { color: var(--attn); background: #FBE9E5; }
.btn-row { display: flex; gap: 8px; align-items: center; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field > span small { font-weight: 400; color: var(--text-3); margin-left: 4px; }
.input, .textarea, .select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
  font: inherit; font-size: 14px; color: var(--text); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input, .select { height: 42px; }
/* a fixed-height select must not also carry vertical padding — the 16px mobile text gets clipped */
.select { padding-top: 0; padding-bottom: 0; line-height: normal; text-overflow: ellipsis; }
.textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px var(--primary-soft); }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--text-3) 75%, #fff); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* choice chips (radio, deselectable) */
.check-row { display: grid; grid-template-columns: 108px 1fr; align-items: center; gap: 12px; padding: 10px 0; }
.check-row + .check-row { border-top: 1.5px dashed var(--line); }
.check-name { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.check-name .status-icon { width: 36px; height: 36px; font-size: 17px; }
/* a number field with its unit written inside on the right ("5 kg") */
.unit-input { position: relative; display: block; }
.unit-input .input { width: 100%; padding-right: 42px; text-align: right; font-weight: 600; }
.unit-input input::-webkit-outer-spin-button, .unit-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit-input input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.unit-input > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; font-weight: 700; color: var(--text-2); pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 38px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--primary-soft); font-size: 14px; font-weight: 600; color: var(--text-2); transition: background .12s, transform .12s; }
.chip:hover { border-color: var(--primary-2); }
.chip[aria-pressed="true"] { background: var(--jelly); color: var(--tuxedo); font-weight: 700; box-shadow: inset 0 -3px 0 rgba(90, 20, 50, .08), inset 0 2px 0 rgba(255,255,255,.5); animation: jelly-pop .32s cubic-bezier(.2,.9,.3,1.5); }
/* jelly press feedback: a squish, never an up/down move (the owner gets motion-sick from that) */
@keyframes jelly-pop { 0% { transform: scale(.88); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* ---------- states ---------- */
.state-box { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.state-box h2 { font-size: 18px; }
.state-box p { color: var(--text-2); font-size: 14px; line-height: 1.6; }
.state-box .btn-primary { margin-top: 8px; }
.state-emoji { font-size: 40px; }
.empty { color: var(--text-3); font-size: 13px; line-height: 1.6; padding: 14px 0; text-align: center; }
.note { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.note-box { font-size: 12px; color: var(--text-2); line-height: 1.6; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: #fff; font-size: 14px; padding: 12px 22px; border-radius: 999px; transition: all .2s; z-index: 100; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--attn); }

/* ---------- photos ---------- */
.photo-pick { position: relative; display: grid; place-items: center; gap: 6px; border: 2px dashed var(--primary-2); border-radius: 22px; background: var(--primary-soft); color: var(--primary-ink); font-size: 13px; cursor: pointer; min-height: 120px; text-align: center; }
.photo-pick:hover { background: var(--primary-soft); }
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 14px; }
.thumb .del { position: absolute; top: 6px; right: 6px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.9); display: grid; place-items: center; color: var(--text-2); }
.thumb .del svg.lucide { width: 14px; height: 14px; }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.album figure { display: flex; flex-direction: column; gap: 6px; }
.album .photo { display: block; aspect-ratio: 1; border-radius: 4px; box-shadow: 0 0 0 8px #fff, 0 10px 22px 8px rgba(140, 80, 70, .12); margin: 8px 8px 22px; }
/* album = a polaroid wall: frames tilt a little, alternating */
.album figure:nth-child(3n+1) .photo { transform: rotate(-1.6deg); }
.album figure:nth-child(3n+2) .photo { transform: rotate(1.2deg); }
.album figcaption { text-align: center; font-family: var(--font-hand); font-size: 15px; margin-top: -16px; }
.album figcaption { font-size: 12px; color: var(--text-3); }

/* ---------- tabs & calendar (shared with design) ---------- */
/* tabs: a rounded pill bar, the chosen one sits on a white sticker */
.tabs { display: inline-flex; gap: 4px; padding: 5px; margin-bottom: 18px; border-radius: 999px; background: color-mix(in srgb, var(--blush) 45%, #fff); max-width: 100%; }
.tab-btn { padding: 10px 22px; font-size: 16px; font-weight: 600; color: var(--text-2); border-radius: 999px; position: relative; }
.tab-btn:hover { color: var(--text); background: rgba(255,255,255,.55); }
.tab-btn.active { color: var(--tuxedo); font-weight: 400; font-family: var(--font-brand); background: var(--jelly); box-shadow: var(--jelly-shadow); }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head h2 { font-size: 17px; font-weight: 700; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px 2px; text-align: center; font-size: 12px; }
.cal .dow { color: var(--text-3); font-weight: 600; padding-bottom: 2px; }
.cal .dow.sun { color: var(--primary-ink); } .cal .dow.sat { color: var(--chart-blue); }
.cal .day { height: 36px; width: 36px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); position: relative; font-size: 12px; }
.cal button.day:hover { background: var(--surface-2); }
.cal .day.has { color: var(--text); font-weight: 600; }
.cal .day.has::after { content: ''; position: absolute; right: -2px; top: -3px; width: 13px; height: 13px; background: var(--cheese); transform: rotate(14deg);
  -webkit-mask: var(--paw) center / contain no-repeat; mask: var(--paw) center / contain no-repeat; }
.cal .day.today { outline: 1.5px dashed var(--cheese-deep); outline-offset: -2px; color: var(--text); font-weight: 700; }
.cal .day.sel { background: var(--cheese); color: var(--tuxedo); font-weight: 800; box-shadow: 0 4px 10px color-mix(in srgb, var(--cheese) 40%, transparent); }
.cal .day.future { color: color-mix(in srgb, var(--text-3) 55%, #fff); cursor: default; }
.cal-legend { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--text-3); margin-top: 12px; }
/* hospital appointment: a small tuxedo dot under the date */
.cal .day.appt { color: var(--text); }
.cal .day.appt::before { content: ''; position: absolute; bottom: 3px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--chart-blue); }
.cal .day.sel.appt::before { background: var(--tuxedo); }
.cal button.day.future.appt { cursor: pointer; }
.cal-legend { flex-wrap: wrap; gap: 12px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend .appt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--chart-blue); display: inline-block; }
.appt-line { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.appt-line .row-icon { width: 32px; height: 32px; }
.appt-line .row-icon svg.lucide { width: 15px; height: 15px; }
.appt-line b { font-size: 14px; }
.appt-line p { font-size: 13px; color: var(--text-2); }
.dday { display: inline-block; flex-shrink: 0; min-width: 62px; text-align: center; padding: 6px 10px; border-radius: 999px; background: var(--blush); color: var(--tuxedo);
  font-weight: 700; font-size: 15px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.dday.sm { min-width: 0; padding: 1px 8px; font-size: 12px; border-radius: 999px; }
.cal-legend i { width: 12px; height: 12px; background: var(--cheese); display: inline-block; -webkit-mask: var(--paw) center / contain no-repeat; mask: var(--paw) center / contain no-repeat; }

/* ---------- record summary bits ---------- */
.mini-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); }
.mini-check b { font-weight: 700; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--primary-soft); color: var(--primary-ink); }
.pill.gray { background: var(--surface-2); color: var(--text-2); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--text-3); font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.dots-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 10px; padding: 7px 0; font-size: 12px; color: var(--text-2); }
.dots { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; }
.dots span { aspect-ratio: 1; border-radius: 50%; background: #F3E8E4; }
.dots span.l0 { background: #F6C08A; } .dots span.l1 { background: #A9D6AF; } .dots span.l2 { background: #F0A5A0; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-3); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- modal ---------- */
dialog.modal { margin: auto; border: 0; border-radius: var(--radius-xl); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(120, 60, 50, .26); color: var(--text); }
dialog.modal::backdrop { background: rgba(75, 50, 50, .38); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- voice input ---------- */
.mic-wrap { position: relative; }
.mic-wrap > .input { padding-right: 48px; }
.mic-wrap > .textarea { padding-right: 48px; }
.mic-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: var(--primary-ink); background: var(--primary-soft); transition: background .15s; }
.mic-wrap.is-area .mic-btn { top: 8px; transform: none; }
.mic-btn:hover { background: var(--sun); }
.mic-btn svg.lucide { width: 17px; height: 17px; }
.mic-btn.on { background: var(--cheese); color: var(--tuxedo); animation: mic-pulse 1.2s ease-in-out infinite; }
.mic-wrap.listening > .input, .mic-wrap.listening > .textarea { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cheese) 55%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
.pill.premium { background: var(--sun); color: var(--tuxedo); }
.pill.warn { background: var(--sun); color: var(--tuxedo); }

/* ---------- phone shell (hidden on larger screens) ---------- */
.m-top, .m-tab { display: none; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .sidebar { width: 196px; }
  .page { padding: 20px 24px 40px; }
  .app-bar { padding: 12px 24px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .d-app { display: block; }
  .sidebar, .app-bar { display: none; }
  .page { padding: 14px 16px calc(104px + env(safe-area-inset-bottom)); }
  .page-head { flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
  .card { padding: 18px; border-radius: 22px; }
  .page-title { font-size: 25px; }
  .tabs { display: flex; width: 100%; }
  .stack, .grid-2 { gap: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  /* iOS zooms into inputs smaller than 16px */
  .input, .textarea, .select { font-size: 16px; }
  .check-row { grid-template-columns: 1fr; gap: 8px; padding: 12px 0; }
  .chip { height: 38px; padding: 0 14px; }
  .tabs { margin-bottom: 14px; }
  .tab-btn { flex: 1; text-align: center; padding: 9px 2px; font-size: 14px; white-space: nowrap; }
  .btn-primary.sm { height: 40px; }

  .m-top { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30;
    height: 56px; padding: 0 12px 0 16px; padding-top: env(safe-area-inset-top); box-sizing: content-box;
    background: color-mix(in srgb, var(--sky) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .m-top .brand { font-size: 22px; }
  .m-top .brand-cat { width: 28px; height: 28px; }
  .m-top-right, .m-top-left { display: flex; align-items: center; gap: 2px; }
  .m-top-left .icon-btn { margin-left: -8px; }
  .m-top .m-home { background: var(--jelly); box-shadow: var(--jelly-shadow); color: var(--tuxedo); }
  .m-top-right { position: relative; }
  .m-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 210px; padding: 6px; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; border-radius: 20px; }
  .m-menu[hidden] { display: none; }
  .m-menu-who { padding: 10px 12px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-family: var(--font-brand); font-size: 17px; }
  .m-menu-who small { font-family: var(--font); }
  .m-menu-who small { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); margin-top: 2px; word-break: break-all; }
  .m-menu a, .m-menu button { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border-radius: 14px; font-family: var(--font-brand) !important;
    font-size: 15px; color: var(--text); text-align: left; width: 100%; background: none; }
  .m-menu a:hover, .m-menu button:hover, .m-menu a:focus-visible, .m-menu button:focus-visible { background: var(--surface-2); }
  .m-menu svg.lucide { width: 18px; height: 18px; color: var(--text-2); }
  .m-menu .m-menu-out { color: var(--danger, #C2412D); }
  .m-menu .m-menu-out svg.lucide { color: currentColor; }
  .m-cat { width: 34px; height: 34px; border-radius: 50%; display: block; }
  .m-cat::before { font-size: 16px; }
  .m-top .icon-btn { width: 40px; height: 40px; }
  .m-top .icon-btn svg.lucide { width: 22px; height: 22px; }

  /* a floating rounded bar, like a sticker at the bottom of the page */
  .m-tab { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
    padding: 6px; border-radius: 26px; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line); box-shadow: var(--shadow); }
  .m-tab a { height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-family: var(--font-brand); font-size: 13px; color: var(--text-3); border-radius: 20px; }
  .m-tab a svg.lucide { width: 22px; height: 22px; }
  .m-tab a.active { color: var(--primary-ink); background: var(--primary-soft); }

  #toast { bottom: calc(86px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; border-radius: 18px; }
  dialog.modal { width: calc(100vw - 24px); }
}

/* ---------- media: video thumbs, viewer ---------- */
.photo > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.thumb, [data-album], [data-day-media] { cursor: pointer; }
.play-badge { position: absolute; z-index: 2; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 7px 2px 5px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; }
.play-badge svg.lucide { width: 12px; height: 12px; fill: #fff; }
dialog.viewer { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog.viewer::backdrop { background: rgba(20,24,32,.9); }
dialog.viewer img, dialog.viewer video { position: absolute; inset: 0; margin: auto; max-width: 94vw; max-height: 86vh; border-radius: 12px; background: #000; }
.viewer-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 2; background: rgba(255,255,255,.9) !important; }

/* ---------- photo editor ---------- */
dialog.media-modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; }
.pe-stage { position: relative; display: flex; justify-content: center; background: var(--tuxedo); border-radius: 16px; padding: 12px; }
.pe-stage canvas { display: block; touch-action: none; cursor: grab; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,.4); }
.pe-stage canvas:active { cursor: grabbing; }
.pe-stage.round canvas { border-radius: 50%; }
.pe-hint { text-align: center; }
.pe-zoom { display: flex; align-items: center; gap: 10px; color: var(--text-3); }
.pe-zoom input, .vt-range input, .field input[type=range] { flex: 1; width: 100%; accent-color: var(--primary); }
.pe-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- video trimmer ---------- */
.vt-stage { background: #000; border-radius: 16px; overflow: hidden; display: flex; justify-content: center; }
.vt-stage video { display: block; width: 100%; max-height: 46vh; object-fit: contain; }
.vt-range { position: relative; }
.vt-track { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); margin: 6px 0 2px; overflow: hidden; }
.vt-window { position: absolute; top: 0; bottom: 0; background: var(--primary-2); border-radius: 999px; }
.vt-info { display: flex; justify-content: space-between; font-size: 13px; }
.vt-progress .bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.vt-progress .bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.vt-progress .note { margin-top: 6px; text-align: center; }
@media (max-width: 760px) {
  dialog.media-modal .modal-foot { flex-wrap: wrap; }
  dialog.media-modal .modal-foot .btn-primary { flex: 1; }
}
.photo-pick.is-full { cursor: default; color: var(--text-3); border-color: var(--line); background: var(--surface-2); font-size: 12px; padding: 8px; }
.photo-pick.is-full small { display: block; font-size: 11px; margin-top: 2px; }

/* ---------- tags, memories, throwback ---------- */
.tag-line { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 12px; padding: 2px 9px; border-radius: 6px; background: var(--primary-soft); color: var(--text-2); }
.tag::before { content: '#'; color: var(--text-3); margin-right: 1px; }
.mem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.mem-grid .photo { aspect-ratio: 1; border-radius: 10px; }
.mem-quotes { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text); margin-bottom: 12px; }
.mem-quotes li::before { content: '“'; color: var(--primary); font-weight: 800; margin-right: 4px; }
.throw { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
#throwback { display: flex; flex-direction: column; gap: 12px; }
#throwback:empty { display: none; }
.throw b { font-size: 14px; }
.throw .note { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.throw-emoji { font-size: 26px; width: 44px; text-align: center; flex-shrink: 0; }
.throw-thumb { width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0; }
.appt-note .dday { min-width: 56px; font-size: 14px; }
.appt-note .dday.now { background: var(--cheese); color: var(--tuxedo); }
.date-change { position: absolute; z-index: 2; top: 14px; left: 14px; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px;
  border-radius: 10px; background: rgba(255,255,255,.94); font-size: 12px; font-weight: 600; color: var(--text); cursor: pointer; overflow: hidden; }
.date-change svg.lucide { width: 15px; height: 15px; }
.date-back { position: absolute; z-index: 2; top: 14px; left: 124px; display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px;
  border-radius: 10px; background: var(--jelly); box-shadow: var(--jelly-shadow); font-size: 12px; font-weight: 700; color: var(--tuxedo); }
.date-back svg.lucide { width: 15px; height: 15px; }
.date-change input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.date-change input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.recent-body .tag-line { margin-top: 2px; }
/* selected day always reads white on tuxedo, even when it is a future appointment day */
.cal .day.sel, .cal .day.sel.future, .cal .day.sel.appt { color: #fff; }

/* link hand-off (vet summary, care sheet) */
.share-link { display: flex; gap: 8px; }
.share-link .input { flex: 1; font-size: 13px; }
.gone { text-align: center; padding: 60px 20px; }
.gone h1 { font-size: 20px; margin: 12px 0 6px; }
.gone p { color: var(--text-2); font-size: 14px; }
.care-line { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.55; color: var(--text-2);
  background: var(--primary-soft); border-radius: 10px; padding: 8px 10px; }
.care-line b { color: var(--text); margin-right: 4px; }
.care-line svg.lucide { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--primary-ink); }

/* stickers in the app: one per page title (chosen by body[data-page]), one sleeping cat in the sidebar */
.page-head > div:first-child { position: relative; padding-right: 78px; }
.page-head > div:first-child::after { content: ''; position: absolute; right: 0; top: -10px; width: 64px; height: 64px; pointer-events: none;
  background: none center / contain no-repeat; filter: var(--stk-edge); transform: rotate(9deg); }
body[data-page="records"] .page-head > div:first-child::after { background-image: var(--stk-box); }
body[data-page="health"]  .page-head > div:first-child::after { background-image: var(--stk-loaf); }
body[data-page="cat"]     .page-head > div:first-child::after { background-image: var(--stk-sit); }
body[data-page="account"] .page-head > div:first-child::after { background-image: var(--stk-sleep); }
.sidebar-foot::before { content: ''; display: block; width: 84px; height: 106px; margin: 0 0 6px 4px;
  background: var(--stk-sit) center / contain no-repeat; filter: var(--stk-edge); }
.state-box .stk { width: 96px; margin-bottom: 4px; }
@media (max-width: 760px) {
  .page-head > div:first-child { padding-right: 60px; }
  .page-head > div:first-child::after { width: 50px; height: 50px; top: -4px; }
  .peek-card { margin-top: 22px; }
  .stk-card { margin-top: 24px; }
  .card-stk { width: 66px; top: -32px; right: 16px; }
  .card-stk.stk-play { width: 50px; top: -42px; }
  .peek-card::before { width: 66px; height: 41px; top: -30px; right: 18px; }
}

/* family: whose cat (sidebar), who wrote it (records), read-only family */
.cat-chip-name small { display: block; font-family: var(--font); font-size: 11px; font-weight: 500; color: var(--text-3); }
.by-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 6px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--c-purple); color: var(--text-2); vertical-align: middle; }
.viewer-ribbon { position: fixed; z-index: 35; right: 20px; top: 84px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; background: var(--tuxedo); color: #fff; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; }
.viewer-ribbon svg.lucide { width: 14px; height: 14px; }
body.role-viewer :is(.card-head a[href^="today.html"], #addRec, #layoutHelp, .save-bar, .photo-pick, .thumb .del, [data-del-log], .tl-actions a[href^="today.html"], .btn-text.danger,
  #newCare, #buyForm, .buy-grid > section:first-child, [data-bedit], [data-again], [data-bdel], #dVoice, #dWrite, .diary-start, .weight-add,
  #save, .form-foot .btn-primary, #addCat, [data-edit], [data-del], #newBook, .book-new, #mkLink, .vet-tools #linkBtn) { display: none !important; }
@media (max-width: 760px) { .viewer-ribbon { top: auto; right: 50%; transform: translateX(50%); bottom: calc(92px + env(safe-area-inset-bottom)); } }

.page-head > div:first-child::after { animation: stk-float 3.4s ease-in-out infinite; }
.sidebar-foot::before { animation: stk-float 4s ease-in-out infinite; }

/* account links under the menu: the same rounded face */
.account-box .btn-text { font-family: var(--font-brand); font-size: 14px; }

/* short laptop windows: drop the decoration first so 계정·로그아웃 stay on screen */
@media (max-height: 860px) { .sidebar-foot::before { display: none; } }
@media (max-height: 700px) { .sidebar-foot .hand { display: none; } .sidebar .brand { margin-bottom: 14px; } }

/* "1호 집사" badge (sidebar name, phone menu, account, admin list) */
.founder-badge { display: inline-flex; align-items: center; flex-shrink: 0; height: 20px; padding: 0 8px; margin-left: 6px; border-radius: 999px;
  border: 1px solid var(--blush); color: var(--cheese-deep); background: #fff; font-family: var(--font); font-size: 11px; font-weight: 700;
  letter-spacing: -.2px; white-space: nowrap; vertical-align: middle; }
.m-menu-who .founder-badge { margin-left: 8px; }
.founder-note { display: flex; align-items: center; gap: 4px; margin: -4px 0 14px; font-size: 13px; color: var(--text-2); }
.founder-note .founder-badge { margin-left: 0; margin-right: 4px; }

/* one line right after a new day is saved (today.js saveNoteText) */
.save-feedback { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 3px; border: 1px solid var(--line);
  background: #fff; font-size: 15px; font-weight: 600; color: var(--text); animation: feedback-in .4s ease-out both; }
.save-feedback .paw-dot { width: 18px; height: 18px; flex-shrink: 0; background: var(--blush);
  -webkit-mask: var(--paw) center / contain no-repeat; mask: var(--paw) center / contain no-repeat; }
@keyframes feedback-in { from { opacity: 0; } to { opacity: 1; } }

/* one-tap "알림 받기" on the today screen (js/push.js pushQuickCard) — a preview of the real notification, then one button */
.push-ask { text-align: center; padding-top: 22px !important; background: linear-gradient(170deg, #FCE4EC 0%, #fff 55%) !important; }
.push-ask-preview { display: flex; gap: 10px; align-items: center; max-width: 340px; margin: 0 auto 16px; padding: 11px 13px; text-align: left;
  border-radius: 16px; background: rgba(255,255,255,.92); box-shadow: 0 8px 22px rgba(29,26,23,.12); animation: pa-in .5s ease-out both; }
@keyframes pa-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.push-ask-preview img { width: 38px; height: 38px; flex-shrink: 0; border-radius: 9px; }
.push-ask-preview > div { flex: 1; min-width: 0; }
.pa-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-3); }
.pa-top b { color: var(--text); font-weight: 700; }
.pa-msg { margin-top: 2px; font-size: 14.5px; font-weight: 600; color: var(--text); }
.push-ask h2 { font-family: var(--font); font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.push-ask > p { margin-top: 4px; font-size: 13.5px; color: var(--text-2); }
.push-ask-on { width: 100%; max-width: 340px; height: 50px; margin: 16px auto 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px !important; font-size: 16px; font-weight: 700; }
.push-ask-on svg.lucide { width: 19px; height: 19px; }
.push-ask-later { display: block; margin: 4px auto 0; height: 40px; padding: 0 16px; background: none; font-size: 14px; font-weight: 600; color: var(--text-3); }
@media (prefers-reduced-motion: reduce) { .push-ask-preview { animation: none; } }

/* =========================================================
   2026-11-27 사용성 점검 반영
   ========================================================= */
/* one shell on every app page: the lovely (pink) sidebar, top bar and bottom tabs — page bodies keep their own tone */
.sidebar { background: linear-gradient(180deg, #FFF1F5, #FFF9F6) !important; border-right: 1px solid #F8DAE3 !important; }
.nav-item { border-radius: 18px !important; }
.nav-item:hover { background: #FFF1F5 !important; }
.nav-item.active { background: #FFE3EB !important; box-shadow: none !important; }
.nav-item.active, .nav-item.active * { color: #A83F5E !important; stroke: #A83F5E !important; }
.bar-btn { border-radius: 18px !important; border: 1px solid #F4D2DC !important; background: #fff !important; color: #6E5A5E !important; }
.bar-btn.home, .m-top .m-home { background: linear-gradient(180deg, #FFA6C0, #F27FA3) !important; border: 0 !important; color: #fff !important;
  box-shadow: 0 6px 14px rgba(242, 127, 163, .4) !important; }
.bar-btn.home *, .m-top .m-home * { color: #fff !important; }
@media (max-width: 760px) {
  .m-top { background: rgba(255, 249, 246, .92) !important; border-bottom: 1px solid #F8DAE3 !important; }
  .m-tab { background: rgba(255, 255, 255, .96) !important; border: 1px solid #F8DAE3 !important; border-radius: 26px !important; box-shadow: 0 12px 28px rgba(228, 132, 159, .22) !important; }
  .m-tab a { border-radius: 20px !important; }
  .m-tab a.active { background: #FFE3EB !important; color: #A83F5E !important; }
  .m-tab a.active svg { stroke: #A83F5E !important; color: #A83F5E !important; }
  .page { padding-bottom: calc(124px + env(safe-area-inset-bottom)); }   /* the floating tab bar never covers the last button */
}
/* rounded fields everywhere, like the buttons */
.input, .textarea, .select { border-radius: 14px !important; }
/* add-photo tile: a soft pink dashed edge, not a heavy black one */
.photo-pick { border: 1.5px dashed #EDB3C4 !important; background: #FFF7F9 !important; color: #B04667 !important; border-radius: 18px !important; }
.photo-pick.is-full { border-color: var(--line) !important; background: var(--surface-2) !important; color: var(--text-3) !important; }
.save-feedback { border-radius: 20px; border-color: #F8DAE3; }
/* today: a small placeholder when there's no photo yet, so the record fields sit on the first screen */
.hero.no-photo { height: 120px !important; }
.hero.no-photo .date-change { top: 10px; }
@media (max-width: 760px) { .hero.no-photo { height: 96px !important; } }
/* 더 적기: 특이사항·메모 folded away until wanted */
.more-write > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.more-write > summary::-webkit-details-marker { display: none; }
.more-write > summary small { flex: 1; font-size: 13px; color: var(--text-3); }
.more-write > summary svg.lucide { width: 20px; height: 20px; color: var(--text-3); transition: transform .2s; }
.more-write[open] > summary svg.lucide { transform: rotate(180deg); }
.more-write .extra { margin-top: 16px; }
/* health header on phones: the main action on its own row, the other two side by side — no wrapped, clipped labels */
@media (max-width: 760px) {
  body[data-page="health"] .page-head .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  body[data-page="health"] .page-head .btn-row > * { white-space: nowrap; justify-content: center; min-height: 44px; height: auto; }
  body[data-page="health"] #addRec { grid-column: 1 / -1; order: -1; height: 48px; }
}
/* empty placeholders (feedback, notifications, notes) take no room until something is in them */
.stack > div:empty { display: none; }
#best { min-height: 64px !important; }

/* 2026-11-27 재점검: 사진 없는 작은 자리 — 발자국은 작게 가운데, 말풍선은 덮지 않고 아래에 */
body.lovely .hero.no-photo, .hero.no-photo { background-size: 56px 56px, 100% 100% !important; background-position: center, 0 0 !important; }
.hero.no-photo ~ .cat-say { margin-top: 10px !important; }
.hero.no-photo ~ .cat-say::before { display: none !important; }
.hero.no-photo ~ .hero-peek { display: none !important; }
/* '← 오늘로'는 새 톤에서 진한 바탕에 진한 글자가 돼 안 보였다 — 날짜 바꾸기와 같은 흰 알약 + 분홍 글자 */
.date-back { background: rgba(255,255,255,.94) !important; box-shadow: none !important; border: 1px solid #F3C4D2; color: #C2577A !important; }

/* =========================================================
   2026-11-28 터치 영역 44px · 작은 글자 12px
   ========================================================= */
.icon-btn, .m-top .icon-btn { min-width: 44px; min-height: 44px; }
.m-top .icon-btn { width: 44px; height: 44px; }
a.brand { min-height: 44px; display: inline-flex; align-items: center; }
.date-change { height: 44px; }
.mic-btn { width: 44px; height: 44px; right: 2px; }
.mic-wrap.is-area .mic-btn { top: 4px; }
.link-more { display: inline-flex; align-items: center; min-height: 44px; }
main summary { min-height: 44px; box-sizing: border-box; }
.btn-line, .btn-primary.sm, .btn-danger, .seg button { min-height: 44px; }
.input, .select { min-height: 44px; }
.drag-handle { width: 44px; height: 44px; margin: -7px; }
.field > span small { font-size: 12px; }
