:root {
  --bg: #f7f7f4;
  --card: #ffffff;
  --ink: #2c2b27;
  --soft: #8a857c;
  --accent: #2f8f8a;
  --accent-ink: #ffffff;
  --accent-soft: #e1f0ef;
  --line: #ecece7;
  --bad-ink: #b1502e;
  --bad-soft: #faeae2;
  --field: #f2f1ec;
  --shadow: 0 2px 10px rgba(40, 36, 30, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Albert Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: "Fraunces", Georgia, serif; margin: 0; font-weight: 600; text-wrap: balance; }

a { color: var(--accent); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.page { max-width: 420px; margin: 0 auto; padding: 60px 18px; }
.page.wide { max-width: 760px; }

.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 26px 26px 28px; }

.card h1 { font-size: 24px; margin-bottom: 6px; }
.card .lede { color: var(--soft); font-size: 13.5px; margin-bottom: 22px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: none;
  background: var(--field); color: var(--ink); font-family: inherit; resize: vertical;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { font-size: 12px; color: var(--soft); margin-top: 5px; }

.btn {
  display: inline-block; border: none; border-radius: 10px; padding: 11px 18px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { opacity: .9; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--bad-ink); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 18px; }
.alert.error { background: var(--bad-soft); color: var(--bad-ink); }
.alert.ok { background: var(--accent-soft); color: var(--accent); }

.links { margin-top: 18px; font-size: 13px; color: var(--soft); display: flex; justify-content: space-between; gap: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.pill.admin { background: var(--accent-soft); color: var(--accent); }
.pill.pending { background: var(--bad-soft); color: var(--bad-ink); }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.topbar .who { font-size: 13.5px; color: var(--soft); }

/* ===================== dashboard ===================== */

.page.dashboard { max-width: 640px; }

.top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 26px; }
.top .greet { font-family: "Fraunces", Georgia, serif; font-size: 25px; font-weight: 600; }

.karma { font-family: "Albert Sans", sans-serif; font-weight: 700; font-size: 13px; margin-left: 7px; cursor: default; vertical-align: middle; }
.top .greet .karma { font-size: 15px; }
.karma-great { color: #3f8f5c; }
.karma-good  { color: #7a9f4a; }
.karma-mid   { color: #b98f2e; }
.karma-bad   { color: #c07a3a; }
.karma-rough { color: #c24f4f; }
.top .date { font-size: 13px; color: var(--soft); }

section { margin-top: 32px; }
section > h2 { font-family: "Fraunces", Georgia, serif; font-size: 20px; margin-bottom: 12px; font-weight: 600; }

/* ---- bins: per-bin queue position ---- */
.bin-columns { display: grid; grid-template-columns: 1fr; gap: 20px; min-width: 0; }
@media (min-width: 560px) {
  .bin-columns { grid-template-columns: 1fr 1fr; }
}
.bin-columns > div { min-width: 0; }
.bin-col-title {
  font-family: "Albert Sans", sans-serif; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--soft); font-weight: 700; margin: 0 0 8px 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bin-row { display: flex; flex-direction: column; gap: 7px; padding: 13px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.bin-row:last-child { border-bottom: none; }
.bin-id { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; min-width: 0; }
.bin-id .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.bin-id .bin-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot.green { background: #4f8d5e; } .dot.plastic { background: #c68a42; }
.dot.paper { background: #4d70aa; } .dot.rest { background: #837c85; }
.bin-sub { font-size: 11.5px; color: var(--soft); margin-left: 20px; }
.bin-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-left: 20px; }
.bin-foot-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bin-pos { font-size: 12.5px; color: var(--soft); }
.bin-pos.next { color: var(--accent); font-weight: 700; }
.bin-info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  font-size: 13px; line-height: 1; color: var(--soft); text-decoration: none;
}
.bin-info-btn:hover { background: var(--field); color: var(--ink); }
.bin-mark {
  border: none; background: transparent; color: var(--soft); border-radius: 20px;
  padding: 7px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; flex: none;
}
.bin-mark:hover { background: var(--field); color: var(--ink); }
.bin-mark.primary { background: var(--accent); color: var(--accent-ink); }
.bin-mark.primary:hover { background: var(--accent); opacity: .9; }

/* ---- reveal buttons (mark extra task / add to list) ---- */
details.reveal summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13.5px;
  padding: 11px 18px; border-radius: 20px;
}
details.reveal summary::-webkit-details-marker { display: none; }
details.reveal summary::after { content: "+"; font-size: 15px; }
details.reveal[open] summary::after { content: "\2212"; }
details.reveal summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
details.reveal[open] summary { border-radius: 20px 20px 0 0; }
.reveal-panel { background: var(--card); border-radius: 0 14px 14px 14px; box-shadow: var(--shadow); padding: 6px 18px 6px; margin-top: -1px; }
details.reveal[open] .reveal-panel { padding: 10px 18px 14px; }

/* ---- extra task tiles ---- */
.extra-grid { display: grid; grid-template-columns: 1fr; gap: 12px; min-width: 0; }
@media (min-width: 560px) {
  .extra-grid { grid-template-columns: 1fr 1fr; }
}
.extra-tile { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.extra-top { margin-bottom: 8px; overflow: hidden; }
.extra-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.extra-mark {
  border: none; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 12.5px; padding: 8px 14px; cursor: pointer; margin-bottom: 10px;
}
.extra-mark:hover { opacity: .9; }
.extra-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.extra-history li { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--soft); min-width: 0; }
.extra-history li .who { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.extra-history li.empty { color: var(--soft); font-style: italic; }
.expand-btn {
  border: none; background: transparent; color: var(--accent); font-weight: 700; font-size: 12px;
  cursor: pointer; padding: 8px 0 0; display: block; text-decoration: none;
}
.expand-btn:hover { text-decoration: underline; }

/* ---- shopping list ---- */
.shop-list { list-style: none; margin: 0; padding: 8px 18px 4px; }
.shop-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.shop-list li:last-child { border-bottom: none; }
.x-btn { border: none; background: transparent; color: var(--soft); font-size: 17px; line-height: 1; cursor: pointer; padding: 6px 8px; border-radius: 50%; }
.x-btn:hover { background: var(--bad-soft); color: var(--bad-ink); }
.shop-empty { padding: 14px 18px; color: var(--soft); font-size: 13.5px; font-style: italic; }
.complete-row { padding: 4px 18px 16px; }
.complete-btn { width: 100%; padding: 11px; border-radius: 10px; border: none; background: transparent; color: var(--bad-ink); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.complete-btn:hover { background: var(--bad-soft); }
.add-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-form input { flex: 1; min-width: 120px; padding: 10px 12px; border-radius: 10px; border: none; background: var(--field); color: var(--ink); }
.add-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.add-form button { padding: 10px 16px; border-radius: 10px; border: none; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }

/* ---- this week's tasks ---- */
.task { padding: 16px 18px; margin-bottom: 10px; }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.check { position: relative; display: flex; align-items: center; gap: 11px; padding-left: 30px; cursor: pointer; min-height: 24px; }
.check input { position: absolute; left: 0; top: 2px; width: 20px; height: 20px; margin: 0; opacity: 0; cursor: pointer; }
.check .box { position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 6px; background: var(--field); }
.check .box::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); opacity: 0;
}
.check input:checked + .box { background: var(--accent); }
.check input:checked + .box::after { opacity: 1; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.tname { font-weight: 600; font-size: 15.5px; }
.tname .ttype { font-weight: 400; color: var(--soft); font-size: 12.5px; }
.task:has(.task-check:checked) .tname { text-decoration: line-through; opacity: .55; }
.instr-link { font-size: 12.5px; color: var(--accent); text-decoration: none; font-weight: 700; white-space: nowrap; }
.instr-link:hover { text-decoration: underline; }
.win-line { font-size: 12.5px; color: var(--soft); margin: 8px 0 0 30px; }
.win-line.bad { color: var(--bad-ink); font-weight: 600; }

.comment-panel { display: none; margin: 14px 0 0 30px; }
.task:has(.task-check:checked) .comment-panel { display: block; }
.comment-panel textarea {
  width: 100%; min-height: 56px; padding: 10px 12px; border-radius: 10px; border: none;
  background: var(--field); color: var(--ink); resize: vertical;
}
.comment-panel textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.comment-actions { margin-top: 9px; }
.comment-actions button {
  padding: 9px 15px; border-radius: 10px; border: none; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.btn-save { display: none; }
.comment-panel:has(textarea:not(:placeholder-shown)) .btn-skip { display: none; }
.comment-panel:has(textarea:not(:placeholder-shown)) .btn-save { display: inline-block; }

.empty-note { color: var(--soft); font-size: 13.5px; font-style: italic; }

.lang-bar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.lang-switch { display: flex; gap: 2px; background: var(--field); border-radius: 20px; padding: 3px; }
.lang-btn {
  border: none; background: transparent; border-radius: 16px; padding: 5px 9px; font-size: 15px;
  cursor: pointer; line-height: 1; opacity: .45; filter: grayscale(60%);
}
.lang-btn.active { opacity: 1; filter: none; background: var(--card); box-shadow: var(--shadow); }

.suggestion-link { text-align: center; margin-top: 36px; }
.suggestion-link a { color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: none; }
.suggestion-link a:hover { text-decoration: underline; }

dialog.modal {
  border: none; border-radius: 16px; padding: 24px 26px 26px; box-shadow: var(--shadow);
  background: var(--card); color: var(--ink); max-width: 440px; width: calc(100% - 40px);
}
dialog.modal::backdrop { background: rgba(20, 18, 14, .45); }
dialog.modal h3 { font-size: 19px; margin-bottom: 16px; }
dialog.modal .modal-body { font-size: 14.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
