@font-face { font-family: "Atkinson"; src: url("/fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #FBF7EF; --card: #FFFFFF; --ink: #1C1B19; --muted: #514C43; --line: #D9D1C1;
  --green: #1F6B45; --green-dark: #164F33; --blue: #1D4F91; --blue-dark: #153A6B;
  --amber-bg: #FFF1C9; --amber-line: #C98A00; --amber-btn: #F2B705; --red: #B3261E;
  --radius: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Atkinson", -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 20px; line-height: 1.4;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
}
body.no-scroll { overflow: hidden; }
main, header { max-width: 760px; margin: 0 auto; }
h1 { font-size: 26px; margin: 0; }
h2 { font-size: 22px; margin: 0 0 10px; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { padding: 14px 0 6px; }
.top-row, .day-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.day-row { margin-top: 4px; }
.day-label { font-size: 22px; font-weight: 700; color: var(--green-dark); }
.small-link { color: var(--muted); font-size: 18px; padding: 12px 4px; min-height: 48px; display: inline-flex; align-items: center; }

/* buttons */
.btn-big, .btn-mid {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  border: 0; border-radius: var(--radius); cursor: pointer; font-weight: 700; text-align: center;
  -webkit-tap-highlight-color: transparent; user-select: none; text-decoration: none;
}
.btn-big { min-height: 76px; font-size: 26px; padding: 14px 18px; }
.btn-mid { min-height: 58px; font-size: 20px; padding: 10px 14px; }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 4px 0 var(--blue-dark); }
.btn-amber { background: var(--amber-btn); color: #1C1B19; box-shadow: 0 3px 0 #A87400; }
.btn-plain { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.btn-big:active, .btn-mid:active { transform: translateY(3px); box-shadow: none; }
button:disabled { opacity: .55; cursor: default; transform: none !important; }
.btn-quiet {
  background: none; border: 0; color: var(--blue); text-decoration: underline; font-size: 19px;
  min-height: 48px; padding: 8px 6px; cursor: pointer;
}
:focus-visible { outline: 4px solid #2F7DE1; outline-offset: 3px; }
.plus { font-size: 40px; line-height: 0; margin-top: -4px; }

.add { margin: 14px 0 6px; }
.hint { color: var(--muted); font-size: 18px; margin: 8px 2px 0; }
.desktop-only { text-align: center; }
body.touch .desktop-only { display: none; }

.notice { background: #EAF2FB; border: 2px solid #9DBBE0; border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; }
.progress { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; }
.prog-text { margin: 0 0 10px; font-weight: 700; font-size: 21px; }
.bar { height: 16px; border-radius: 99px; background: #ECE6DA; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--green); transition: width .4s; }
.warn-text { color: #7A3E00; font-weight: 700; margin: 12px 0 10px; }

.styles, .save { margin: 22px 0 0; }
.style-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.style-btn {
  background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-height: 64px;
}
.style-btn img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: bottom; border-radius: 8px; background: #eee; }
.style-btn.on { border-color: var(--green); background: #E7F3EC; box-shadow: 0 0 0 2px var(--green); }
.style-name { font-weight: 700; font-size: 17px; line-height: 1.2; padding: 2px 0 4px; }
.groups { display: grid; gap: 12px; margin-top: 12px; }
.group-btn.did { background: #E7F3EC; color: var(--green-dark); box-shadow: none; border: 2px solid var(--green); }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 26px 0 12px; background: #ECE6DA; padding: 6px; border-radius: 16px; position: sticky; top: 0; z-index: 5; }
.tab { border: 0; background: transparent; border-radius: 12px; min-height: 60px; font-weight: 700; font-size: 18px; line-height: 1.15; padding: 6px; cursor: pointer; }
.tab.on { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.tab.has-check { color: #7A4B00; }
.count { display: inline-block; }
.all-good { background: #E7F3EC; border: 2px solid #9BC9AE; border-radius: var(--radius); padding: 16px; font-weight: 700; }

.cards { display: grid; gap: 22px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 14px; box-shadow: 0 2px 10px rgba(60,40,0,.06); }
.card.is-check { border-color: var(--amber-line); border-width: 3px; }
.card.is-done { border-color: #9BC9AE; }
.flag { background: var(--amber-bg); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.flag-text { margin: 0 0 10px; font-weight: 700; color: #5E3B00; }
.working { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--muted); padding: 4px 2px 12px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 4px solid #D9D1C1; border-top-color: var(--green); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pic { display: block; width: 100%; padding: 0; border: 0; background: #F1ECE2; border-radius: 14px; overflow: hidden; cursor: zoom-in; position: relative; }
.pic img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #F1ECE2; }
.done-badge { position: absolute; top: 10px; left: 10px; background: var(--green); color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 99px; }
.taken { color: var(--muted); font-size: 18px; margin: 12px 2px 6px; }

.field { display: block; margin-top: 14px; }
.lab { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin-bottom: 6px; font-size: 19px; }
.tick { font-weight: 700; font-size: 17px; color: var(--green); min-height: 1em; }
.tick.retry { color: #7A3E00; }
textarea, input[type=text] {
  width: 100%; border: 2px solid #B9B0A0; border-radius: 14px; background: #fff; padding: 12px 14px;
  font-size: 21px; min-height: 58px; line-height: 1.3; resize: none;
}
textarea[data-field=title] { font-weight: 700; font-size: 22px; overflow: hidden; }
textarea:focus, input:focus { border-color: var(--blue); outline: 3px solid #BFD6F5; }
.pound-wrap { display: flex; align-items: center; gap: 0; }
.pound { font-size: 30px; font-weight: 700; padding: 0 10px 0 4px; }
.price-field input { font-size: 30px; font-weight: 700; max-width: 220px; }

.mode { margin-top: 14px; }
.mode-q { margin: 0 0 8px; font-weight: 700; }
.mode-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-btn {
  min-height: 64px; border-radius: 16px; border: 3px solid var(--line); background: #fff; font-weight: 700;
  font-size: 21px; cursor: pointer; padding: 8px;
}
.mode-btn.on { border-color: var(--green); background: var(--green); color: #fff; }
.mode-btn.on::before { content: "✓ "; }

.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 18px; }
.three .btn-mid { font-size: 19px; padding: 8px 6px; }
.done-btn.is-on { background: #E7F3EC; color: var(--green-dark); box-shadow: none; border: 3px solid var(--green); }

.more { margin-top: 12px; border-top: 2px dashed var(--line); padding-top: 4px; }
.more summary { cursor: pointer; color: var(--blue); text-decoration: underline; font-size: 19px; min-height: 48px; display: flex; align-items: center; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: " ▾"; text-decoration: none; margin-left: 6px; }
.more[open] summary::after { content: " ▴"; }
.more-actions { display: grid; gap: 10px; margin-top: 10px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.step { width: 64px; height: 58px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-size: 32px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.qty { font-size: 30px; font-weight: 700; min-width: 48px; text-align: center; }

.tidy { margin: 28px 0 0; display: grid; gap: 8px; justify-items: center; }
.tidy .btn-mid { max-width: 420px; }
.nothing { text-align: center; color: var(--muted); margin: 40px 0; font-size: 21px; }

.drop-shade { position: fixed; inset: 0; background: rgba(31,107,69,.85); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; z-index: 50; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 58; }
.modal-box { background: #fff; border-radius: 22px; padding: 22px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal-buttons, .day-list { display: grid; gap: 12px; margin-top: 16px; }
.day-btn.current { border-color: var(--green); }
.viewer { position: fixed; inset: 0; background: #111; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; cursor: zoom-out; }
.viewer img { max-width: 100%; max-height: calc(100vh - 70px); object-fit: contain; }
.viewer-hint { color: #ddd; margin: 12px 0 0; font-size: 19px; }

@media (min-width: 900px) {
  main, header { max-width: 1240px; }
  .add, .styles, .save, #aiOff, .progress { max-width: 760px; margin-left: auto; margin-right: auto; }
  .tabs { max-width: 760px; margin-left: auto; margin-right: auto; }
  .cards { grid-template-columns: repeat(2, 1fr); align-items: start; }
  .all-good { max-width: 760px; margin: 0 auto; }
}
@media (min-width: 1300px) { .cards { grid-template-columns: repeat(3, 1fr); } }

/* library, batch line, progress rows */
.lib-btn { margin-top: 12px; }
.lib-banner { background: #EAF2FB; border: 2px solid #9DBBE0; border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.lib-banner p { margin: 0 0 10px; }
.batch-line { font-size: 21px; margin: 22px 0 0; color: var(--green-dark); }
.prow + .prow { margin-top: 14px; }
.mini-text { margin: 0 0 8px; font-weight: 700; font-size: 20px; }
.mini-prog { margin-top: 12px; }
.card-prog { margin: 10px 0 0; }
.card-prog .mini-text { font-size: 18px; color: var(--muted); }
.card-prog .bar { height: 12px; }
.bar > div { transition: width .2s linear; }
.dates { color: var(--muted); font-size: 16px; margin: 8px 2px 0; }
.viewer-prog { width: min(420px, 90vw); }
.viewer-prog .mini-text { color: #eee; }
.library { position: fixed; inset: 0; background: var(--bg); z-index: 45; overflow: auto; padding: 16px 16px 40px; }
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 760px; margin: 0 auto; }
.lib-head .btn-mid { width: auto; padding: 8px 22px; }
.library > .hint { max-width: 760px; margin: 6px auto 14px; }
.lib-list { display: grid; gap: 16px; max-width: 760px; margin: 0 auto; }
.lib-card { background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 14px; }
.lib-card h3 { margin: 0; font-size: 22px; }
.lib-count { margin: 4px 0 10px; color: var(--muted); }
.lib-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.lib-thumbs img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; background: #eee; }
.lib-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lib-btns .btn-mid { font-size: 18px; }
textarea[data-field=post_text] { font-size: 19px; overflow: hidden; }
.post-hint { color: var(--muted); font-size: 16px; margin: 6px 2px 10px; }
.copy-btn.is-copied, .copy-all.is-copied { border-color: var(--green); color: var(--green-dark); }
.copy-all { margin-top: 12px; }
.styles-bottom { margin-top: 30px; }
.batch-line { font-size: 19px; }
.size-field input { font-size: 26px; font-weight: 700; max-width: 260px; }
.size-field.is-missing input { border-color: var(--amber-line); background: var(--amber-bg); border-width: 3px; }
.size-field.is-missing .lab::after { content: "Please add the size"; color: #7A4B00; font-size: 17px; }
.download-btn { margin-top: 16px; font-size: 28px; }
.download-btn.did { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.card.is-done .done-btn { font-size: 17px; }
.del-row { display: flex; justify-content: flex-end; margin-top: 14px; }
.btn-del { background: #fff; color: var(--red); border: 2px solid var(--red); border-radius: 14px; min-height: 48px; padding: 6px 16px; font-weight: 700; font-size: 18px; cursor: pointer; }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 4px 0 #7E1A14; }
.undo-bar { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; z-index: 55;
  background: #1C1B19; color: #fff; border-radius: 16px; padding: 10px 12px 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; font-size: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.undo-link { background: #fff; color: #1C1B19; border: 0; border-radius: 12px; min-height: 48px; padding: 6px 22px; font-weight: 700; font-size: 20px; cursor: pointer; }
.lib-card .del-row { margin-top: 10px; }
.size-row { display: flex; gap: 10px; align-items: center; }
.size-row input { flex: 1; min-width: 0; }
.nosize-btn { width: auto; flex: none; font-size: 18px; padding: 8px 16px; }
