/* Rotina — a paper planner, not a dashboard.
   Palette comes from the logo art: forest-green ink on cream paper,
   with apple coral, sun yellow, moon lavender and dumbbell sage. */

@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-latin-full-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-latin-full-italic.woff2") format("woff2");
  font-weight: 100 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("../assets/fonts/outfit-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --paper: #F7F1E6;
  --paper-2: #EFE6D5;
  --paper-3: #E6DAC4;
  --ink: #1F3B2C;
  --ink-2: #4E5F53;
  --ink-3: #7F8B80;
  --rule: rgba(31, 59, 44, .26);
  --hair: rgba(31, 59, 44, .14);
  --note: #FBE7A6;
  --note-ink: #3B2F10;
  --tape: rgba(155, 135, 197, .38);
  --bar: #1F3B2C;
  --bar-ink: #F7F1E6;
  --bar-ink-dim: rgba(247, 241, 230, .6);
  --sun-fill: #F2B23E;
  --sun-line: #B7801C;
  --grain-opacity: .5;
  --toast-accent: #F2B23E;

  /* data-mark colors, validated for CVD separation (in this order) */
  --c-forca: #D5553C;
  --c-pilates: #7B5CC7;
  --c-cardio: #C98A0E;
  --c-minimo: #2F7BB5;
  --c-recreativo: #4E8F4A;
  --c-sleep: #7B5CC7;
  --c-energy: #A8740A;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Outfit", -apple-system, "SF Pro Text", system-ui, sans-serif;
  --tab-h: 62px;
  color-scheme: light;
}

/* night journal */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14201A; --paper-2: #1B2A22; --paper-3: #24362C;
    --ink: #F1E9DA; --ink-2: #BFC6B9; --ink-3: #8A968B;
    --rule: rgba(241, 233, 218, .22); --hair: rgba(241, 233, 218, .12);
    --note: #3A3320; --note-ink: #F6E7B8; --tape: rgba(155, 135, 197, .30);
    --bar: #0C1510; --bar-ink: #F1E9DA; --bar-ink-dim: rgba(241, 233, 218, .5);
    --sun-line: #E0A640; --grain-opacity: .22; --toast-accent: #B5452F; --blob: .16;
    --c-forca: #E0634A; --c-pilates: #9277DC; --c-cardio: #BD8A1C; --c-minimo: #4A8FCB; --c-recreativo: #58A254;
    --c-sleep: #9277DC; --c-energy: #D9A036;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14201A; --paper-2: #1B2A22; --paper-3: #24362C;
  --ink: #F1E9DA; --ink-2: #BFC6B9; --ink-3: #8A968B;
  --rule: rgba(241, 233, 218, .22); --hair: rgba(241, 233, 218, .12);
  --note: #3A3320; --note-ink: #F6E7B8; --tape: rgba(155, 135, 197, .30);
  --bar: #0C1510; --bar-ink: #F1E9DA; --bar-ink-dim: rgba(241, 233, 218, .5);
  --sun-line: #E0A640; --grain-opacity: .22; --toast-accent: #B5452F; --blob: .16;
  --c-forca: #E0634A; --c-pilates: #9277DC; --c-cardio: #BD8A1C; --c-minimo: #4A8FCB; --c-recreativo: #58A254;
  --c-sleep: #9277DC; --c-energy: #D9A036;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
/* paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .25 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
img { -webkit-user-drag: none; -webkit-touch-callout: none; }
svg { display: block; }
[hidden] { display: none !important; }

.status-veil {
  position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px);
  background: var(--paper); z-index: 30;
}

#app {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto;
  padding: env(safe-area-inset-top, 0px) 0 calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 28px);
}
main { padding: 0 20px; }

/* ---------- day header ---------- */
.dayhead { padding: 14px 20px 6px; }
.dayhead-top { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.greet { flex: 1; font-family: var(--display); font-style: italic; font-size: 16px; color: var(--ink-2); font-variation-settings: "SOFT" 100, "WONK" 1; }
.dayname {
  margin: 4px 0 0;
  font-family: var(--display); font-weight: 600; font-size: 52px; line-height: .95; letter-spacing: -.02em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.daydate { display: flex; align-items: baseline; gap: 12px; margin-top: 6px; font-size: 15px; color: var(--ink-2); }
.back-today { border: 0; background: none; padding: 0; color: var(--c-forca); font-weight: 600; font-size: 14px; }

.week { display: grid; grid-template-columns: 28px repeat(7, 1fr) 28px; align-items: center; margin: 16px -6px 4px; }
.week .wk-arrow { border: 0; background: none; padding: 6px 0; color: var(--ink-3); display: flex; justify-content: center; }
.week .wk-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.week .wk-arrow:disabled { opacity: .25; }
.day {
  position: relative; border: 0; background: none; padding: 4px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.day .d-letter { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); }
.day .d-num { width: 34px; height: 34px; display: grid; place-items: center; font-family: var(--display); font-size: 17px; font-weight: 500; border-radius: 50%; }
.day .d-dots { position: absolute; bottom: 2px; display: flex; gap: 2px; height: 5px; }
.day .d-dots i { width: 5px; height: 5px; border-radius: 50%; }
.day.is-today .d-num { color: var(--c-forca); font-weight: 700; }
.day.is-selected .d-num { background: var(--ink); color: var(--paper); }
.day:disabled { opacity: .35; }
.day:active .d-num { transform: scale(.92); }

/* ---------- panels ---------- */
.panel { display: none; }
.panel.active { display: block; animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel.active { animation: none; } }

.page-head { padding: 18px 0 4px; }
.page-head h1 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 44px; letter-spacing: -.02em; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.back-link { border: 0; background: none; padding: 6px 0; color: var(--ink-2); font-size: 15px; font-weight: 500; }

.block { padding: 18px 0 10px; }
.block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.block-head h2 {
  margin: 0; flex: 1;
  font-family: var(--display); font-style: italic; font-weight: 500; font-size: 26px; letter-spacing: -.01em;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.block-aside { font-size: 13px; color: var(--ink-3); }
.art { height: 34px; width: auto; flex: 0 0 auto; }
.art-dumbbell { height: 26px; transform: rotate(-8deg); }
.art-sun { height: 36px; }
.art-apple { height: 34px; }
.art-moon { height: 38px; }

/* hand-drawn divider */
.rule {
  height: 12px; margin: 8px -4px;
  background: var(--rule);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='12' viewBox='0 0 240 12'%3E%3Cpath d='M0 6c20-3 40 3 60 0s40-4 60 0 40 3 60 0 40-3 60 0' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 240px 12px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='12' viewBox='0 0 240 12'%3E%3Cpath d='M0 6c20-3 40 3 60 0s40-4 60 0 40 3 60 0 40-3 60 0' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 240px 12px;
}

/* ---------- sticky note (plan of the day) ---------- */
.note {
  position: relative; margin: 14px 6px 8px; padding: 22px 20px 18px;
  background: var(--note); color: var(--note-ink);
  border-radius: 2px 3px 14px 2px;
  transform: rotate(-1.2deg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 10px 18px -12px rgba(60, 40, 0, .35);
}
.tape { position: absolute; top: -10px; left: 50%; width: 86px; height: 22px; margin-left: -43px; background: var(--tape); transform: rotate(2.5deg); border-radius: 2px; }
.note-label { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.note-title { margin-top: 4px; font-family: var(--display); font-size: 27px; font-weight: 600; line-height: 1.1; font-variation-settings: "SOFT" 100, "WONK" 1; }
.note-detail { margin-top: 4px; font-size: 15px; opacity: .85; }
.note.is-empty .note-title { font-size: 20px; font-style: italic; font-weight: 400; }
.note button.linkish { margin-top: 8px; border: 0; background: none; padding: 0; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- activities ---------- */
.cat { margin-bottom: 14px; }
.cat-label { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.cat-label i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  --c: var(--ink);
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 42px; padding: 9px 14px;
  border: 1.5px solid var(--hair); border-radius: 12px;
  background: transparent; font-size: 15px; font-weight: 500; text-align: left;
  transition: background .15s, border-color .15s, transform .08s;
}
.tag:active { transform: scale(.96); }
.tag .check { width: 16px; height: 16px; margin-left: -3px; display: none; fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tag.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); font-weight: 600; }
.tag.on .check { display: block; }

.add-act { display: flex; gap: 8px; margin-top: 4px; }
.add-act input { flex: 1; min-width: 0; }
.add-act select { flex: 0 0 116px; }
.add-act button { flex: 0 0 46px; border: 0; border-radius: 12px; background: var(--ink); color: var(--paper); display: grid; place-items: center; }
.add-act button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.add-act button:active { transform: scale(.94); }

input[type=text], input[type=url], input[type=password], input[type=time], select, textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  font-size: 16px; /* 16px+ stops iOS zooming in on focus */
  background: var(--paper-2); border: 1.5px solid transparent; border-radius: 12px;
  -webkit-appearance: none; appearance: none; outline: none;
}
select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237F8B80' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink-3); }
::placeholder { color: var(--ink-3); opacity: 1; }
.line-input {
  margin-top: 14px; background: transparent !important; border-radius: 0 !important;
  border: 0 !important; border-bottom: 1.5px dashed var(--rule) !important; padding: 10px 2px !important;
}
.line-input:focus { border-bottom-color: var(--ink-2) !important; border-bottom-style: solid !important; }

/* ---------- energy suns ---------- */
.suns { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 2px; }
.sun-btn { border: 0; background: none; padding: 4px; display: grid; place-items: center; }
.sun-btn svg { overflow: visible; }
.sun-btn .core { fill: transparent; stroke: var(--sun-line); stroke-width: 2; transition: fill .15s; }
.sun-btn .rays { stroke: var(--sun-line); stroke-width: 2.2; stroke-linecap: round; fill: none; opacity: .55; transition: opacity .15s; }
.sun-btn.on .core { fill: var(--sun-fill); stroke: var(--sun-fill); }
.sun-btn.on .rays { stroke: var(--sun-fill); opacity: 1; }
.sun-btn:active svg { transform: scale(.9); }
.scale-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12.5px; color: var(--ink-3); font-style: italic; font-family: var(--display); }

/* ---------- food ---------- */
.food { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.food-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 6px 12px; border: 1.5px solid var(--hair); border-radius: 16px; background: transparent;
  font-size: 13.5px; font-weight: 500; line-height: 1.2; text-align: center;
  transition: background .15s, border-color .15s, transform .08s;
}
.food-opt svg { width: 42px; height: 42px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.food-opt .flesh { fill: color-mix(in srgb, #E8705C 22%, transparent); stroke: none; }
.food-opt.on { border-color: var(--ink); background: var(--paper-2); font-weight: 700; }
.food-opt.on .flesh { fill: #E8705C; }
.food-opt:active { transform: scale(.96); }

.nutri { margin-top: 14px; padding: 12px 14px 14px; border: 1.5px dashed var(--rule); border-radius: 14px; }
.nutri-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.nutri-refresh { border: 0; background: var(--paper-2); color: var(--ink); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.nutri-kcal { margin-top: 4px; font-family: var(--display); font-size: 34px; font-weight: 600; line-height: 1.05; font-variation-settings: "SOFT" 100, "WONK" 1; }
.nutri-kcal small { margin-left: 6px; font-size: 15px; font-weight: 400; font-style: italic; color: var(--ink-2); }
.macros { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.macro b { color: var(--ink); font-weight: 600; }
.nutri-empty { margin: 6px 0 0; font-family: var(--display); font-style: italic; font-size: 15px; color: var(--ink-3); }

.polaroids { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; padding: 4px 2px; }
.polaroid {
  position: relative; width: 92px; padding: 6px 6px 22px; background: #fff; border: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 6px 14px -8px rgba(0, 0, 0, .35);
  transform: rotate(var(--r, -2deg));
}
.polaroid .ph { width: 80px; height: 80px; background: var(--paper-3) center / cover no-repeat; display: grid; place-items: center; color: #1F3B2C; font-weight: 700; font-size: 13px; }
.polaroid .cap { position: absolute; left: 6px; right: 6px; bottom: 4px; font-size: 10.5px; color: #4E5F53; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; font-family: var(--display); font-style: italic; }
.polaroid .x { position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); font-size: 15px; line-height: 26px; padding: 0; }
.add-photo {
  width: 92px; height: 108px; border: 1.5px dashed var(--rule); border-radius: 6px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink-2); font-size: 12.5px; font-weight: 500; line-height: 1.2; text-align: center; padding: 6px;
}
.add-photo svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.autosave-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 24px 0 0; font-family: var(--display); font-style: italic; font-size: 14px; color: var(--ink-3); }

/* ---------- sync pill ---------- */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 4px; font-size: 13px; color: var(--ink-3); }
.sync-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.sync-pill[data-s="ok"] i { background: var(--c-recreativo); }
.sync-pill[data-s="syncing"] i { background: var(--c-cardio); animation: pulse 1s infinite alternate; }
.sync-pill[data-s="error"] i { background: var(--c-forca); }
.sync-pill[data-s="error"] { color: var(--c-forca); }
@keyframes pulse { to { opacity: .3; } }
.icon-btn { width: 38px; height: 38px; border: 0; background: none; padding: 0; display: grid; place-items: center; color: var(--ink); border-radius: 50%; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: var(--paper-2); }

/* ---------- diário ---------- */
.tally { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.tally:last-child { border-bottom: 0; }
.tally-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.tally-name i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tally-count { font-family: var(--display); font-size: 15px; color: var(--ink-2); }
.tally-boxes { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.box { width: 26px; height: 26px; border: 1.6px solid var(--rule); border-radius: 6px 5px 7px 5px; display: grid; place-items: center; }
.box svg { width: 17px; height: 17px; fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.box.done { border-color: var(--c); }
.box.extra { border-style: dashed; border-color: var(--c); }
.tally-none { font-size: 13px; color: var(--ink-3); font-style: italic; }

.cal-nav { display: flex; gap: 2px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); padding-bottom: 4px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1.1; border: 0; border-radius: 10px; background: transparent; padding: 5px 0 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--display); font-size: 15px;
}
.cal-day.has { background: var(--paper-2); }
.cal-day.today { box-shadow: inset 0 0 0 1.6px var(--ink); }
.cal-day.future { opacity: .3; }
.cal-day .dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 30px; }
.cal-day .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px var(--paper-2); }
.cal-day .moon { position: absolute; top: 3px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--c-sleep); opacity: .7; }
.cal-day:active { transform: scale(.94); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.minichart { position: relative; margin-bottom: 14px; }
.minichart .mc-title { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.minichart .mc-title b { font-weight: 600; color: var(--ink); }
.minichart svg { width: 100%; height: auto; overflow: visible; }
.minichart .grid { stroke: var(--hair); stroke-width: 1; }
.minichart .axis-label { fill: var(--ink-3); font-size: 10px; font-family: var(--body); }
.minichart .bar { fill: var(--c-sleep); }
.minichart .target { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.minichart .line { fill: none; stroke: var(--c-energy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.minichart .dot { fill: var(--c-energy); stroke: var(--paper); stroke-width: 2; }
.minichart .hit { fill: transparent; }
.minichart .hl { fill: var(--ink); opacity: .06; }
.minichart .empty { font-size: 13px; color: var(--ink-3); font-style: italic; padding: 10px 0; }
.tip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  background: var(--ink); color: var(--paper); font-size: 12px; padding: 5px 8px; border-radius: 8px;
}

.day-row { display: flex; gap: 14px; width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--hair); background: none; text-align: left; }
.day-row:last-child { border-bottom: 0; }
.day-row .dr-date { flex: 0 0 48px; font-family: var(--display); }
.day-row .dr-date b { display: block; font-size: 22px; font-weight: 600; line-height: 1; }
.day-row .dr-date span { font-size: 12px; color: var(--ink-3); }
.day-row .dr-main { flex: 1; min-width: 0; }
.day-row .dr-acts { display: flex; flex-wrap: wrap; gap: 4px 10px; font-weight: 500; font-size: 14.5px; }
.day-row .dr-acts span { display: inline-flex; align-items: center; gap: 5px; }
.day-row .dr-acts i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.day-row .dr-meta { margin-top: 3px; font-size: 13px; color: var(--ink-2); }
.empty-note { font-size: 14px; color: var(--ink-3); font-style: italic; font-family: var(--display); padding: 6px 0; }

/* ---------- sono ---------- */
.tickets { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.ticket { display: block; min-width: 0; padding: 12px 14px 10px; background: var(--paper-2); border-radius: 16px; }
.ticket-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.ticket input[type=time] {
  background: transparent; padding: 2px 0 0; min-height: 0; border: 0;
  width: 100%; min-width: 0;
  font-family: var(--display); font-size: 28px; font-weight: 600; letter-spacing: -.01em; font-variation-settings: "SOFT" 100;
}
input[type=time]::-webkit-calendar-picker-indicator { display: none; }
.ticket input[type=time]::-webkit-date-and-time-value { text-align: left; }
.ticket-arrow { color: var(--ink-3); font-size: 20px; }
.sleep-result { margin-top: 16px; min-height: 22px; }
.sleep-result .big { font-family: var(--display); font-size: 40px; font-weight: 600; line-height: 1; font-variation-settings: "SOFT" 100, "WONK" 1; }
.sleep-result .big small { font-size: 18px; font-weight: 400; font-style: italic; color: var(--ink-2); margin-left: 6px; }
.sleep-meter { position: relative; height: 10px; margin-top: 12px; background: var(--paper-2); border-radius: 6px; }
.sleep-meter .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c-sleep); border-radius: 6px; }
.sleep-meter .goal { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.sleep-meter-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--ink-3); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 13.5px; color: var(--ink-2); }
.seg { display: flex; padding: 3px; background: var(--paper-2); border-radius: 12px; }
.seg button { flex: 1; min-height: 40px; border: 0; background: none; border-radius: 9px; font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.seg button.on { background: var(--paper); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.bedtime { margin: 6px 0 12px; padding: 16px 18px; border-radius: 18px; background: color-mix(in srgb, var(--c-pilates) 13%, var(--paper)); }
.bedtime-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; color: var(--ink-2); }
.bedtime-row strong { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--ink); }
.bedtime-row.big strong { font-size: 44px; font-variation-settings: "SOFT" 100, "WONK" 1; }
.aside-note { margin: 0 0 14px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }

.solid-btn, .ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; font-size: 15px; font-weight: 600; text-decoration: none;
}
.solid-btn { border: 0; background: var(--ink); color: var(--paper); }
.ghost-btn { border: 1.5px solid var(--rule); background: transparent; color: var(--ink); }
.solid-btn:active, .ghost-btn:active { transform: scale(.97); }
.block > .ghost-btn { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > * { flex: 1; }

/* ---------- ajustes ---------- */
.plan-row { display: grid; grid-template-columns: 44px 1fr; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.plan-row:last-child { border-bottom: 0; }
.plan-row .pr-day { grid-row: span 2; font-family: var(--display); font-style: italic; font-size: 17px; }
.plan-row input { min-height: 40px; padding: 8px 12px; }
.plan-row input.detail { font-size: 16px; background: transparent; border-bottom: 1px dashed var(--rule); border-radius: 0; padding: 6px 2px; min-height: 36px; }

.cfg-cat { padding: 12px 0; border-bottom: 1px solid var(--hair); }
.cfg-cat:last-child { border-bottom: 0; }
.cfg-cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cfg-cat-head i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.cfg-cat-head b { flex: 1; font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); }
.stepper button { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--rule); background: none; font-size: 17px; line-height: 1; padding: 0; }
.stepper output { min-width: 58px; text-align: center; font-weight: 600; color: var(--ink); }
.cfg-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cfg-tag { display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--paper-2); font-size: 14px; }
.cfg-tag button { width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: var(--ink-3); font-size: 16px; padding: 0; line-height: 1; }
.cfg-add { display: flex; gap: 6px; margin-top: 8px; }
.cfg-add input { min-height: 40px; padding: 8px 12px; }
.cfg-add button { flex: 0 0 auto; border: 1.5px solid var(--rule); background: none; border-radius: 10px; padding: 0 14px; font-weight: 600; }

.sync-detail { font-size: 13.5px; color: var(--ink-2); margin: 12px 0 0; line-height: 1.5; min-height: 20px; }
.sync-detail a { color: inherit; }
.paste { margin-top: 14px; }
.paste summary { font-size: 14px; color: var(--ink-2); padding: 6px 0; }
.paste textarea { margin: 8px 0; font-family: ui-monospace, Menlo, monospace; font-size: 13px; resize: vertical; }
.version { margin-top: 18px; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--bar);
  border-radius: 22px 22px 0 0;
}
.tab {
  position: relative; flex: 1; max-width: 140px; height: 50px; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--bar-ink-dim); font-size: 12px; font-weight: 500; letter-spacing: .02em;
}
.tab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--bar-ink); font-weight: 700; }
.tab.active::before {
  content: ""; position: absolute; top: 3px; width: 34px; height: 34px; border-radius: 45% 55% 50% 50%;
  background: var(--sun-fill); opacity: var(--blob, .28); transform: rotate(-12deg);
}
.tab:active svg { transform: scale(.9); }

/* ---------- toast & viewer ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 40;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--paper);
  font-size: 14.5px; font-weight: 500;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: transform .22s, opacity .22s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--toast-accent); font-weight: 700; padding: 0; }

.viewer {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 16, 12, .92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 56px) 12px calc(env(safe-area-inset-bottom, 0px) + 24px);
}
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.viewer .v-close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 14px; border: 0; background: rgba(255, 255, 255, .14); color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; }
.viewer .v-share { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 14px; border: 0; background: rgba(255, 255, 255, .14); color: #fff; height: 40px; padding: 0 16px; border-radius: 20px; font-weight: 600; }

@media (min-width: 560px) {
  .tabbar { max-width: 520px; margin: 0 auto; }
}
