/* Look & feel taken from the Disk Space site: black header, dark panels, 14px system font. */
:root {
  --bg: #111214; --panel: #1a1c1f; --panel2: #222529; --line: #2e3237;
  --text: #e8e9eb; --muted: #8b9096; --accent: #d9622b; --ok: #3ecf8e; --bad: #f2555a;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
html, body { overflow-x: hidden; max-width: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: var(--text); cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- header: black bar ---------- */
header { position: sticky; top: 0; z-index: 50; background: #000; border-bottom: 1px solid #1c1c1c; }
.topbar { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 20px; }
.brand { margin: 0; flex: none; font-size: 15px; font-weight: 650; letter-spacing: -.2px; line-height: 1; }
.brand a { display: inline-flex; align-items: center; gap: 9px; color: #fff; }
.brand svg { width: 20px; height: 20px; flex: none; }
#backBtn { margin-left: 8px; }

.tools { display: flex; gap: 4px; align-items: center; flex: none; margin-left: auto; }
.icon {
  width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 6px; color: #a3a8ae;
}
.icon:hover, .icon[aria-expanded="true"] { color: #fff; background: #17181b; }
.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.menu-wrap { position: relative; }
.menu {
  display: none; position: absolute; right: 0; top: 44px; min-width: 190px; z-index: 20;
  background: #17181b; border: 1px solid #2c2d31; border-radius: 8px; padding: 4px; box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.menu.show { display: block; }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: none;
  border-radius: 5px; padding: 8px 10px; text-align: left; color: var(--text); font-size: 13px;
}
.menu button:hover { background: #25272b; }
.menu button svg { width: 15px; height: 15px; fill: none; stroke: #a3a8ae; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- grid ---------- */
main.grid { display: flex; flex-direction: column; gap: 36px; padding: 22px 20px 60px; }
.group-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px; height: 22px;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
}
.group-title .fold {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 6px 0 2px; margin-left: -2px;
  background: none; border: 0; border-radius: 5px; color: inherit;
  font: inherit; text-transform: inherit; letter-spacing: inherit;
}
.chev { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.group.collapsed .chev { transform: rotate(-90deg); }
.group.collapsed .cards { display: none; }
.group.collapsed .group-title { margin-bottom: 0; }
.group.is-empty.collapsed .group-title { opacity: .55; }
.group-title .n { font-weight: 400; color: #5c6167; letter-spacing: 0; }
.group-title .add {
  width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 5px; color: var(--muted); opacity: 0; transition: opacity .12s;
}
.group-title .add svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.group:hover .add, .group-title .add:focus-visible { opacity: 1; }
.group-title .add:hover { color: var(--text); background: var(--panel2); }
@media (hover: none) { .group-title .add { opacity: .6; } }
.cards { display: grid; gap: 15px; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); }
.cards > * { min-width: 0; }
.drop-empty { margin: 0; color: #5c6167; font-size: 13px; align-self: center; }
.drop-empty:empty { display: none; }
.cards:has(.card-placeholder) .drop-empty { display: none; }
.cards:not(:has(.card)) {
  min-height: 70px; border: 1px dashed var(--line); border-radius: var(--radius); padding: 0 16px; align-items: center;
}
.cards:has(.card-placeholder):not(:has(.card)) { border-color: transparent; padding: 0; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px; gap: 9px; min-height: 150px; transition: border-color .12s, background .12s;
}
.card:hover { border-color: #3d4248; }
.card h2 { margin: 0; padding-right: 44px; font-size: 16.5px; line-height: 1.3; font-weight: 650; overflow-wrap: anywhere; }
.card .thumb { margin: 0; display: flex; gap: 9px; align-items: flex-start; color: var(--muted); font-size: 15px; }
.card .thumb p {
  margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere; transition: color .2s;
}
.card .thumb.done p { text-decoration: line-through; }
.card .thumb .check { margin-top: 1px; width: 17.5px; height: 17.5px; }
.card .progress { margin-top: auto; height: 5px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.card .progress div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.card .count { position: absolute; top: 16px; right: 15px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card.is-done { opacity: .5; }

/* swapped cards: the step is the headline, the title sits small underneath */
body.swap .card .thumb { order: 1; padding-right: 44px; color: var(--text); font-size: 16.5px; font-weight: 650; line-height: 1.3; }
body.swap .card .thumb .check { display: none; }
body.swap .card .thumb.done p, body.swap .card .thumb.muted { color: var(--muted); }
body.swap .card h2 { order: 2; padding-right: 0; font-size: 13px; font-weight: 400; color: var(--muted); }
body.swap .card .progress { order: 3; }
.icon[aria-pressed="true"] { color: var(--accent); }

/* Done section: quiet, flat cards */
.group[data-cat="done"] .card {
  min-height: 0; background: transparent; border-color: #24272b; opacity: .5; gap: 6px; transition: opacity .15s, border-color .12s;
}
.group[data-cat="done"] .card:hover { opacity: .85; }
.group[data-cat="done"] .card h2 { font-size: 14px; font-weight: 500; color: var(--muted); }
.group[data-cat="done"] .card .thumb { font-size: 13px; }
.group[data-cat="done"] .card .thumb .check,
.group[data-cat="done"] .card .progress,
.group[data-cat="done"] .card .count { display: none; }
body.swap .group[data-cat="done"] .card .thumb { font-size: 14px; font-weight: 500; color: var(--muted); }
.group[data-cat="done"] .card.dragging { opacity: 1; background: var(--panel); }

/* "later" button + quiet later cards */
.later-btn {
  position: absolute; top: 11px; right: 10px; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 6px; color: var(--muted); opacity: 0; transition: opacity .12s, background .12s;
}
.later-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.later-btn:hover { color: var(--text); background: var(--panel2); }
.card:hover .later-btn, .later-btn:focus-visible { opacity: 1; }
.card:hover .count { opacity: 0; }
main.sorting .later-btn { opacity: 0 !important; }
@media (hover: none) { .later-btn { opacity: .5; } .card .count { right: 44px; } }

.card.later { min-height: 0; background: transparent; border-color: #26292d; opacity: .55; transition: opacity .15s, border-color .12s; }
.card.later:hover { opacity: .9; }
.card.later h2 { font-weight: 500; color: var(--muted); }
.card.later .progress { display: none; }
.card.later .later-btn { color: var(--accent); opacity: 1; }
.card.later:not(:hover) .later-btn { opacity: 0; }
.card.later.dragging { opacity: 1; background: var(--panel); }

/* drag & drop */
.card { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.card.dragging { pointer-events: none; transition: none; border-color: var(--accent); box-shadow: 0 18px 40px rgba(0,0,0,.55); }
main.sorting, main.sorting * { cursor: grabbing !important; }
.card-placeholder { border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.02); }

/* ---------- detail ---------- */
main.detail { max-width: 760px; margin: 0 auto; padding: 20px 20px 80px; }
.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.title {
  flex: 1; min-width: 0; border: 0; background: none; color: var(--text); outline: none; padding: 4px 0;
  font-family: inherit; font-size: 20px; font-weight: 650; line-height: 1.3; letter-spacing: -.2px;
}
.title::placeholder { color: var(--muted); }
/* delete: a quiet × that appears on hover (always faintly visible on touch screens) */
.x {
  flex: none; width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px; color: var(--muted); opacity: 0; transition: opacity .12s, background .12s;
}
.x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.x:hover { color: var(--text); background: var(--panel2); }
.detail-head:hover .x, .x:focus-visible { opacity: 1; }
@media (hover: none) { .x { opacity: .5; } }

.sheet {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px;
}
.steps { list-style: none; margin: 0; padding: 0; }
.step {
  display: grid; grid-template-columns: 18px 1fr 22px; align-items: start; gap: 10px;
  padding: 4px 0 4px calc(var(--level) * 26px); position: relative;
}
.step::before { /* nesting guide line */
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(var(--level) * 26px - 17px); border-left: 1px solid var(--line);
}
.step[style*="--level:0"]::before { display: none; }
.step .check { margin-top: 1px; }
.step textarea {
  resize: none; border: 0; background: none; color: inherit; outline: none; overflow: hidden;
  font: inherit; line-height: 1.4; padding: 0; width: 100%;
}
.step textarea::placeholder { color: #5c6167; }
.step.done textarea { color: var(--muted); text-decoration: line-through; }
.pin { background: none; border: 0; color: #4a4f55; font-size: 13px; padding: 0; opacity: 0; }
.step:hover .pin, .step:focus-within .pin, .pin.on { opacity: 1; }
.pin:hover { color: var(--muted); }
.pin.on { color: var(--accent); }
.hint { margin-top: 12px; padding: 0 2px; font-size: 11px; color: #4a4f55; transition: color .2s; }
.hint:hover { color: var(--muted); }

@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  main.grid { padding: 14px; }
  main.detail { padding: 14px 14px 60px; }
}

/* round checkbox: dashed ring when open, filled with a tick when done.
   The ring is an SVG mask so its colour comes from CSS. */
.check {
  --ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='7.5' fill='none' stroke='black' stroke-width='1.4' stroke-dasharray='2.8 2.436' transform='rotate(-90 9 9)'/%3E%3C/svg%3E");
  appearance: none; -webkit-appearance: none; flex: none; display: inline-block;
  width: 16px; height: 16px; margin: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--muted) no-repeat center / 100%;
  -webkit-mask: var(--ring) center / 100% no-repeat; mask: var(--ring) center / 100% no-repeat;
  transition: background-color .15s, transform .15s;
}
.check:hover { background-color: var(--accent); }
.check:active { transform: scale(.85); }
.check:checked, .check.on {
  -webkit-mask: none; mask: none;
  background-color: #3f4348;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.3l2.2 2.2 4.8-5' fill='none' stroke='%23a3a8ae' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check:checked:hover, .check.on:hover { background-color: #4a4f55; }


/* password dialog (same as Disk Space) */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(380px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog h3 { margin: 0 0 8px; font-size: 15px; }
dialog p { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
dialog label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
dialog input { width: 100%; font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
dialog input:focus { outline: none; border-color: var(--accent); }
dialog .actions { display: flex; justify-content: flex-end; margin-top: 16px; }
dialog .primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; font-weight: 600; border-radius: 8px; padding: 7px 14px; }
