:root {
  color-scheme: light;
  --bg: #f6f1e7; --surface: #fffdf8; --surface2: #eee7d8;
  --text: #2a2620; --text2: #8a8172; --text3: #b3aa99;
  --line: rgba(42,38,32,.09); --accent: #c4552d; --accent-bg: #f6e3d9; --on-accent: #fffaf2; --danger: #b3352b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; flex: none; }
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }

.screen { padding: calc(env(safe-area-inset-top) + 14px) 20px calc(env(safe-area-inset-bottom) + 110px); }
h1 { font-size: 30px; line-height: 1.1; margin: 2px 0 0; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 13px; margin: 22px 0 8px; font-weight: 500; color: var(--text2); }
.k { font-size: 12px; color: var(--text2); margin: 0; }
.sub { color: var(--text2); font-size: 14px; margin: 2px 0 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--text2); display: grid; place-items: center; }

/* barra flotante de vidrio */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 14px); width: min(260px, calc(100% - 48px)); height: 62px; z-index: 20; border-radius: 31px; padding: 4px; display: flex;
  background: rgba(255,252,246,.5); -webkit-backdrop-filter: blur(22px) saturate(190%); backdrop-filter: blur(22px) saturate(190%);
  box-shadow: 0 10px 28px rgba(60,40,20,.16), 0 0 0 .5px rgba(255,255,255,.75) inset, 0 1px 0 rgba(255,255,255,.9) inset; }
.tabbar-in { display: flex; width: 100%; }
.tab { flex: 1; border: 0; background: transparent; color: #7d7466; font-size: 11px; font-weight: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 26px; padding: 0; }
.tab svg { width: 23px; height: 23px; }
.tab.on { color: var(--accent); }

.card { background: var(--surface); border-radius: 20px; padding: 16px; }
.progress { position: relative; background: var(--surface); border-radius: 22px; padding: 16px 16px 15px; margin-bottom: 14px; }
.progress .k { font-size: 12px; }
.progress b { display: block; font-size: 36px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 8px; padding-right: 36px; }
.progress .gear { position: absolute; top: 10px; right: 10px; }

.hello { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 12px; }
.hello h1 { font-size: 26px; margin: 0; }
.hello .actions { display: flex; }
.rev { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; text-align: left; margin-top: 4px; padding: 14px 16px; border-radius: 18px; background: var(--accent-bg); color: var(--accent); }
.rev b { display: block; font-size: 16px; font-weight: 600; }
.rev small { font-size: 12px; opacity: .85; }

.weak { background: var(--surface); border-radius: 18px; padding: 14px; margin-top: 12px; }
.weak > b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.wk-i { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: .5px solid var(--line); font-size: 14px; }
.wk-i i { font-style: normal; color: var(--accent); font-size: 12px; flex: none; align-self: center; }
.pbar { height: 4px; border-radius: 2px; background: rgba(42,38,32,.1); overflow: hidden; margin: 6px 0 16px; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }
.pbar.load i { width: 40%; animation: slide 1.1s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0 } to { margin-left: 60% } }
.qtext { font-size: 21px !important; line-height: 1.3; margin: 4px 0 16px !important; }
.opt { display: block; width: 100%; text-align: left; border: 0; background: var(--surface); border-radius: 14px; padding: 14px 16px; margin-bottom: 8px; font-size: 16px; color: var(--text); }
.opt:disabled { opacity: 1; }
.opt.ok { background: #e3efdc; color: #2c5a1a; }
.opt.bad { background: #f6dcd6; color: var(--danger); }
.fb { margin: 12px 0; font-size: 14px; color: var(--text2); }
.fb b { color: var(--text); margin-right: 4px; }
.fb.good b { color: #2c5a1a; }
.fb.no b { color: var(--danger); }
.big-score { font-size: 56px; font-weight: 600; letter-spacing: -.03em; color: var(--accent); line-height: 1.1; margin: 4px 0; }
.big-score span { font-size: 20px; color: var(--text2); font-weight: 400; letter-spacing: 0; }
.week { display: flex; justify-content: space-between; margin: 0 0 14px; }
.day { border: 0; background: transparent; width: 40px; padding: 7px 0 8px; border-radius: 20px; text-align: center; color: var(--text2); font-size: 11px; text-transform: uppercase; }
.day b { display: block; font-size: 16px; font-weight: 500; color: var(--text); margin-top: 2px; text-transform: none; }
.day.today b { color: var(--accent); font-weight: 600; }
.day .mark { display: block; height: 4px; margin-top: 3px; }
.day .mark i { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin: 0 1px; }
.day.sel { background: var(--accent); color: var(--on-accent); }
.day.sel b { color: var(--on-accent); }
.day.sel .mark i { background: var(--on-accent); }

.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: var(--surface); border-radius: 16px; margin-bottom: 8px; width: 100%; border: 0; text-align: left; }
.row .bar { width: 3px; height: 30px; border-radius: 2px; background: var(--accent); flex: none; }
.row .bar.i { background: var(--text2); }
.row b { display: block; font-weight: 500; font-size: 15px; line-height: 1.25; }
.row small { font-size: 12px; color: var(--text2); }
.row .r { margin-left: auto; font-size: 12px; color: var(--text2); flex: none; display: flex; align-items: center; gap: 4px; }
.row.pend { background: transparent; border: 1px dashed rgba(42,38,32,.25); }
.row.pend .bar { background: rgba(42,38,32,.2); }
.row.pend b { color: var(--text2); }
.row.pend .r { color: var(--accent); font-weight: 500; }
.row.done { opacity: .55; }
.empty { text-align: center; color: var(--text3); font-size: 14px; padding: 18px 0; }

.btn { border: 0; border-radius: 14px; padding: 12px 16px; background: var(--surface2); color: var(--text); font-weight: 500; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 12px; }
.row-btns { display: flex; gap: 8px; margin-top: 10px; }
.row-btns .btn { flex: 1; }

/* temas en cuadrícula */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sq { background: var(--surface); border-radius: 20px; aspect-ratio: 1 / 1; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; border: 0; text-align: left; min-width: 0; width: 100%; }
.sq .n { font-size: 34px; font-weight: 600; letter-spacing: -.03em; color: var(--accent); line-height: 1; }
.sq .n span { display: block; font-size: 11px; font-weight: 400; letter-spacing: 0; color: var(--text2); margin-top: 3px; }
.sq b { font-size: 15px; font-weight: 600; line-height: 1.2; display: block; overflow-wrap: anywhere; }
.sq small { font-size: 12px; color: var(--text2); }
.sq.add { background: transparent; border: 1px dashed rgba(42,38,32,.25); align-items: center; justify-content: center; color: var(--text2); font-size: 13px; gap: 4px; }
.sq.add svg { width: 24px; height: 24px; }

.back { border: 0; background: none; color: var(--accent); padding: 0; font-size: 16px; display: inline-flex; align-items: center; margin-bottom: 8px; }
.back svg { width: 20px; height: 20px; }

.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.photos .ph { aspect-ratio: 1; border: 0; padding: 0; background: var(--surface2); border-radius: 12px; overflow: hidden; position: relative; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .add { display: grid; place-items: center; align-content: center; color: var(--text2); border: 1px dashed rgba(42,38,32,.25); background: none; font-size: 12px; text-align: center; gap: 2px; }
.photos .add svg { width: 24px; height: 24px; }

.note { background: var(--surface); border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; width: 100%; border: 0; text-align: left; display: block; }
.note small { display: block; color: var(--text2); font-size: 12px; margin-bottom: 3px; }
.note b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.note p { margin: 0; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 8px; background: var(--surface2); color: var(--text2); margin-right: 4px; }

.seg { display: flex; background: rgba(42,38,32,.07); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 0; border-radius: 10px; font-size: 14px; color: var(--text2); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 500; }

.vb { background: var(--surface); border-radius: 16px; padding: 13px 14px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; border: 0; text-align: left; }
.vb b { font-size: 16px; font-weight: 500; display: block; }
.vb small { color: var(--text2); font-size: 12px; display: block; }
.vb em { font-style: normal; font-size: 12px; display: block; margin-top: 2px; color: var(--text3); }
.vb .es { font-size: 15px; text-align: right; color: var(--accent); }
.search { width: 100%; border: 0; background: rgba(42,38,32,.07); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; outline: none; }

.fab { position: fixed; right: max(20px, calc(50% - 260px)); bottom: calc(env(safe-area-inset-bottom) + 90px); width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; z-index: 15; box-shadow: 0 6px 16px rgba(120,50,20,.28); }
.fab svg { width: 24px; height: 24px; }

.scrim { position: fixed; inset: 0; background: rgba(30,20,10,.4); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 8px 18px calc(env(safe-area-inset-bottom) + 20px); animation: up .22s ease-out; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h3 { margin: 4px 0 2px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.sheet .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(40px); opacity: .6 } }

label.f { display: block; font-size: 13px; color: var(--text2); margin: 12px 0 4px; }
.inp { width: 100%; border: 0; background: var(--surface); border-radius: 14px; padding: 11px 13px; outline: none; font-size: 16px; }
textarea.inp { min-height: 110px; resize: vertical; }
.inp:focus { box-shadow: 0 0 0 2px var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 18px; padding: 7px 12px; font-size: 14px; }
.chk input { accent-color: var(--accent); }
.err { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

.lightbox { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; animation: fade .15s; }
.lightbox .bar { display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; color: #fff; }
.lightbox .bar button { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 18px; padding: 8px 14px; font-size: 14px; }
.lightbox .pic { flex: 1; min-height: 0; display: grid; place-items: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .cap { padding: 10px 14px calc(env(safe-area-inset-bottom) + 14px); }
.lightbox .cap input { width: 100%; background: rgba(255,255,255,.12); border: 0; border-radius: 12px; color: #fff; padding: 10px 12px; outline: none; }
.lightbox .nav { display: flex; justify-content: space-between; padding: 0 8px; }
.lightbox .nav button { background: none; border: 0; color: #fff; font-size: 28px; padding: 6px 14px; }

.flash { perspective: 900px; height: 240px; margin: 14px 0; }
.flash .in { position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.flash.f .in { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 18px; background: var(--surface); color: var(--text); }
.flash .face.back { transform: rotateY(180deg); background: var(--accent-bg); color: var(--accent); }
.flash .face b { font-size: 34px; letter-spacing: -.02em; font-weight: 600; }
.flash .face small { font-size: 14px; opacity: .8; margin-top: 8px; }

.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; }
.login .logo { width: 72px; height: 72px; border-radius: 18px; margin-bottom: 18px; }
.login h1 { margin-bottom: 18px; }

#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 22px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: 90%; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
