/* Minuta express — one stylesheet for both pages (create and the public minuta). */
:root {
  --bg: #F5F2EB; --card: #ffffff; --ink: #1c1a17; --muted: #6b665d; --line: #e0dacd; --field: #ffffff;
  --hover: rgba(28,26,23,.06); --primary: #1c1a17; --on-primary: #ffffff; --brand: #D4310A;
  --ok: #1a7f45; --ok-bg: #e4f3ea; --late: #c22a1b; --late-bg: #fbe6e2; --soon: #8a5a00; --soon-bg: #fbefd2;
  --shadow: 0 1px 2px rgba(40,30,10,.06), 0 6px 20px rgba(40,30,10,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513; --card: #201e1b; --ink: #f0ece3; --muted: #a59f93; --line: #37332d; --field: #191816;
    --hover: rgba(255,255,255,.07); --primary: #f0ece3; --on-primary: #161513; --brand: #ff6a45;
    --ok: #55c98a; --ok-bg: #17301f; --late: #ff8272; --late-bg: #3a1a15; --soon: #f0c060; --soon-bg: #33290f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; }
h1 { font-size: clamp(26px, 6vw, 34px); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 10px; text-wrap: balance; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -.01em; }
p { margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 17px; max-width: 34em; margin-bottom: 22px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; }
.brand img { width: 28px; height: 28px; display: block; }
main { padding: 14px 0 40px; }
section + section, article + aside { margin-top: 36px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; }

/* Buttons and fields */
button, input, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 11px;
       border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { opacity: .88; }
.btn.big { min-height: 52px; font-size: 17px; width: 100%; }
.btn.slim { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--late); }
.btn:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
input[type="text"], input[type="date"], textarea {
  width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; line-height: 1.4; }
label.field { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label.field > input { margin-top: 5px; font-size: 16px; font-weight: 400; color: var(--ink); }
.msg { min-height: 1.4em; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.msg.error { color: var(--late); font-weight: 600; }

/* Create: the form */
.meta { display: grid; grid-template-columns: 1fr 170px; gap: 12px; }
details.ai { margin-top: 16px; border: 1px dashed var(--line); border-radius: 12px; padding: 0 12px; }
details.ai > summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style-position: inside; }
details.ai[open] { padding-bottom: 12px; }
details.ai textarea { min-height: 130px; margin-bottom: 10px; }
.rows-title { margin: 22px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
#rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 150px 40px; gap: 6px; align-items: start; }
.row .x { width: 40px; min-height: 44px; padding: 0; font-size: 20px; line-height: 1; color: var(--muted); }
#add { margin-top: 10px; }
.submit { margin-top: 20px; }

/* Create: the link is ready */
.linkbox { display: flex; gap: 8px; margin: 14px 0 18px; }
.linkbox input { font-weight: 600; text-overflow: ellipsis; }
#share-text { min-height: 190px; font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions.split { justify-content: space-between; margin-top: 22px; }

/* Create: my minutas */
.mine { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.mine li { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.mine .name { flex: 1; min-width: 0; text-decoration: none; }
.mine .name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine .name span { font-size: 13px; color: var(--muted); }
.mine .name:hover b { text-decoration: underline; }

/* The Whagons invitation (both pages) */
.whagons { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); }
.whagons img { width: 36px; height: 36px; flex: none; }
.whagons .t { flex: 1; min-width: 200px; }
.whagons .t b { display: block; }
.whagons .t span { color: var(--muted); font-size: 15px; }
#offer { margin-bottom: 14px; }

/* The public minuta */
.eyebrow { font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.eyebrow::first-letter { text-transform: uppercase; }
.progress { display: flex; align-items: center; gap: 12px; margin: 14px 0 18px; }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .3s; }
.progress span { font-size: 14px; font-weight: 600; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { min-height: 36px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; cursor: pointer; }
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip small { font-weight: 400; opacity: .7; margin-left: 3px; font-size: 13px; }

.items { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.item + .item { border-top: 1px solid var(--line); }
.item label { display: flex; gap: 14px; padding: 14px 16px; cursor: pointer; align-items: flex-start; }
.item label:hover { background: var(--hover); }
.item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.item .box { flex: none; width: 26px; height: 26px; margin-top: 1px; border-radius: 8px; border: 2px solid var(--muted); display: grid; place-items: center; transition: background .12s, border-color .12s; }
.item .box svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.item input:focus-visible + .box { outline: 2px solid var(--ink); outline-offset: 2px; }
.item.done .box { background: var(--ok); border-color: var(--ok); }
.item.done .box svg { opacity: 1; }
.item .txt { flex: 1; min-width: 0; }
.item .what { display: block; font-size: 17px; overflow-wrap: anywhere; }
.item.done .what { text-decoration: line-through; color: var(--muted); }
.item .sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item .sub:empty { display: none; }
.tag { font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--hover); color: var(--muted); }
.tag.who { color: var(--ink); }
.tag.late { background: var(--late-bg); color: var(--late); }
.tag.soon { background: var(--soon-bg); color: var(--soon); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.item.late { box-shadow: inset 4px 0 0 var(--late); }
.empty { padding: 22px 16px; color: var(--muted); text-align: center; }
.state { padding: 60px 0; text-align: center; color: var(--muted); }
.state b { display: block; color: var(--ink); font-size: 20px; margin-bottom: 6px; }

footer { padding: 22px 0 36px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; border-top: 1px solid var(--line); }
footer .wh { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--ink); text-decoration: none; }
footer .wh img { width: 20px; height: 20px; }

@media (max-width: 640px) {
  .meta { grid-template-columns: 1fr; }
  .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
  .row .what { grid-column: 1 / 3; }
  .row .x { grid-column: 3; grid-row: 1; }
  .row .due { grid-column: 2 / 4; }
  .linkbox { flex-direction: column; }
  .actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.note { margin-top: 10px; }
