/* チャロたん日記 — quiet and soft: warm white, thin lines instead of boxes, rounded type.
   Dark colours too (seizures happen at night): chosen in 設定 — light / dark / follow the phone. */
:root {
  color-scheme: light;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  --bg: #fcfaf6;         /* page */
  --card: #fcfaf6;       /* ring around chart marks = the page */
  --soft: #f3eee6;       /* quiet fills */
  --ink: #3a3029;        /* text and main buttons */
  --on-ink: #fcfaf6;
  --sub: #8a7f74;        /* secondary text */
  --line: #ece6dc;       /* dividers, chart grid */
  --line2: #d9d0c4;      /* button and input borders */
  --red: #c0503f;
  --red-soft: #f8ebe7;
  --muted: var(--sub);
  --hair: var(--line);
  /* record kinds (checked together as one set with the dataviz validator, on --bg) */
  --k-pee: #c48600; --k-poop: #8f4a1c; --k-food: #2b6cd0; --k-water: #139bab; --k-vomit: #b0459e; --k-seizure: #d8403a; --k-med: #3a9a3e; --k-memo: #9a8f84; --k-trim: #9a8f84; --k-vaccine: #9a8f84;
  --k-sleep: rgba(70, 80, 140, 0.13);
  --k-sleep-bar: rgba(70, 80, 140, 0.45);
  --m-a: #2b6cd0; --m-b: #d9802f; --m-c: #3a9a3e; --m-d: #b0459e;
  --r: 12px;
  --tabs-h: 58px;
  --quick-h: 74px;
}
/* 画面の色 is chosen per device in 設定 (html[data-theme] = light / dark / auto; set before paint by theme.js) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d1915; --card: #1d1915; --soft: #29231e; --ink: #efe7dc; --on-ink: #1d1915; --sub: #a99d90;
  --line: #342c25; --line2: #4a4037; --red: #e8705f; --red-soft: #3a231e;
  --k-pee: #c08a1a; --k-poop: #a8683c; --k-food: #4f86e0; --k-water: #1a9fb0; --k-vomit: #b267d0; --k-seizure: #ea4e5e; --k-med: #45a24c; --k-memo: #a09284; --k-trim: #a09284; --k-vaccine: #a09284;
  --k-sleep: rgba(150, 160, 230, 0.16);
  --k-sleep-bar: rgba(150, 160, 230, 0.5);
  --m-a: #4f86e0; --m-b: #e0954f; --m-c: #45a24c; --m-d: #c46ec0;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #1d1915; --card: #1d1915; --soft: #29231e; --ink: #efe7dc; --on-ink: #1d1915; --sub: #a99d90;
    --line: #342c25; --line2: #4a4037; --red: #e8705f; --red-soft: #3a231e;
    --k-pee: #c08a1a; --k-poop: #a8683c; --k-food: #4f86e0; --k-water: #1a9fb0; --k-vomit: #b267d0; --k-seizure: #ea4e5e; --k-med: #45a24c; --k-memo: #a09284; --k-trim: #a09284; --k-vaccine: #a09284;
    --k-sleep: rgba(150, 160, 230, 0.16);
    --k-sleep-bar: rgba(150, 160, 230, 0.5);
    --m-a: #4f86e0; --m-b: #e0954f; --m-c: #45a24c; --m-d: #c46ec0;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-weight: 500; color: var(--ink); background: var(--bg);
  font-size: 16px; line-height: 1.55; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.jp { word-break: keep-all; overflow-wrap: anywhere; }
.nw { white-space: nowrap; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.tnum { font-variant-numeric: tabular-nums; }
.red { color: var(--red); }
.ink { color: var(--ink) !important; }
.grow { flex: 1; min-width: 0; }

/* ─── Layout: tabs at the bottom on phones, on the left on wide screens ─── */
.main { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px); max-width: 680px; margin: 0 auto; }
.main:has(.quick) { padding-bottom: calc(var(--tabs-h) + var(--quick-h) + env(safe-area-inset-bottom) + 20px); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  height: var(--tabs-h); border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 500; color: var(--sub); padding: 0;
}
.tabs svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs button[aria-current="page"] svg { stroke-width: 2.2; }
@media (min-width: 900px) {
  .tabs { top: 0; right: auto; width: 190px; grid-template-columns: 1fr; grid-auto-rows: min-content; border-top: 0; border-right: 1px solid var(--line); padding: 28px 12px; gap: 2px; }
  .tabs button { flex-direction: row; justify-content: flex-start; height: 46px; font-size: 15px; gap: 12px; padding: 0 12px; border-radius: 10px; }
  .tabs button[aria-current="page"] { background: var(--soft); }
  .main { margin-left: 190px; max-width: none; padding-left: 24px; padding-right: 24px; }
  .view, .top { max-width: 900px; margin-left: auto; margin-right: auto; }
}

/* ─── Header ─── */
.top { padding: calc(env(safe-area-inset-top) + 34px) 20px 6px; display: flex; align-items: flex-start; gap: 12px; }
html.standalone .top { padding-top: calc(env(safe-area-inset-top) + 28px); }
@media (min-width: 900px) { .top { padding-top: 28px; } }
.top .dog { font-size: 21px; font-weight: 700; line-height: 1.3; letter-spacing: 0.04em; white-space: nowrap; }
.top .date { display: block; position: relative; border: 0; background: none; padding: 0 14px 0 0; text-align: left; font: inherit; font-size: 13px; color: var(--sub); margin-top: 2px; line-height: 1.75; }
.top .date .more-arrow { position: absolute; right: 0; bottom: 0; font-size: 16px; }
.top .ahead.down { color: var(--red); font-weight: 700; }
.top .press { display: inline-flex; align-items: center; gap: 3px; }
.top .press svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; margin-left: 4px; }
.top .press.down { color: var(--red); font-weight: 700; }
.top .press .lv { margin-left: 8px; padding: 0 7px; border-radius: 999px; background: var(--soft); color: var(--sub); font-weight: 500; font-size: 12px; }
/* 設定: a labelled button (an icon alone was read as a sun) */
.gear { flex: none; min-height: 38px; margin-top: -2px; padding: 4px 14px 4px 10px; border: 1px solid var(--line2); border-radius: 999px; background: var(--bg); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.gear[data-act="settingsclose"] { padding: 4px 16px; }
.gear:active { background: var(--soft); }
.gear svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.view { padding: 0 20px; }
/* Section heading: small, quiet, with an optional note or link on the right */
.h, .view h2 { font-size: 13px; color: var(--sub); font-weight: 700; margin: 26px 0 6px; display: flex; align-items: baseline; gap: 8px; }
.h span { font-weight: 500; }
.h .link, .view h2 .act { margin-left: auto; font-size: 14px; }
.view h3, .report h3 { font-size: 15px; font-weight: 700; margin: 22px 0 6px; display: flex; gap: 8px; align-items: baseline; }
.view h3 span { font-size: 13px; color: var(--sub); font-weight: 500; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 8px 18px;
  border: 1px solid var(--line2); border-radius: var(--r); background: var(--bg); color: var(--ink);
  font-weight: 700; font-size: 16px; text-decoration: none; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { background: var(--soft); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.primary:active:not(:disabled) { opacity: 0.85; }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.small { min-height: 36px; font-size: 14px; padding: 4px 14px; border-radius: 999px; }
.btn.wide { width: 100%; }
.link { border: 0; background: none; padding: 4px 0; color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 4px; font-size: 14px; }
.link.small { font-size: 13px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

/* ─── Notices at the top of きょう (medicine not given, asleep, check-up due) ─── */
.notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 8px 8px 8px 14px; border-radius: var(--r); background: var(--soft); font-size: 15px; font-weight: 700; }
.notice.alert { background: var(--red-soft); color: var(--red); }
.notice .btn { background: var(--bg); color: var(--ink); flex: none; }

/* ─── The day in numbers ─── */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats.four { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .stats.four { grid-template-columns: repeat(4, 1fr); } }
.stats div { padding: 10px 2px; text-align: center; min-width: 0; }
.stats b { display: block; font-size: 21px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats b small { font-size: 12px; margin-left: 1px; }
.stats span { font-size: 11px; color: var(--sub); white-space: nowrap; }
.statx { font-size: 14px; padding: 8px 0 0; font-weight: 700; }
.statx .sep { color: var(--sub); margin: 0 4px; }

/* ─── Lists of records, medicines, check-ups ─── */
.list { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: baseline; width: 100%; text-align: left;
  padding: 11px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink);
}
.row:not(:has(.t)) { grid-template-columns: 1fr auto; }
/* Foods: the name opens the edit sheet, the button on the right marks 減ってきた / 買った */
.row.stock { align-items: center; }
.row .c.plain { border: 0; background: none; padding: 0; text-align: left; color: inherit; font: inherit; }
.row.stock.low .k { color: var(--red); }
.newfood { display: grid; gap: 8px; margin: 10px 0 4px; padding: 12px; border-radius: var(--r); background: var(--soft); }
.newfood .btn { justify-self: start; }
button.row:active { background: var(--soft); }
.row .t { font-variant-numeric: tabular-nums; color: var(--sub); font-size: 14px; }
.row .c { min-width: 0; }
.row .k { font-weight: 700; }
.row .d { font-size: 14px; color: var(--sub); }
.row .note { display: block; font-size: 14px; white-space: pre-wrap; margin-top: 1px; }
.row .by { font-size: 12px; color: var(--sub); white-space: nowrap; }
.row.sz .k { color: var(--red); }
.row.med { align-items: center; }
.row.med.late .t, .row.med.late .k { color: var(--red); }
.row.med.done .k { font-weight: 500; }
.link-q { border: 0; background: none; padding: 6px 0; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 2px; flex: none; }
.thumbs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.thumbs img, .thumbs .vid { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: var(--soft); font-size: 12px; font-weight: 700; color: var(--sub); }
.k-pee { background: var(--k-pee); } .k-food { background: var(--k-food); } .k-poop { background: var(--k-poop); } .k-med { background: var(--k-med); }
.k-vomit { background: var(--k-vomit); } .k-seizure { background: var(--k-seizure); } .k-memo, .k-trim, .k-vaccine { background: var(--k-memo); } .k-water { background: var(--k-water); }
.k-sleep { background: var(--k-sleep); border: 1px solid var(--line2); }
.c-a { background: var(--m-a); } .c-b { background: var(--m-b); } .c-c { background: var(--m-c); } .c-d { background: var(--m-d); }
.empty { padding: 16px 0; color: var(--sub); font-size: 14px; border-bottom: 1px solid var(--line); }
details.more { margin-top: 4px; }
details.more summary { font-size: 14px; color: var(--sub); padding: 10px 0; cursor: pointer; }

/* ─── The everyday buttons: one tap records "now" ─── */
.quick {
  position: fixed; left: 0; right: 0; z-index: 15; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4, 1fr) 52px; gap: 8px; padding: 10px 12px; background: var(--bg); border-top: 1px solid var(--line);
}
.quick button { height: 52px; border: 0; border-radius: 14px; background: var(--soft); font-size: 15px; font-weight: 700; color: var(--ink); touch-action: manipulation; padding: 0; }
.quick button:active:not(:disabled) { background: var(--line2); }
.quick button:disabled { opacity: 0.5; }
.quick .plus { background: var(--ink); color: var(--on-ink); font-size: 24px; font-weight: 500; }
@media (min-width: 700px) { .quick { padding-left: max(12px, calc((100% - 640px) / 2)); padding-right: max(12px, calc((100% - 640px) / 2)); } }
@media (min-width: 900px) { .quick { left: 190px; bottom: 0; } }

/* ─── Bottom sheet (forms, menus) ─── */
.shade { position: fixed; inset: 0; background: rgba(30, 22, 15, 0.38); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 14px 20px calc(24px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 540px; border-radius: 20px; } }
.sheet .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sheet .head h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.sheet .head .x { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--soft); font-size: 20px; line-height: 1; color: var(--sub); }
.menu button { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 15px 0; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 16px; text-align: left; color: var(--ink); }
.menu button span { font-size: 13px; color: var(--sub); }
.menu button.red { color: var(--red); }
.menu button:active { background: var(--soft); }
.field { margin: 14px 0; }
.field > label, .field > .lb { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.fields2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.when { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="tel"], input[type="password"], select, textarea {
  width: 100%; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: var(--r); background: var(--bg); font-size: 16px;
}
input:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; text-align: left; }
textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button { min-height: 42px; padding: 6px 14px; border: 1px solid var(--line2); border-radius: 999px; background: var(--bg); font-size: 15px; }
.choices button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); font-weight: 700; }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 20px; }
.actions.one { grid-template-columns: 1fr; }
.files { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.files .f { position: relative; }
.files .f img, .files .f .vid { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; display: grid; place-items: center; background: var(--soft); font-weight: 700; font-size: 13px; }
.files .f button { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line2); background: var(--bg); line-height: 1; padding: 0; }
.addfile { position: relative; overflow: hidden; }
.addfile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dur { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; }
.sheet .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border: 0; padding: 0; }

/* ─── Home check-up: body parts with ticks ─── */
.part { padding: 12px 0; border-bottom: 1px solid var(--line); }
.part .pn { font-weight: 700; margin-bottom: 4px; }
.ticks { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.ticks label { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 15px; }
.ticks input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); flex: none; }
.ed { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ed-head, .ed-opt { display: flex; gap: 6px; align-items: center; }
.ed-head input { font-weight: 700; }
.ed-head .unit { width: 72px; flex: none; }
.ed-opt { margin: 6px 0 0 18px; }
.ed-opt input { min-height: 40px; font-size: 15px; }
.ed .link { margin: 6px 0 0 18px; }
.ic { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: none; color: var(--sub); font-size: 17px; }
.ic:disabled { opacity: 0.3; }

/* ─── Calendar ─── */
.calhead, .dayhead { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center; margin: 4px 0 8px; text-align: center; }
.calhead .btn, .dayhead .btn { min-height: 44px; padding: 0; font-size: 20px; border-radius: 50%; }
.calhead b { font-size: 17px; }
/* Month grid */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; font-size: 15px; }
.cal .w { font-size: 11px; color: var(--sub); padding: 2px 0 4px; }
.cal .w.sun { color: var(--red); }
.cal button { border: 0; border-radius: 10px; background: none; padding: 6px 0 5px; min-height: 50px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); }
.cal button .dn { line-height: 1.2; font-variant-numeric: tabular-nums; }
.cal button .ms { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 8px; max-width: 38px; }
.cal button.has .dn { font-weight: 700; }
.cal button.szday { background: var(--red-soft); }
.cal button.today .dn { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.cal button.sel { background: var(--ink); color: var(--on-ink); }
.cal button:disabled { opacity: 0.3; }
/* Day marks: colour + shape, so they can be told apart without colour too */
.m { display: inline-block; width: 7px; height: 7px; border-radius: 50%; font-style: normal; }
.m.sz { background: var(--k-seizure); min-width: 7px; width: auto; height: auto; padding: 0 2px; font-size: 9px; line-height: 9px; color: #fff; font-weight: 700; border-radius: 5px; min-height: 9px; }
.m.vo { background: var(--k-vomit); }
.m.hc { border: 1.5px solid currentColor; background: none; }
.m.ph { border-radius: 1px; background: var(--sub); }
.m.me { width: 8px; height: 2px; border-radius: 1px; background: var(--sub); align-self: center; }
.cal button.sel .m.ph, .cal button.sel .m.me { background: var(--on-ink); }
.calkey { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--sub); margin: 10px 0 0; }
.calkey span { display: inline-flex; align-items: center; gap: 5px; }
.calkey .m.hc { color: var(--sub); }
/* The chosen day */
.dayhead { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.dayhead .d { position: relative; display: flex; flex-direction: column; align-items: center; }
.dayhead .d b { font-size: 18px; }
.dayhead .d b span { font-size: 12px; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--soft); vertical-align: 2px; }
.dayhead .d small { font-size: 12px; color: var(--sub); }
.dayhead input { position: absolute; inset: 0; opacity: 0; }

/* ─── Charts ─── */
.chart { width: 100%; display: block; overflow: visible; margin: 4px 0; }
.chart text { fill: var(--sub); font-size: 10.5px; font-family: var(--font); }
.chart text.lab { fill: var(--ink); font-size: 11.5px; font-weight: 700; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--sub); margin: 4px 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend i.ln { height: 2px; width: 14px; border-radius: 1px; }
.legend i.dt { border-radius: 50%; }
.checks-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.ck { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px; border: 1px solid var(--line2); border-radius: 999px; background: var(--bg); font-size: 13px; color: var(--sub); }
.ck .box { width: 14px; height: 14px; border: 1.5px solid var(--line2); border-radius: 4px; display: inline-grid; place-items: center; padding: 0; }
.ck .ln { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.ck .ln.dashed { background-image: linear-gradient(90deg, transparent 55%, var(--bg) 55%); background-size: 6px 2px; }
.ck[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); font-weight: 700; }
.ck[aria-pressed="true"] .box { background: var(--ink); border-color: var(--ink); }
.ck[aria-pressed="true"] .box::after { content: ""; width: 7px; height: 4px; border: 2px solid var(--on-ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.seg button { flex: 1; min-height: 38px; border: 0; background: none; font-size: 14px; color: var(--sub); padding: 0 6px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); font-weight: 700; }
.seg.small { display: inline-flex; }
.seg.small button { padding: 0 14px; font-size: 13px; min-height: 32px; white-space: nowrap; }
.note-box { font-size: 13px; color: var(--sub); background: var(--soft); border-radius: var(--r); padding: 10px 12px; line-height: 1.6; }
.cmp { display: grid; gap: 10px; }
.cmp .r { display: grid; grid-template-columns: 7em 1fr 3.5em; gap: 8px; align-items: center; font-size: 14px; }
.cmp .track { height: 12px; background: var(--soft); border-radius: 0 4px 4px 0; overflow: hidden; }
.cmp .fill { height: 100%; border-radius: 0 4px 4px 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--sub); font-weight: 500; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.mx th, table.mx td { text-align: center; white-space: nowrap; font-size: 13px; }
table.mx th:first-child, table.mx td:first-child { text-align: left; white-space: normal; min-width: 8.5em; }
.mk { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.scroll-x { overflow-x: auto; }
.tip {
  position: fixed; z-index: 70; pointer-events: none; background: var(--ink); color: var(--on-ink); font-size: 13px;
  padding: 7px 10px; border-radius: 10px; max-width: 240px; line-height: 1.5; white-space: pre-line;
}

/* ─── Settings ─── */
.box { padding: 4px 0 12px; border-bottom: 1px solid var(--line); }
.box .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border: 0; padding: 0; margin-top: 8px; }
.hist { font-size: 14px; }
.hist div { padding: 7px 0; border-bottom: 1px solid var(--line); }
.hist b { font-variant-numeric: tabular-nums; margin-right: 8px; font-weight: 500; color: var(--sub); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--soft); padding: 8px 10px; border-radius: 8px; word-break: break-all; }
.colors { display: flex; gap: 8px; }
.colors button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; }
.colors button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--bg); }
.member { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member .grow { flex: 1; font-weight: 700; }
.member .dot { margin: 0; width: 12px; height: 12px; }
.dev { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.dev .grow { flex: 1; }
.dev b { display: block; font-size: 15px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + var(--quick-h) + env(safe-area-inset-bottom) + 10px); z-index: 80;
  background: var(--ink); color: var(--on-ink); padding: 10px 8px 10px 16px; border-radius: 14px; width: max-content; max-width: calc(100% - 24px);
  display: flex; gap: 4px; align-items: center; font-size: 14px;
}
.toast .msg { flex: 1; padding-right: 6px; white-space: nowrap; }
.toast button { border: 0; background: none; color: var(--on-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 8px; white-space: nowrap; }

/* ─── 病院に見せる (printable) ─── */
.report {
  /* always the light colours: it is for paper */
  color-scheme: light; --ink: #222; --sub: #555; --line: #ddd; --line2: #bbb; --card: #fff; --soft: #f2f2f2; --bg: #fff; --on-ink: #fff;
  --k-pee: #c48600; --k-food: #2b6cd0; --k-poop: #8f4a1c; --k-med: #3a9a3e; --k-vomit: #b0459e; --k-seizure: #d8403a; --k-water: #139bab; --k-sleep: rgba(70, 80, 140, 0.13);
  position: fixed; inset: 0; z-index: 90; background: #fff; color: #222; overflow-y: auto; padding: calc(env(safe-area-inset-top) + 16px) 16px 40px; }
.report .bar { display: flex; gap: 8px; justify-content: flex-end; max-width: 820px; margin: 0 auto 10px; }
.report .page { max-width: 820px; margin: 0 auto; font-size: 13px; line-height: 1.55; }
.report h1 { font-size: 20px; margin: 0 0 2px; }
.report h2 { font-size: 15px; margin: 18px 0 6px; border-bottom: 1.5px solid #222; padding-bottom: 2px; color: #222; display: block; }
.report table.t th, .report table.t td { padding: 4px; }
.report .kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.report .kv div { border: 1px solid #ccc; border-radius: 6px; padding: 6px 8px; }
.report .kv b { display: block; font-size: 18px; }
@media print {
  body > *:not(.report) { display: none !important; }
  .report { position: static; padding: 0; overflow: visible; }
  .report .bar { display: none; }
  .report h2 { break-after: avoid; }
  .report svg, .report table { break-inside: avoid; }
}

/* かかりつけの病院: the call button is meant to be found in a hurry */
.vet { margin-top: 14px; padding: 14px; border-radius: var(--r); background: var(--soft); }
.vet .vh { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.vet .vn { font-weight: 700; font-size: 16px; }
.vet .vt { font-size: 14px; color: var(--sub); font-variant-numeric: tabular-nums; margin: 2px 0 10px; }
.btn.call { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; font-size: 17px; font-weight: 700; text-decoration: none;
  background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.call svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; flex: none; }
.btn.call span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .btn.call { margin-bottom: 16px; }
.sheet .btn.call.menu-call { margin: 16px 0 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.legend i.dash { width: 14px; height: 2px; border-radius: 0; background: repeating-linear-gradient(90deg, var(--ink) 0 4px, transparent 4px 7px); }

/* カレンダー: the day as a timetable */
.tt { border-top: 1px solid var(--line); }
.tt .hr { display: grid; grid-template-columns: 34px 6px 1fr; gap: 0 10px; border-bottom: 1px solid var(--line); min-height: 44px; }
.tt .hr.empty { min-height: 20px; }
.tt .hl { font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; text-align: right; padding-top: 3px; line-height: 1.2; }
.tt .hr.empty .hl { opacity: 0.6; font-size: 11px; padding-top: 2px; }
.tt .hs { position: relative; background: var(--soft); }
.tt .hs i { position: absolute; left: 0; right: 0; background: var(--k-sleep-bar); border-radius: 1px; }
.tt .he { min-width: 0; padding: 2px 0; }
.tt .ti { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: baseline; width: 100%; border: 0; background: none; padding: 7px 0; text-align: left; color: var(--ink); }
.tt .ti + .ti { border-top: 1px dashed var(--line); }
.tt .ti:active { background: var(--soft); }
.tt .ti .tm { font-size: 13px; color: var(--sub); font-variant-numeric: tabular-nums; }
.tt .ti .k { font-weight: 700; }
.tt .ti.sz .k { color: var(--red); }
.tt .ti .d { font-size: 13px; color: var(--sub); }
.tt .ti .note { display: block; font-size: 13px; white-space: pre-wrap; }
.tt .ti .by { font-size: 11px; color: var(--sub); white-space: nowrap; }
.stockbtns { display: flex; gap: 6px; flex: none; }
.row.care { align-items: center; }

/* ─── 見た目「ポップ」(設定で端末ごとに選ぶ。html[data-look="pop"]) ───
   Flat colours from the icon (apricot coat, navy bandana), navy outlines, buttons that press in.
   No gradients, no glass, no emoji. The record-kind colours (--k-*) stay as checked. */
:root[data-look="pop"] {
  --bg: #fff6ea; --card: #fff6ea; --soft: #ffe6c7; --ink: #29305a; --on-ink: #fff6ea; --sub: #7a6a64;
  --line: #f0dcc0; --line2: #29305a; --red: #c8402f; --red-soft: #ffe0d8;
  --pop: #f19a4b;         /* apricot: the dog's coat */
  --pop-soft: #ffd9b0;
  --q-pee: #ffe49a; --q-poop: #f2cfb2; --q-food: #cfe0ff; --q-water: #c4eef0;
  --r: 16px;
}
:root[data-look="pop"][data-theme="dark"] {
  --bg: #1c1d2e; --card: #1c1d2e; --soft: #2a2b42; --ink: #fbeedd; --on-ink: #1c1d2e; --sub: #b3a9a0;
  --line: #34354f; --line2: #8b8fbd; --red: #ff7a68; --red-soft: #45252a;
  --pop: #f19a4b; --pop-soft: #363a63;
  --q-pee: #4d4217; --q-poop: #4a3424; --q-food: #23345a; --q-water: #1a4146;
}
@media (prefers-color-scheme: dark) {
  :root[data-look="pop"][data-theme="auto"] {
    --bg: #1c1d2e; --card: #1c1d2e; --soft: #2a2b42; --ink: #fbeedd; --on-ink: #1c1d2e; --sub: #b3a9a0;
    --line: #34354f; --line2: #8b8fbd; --red: #ff7a68; --red-soft: #45252a;
    --pop: #f19a4b; --pop-soft: #363a63;
    --q-pee: #4d4217; --q-poop: #4a3424; --q-food: #23345a; --q-water: #1a4146;
  }
}
/* Header: the dog's name bigger, with an apricot underline */
[data-look="pop"] .top .dog { font-size: 25px; font-weight: 900; }
[data-look="pop"] .top .dog::after { content: ""; display: block; width: 44px; height: 5px; margin-top: 3px; border-radius: 3px; background: var(--pop); }
[data-look="pop"] .h, [data-look="pop"] .view h2 { color: var(--ink); font-size: 14px; font-weight: 900; }
/* Buttons: navy outline + a solid shadow that disappears when pressed */
[data-look="pop"] .btn, [data-look="pop"] .gear { border-width: 2px; border-color: var(--line2); box-shadow: 0 3px 0 var(--line2); }
[data-look="pop"] .btn:active:not(:disabled), [data-look="pop"] .gear:active { transform: translateY(3px); box-shadow: none; }
[data-look="pop"] .btn.primary { background: var(--pop); color: #29305a; border-color: var(--line2); }
[data-look="pop"] .btn.danger { border-color: var(--line2); }
[data-look="pop"] .btn.call { background: var(--ink); color: var(--on-ink); }
[data-look="pop"] .choices button { border-width: 2px; }
[data-look="pop"] .choices button[aria-pressed="true"] { background: var(--pop); color: #29305a; border-color: var(--line2); }
/* The everyday buttons: one colour per kind */
[data-look="pop"] .quick { border-top: 2px solid var(--line); }
[data-look="pop"] .quick button { border: 2px solid var(--line2); box-shadow: 0 3px 0 var(--line2); font-weight: 900; }
[data-look="pop"] .quick button:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
[data-look="pop"] .quick [data-quick="pee"] { background: var(--q-pee); }
[data-look="pop"] .quick [data-quick="poop"] { background: var(--q-poop); }
[data-look="pop"] .quick [data-quick="food"] { background: var(--q-food); }
[data-look="pop"] .quick [data-quick="water"] { background: var(--q-water); }
[data-look="pop"] .quick .plus { background: var(--pop); color: #29305a; }
/* Notices and the vet: filled apricot blocks */
[data-look="pop"] .notice { background: var(--pop-soft); border: 2px solid var(--line2); }
[data-look="pop"] .notice.alert { background: var(--red-soft); border-color: var(--red); }
[data-look="pop"] .vet { background: var(--pop-soft); border: 2px solid var(--line2); }
/* The day in numbers: separate tiles */
[data-look="pop"] .stats { border: 0; gap: 6px; }
[data-look="pop"] .stats div { background: var(--soft); border-radius: 12px; }
[data-look="pop"] .stats b { font-size: 23px; font-weight: 900; }
/* Bottom tabs: the current one sits on an apricot pill */
[data-look="pop"] .tabs { border-top: 2px solid var(--line); }
[data-look="pop"] .tabs button[aria-current="page"] svg { background: var(--pop-soft); border-radius: 999px; padding: 3px 16px; box-sizing: content-box; }
[data-look="pop"] .sheet { border-top: 3px solid var(--line2); }
[data-look="pop"] .sheet .head .x { background: var(--pop-soft); color: var(--ink); }
