/* makro look: navy top bar, yellow accents, blue primary buttons, light grey-blue surfaces, Lato. */
:root {
  --navy: #002d72;
  --blue: #005ae0;
  --blue-hover: #2a7bf0;
  --tint: #cddff9;
  --tint-hover: #bcd3f6;
  --grey: #f2f4f8;
  --grey-2: #e4e9f1;
  --yellow: #ffe500;
  --ink: #33435b;
  --ink-strong: #1f2a3d;
  --muted: #5d6a7e;
  --line: #d5d8dd;
  --field-line: #9aacc6;
  --err: #d6283a;
  --ok: #1a8a5a;
  --pad: clamp(16px, 5.556vw, 96px);
  --font: "Lato", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--grey); color: var(--ink); font: 16px/1.5 var(--font); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { padding-inline: var(--pad); }

/* ---- top bar ---- */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.top-in { min-height: 88px; display: flex; align-items: center; gap: 24px; }
.top :focus-visible { outline-color: var(--yellow); }
.logo { display: block; flex: none; }
.top-txt { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid rgba(255,255,255,.3); padding-left: 24px; }
.top-kicker { font-size: 14px; line-height: 18px; opacity: .85; }
.top-title { font-size: 24px; line-height: 30px; font-weight: 900; }
.sync { margin-left: auto; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sync::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); }
.sync[data-state="ok"]::before { background: #6fd39b; }
.sync[data-state="err"]::before { background: #ff6b78; }

/* ---- main ---- */
.main { max-width: calc(960px + 2 * var(--pad)); margin: 0 auto; padding-block: 32px 96px; }

.lbl { display: block; font-size: 14px; line-height: 18px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; height: 48px; border: 1px solid var(--field-line); border-radius: 8px; background: #fff;
  padding: 0 14px; color: var(--ink-strong); appearance: none;
}
.field textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: #7a8597; }
.field input:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); outline: none; }

.btn {
  height: 48px; padding: 0 20px; border: 0; border-radius: 8px; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-soft { background: var(--tint); color: var(--navy); }
.btn-soft:hover { background: var(--tint-hover); }

.add {
  display: grid; grid-template-columns: 1fr 220px auto; gap: 12px; align-items: end;
  background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 2px rgba(0, 45, 114, .08);
}

.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--field-line); background: #fff;
  font-size: 14px; font-weight: 700; color: var(--navy); display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { background: var(--grey-2); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip small { font-size: 12px; font-weight: 400; opacity: .8; }
.count { margin: 0; font-size: 14px; color: var(--muted); }
.hint { margin: 0 0 16px; font-size: 14px; color: var(--muted); }

/* ---- list ---- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(0, 45, 114, .08); border: 1px solid transparent; }
.item.is-open { border-color: var(--tint); }
.row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 6px; }

.handle {
  flex: none; width: 32px; height: 40px; border: 0; background: none; border-radius: 6px; color: #8a96a8;
  display: grid; place-items: center; cursor: grab; touch-action: none;
}
.handle:hover { background: var(--grey); color: var(--navy); }
.prio {
  flex: none; min-width: 32px; height: 32px; margin-top: 4px; border-radius: 99px; background: var(--yellow); color: var(--navy);
  font-weight: 900; font-size: 15px; display: grid; place-items: center; padding: 0 6px;
}

.check { flex: none; position: relative; width: 24px; height: 24px; margin-top: 8px; cursor: pointer; }
.check-in { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.check-box {
  width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--field-line); background: #fff;
  display: grid; place-items: center; color: transparent;
}
.check-in:checked + .check-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-in:focus-visible + .check-box { outline: 2px solid var(--blue); outline-offset: 2px; }

.body { flex: 1; min-width: 0; padding-top: 6px; }
.name {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 2px 4px; margin: -2px -4px;
  font-weight: 700; color: var(--ink-strong); border-radius: 6px; overflow-wrap: anywhere; cursor: text;
}
.name:hover { background: var(--grey); }
.name-input { width: 100%; height: 36px; border: 1px solid var(--blue); box-shadow: 0 0 0 1px var(--blue); border-radius: 6px; padding: 0 8px; font-weight: 700; color: var(--ink-strong); outline: none; }
.meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 4px; }
.meta:empty { display: none; }
.tag {
  font-size: 12px; line-height: 20px; font-weight: 700; color: var(--navy); background: var(--tint);
  border-radius: 4px; padding: 0 8px; white-space: nowrap;
}
.tag:empty { display: none; }
.note-preview {
  font-size: 14px; line-height: 20px; color: var(--muted); min-width: 0; flex: 1 1 200px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.note-preview:empty, .is-open .note-preview { display: none; }

.acts { flex: none; display: flex; gap: 2px; }
.icon {
  width: 40px; height: 40px; border: 0; background: none; border-radius: 99px; color: var(--navy);
  display: grid; place-items: center; padding: 0;
}
.icon:hover { background: var(--tint); }
.icon:disabled { opacity: .3; cursor: default; background: none; }
.icon.del:hover { background: #fde4e7; color: var(--err); }
.more[aria-expanded="true"] { background: var(--navy); color: #fff; }

.editor { display: grid; grid-template-columns: 1fr 220px; gap: 12px; padding: 4px 16px 16px 50px; }
.editor[hidden] { display: none; }
.editor .field-wide { grid-column: 1 / -1; }
.ed-acts { grid-column: 1 / -1; display: flex; gap: 8px; }

/* done */
.item.is-done .name { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.item.is-done .handle, .item.is-done .up, .item.is-done .down, .item.is-done .prio { display: none; }
.item.is-done .row { padding-left: 16px; }
.done { margin-top: 32px; }
.done summary {
  cursor: pointer; font-weight: 900; color: var(--navy); font-size: 18px; padding: 8px 0; list-style: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.done summary::-webkit-details-marker { display: none; }
.done summary::before { content: ""; width: 8px; height: 8px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.done[open] summary::before { transform: rotate(45deg); }
.done .list { margin-top: 8px; }

.empty { margin: 24px 0; padding: 32px; text-align: center; color: var(--muted); background: #fff; border-radius: 12px; }

/* drag */
.item.is-dragging { position: relative; z-index: 10; box-shadow: 0 12px 28px rgba(0, 45, 114, .22); border-color: var(--blue); }
.item.is-dragging .handle { cursor: grabbing; }
body.dragging { user-select: none; cursor: grabbing; }
.item.flash { animation: flash 1s ease-out; }
@keyframes flash { from { background: #fff8b3; } to { background: #fff; } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30;
  background: var(--navy); color: #fff; border-radius: 8px; padding: 10px 10px 10px 18px;
  display: flex; align-items: center; gap: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px);
}
.toast[hidden] { display: none; }
.toast-btn { border: 0; background: var(--yellow); color: var(--navy); font-weight: 900; border-radius: 6px; height: 36px; padding: 0 14px; }
.toast-btn[hidden] { display: none; }

/* ---- small screens ---- */
@media (max-width: 720px) {
  .top-in { min-height: 64px; gap: 14px; }
  .logo { width: 96px; height: auto; }
  .top-txt { padding-left: 14px; }
  .top-kicker { font-size: 12px; line-height: 16px; }
  .top-title { font-size: 18px; line-height: 24px; }
  .sync { font-size: 0; gap: 0; }
  .main { padding-top: 20px; }
  .add { grid-template-columns: 1fr; padding: 16px; }
  .row { flex-wrap: wrap; padding-right: 8px; }
  .body { flex-basis: calc(100% - 140px); }
  .acts { width: 100%; justify-content: flex-end; margin-top: -4px; }
  .editor { grid-template-columns: 1fr; padding-left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
