:root {
  --bg: #e8efec;
  --card: #ffffff;
  --text: #1c2624;
  --muted: #434e4b;
  --line: #d0dbd7;
  --field-line: #8a9b96;
  --primary: #17694a;
  --primary-soft: #dcefe5;
  --accent: #8e1b22;
  --on-primary: #ffffff;
  --danger: #c2410c;
  --good: #15803d;
  --ok: #65a30d;
  --mid: #ca8a04;
  --warn: #ea580c;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 3px 10px rgba(0, 0, 0, .07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1110;
    --card: #19211f;
    --text: #e6ecea;
    --muted: #b9c5c1;
    --line: #34423e;
    --field-line: #6b7d78;
    --primary: #4cbf8c;
    --primary-soft: #15342a;
    --on-primary: #06201a;
    --accent: #e0606a;
    --shadow: none;
  }
}

/* ===== bảng màu phụ: mỗi trang / loại nút một màu ===== */
:root {
  --c-orange: #c2410c; --c-orange-soft: #ffedd5;
  --c-amber: #b45309;  --c-amber-soft: #fef3c7;
  --c-teal: #0f766e;   --c-teal-soft: #ccfbf1;
  --c-blue: #1d4ed8;   --c-blue-soft: #dbeafe;
  --c-purple: #7c3aed; --c-purple-soft: #ede9fe;
  --c-slate: #475569;  --c-slate-soft: #e2e8f0;
  --c-green: #15803d;  --c-green-soft: #dcfce7;
  --c-red: #dc2626;    --c-red-soft: #fee2e2;
  --page: var(--primary); --page-soft: var(--primary-soft); --on-page: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-orange: #fb923c; --c-orange-soft: #3a2414;
    --c-amber: #fbbf24;  --c-amber-soft: #3a2e10;
    --c-teal: #2dd4bf;   --c-teal-soft: #10332f;
    --c-blue: #60a5fa;   --c-blue-soft: #172a46;
    --c-purple: #a78bfa; --c-purple-soft: #2a2145;
    --c-slate: #94a3b8;  --c-slate-soft: #252d38;
    --c-green: #4ade80;  --c-green-soft: #12301f;
    --c-red: #f87171;    --c-red-soft: #3a1717;
    --on-page: #0c1110;
  }
}
/* màu theo trang (body) và theo nút tab */
[data-page="menu"], [data-tab="menu"]         { --page: var(--c-orange); --page-soft: var(--c-orange-soft); }
[data-page="meal"], [data-tab="meal"]         { --page: var(--c-amber);  --page-soft: var(--c-amber-soft); }
[data-page="clean"], [data-tab="clean"]       { --page: var(--c-teal);   --page-soft: var(--c-teal-soft); }
[data-page="summary"], [data-tab="summary"]   { --page: var(--c-blue);   --page-soft: var(--c-blue-soft); }
[data-page="users"], [data-tab="users"]       { --page: var(--c-purple); --page-soft: var(--c-purple-soft); }
[data-page="settings"], [data-tab="settings"] { --page: var(--c-slate);  --page-soft: var(--c-slate-soft); }

* { box-sizing: border-box; }
:root { accent-color: var(--primary); color-scheme: light dark; }
::placeholder { color: var(--muted); opacity: .8; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden; overflow-x: clip; /* chốt an toàn: không cho trang bị kéo giãn ngang */
}
#app { max-width: 760px; margin: 0 auto; min-height: 100vh; padding-bottom: 84px; }
h2 { font-size: 18px; margin: 4px 0 12px; color: var(--page); }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* thanh trên */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; background: var(--primary); color: var(--on-primary);
  border-bottom: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 700; letter-spacing: .3px; font-size: 15px; }
.brand span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-sm { width: 38px; height: 38px; flex: none; border-radius: 50%; background: #fff; object-fit: contain; padding: 3px; }
.who { flex: none; max-width: 40%; font-size: 13px; opacity: .9; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who > * { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) {
  .topbar { padding: 10px 12px; }
  .brand { font-size: 14px; gap: 8px; }
  .who { font-size: 12px; }
  main { padding: 12px; }
}

main { padding: 16px; }

/* tab dưới */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; max-width: 152px; border: 0; background: none; color: var(--muted);
  margin: 4px 2px; padding: 4px 2px 6px; border-radius: 12px;
  font-size: 13px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
  transition: background .15s, color .15s;
}
.tabs button span { font-size: 20px; line-height: 1.2; opacity: .85; }
.tabs button.on { background: var(--page-soft); color: var(--page); font-weight: 700; }
.tabs button.on span { opacity: 1; }

/* thẻ */
.card { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--page); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.badge { font-size: 12px; background: var(--page-soft); color: var(--page); padding: 2px 8px; border-radius: 99px; font-weight: 600; }

.dishes { margin: 0; padding-left: 20px; }
.dishes li { padding: 1px 0; }
.meal-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 8px 0 2px; letter-spacing: .4px; }
.note { margin-top: 8px; padding: 8px 10px; background: var(--page-soft); border-radius: 10px; font-size: 14px; white-space: pre-wrap; }

/* nút & form */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--field-line); background: var(--card); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--card); }
/* nút phụ tô màu theo hành động (dựa vào data-do có sẵn trong app.js) */
.btn[data-do="pw"]                  { color: var(--c-orange); border-color: var(--c-orange); background: var(--c-orange-soft); }
.btn[data-do="role"]                { color: var(--c-purple); border-color: var(--c-purple); background: var(--c-purple-soft); }
.btn[data-do="active"][data-v="0"]  { color: var(--c-red);    border-color: var(--c-red);    background: var(--c-red-soft); }
.btn[data-do="active"][data-v="1"]  { color: var(--c-green);  border-color: var(--c-green);  background: var(--c-green-soft); }
.btn[data-do="name"] { color: var(--c-blue); border-color: var(--c-blue); background: var(--c-blue-soft); }
.btn[for="plib"] { color: var(--page); border-color: var(--page); background: var(--card); }
.btn:disabled { opacity: .6; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

label.f { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--field-line); border-radius: 10px; padding: 10px 12px;
}
/* iPhone: ô ngày tự vẽ rộng hơn khung, chữ căn giữa → ép theo khung, căn trái */
input[type=date], input[type=datetime-local] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; min-height: 44px; text-align: left;
}
input::-webkit-date-and-time-value { text-align: left; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--page); outline-offset: -1px; }
::selection { background: var(--page-soft); color: var(--text); }
textarea { resize: vertical; min-height: 72px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--field-line);
  background: var(--card); cursor: pointer; font-size: 14px; user-select: none;
}
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
/* nút chấm điểm trong form đánh giá: lưới đều, mỗi tiêu chí 1 khối, màu theo mức */
.chips.rate { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.chips.rate:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, 1fr); }
.chips.rate .chip span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; height: 100%; padding: 8px 10px; border-radius: 12px; font-weight: 500; }
.chips.rate .chip[data-tone="good"] input:checked + span { background: var(--good); border-color: var(--good); color: #fff; }
.chips.rate .chip[data-tone="ok"] input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.chips.rate .chip[data-tone="mid"] input:checked + span { background: var(--mid); border-color: var(--mid); color: #1c2624; }
.chips.rate .chip[data-tone="warn"] input:checked + span { background: var(--warn); border-color: var(--warn); color: #fff; }
.chips.rate .chip[data-tone="bad"] input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.chips.rate .chip input:checked + span { font-weight: 700; }

.seg { display: flex; background: var(--card); border: 1px solid var(--field-line); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--page); color: var(--on-page); box-shadow: var(--shadow); }

.weekbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.weekbar .btn { min-width: 44px; }

.edit-day { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.edit-day:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid2 input, .grid3 input { padding: 8px 10px; font-size: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr; } }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.thumb { position: relative; }
.cell-photos .thumbs { margin: 0; flex-wrap: nowrap; gap: 4px; }
.cell-photos .thumbs img { width: 44px; height: 44px; border-radius: 6px; }
.thumb button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-size: 13px; line-height: 22px; padding: 0; cursor: pointer; }

/* tổng hợp */
.range { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.crit { margin-bottom: 14px; }
.crit-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--line); gap: 2px; }
.bar i { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend b { color: var(--text); font-weight: 600; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.c-good { background: var(--good); } .c-ok { background: var(--ok); } .c-mid { background: var(--mid); }
.c-warn { background: var(--warn); } .c-bad { background: var(--bad); }
/* bấm dải màu / chú thích để xem chi tiết */
.bar i[data-crit], .legend .pick { cursor: pointer; }
.bar:has(.sel) i:not(.sel) { opacity: .35; }
.legend .pick { border-radius: 6px; padding: 1px 4px; margin: -1px -4px; }
.legend .pick:hover { background: var(--line); }
.legend .pick.sel { background: var(--line); color: var(--text); }
.crit-pop { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.crit-pop .pop-head { margin-bottom: 4px; }
.pop-row { padding: 6px 0; border-top: 1px solid var(--line); }
.pop-row .row { justify-content: space-between; }

.comment { padding: 10px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; padding-top: 0; }
.comment p { margin: 2px 0 0; white-space: pre-wrap; }

.tbl-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }

.list-item { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 140px; }
.off { opacity: .5; }

/* đăng nhập */
.login { max-width: 360px; margin: 8vh auto 0; }
.login .logo-lg { display: block; width: 140px; height: 140px; margin: 0 auto; border-radius: 16px; background: #fff; object-fit: contain; padding: 6px; }
.login h1 { text-align: center; font-size: 20px; margin: 10px 0 20px; color: var(--accent); }

.loading, .empty { text-align: center; color: var(--muted); padding: 24px 0; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: #1c2624; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--bad); }

/* Điện thoại: chữ ô nhập 16px để iPhone không tự phóng to khi bấm vào ô */
@media (pointer: coarse) {
  input, select, textarea, .grid2 input, .grid3 input { font-size: 16px; }
}

/* ===== lịch chọn ngày/giờ (flatpickr): màu theo trang, hợp giao diện tối ===== */
input.date-pick { min-height: 44px; cursor: pointer; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2364716e' stroke-width='2' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right: 38px !important; }
/* ===== lịch kiểu iPhone: hộp xám rất nhạt bo lớn, chữ to, màu nhấn xanh iPhone ===== */
:root { --ios: #007aff; --ios-pop: #f7f7f9; --ios-fill: rgba(118, 118, 128, .12); --ios-gray: #8e8e93; --cal-hover: rgba(118, 118, 128, .12); }
@media (prefers-color-scheme: dark) { :root { --ios: #0a84ff; --ios-pop: #2c2c2e; --ios-fill: rgba(118, 118, 128, .24); --cal-hover: rgba(118, 118, 128, .24); } }
.flatpickr-calendar {
  background: var(--ios-pop); color: var(--text); border: 0; border-radius: 22px; padding: 10px 12px 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .06);
  width: calc(307.875px + 24px); font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}
.flatpickr-calendar::before, .flatpickr-calendar::after { display: none; }
.flatpickr-months { padding: 4px 0 10px; }
.flatpickr-months .flatpickr-month { height: 40px; color: var(--text); fill: var(--text); overflow: visible; }
.flatpickr-current-month { left: 0; width: auto; padding: 9px 0 0 6px; font-size: 17px; font-weight: 600; display: flex; align-items: baseline; gap: 5px; }
.flatpickr-current-month span.cur-month { margin: 0; font-weight: 600; color: var(--text); }
.flatpickr-current-month span.cur-month:hover { background: none; }
.flatpickr-current-month .numInputWrapper { width: auto; display: inline-flex; align-items: baseline; gap: 5px; }
.flatpickr-current-month .numInputWrapper::before { content: "năm"; font-weight: 600; }
.flatpickr-current-month .numInputWrapper:hover { background: none; }
.flatpickr-current-month .numInputWrapper span { display: none; }
.flatpickr-current-month input.cur-year { width: 4.4ch; padding: 0; font-weight: 600; color: var(--text); background: transparent; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { top: 4px; padding: 10px; color: var(--ios); fill: var(--ios); border-radius: 50%; }
.flatpickr-months .flatpickr-prev-month { left: auto !important; right: 46px; }
.flatpickr-months .flatpickr-next-month { right: 4px; }
.flatpickr-months .flatpickr-prev-month svg, .flatpickr-months .flatpickr-next-month svg { width: 18px; height: 18px; }
.flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { background: var(--ios-fill); }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: var(--ios); }
span.flatpickr-weekday { color: var(--ios-gray); font-size: 11px; font-weight: 600; background: transparent; white-space: nowrap; }
.flatpickr-day { color: var(--text); border: 0; border-radius: 50%; font-size: 20px; font-weight: 400; max-width: 40px; flex-basis: 40px; height: 40px; line-height: 40px; margin: 2px calc((14.2857% - 40px) / 2); }
.flatpickr-day:hover, .flatpickr-day:focus { background: var(--ios-fill); color: var(--text); }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { visibility: hidden; }
.flatpickr-day.today { color: var(--ios); background: none; font-weight: 500; }
.flatpickr-day.today:hover { background: var(--ios-fill); color: var(--ios); }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.selected:focus, .flatpickr-day.selected.today { background: var(--ios); color: #fff; font-weight: 600; }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover { color: var(--ios-gray); opacity: .45; background: none; }
/* ===== ô chọn xổ xuống (select): màu theo trang =====
   Ô khi đóng: mọi trình duyệt. Danh sách khi mở: Chrome/Edge mới (appearance: base-select);
   trình duyệt khác giữ danh sách của hệ điều hành (iPhone: bánh xe chọn). */
select {
  -webkit-appearance: none; appearance: none; min-height: 44px; cursor: pointer;
  border-color: var(--field-line); background-color: var(--card); color: var(--text); font-weight: 400;
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--page) 50%), linear-gradient(135deg, var(--page) 50%, transparent 50%);
  background-position: right 20px center, right 14px center; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
/* mọi ô nhập cùng một kiểu: rê chuột / bấm vào thì viền màu trang */
input[type=text]:hover, input[type=password]:hover, select:hover, textarea:hover { border-color: var(--page); }
select:focus { outline: 2px solid var(--page); }
select option { background: var(--card); color: var(--text); font-weight: 500; }
select option:checked { background: var(--page); color: var(--on-page); }
@supports (appearance: base-select) {
  select, ::picker(select) { appearance: base-select; }
  select { background-image: none; padding-right: 12px; display: flex; align-items: center; }
  select::picker-icon { color: var(--page); transition: rotate .2s; }
  select:open::picker-icon { rotate: 180deg; }
  ::picker(select) {
    border: 1px solid var(--field-line); border-top: 3px solid var(--page); border-radius: 12px;
    background: var(--card); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 4px; margin-top: 4px;
  }
  select option { padding: 9px 12px; border-radius: 8px; font-weight: 500; }
  select option:hover, select option:focus-visible { background: var(--page-soft); color: var(--page); outline: none; }
  select option:checked { background: var(--page); color: var(--on-page); font-weight: 700; }
  select option::checkmark { color: inherit; }
  select option:first-child { color: var(--muted); }
  select option:first-child:checked { background: var(--page-soft); color: var(--muted); }
}

/* điện thoại: lịch bật ngay dưới ô nhập (như iPhone), canh 2 mép màn hình để không lệch */
@media (max-width: 600px) {
  .flatpickr-calendar.open:not(.noCalendar) { left: 16px !important; right: 16px !important; width: auto !important; max-width: none !important; z-index: 50; }
  .flatpickr-calendar::before, .flatpickr-calendar::after { display: none !important; }
  .flatpickr-calendar .flatpickr-innerContainer, .flatpickr-calendar .flatpickr-rContainer { display: block; width: 100%; }
  .flatpickr-calendar .flatpickr-days { width: 100% !important; }
  .flatpickr-calendar .dayContainer { width: 100%; min-width: 100%; max-width: 100%; }
  .flatpickr-calendar .flatpickr-weekdaycontainer { display: flex; }
  .flatpickr-calendar span.flatpickr-weekday { flex: 1; }
  .flatpickr-calendar .flatpickr-day { max-width: 40px; flex-basis: 40px; height: 40px; line-height: 40px; margin: 2px calc((14.2857% - 40px) / 2); font-size: 20px; }
}

/* bánh xe chọn giờ (addTimeWheel trong app.js): cuộn dừng đúng số, dải chọn ở giữa */
.flatpickr-calendar.has-wheel .flatpickr-time { display: none !important; }
.wheel { position: relative; display: flex; justify-content: center; align-items: center; gap: 6px; padding: 4px 0; margin-top: 6px; border-top: 1px solid var(--line); }
.wheel-band { position: absolute; left: 16px; right: 16px; top: 50%; height: 36px; transform: translateY(-50%); background: var(--cal-hover); border-radius: 10px; pointer-events: none; }
.wheel-col {
  position: relative; z-index: 1; width: 72px; height: 172px; overflow-y: scroll; scroll-snap-type: y mandatory;
  scrollbar-width: none; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-col::before, .wheel-col::after { content: ""; display: block; height: 68px; }
.wheel-col > div { height: 36px; line-height: 36px; text-align: center; font-size: 20px; color: var(--text); scroll-snap-align: center; cursor: pointer; user-select: none; font-variant-numeric: tabular-nums; }
.wheel-sep { position: relative; z-index: 1; font-size: 20px; font-weight: 600; }
.wheel-group { display: flex; flex-direction: column; align-items: center; }
.wheel-col:focus-visible { outline: 2px solid var(--page); outline-offset: -2px; border-radius: 10px; }
.wheel-btn { display: none; width: 72px; height: 26px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 11px; cursor: pointer; }
.wheel-btn:hover { background: var(--cal-hover); color: var(--page); }
.wheel-btn:active { background: var(--page-soft); }
@media (hover: hover) and (pointer: fine) { .wheel-btn { display: block; } .wheel-col { cursor: grab; } }

/* ô ngày + giờ kiểu iPhone: 2 viên thuốc, ô đang mở chữ màu trang */
.dt-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.dt-pill {
  border: 0; border-radius: 10px; background: rgba(120, 120, 128, .14); color: var(--text);
  font: inherit; font-size: 17px; min-height: 44px; padding: 8px 16px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.dt-pill:hover { background: rgba(120, 120, 128, .2); }
.dt-pill.on { color: var(--page); }
.dt-pill:focus-visible { outline: 2px solid var(--page); outline-offset: 2px; }
/* hộp chỉ có bánh xe giờ: gọn, không viền trên */
.flatpickr-calendar.noCalendar { width: 220px; padding: 4px; }
.flatpickr-calendar.noCalendar .wheel { border-top: 0; margin-top: 0; }

/* ===== bánh xe giờ + ô viên thuốc kiểu iPhone ===== */
.flatpickr-calendar.noCalendar { width: 230px; padding: 8px; background: var(--ios-pop); }
.wheel-band { left: 10px; right: 10px; height: 38px; background: var(--ios-fill); border-radius: 9px; }
.wheel-col > div { font-size: 22px; font-weight: 400; color: var(--text); }
.wheel-col:focus-visible { outline-color: var(--ios); }
.wheel-group + .wheel-group { margin-left: 18px; }
.wheel-btn { color: var(--ios-gray); opacity: .7; }
.wheel-btn:hover { background: var(--ios-fill); color: var(--ios); opacity: 1; }
.wheel-btn:active { background: var(--ios-fill); }
.dt-pill { background: var(--ios-fill); color: var(--text); font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
.dt-pill:hover { background: rgba(118, 118, 128, .2); }
.dt-pill.on { color: var(--ios); }
.dt-pill:focus-visible { outline-color: var(--ios); }
/* 2 ô ngày cạnh nhau (Báo cáo): chia đều, 1 dòng */
.row:has(> .dt-pill.short) { flex-wrap: nowrap; }
.dt-pill.short { flex: 1 1 0; min-width: 0; font-size: 15px; padding: 8px 10px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* trang Tài khoản: máy tính nút nằm ngang; điện thoại ẩn nút, bấm ⋯ / tên để mở lưới 2×2 */
.u-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.u-more { display: none; }
@media (max-width: 600px) {
  .u-row { flex-wrap: wrap; }
  .u-row > .grow { min-width: 0; cursor: pointer; }
  .u-row > .grow > .muted { display: block; }
  .u-more { display: inline-flex; font-size: 20px; line-height: 1; padding: 6px 14px; }
  .u-row .u-actions { display: none; width: 100%; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 4px; }
  .u-row.open .u-actions { display: grid; }
  .u-row .u-actions .btn { min-height: 42px; font-size: 14px; }
  .u-row.open .u-more { background: var(--page-soft); color: var(--page); border-color: var(--page); }
}

/* ===== khối chấm điểm nổi bật (Bữa ăn, Vệ sinh → Đánh giá) ===== */
.crit-box { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--page-soft); border: 1.5px solid transparent; transition: border-color .2s; }
.crit-box.miss { border-color: var(--bad); background: var(--c-red-soft); }
.crit-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 16px; font-weight: 700; color: var(--text); }
.crit-no { font-size: 12px; font-weight: 600; color: var(--page); background: var(--card); padding: 2px 8px; border-radius: 99px; }
.crit-box .chips.rate { padding-bottom: 0; border-bottom: 0; }
/* nút chưa chọn: chấm màu theo mức + viền nhạt cùng màu */
.chips.rate .chip span { gap: 8px; background: var(--card); }
.chips.rate .chip span::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--tone, var(--field-line)); }
.chips.rate .chip[data-tone="good"] { --tone: var(--good); }
.chips.rate .chip[data-tone="ok"]   { --tone: var(--ok); }
.chips.rate .chip[data-tone="mid"]  { --tone: var(--mid); }
.chips.rate .chip[data-tone="warn"] { --tone: var(--warn); }
.chips.rate .chip[data-tone="bad"]  { --tone: var(--bad); }
.chips.rate .chip span { border-color: color-mix(in srgb, var(--tone, var(--field-line)) 45%, var(--field-line)); }
/* đã chọn: tô đặc (quy tắc cũ) + dấu ✓ thay cho chấm */
.chips.rate .chip input:checked + span::before { content: "✓"; width: auto; height: auto; background: none; font-weight: 800; }

/* ===== form trắng sạch: nhãn là tiêu đề mục có vạch màu trang, bỏ nền màu khối tiêu chí ===== */
label.f, .crit-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--text);
  margin: 20px 0 8px; padding-left: 10px; border-left: 3px solid var(--page); line-height: 1.25;
}
form > label.f:first-child, .card > label.f:first-child, .row:first-child .grow > label.f:first-child { margin-top: 2px; }
.crit-box { margin-top: 0; padding: 0 0 16px; background: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.crit-box .crit-title { margin-top: 20px; }
.crit-no { background: none; padding: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.crit-box.miss { background: none; border-color: var(--line); }
.crit-box.miss .crit-title { border-left-color: var(--bad); color: var(--bad); }
.crit-box.miss .chip span { border-color: var(--bad); }
.note { background: var(--bg); border-left: 3px solid var(--page); border-radius: 8px; color: var(--text); }
