:root {
  --bg: #ffffff;
  --ink: #111312;
  --soft: #6b716e;
  --line: #e7e9e8;
  --fill: #f5f6f5;
  --accent: #1f7a4d;
  --g1: #d5eadf;
  --g2: #9fd0b6;
  --g3: #58ad82;
  --g4: #1f7a4d;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main, #login, .notice {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 16px calc(48px + env(safe-area-inset-bottom));
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 14px; font-weight: 600; color: var(--soft); margin: 34px 0 10px; }

button, input { font: inherit; color: inherit; }

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ghost { background: none; color: var(--ink); font-weight: 500; padding: 8px 10px; }
.ghost:hover { background: var(--fill); }
.ghost:disabled { color: var(--line); cursor: default; background: none; }

.daynav { display: flex; align-items: center; gap: 2px; }
#daylabel { min-width: 132px; text-align: center; font-variant-numeric: tabular-nums; }

#add { display: flex; gap: 8px; }

input[type="text"], input[type="password"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  background: var(--bg);
}
input::placeholder { color: #9aa09d; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  background: var(--fill);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
}
.chip[aria-checked="true"] { background: var(--ink); color: #fff; }

#list { margin-top: 26px; }
.meal { margin-bottom: 18px; }
.meal h3 { font-size: 14px; font-weight: 600; color: var(--soft); margin: 0 0 2px; }
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.row .t { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: text; }
.row .time { color: var(--soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.row input { padding: 6px 9px; }
.row .del { background: none; color: var(--soft); padding: 4px 8px; font-size: 18px; line-height: 1; font-weight: 400; }
.row .del:hover { color: var(--ink); background: var(--fill); }
.empty { color: var(--soft); padding: 14px 0; }

.calhead { display: flex; align-items: center; justify-content: space-between; margin: 34px 0 10px; }
.calhead h2 { margin: 0; font-size: 16px; color: var(--ink); }
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 6px; }
.daycol {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  min-height: 150px;
  padding: 9px 7px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--ink);
  font-weight: 400;
  text-align: left;
}
.daycol .dname { font-size: 12px; color: var(--soft); }
.daycol .dnum { font-size: 17px; font-weight: 650; line-height: 1.1; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.daycol .line { font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.daycol .line.done { color: var(--accent); font-weight: 600; }
.daycol .foot { margin-top: auto; padding-top: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.daycol.today .dname { color: var(--accent); font-weight: 600; }
.daycol.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

#login { display: flex; flex-direction: column; gap: 10px; padding-top: 22vh; max-width: 340px; }
#login h1 { margin-bottom: 8px; }
#login input { flex: none; }
.error { color: #a4332b; font-size: 14px; margin: 0; min-height: 20px; }
.notice { color: var(--soft); padding-top: 22vh; }

[hidden] { display: none !important; }

.brand { display: flex; align-items: baseline; gap: 14px; }
.brand a, .back { color: var(--soft); font-size: 14px; font-weight: 500; text-decoration: none; }
.brand a:hover, .back:hover { color: var(--ink); }

.protein { margin-top: 22px; }
.protein-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
#proteintotal { font-weight: 600; }
#proteinleft { color: var(--soft); }
.bar { height: 6px; margin-top: 7px; border-radius: 999px; background: var(--fill); overflow: hidden; }
#proteinbar { height: 100%; width: 0; border-radius: 999px; background: var(--accent); }

.row .grams { font-size: 13px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.row .note { display: block; color: var(--soft); font-size: 13px; }
.row .t:not([title]) { cursor: default; }
.row .time.soon { color: #a35a00; font-weight: 600; }
.row .time.late { color: #a4332b; font-weight: 600; }

.inline { display: flex; gap: 8px; margin-top: 12px; }
.inline input[type="date"] { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); min-width: 0; }

.doc h2 { font-size: 17px; color: var(--ink); margin: 34px 0 8px; }
.doc p, .doc li { margin: 0 0 8px; }
.doc ol, .doc ul { padding-left: 22px; margin: 0; }
.doc table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.doc td, .doc th { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.doc td:last-child, .doc th:last-child { text-align: right; }
.doc tr:last-child td { font-weight: 600; border-bottom: 0; }
.doc th { color: var(--soft); font-size: 14px; }

.shoptotal { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; font-weight: 600; font-variant-numeric: tabular-nums; }
.shoptotal .ghost { font-size: 14px; color: var(--soft); }
.row input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.row.got .t, .row.got .price { color: var(--soft); text-decoration: line-through; }
.row .price { background: none; color: var(--ink); padding: 4px 6px; font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums; }
.row .price:hover { background: var(--fill); }
.row .priceedit, #buyprice { flex: none; width: 92px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; background: var(--bg); }
#buyprice { padding: 11px 10px; }

.row .when { flex: none; width: 74px; color: var(--soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.row .log { background: var(--fill); color: var(--ink); font-size: 13px; padding: 6px 13px; }
.row .log:hover { background: var(--line); }
.day h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.day .daytotal { color: var(--soft); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.day.now h2 { color: var(--accent); }

.shopweekly { margin: 0 0 6px; color: var(--soft); font-size: 14px; }

.weektop .calhead { margin-top: 0; }
.weektop { margin-bottom: 26px; }

/* Read only view: nothing that changes data is shown. The server refuses those requests as well. */
.ro #add, .ro #meals, .ro #oftenwrap, .ro .inline, .ro .del, .ro .log, .ro #untick { display: none !important; }
.ro .row .t, .ro .row .price { cursor: default; }
.ro .row .price:hover { background: none; }
