/* =========================================================
   Themes: data-style (6 looks) × data-mode (light/dark).
   Selectors are attribute-only so the settings previews can
   reuse them on any element, not just <html>.
   ========================================================= */
[data-style] {
  --danger: #ef4444;
  --ok: #22c55e;
  --bw: 1px;
  --radius: 12px;
  --radius-sm: 8px;
  --pill: 999px;
  --shadow: none;
  --blur: none;
  --bg-image: none;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font);
  --head-weight: 700;
  --head-transform: none;
  --head-spacing: -0.01em;
  --check-radius: 50%;
  --bstyle: solid;
  --scale: 1;
  --stripe: 4px;
}
[data-mode="dark"] { color-scheme: dark; }
[data-mode="light"] { color-scheme: light; }

/* 1. Classic — clean and neutral */
[data-style="classic"][data-mode="dark"] {
  --bg: #0f1115; --panel: #171a21; --panel-2: #1e222b; --border: #2a2f3a;
  --text: #e6e8ee; --muted: #8b93a7; --accent: #6c8cff; --accent-text: #fff;
}
[data-style="classic"][data-mode="light"] {
  --bg: #f4f5f8; --panel: #ffffff; --panel-2: #f0f2f6; --border: #dde1e9;
  --text: #1b1f29; --muted: #697186; --accent: #4a6cf7; --accent-text: #fff;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06);
}

/* 2. Paper — warm, serif, notebook */
[data-style="paper"] {
  --font: "Lora", Georgia, "Iowan Old Style", serif;
  --radius: 4px; --radius-sm: 3px; --pill: 4px;
  --head-weight: 600; --head-spacing: 0;
  --check-radius: 3px;
}
[data-style="paper"][data-mode="light"] {
  --bg: #efe6d2; --panel: #fffaf0; --panel-2: #f6eedb; --border: #ddcfb0;
  --text: #3b2f20; --muted: #8a7a60; --accent: #b5542c; --accent-text: #fff8ef;
  --shadow: 0 1px 0 #d8c9a8, 0 3px 10px rgba(80, 60, 20, .08);
}
[data-style="paper"][data-mode="dark"] {
  --bg: #1d1812; --panel: #29221a; --panel-2: #322a20; --border: #4a3e2e;
  --text: #efe4cc; --muted: #a8987a; --accent: #e08a5a; --accent-text: #1d1812;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

/* 3. Terminal — monospace, square, phosphor */
[data-style="terminal"] {
  --font: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 0; --radius-sm: 0; --pill: 0;
  --head-weight: 700; --head-transform: lowercase; --head-spacing: 0;
  --check-radius: 0;
}
[data-style="terminal"][data-mode="dark"] {
  --bg: #070b07; --panel: #0b120b; --panel-2: #0f190f; --border: #1f3d1f;
  --text: #b6f5b6; --muted: #5d995d; --accent: #39ff6a; --accent-text: #021a08;
  --bg-image: repeating-linear-gradient(0deg, rgba(57, 255, 106, .025) 0 1px, transparent 1px 3px);
}
[data-style="terminal"][data-mode="light"] {
  --bg: #eef3ea; --panel: #f9fcf7; --panel-2: #e8f0e3; --border: #a9c9a2;
  --text: #123a12; --muted: #4b774b; --accent: #157a30; --accent-text: #f2fff4;
}

/* 4. Glass — gradients and frosted panels */
[data-style="glass"] {
  --radius: 20px; --radius-sm: 12px;
  --blur: blur(18px) saturate(140%);
}
[data-style="glass"][data-mode="dark"] {
  --bg: #0b0b1a; --panel: rgba(255, 255, 255, .07); --panel-2: rgba(255, 255, 255, .06); --border: rgba(255, 255, 255, .14);
  --text: #f1efff; --muted: #a9a6cc; --accent: #a78bfa; --accent-text: #160b33;
  --bg-image: radial-gradient(40rem 30rem at 10% -10%, rgba(124, 58, 237, .45), transparent 60%),
              radial-gradient(35rem 30rem at 110% 10%, rgba(14, 165, 233, .35), transparent 60%),
              radial-gradient(40rem 30rem at 50% 120%, rgba(236, 72, 153, .3), transparent 60%);
  --shadow: 0 8px 32px rgba(0, 0, 0, .35);
}
[data-style="glass"][data-mode="light"] {
  --bg: #eef0ff; --panel: rgba(255, 255, 255, .55); --panel-2: rgba(255, 255, 255, .5); --border: rgba(255, 255, 255, .85);
  --text: #1e1b3a; --muted: #5e5a85; --accent: #7c3aed; --accent-text: #fff;
  --bg-image: radial-gradient(40rem 30rem at 10% -10%, rgba(167, 139, 250, .55), transparent 60%),
              radial-gradient(35rem 30rem at 110% 10%, rgba(56, 189, 248, .45), transparent 60%),
              radial-gradient(40rem 30rem at 50% 120%, rgba(244, 114, 182, .45), transparent 60%);
  --shadow: 0 8px 32px rgba(76, 60, 160, .15);
}

/* 5. Brutal — thick borders, hard shadows, loud */
[data-style="brutal"] {
  --font: "Space Grotesk", "Arial", sans-serif;
  --bw: 2.5px; --radius: 0; --radius-sm: 0; --pill: 0;
  --head-weight: 700; --head-transform: uppercase; --head-spacing: .02em;
  --check-radius: 0;
}
[data-style="brutal"][data-mode="light"] {
  --bg: #f4efe1; --panel: #ffffff; --panel-2: #fff6c7; --border: #111111;
  --text: #111111; --muted: #4a4a4a; --accent: #ffd400; --accent-text: #111;
  --shadow: 4px 4px 0 #111;
}
[data-style="brutal"][data-mode="dark"] {
  --bg: #121212; --panel: #1b1b1b; --panel-2: #262212; --border: #f2f2f2;
  --text: #f2f2f2; --muted: #b5b5b5; --accent: #ffd400; --accent-text: #111;
  --shadow: 4px 4px 0 #ffd400;
}

/* 6. Bubble — soft, rounded, playful */
[data-style="bubble"] {
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --radius: 26px; --radius-sm: 16px;
  --head-weight: 800; --head-spacing: 0;
}
[data-style="bubble"][data-mode="light"] {
  --bg: #fdf0f7; --panel: #ffffff; --panel-2: #fde7f3; --border: #f7d2e6;
  --text: #43294f; --muted: #9a7ea8; --accent: #ec4899; --accent-text: #fff;
  --shadow: 0 8px 24px rgba(236, 72, 153, .12);
}
[data-style="bubble"][data-mode="dark"] {
  --bg: #1d1426; --panel: #2a1f36; --panel-2: #342642; --border: #4a3660;
  --text: #f6eaff; --muted: #b9a3cc; --accent: #f472b6; --accent-text: #2a0b1c;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

/* Text size */
html[data-font="small"] { font-size: 14px; }
html[data-font="normal"] { font-size: 16px; }
html[data-font="large"] { font-size: 19px; }

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg-image), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: calc(0.95rem * var(--scale));
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color .35s, color .35s;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

.panel {
  background: var(--panel);
  border: var(--bw) var(--bstyle) var(--border);
  transition: background-color .35s, border-color .35s, box-shadow .35s, color .35s;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.brand, h2 {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  text-transform: var(--head-transform);
  letter-spacing: var(--head-spacing);
}
[data-style="terminal"] .brand::before { content: "$ "; color: var(--accent); }
[data-style="terminal"] .brand::after { content: "_"; color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Buttons */
.btn {
  border: var(--bw) solid transparent;
  border-radius: var(--radius-sm);
  padding: .55rem 1.3rem;
  font-weight: 600;
  line-height: 1.2;
}
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.small { font-size: .82rem; padding: .3rem .7rem; }
[data-style="brutal"] .btn.primary, [data-style="brutal"] .btn.ghost { border-color: var(--border); box-shadow: 2px 2px 0 var(--border); }
[data-style="brutal"] .btn:active { transform: translate(2px, 2px); box-shadow: none; }
[data-style="bubble"] .btn { border-radius: 999px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.3rem; height: 2.3rem; padding: 0;
  background: transparent; color: var(--muted);
  border: var(--bw) solid var(--border); border-radius: var(--radius-sm);
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }
[data-style="bubble"] .icon-btn { border-radius: 50%; }

.field {
  background: var(--panel-2);
  border: var(--bw) solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .8rem;
  outline: none;
  width: 100%;
}
.field:focus { border-color: var(--accent); }
.error { color: var(--danger); min-height: 1.3em; margin: 0; font-size: .85rem; }

/* Segmented control */
.seg { display: flex; background: var(--panel-2); border: var(--bw) solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg-btn { flex: 1; background: none; border: 0; padding: .45rem .6rem; border-radius: calc(var(--radius-sm) - 2px); color: var(--muted); font-weight: 600; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: var(--accent-text); }

/* =========================================================
   Auth
   ========================================================= */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 22rem; padding: 1.8rem; display: flex; flex-direction: column; gap: .75rem; }
.auth-card .brand { margin: 0 0 .25rem; text-align: center; font-size: 1.8rem; }
.auth-card .error { text-align: center; }

/* =========================================================
   App
   ========================================================= */
.app { max-width: 48rem; margin: 0 auto; padding: 1rem 16px 4rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.topbar .brand { margin: 0; font-size: 1.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: .4rem; flex: none; }

/* Category chips */
.cats { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.cat-buttons { display: flex; flex-wrap: wrap; gap: .5rem; flex: 1 1 18rem; }
.cat-tools { display: flex; gap: .4rem; }
.cat {
  --c: var(--accent);
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--panel); color: var(--text);
  border: var(--bw) solid var(--border); border-radius: var(--pill);
  padding: .4rem .95rem; font-weight: 600;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.cat:hover { border-color: var(--c); }
.cat.active { background: var(--c); border-color: var(--c); color: var(--on-c, #fff); }
.cat .n { font-size: .75rem; opacity: .75; font-weight: 500; }
.cat.editing { border-style: dashed; }
.cat.editing::after { content: "✎"; font-size: .8rem; opacity: .7; }
[data-style="brutal"] .cat { box-shadow: 2px 2px 0 var(--border); }
[data-style="brutal"] .cat.active { border-color: var(--border); }

.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
[data-style="terminal"] .dot, [data-style="brutal"] .dot { border-radius: 0; }
.cat.active .dot { background: var(--on-c, #fff); opacity: .85; }

/* Composer */
.composer { padding: .25rem .25rem .75rem; margin-bottom: 1.2rem; }
.composer:focus-within { border-color: var(--accent); }
.note-box { display: flex; flex-direction: column; }
.note-box input, .note-box textarea {
  background: transparent; border: 0; outline: none; padding: .6rem .9rem; resize: vertical;
}
.subject { font-size: 1.3rem; font-weight: 700; padding-top: .9rem !important; font-family: var(--font-head); }
.content { font-size: 1rem; min-height: 4.5rem; padding-top: .1rem !important; }
.note-box ::placeholder { color: var(--muted); opacity: .7; }
[data-style="paper"] .content {
  background-image: repeating-linear-gradient(transparent 0 calc(1.5em - 1px), var(--border) calc(1.5em - 1px) 1.5em);
  background-attachment: local; line-height: 1.5em;
}
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 0 .6rem 0 .9rem; }
.select-wrap { min-width: 0; }
.select-wrap select { min-width: 0; width: 100%; }
.adding-to { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .88rem; min-width: 0; }
.adding-to > span:first-child { white-space: nowrap; }
.select-wrap {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--panel-2); border: var(--bw) solid var(--border); border-radius: var(--radius-sm);
  padding: 0 .3rem 0 .65rem;
}
.select-wrap:focus-within { border-color: var(--accent); }
.select-wrap select {
  background: transparent; border: 0; outline: none; padding: .4rem .2rem; color: var(--text); font-weight: 600; max-width: 14rem;
}
.select-wrap select option { background: var(--panel-2); color: var(--text); }

/* List */
.list-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .82rem; margin-bottom: .5rem; }
.toggle { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.item {
  --c: var(--border);
  display: flex; gap: .8rem; padding: .8rem .9rem;
  border-left: var(--stripe) solid var(--c);
}
[data-style="brutal"] .item { border-left-width: 8px; border-left-color: var(--c); }
[data-style="terminal"] .item { border-left-style: double; }
.item.done .item-subject, .item.done .item-content { color: var(--muted); }
.item.done .item-subject { text-decoration: line-through; }
.check {
  flex: none; width: 1.4rem; height: 1.4rem; margin-top: .1rem; padding: 0;
  border-radius: var(--check-radius); border: 2px solid var(--muted); background: none;
  display: grid; place-items: center;
}
.check:hover { border-color: var(--ok); }
.item.done .check { background: var(--ok); border-color: var(--ok); }
.item.done .check::after { content: "✓"; color: #fff; font-size: .8rem; font-weight: 700; }
[data-style="terminal"] .item.done .check::after { content: "x"; color: #021a08; }
.item-body { flex: 1; min-width: 0; }
.item-subject { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; font-family: var(--font-head); }
.item-content { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); opacity: .82; margin-top: .1rem; }
.item-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; font-size: .75rem; color: var(--muted); }

.tag {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: .35rem;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  color: var(--text); font-weight: 600;
  padding: .05rem .55rem; border-radius: var(--pill);
}
.item-actions { display: flex; gap: .2rem; align-items: flex-start; opacity: .45; }
.item:hover .item-actions, .item:focus-within .item-actions { opacity: 1; }
.icon { background: none; border: 0; color: var(--muted); padding: .3rem; border-radius: var(--radius-sm); display: inline-grid; place-items: center; }
.icon svg { width: 1.05rem; height: 1.05rem; }
.icon:hover { color: var(--text); background: var(--panel-2); }
.icon.del:hover { color: var(--danger); }

.edit-subject, .edit-content { margin-bottom: .4rem; }
.edit-subject { font-weight: 700; font-size: 1.05rem; }
.edit-content { resize: vertical; min-height: 4rem; }
.edit-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

.empty { text-align: center; color: var(--muted); padding: 2rem 0; border: 0; background: none; }

/* =========================================================
   Modals
   ========================================================= */
.modal { border: 0; padding: 16px; background: transparent; color: var(--text); max-width: 100vw; width: 100%; }
.modal::backdrop { background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-card {
  margin: 0 auto; width: 100%; max-width: 24rem; padding: 1.4rem;
  display: flex; flex-direction: column; gap: .55rem;
  font-family: var(--font);
}
/* Opaque in glass mode so text stays readable over the page */
[data-style="glass"] .modal-card { background: var(--bg); background-image: var(--bg-image); }
.modal-card.wide { max-width: 34rem; }
.modal-card h2 { margin: 0 0 .3rem; font-size: 1.2rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; }
.modal-actions { display: flex; gap: .5rem; align-items: center; margin-top: .4rem; }
.label { font-size: .8rem; font-weight: 600; color: var(--muted); margin-top: .5rem; text-transform: uppercase; letter-spacing: .04em; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.1rem, 1fr)); gap: .45rem; }
.swatch {
  aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; padding: 0;
  background: var(--sw); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .12);
}
.swatch.selected { outline: 2px solid var(--text); outline-offset: 2px; }
.swatch.custom {
  position: relative; overflow: hidden;
  background: conic-gradient(#ef4444, #eab308, #22c55e, #06b6d4, #3b82f6, #a855f7, #ef4444);
}
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
[data-style="terminal"] .swatch, [data-style="brutal"] .swatch { border-radius: 0; }

/* Style picker */
.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.style-card {
  padding: 0; border: 2px solid var(--border); border-radius: 12px; overflow: hidden;
  background: none; text-align: left; display: flex; flex-direction: column;
}
.style-card.selected { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
html[data-style] .style-card { font-size: 14px; }
.preview {
  background: var(--bg-image), var(--bg); color: var(--text); font-family: var(--font);
  padding: .7rem; display: flex; flex-direction: column; gap: .4rem; height: 6.2rem;
}
.preview .pv-panel {
  background: var(--panel); border: var(--bw) solid var(--border); border-radius: min(var(--radius), 12px);
  box-shadow: var(--shadow); padding: .4rem .5rem; font-size: .72rem; font-weight: 700; font-family: var(--font-head);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview .pv-row { display: flex; gap: .3rem; }
.preview .pv-chip { height: .7rem; flex: 1; border-radius: var(--pill); background: var(--panel-2); border: 1px solid var(--border); }
.preview .pv-chip.on { background: var(--accent); border-color: var(--accent); }
.style-name { padding: .4rem .6rem; font-size: .82rem; font-weight: 700; background: var(--panel-2); color: var(--text); font-family: "Inter", system-ui, sans-serif; }

@media (max-width: 560px) {
  .style-grid { grid-template-columns: repeat(2, 1fr); }
  .item-actions { opacity: 1; }
  .topbar .brand { font-size: 1.25rem; }
  .btn.small { padding: .3rem .55rem; }
}

/* =========================================================
   Nine more styles
   ========================================================= */

/* 7. Neon — glowing cyberpunk */
[data-style="neon"] {
  --font: "Rajdhani", "Inter", sans-serif; --font-head: "Orbitron", "Rajdhani", sans-serif;
  --scale: 1.08; --radius: 6px; --radius-sm: 4px; --pill: 4px;
  --head-weight: 700; --head-transform: uppercase; --head-spacing: .08em;
}
[data-style="neon"][data-mode="dark"] {
  --bg: #07060f; --panel: rgba(22, 12, 44, .78); --panel-2: #140b2a; --border: #3a1f6e;
  --text: #f1e8ff; --muted: #a08ccc; --accent: #00f0ff; --accent-text: #04121a;
  --bg-image: radial-gradient(45rem 25rem at 0% 0%, rgba(255, 43, 214, .22), transparent 60%),
              radial-gradient(45rem 25rem at 100% 100%, rgba(0, 240, 255, .18), transparent 60%);
  --shadow: 0 0 0 1px rgba(0, 240, 255, .18), 0 0 22px rgba(255, 43, 214, .16);
}
[data-style="neon"][data-mode="light"] {
  --bg: #f6f3ff; --panel: #ffffff; --panel-2: #f0eaff; --border: #dccfff;
  --text: #1a1033; --muted: #6b5f8f; --accent: #d1007a; --accent-text: #fff;
  --bg-image: radial-gradient(45rem 25rem at 0% 0%, rgba(209, 0, 122, .10), transparent 60%),
              radial-gradient(45rem 25rem at 100% 100%, rgba(0, 170, 255, .10), transparent 60%);
  --shadow: 0 0 0 1px rgba(209, 0, 122, .12), 0 6px 22px rgba(120, 0, 255, .10);
}
[data-style="neon"] .brand { color: var(--accent); text-shadow: 0 0 6px var(--accent), 0 0 22px var(--accent); }
[data-style="neon"][data-mode="light"] .brand { text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent); }
[data-style="neon"] .btn.primary { box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent); }
[data-style="neon"] .cat.active { box-shadow: 0 0 14px var(--c); }
[data-style="neon"] .item { box-shadow: var(--shadow), -6px 0 18px -10px var(--c); }

/* 8. Blueprint — technical drawing */
[data-style="blueprint"] {
  --font: "IBM Plex Mono", ui-monospace, monospace; --radius: 2px; --radius-sm: 2px; --pill: 2px;
  --bstyle: dashed; --head-transform: uppercase; --head-spacing: .12em; --check-radius: 2px;
}
[data-style="blueprint"][data-mode="dark"] {
  --bg: #0e3a63; --panel: rgba(14, 58, 99, .82); --panel-2: #0b3256; --border: rgba(225, 240, 255, .55);
  --text: #eaf4ff; --muted: #9cc3e6; --accent: #ffffff; --accent-text: #0e3a63;
  --bg-image: linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px) 0 0 / 24px 24px,
              linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px) 0 0 / 24px 24px,
              linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px) 0 0 / 120px 120px,
              linear-gradient(90deg, rgba(255, 255, 255, .12) 1px, transparent 1px) 0 0 / 120px 120px;
}
[data-style="blueprint"][data-mode="light"] {
  --bg: #eef5fc; --panel: rgba(251, 253, 255, .92); --panel-2: #e6f0fa; --border: #3a78b5;
  --text: #0d3b66; --muted: #4f7aa3; --accent: #1d5fa3; --accent-text: #fff;
  --bg-image: linear-gradient(rgba(30, 90, 160, .08) 1px, transparent 1px) 0 0 / 24px 24px,
              linear-gradient(90deg, rgba(30, 90, 160, .08) 1px, transparent 1px) 0 0 / 24px 24px,
              linear-gradient(rgba(30, 90, 160, .14) 1px, transparent 1px) 0 0 / 120px 120px,
              linear-gradient(90deg, rgba(30, 90, 160, .14) 1px, transparent 1px) 0 0 / 120px 120px;
}
[data-style="blueprint"] body { background-attachment: fixed; }
[data-style="blueprint"] .cat, [data-style="blueprint"] .btn.ghost, [data-style="blueprint"] .field { border-style: dashed; }

/* 9. Chalkboard (dark) / Whiteboard (light) */
[data-style="chalk"] {
  --font: "Patrick Hand", "Comic Sans MS", cursive; --font-head: "Cabin Sketch", "Patrick Hand", cursive;
  --scale: 1.15; --radius: 6px; --radius-sm: 6px; --head-weight: 700; --head-spacing: .02em;
}
[data-style="chalk"][data-mode="dark"] {
  --bg: #24402f; --panel: rgba(255, 255, 255, .045); --panel-2: rgba(0, 0, 0, .14); --border: rgba(255, 255, 255, .5);
  --text: #f4f1e8; --muted: #b9c6b6; --accent: #ffe27a; --accent-text: #24402f;
  --bg-image: radial-gradient(ellipse at 25% 15%, rgba(255, 255, 255, .07), transparent 55%),
              radial-gradient(ellipse at 80% 80%, rgba(255, 255, 255, .05), transparent 50%);
}
[data-style="chalk"][data-mode="light"] {
  --bg: #f7f7f3; --panel: #ffffff; --panel-2: #f2f3ef; --border: #c3cac4;
  --text: #1f3550; --muted: #6e7d8c; --accent: #2f8a52; --accent-text: #fff;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
html[data-style="chalk"] body { box-shadow: inset 0 0 0 10px #6b4a2b, inset 0 0 0 12px #3e2a17; }
html[data-style="chalk"][data-mode="light"] body { box-shadow: inset 0 0 0 10px #b8bec4, inset 0 0 0 12px #8d949b; }
[data-style="chalk"][data-mode="dark"] .brand, [data-style="chalk"][data-mode="dark"] .item-subject { text-shadow: 0 0 1px rgba(255, 255, 255, .6); }

/* 10. Sticky Notes — post-its on a cork board */
[data-style="sticky"] {
  --font: "Kalam", "Patrick Hand", cursive; --font-head: "Caveat", "Kalam", cursive;
  --scale: 1.05; --radius: 2px; --radius-sm: 4px; --pill: 4px; --bw: 0px;
  --head-weight: 700; --head-spacing: 0; --stripe: 0px; --check-radius: 4px;
}
[data-style="sticky"][data-mode="light"] {
  --bg: #c89a64; --panel: #fff59d; --panel-2: #fff9c4; --border: #e6d77a;
  --text: #3a3220; --muted: #7a6a40; --accent: #e8505b; --accent-text: #fff;
  --shadow: 2px 6px 12px rgba(60, 35, 10, .28);
  --bg-image: radial-gradient(rgba(120, 72, 30, .35) 1px, transparent 1.5px) 0 0 / 9px 9px,
              radial-gradient(rgba(255, 230, 190, .25) 1px, transparent 1.5px) 4px 5px / 11px 11px;
}
[data-style="sticky"][data-mode="dark"] {
  --bg: #2b2118; --panel: #4d4522; --panel-2: #3e381c; --border: #6b5f2e;
  --text: #fff4c9; --muted: #cbbd86; --accent: #ff7a7a; --accent-text: #2b2118;
  --shadow: 2px 6px 14px rgba(0, 0, 0, .5);
  --bg-image: radial-gradient(rgba(255, 220, 160, .08) 1px, transparent 1.5px) 0 0 / 9px 9px;
}
[data-style="sticky"] .brand { font-size: 2.1rem; }
[data-style="sticky"] .topbar .brand { font-size: 2rem; color: #fff; text-shadow: 1px 2px 0 rgba(0, 0, 0, .25); }
[data-style="sticky"][data-mode="dark"] .topbar .brand { color: var(--text); }
[data-style="sticky"] .item { background: color-mix(in srgb, var(--c) 30%, var(--panel)); position: relative; }
[data-style="sticky"] .item:nth-child(odd) { rotate: -.7deg; }
[data-style="sticky"] .item:nth-child(even) { rotate: .6deg; }
[data-style="sticky"] .item::before, [data-style="sticky"] .composer::before {
  content: ""; position: absolute; top: -8px; left: 50%; width: 70px; height: 18px; translate: -50% 0; rotate: -2deg;
  background: rgba(255, 255, 255, .45); box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
[data-style="sticky"] .composer { position: relative; }
[data-style="sticky"] .list { gap: 1rem; }
[data-style="sticky"] .list-head, [data-style="sticky"] .toggle { color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .35); }
[data-style="sticky"][data-mode="dark"] .list-head, [data-style="sticky"][data-mode="dark"] .toggle { color: var(--muted); text-shadow: none; }
[data-style="sticky"] .tag { background: rgba(255, 255, 255, .4); }

/* 11. Newspaper — black & white print */
[data-style="news"] {
  --font: "Libre Baskerville", Georgia, serif; --font-head: "Playfair Display", Georgia, serif;
  --scale: .95; --radius: 0; --radius-sm: 0; --pill: 0; --check-radius: 0;
  --head-weight: 900; --head-spacing: -.01em; --stripe: 0px;
}
[data-style="news"][data-mode="light"] {
  --bg: #f3f0e8; --panel: #f9f7f1; --panel-2: #eeeae0; --border: #1a1a1a;
  --text: #111; --muted: #5a5650; --accent: #111; --accent-text: #f9f7f1;
}
[data-style="news"][data-mode="dark"] {
  --bg: #141413; --panel: #1a1a19; --panel-2: #222220; --border: #e8e4da;
  --text: #ece8de; --muted: #a39e92; --accent: #ece8de; --accent-text: #141413;
}
[data-style="news"] .topbar { border-bottom: 4px double var(--text); padding-bottom: .6rem; }
[data-style="news"] .topbar .brand { font-size: 2.1rem; text-transform: uppercase; letter-spacing: .02em; }
[data-style="news"] .list { gap: 0; border-top: 2px solid var(--text); }
[data-style="news"] .item { background: transparent; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--text) 35%, transparent); box-shadow: none; padding: 1rem .2rem; }
[data-style="news"] .item-subject { font-size: 1.3rem; line-height: 1.25; }
[data-style="news"] .item-content { columns: 2 16rem; column-rule: 1px solid color-mix(in srgb, var(--text) 25%, transparent); text-align: justify; }
[data-style="news"] .tag { background: none; border: 0; padding: 0; text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; }
[data-style="news"] .cat { text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }

/* 12. Minimal — almost nothing */
[data-style="minimal"] {
  --font: "DM Sans", "Inter", sans-serif; --radius: 6px; --radius-sm: 6px;
  --head-weight: 500; --head-spacing: -.02em; --stripe: 0px; --bw: 1px;
}
[data-style="minimal"][data-mode="light"] {
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f6f6f6; --border: #ececec;
  --text: #111; --muted: #9a9a9a; --accent: #111; --accent-text: #fff;
}
[data-style="minimal"][data-mode="dark"] {
  --bg: #0c0c0c; --panel: #0c0c0c; --panel-2: #161616; --border: #1f1f1f;
  --text: #ededed; --muted: #777; --accent: #ededed; --accent-text: #0c0c0c;
}
[data-style="minimal"] .app { max-width: 42rem; padding-top: 2.5rem; }
[data-style="minimal"] .topbar { margin-bottom: 2rem; }
[data-style="minimal"] .list { gap: 0; }
[data-style="minimal"] .item { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 1.1rem .2rem; background: transparent; }
[data-style="minimal"] .item-subject { font-weight: 500; }
[data-style="minimal"] .cat { background: transparent; border-color: transparent; padding: .3rem .6rem; font-weight: 500; color: var(--muted); }
[data-style="minimal"] .cat.active { background: transparent; color: var(--text); border-color: transparent; box-shadow: inset 0 -2px 0 var(--c); border-radius: 0; }
[data-style="minimal"] .cat.active .dot { background: var(--c); }
[data-style="minimal"] .tag { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 500; }
[data-style="minimal"] .composer { border-color: transparent; background: var(--panel-2); }
[data-style="minimal"] .icon-btn, [data-style="minimal"] .btn.ghost { border-color: transparent; }

/* 13. Retro 90s — bevelled desktop */
[data-style="retro"] {
  --font: Tahoma, Verdana, "DejaVu Sans", Geneva, sans-serif; --font-head: "Pixelify Sans", Tahoma, sans-serif;
  --radius: 0; --radius-sm: 0; --pill: 0; --bw: 0px; --check-radius: 0; --head-weight: 700; --head-spacing: 0;
}
[data-style="retro"][data-mode="light"] {
  --bg: #008080; --panel: #c0c0c0; --panel-2: #ffffff; --border: #808080;
  --text: #000; --muted: #404040; --accent: #000080; --accent-text: #fff;
  --hi: #ffffff; --hi2: #dfdfdf; --lo: #808080; --lo2: #0a0a0a; --title-a: #000080; --title-b: #1084d0;
}
[data-style="retro"][data-mode="dark"] {
  --bg: #20253a; --panel: #3c3c44; --panel-2: #1c1c22; --border: #222;
  --text: #ececec; --muted: #b0b0b8; --accent: #3a6ea5; --accent-text: #fff;
  --hi: #6a6a74; --hi2: #50505a; --lo: #222228; --lo2: #000; --title-a: #3a2a6e; --title-b: #6e4bb8;
}
[data-style="retro"] { --shadow: inset -1px -1px var(--lo2), inset 1px 1px var(--hi), inset -2px -2px var(--lo), inset 2px 2px var(--hi2); }
[data-style="retro"] .topbar { background: linear-gradient(90deg, var(--title-a), var(--title-b)); color: #fff; padding: .3rem .4rem .3rem .7rem; box-shadow: var(--shadow); }
[data-style="retro"] .topbar .brand { font-size: 1.15rem; }
[data-style="retro"] .btn, [data-style="retro"] .icon-btn, [data-style="retro"] .cat, [data-style="retro"] .seg-btn {
  background: var(--panel); color: var(--text); border: 0; box-shadow: var(--shadow); border-radius: 0;
}
[data-style="retro"] .btn:active, [data-style="retro"] .icon-btn:active, [data-style="retro"] .cat:active, [data-style="retro"] .cat.active, [data-style="retro"] .seg-btn.active {
  box-shadow: inset 1px 1px var(--lo2), inset -1px -1px var(--hi), inset 2px 2px var(--lo), inset -2px -2px var(--hi2);
}
[data-style="retro"] .cat.active { background: var(--panel); color: var(--text); background-image: repeating-conic-gradient(var(--panel) 0 25%, var(--hi) 0 50%); background-size: 4px 4px; }
[data-style="retro"] .cat.active .dot { background: var(--c); opacity: 1; }
[data-style="retro"] .btn.primary { font-weight: 700; outline: 1px solid var(--lo2); outline-offset: -4px; }
[data-style="retro"] .field, [data-style="retro"] .select-wrap, [data-style="retro"] .note-box {
  background: var(--panel-2); border: 0; box-shadow: inset 1px 1px var(--lo), inset -1px -1px var(--hi), inset 2px 2px var(--lo2), inset -2px -2px var(--hi2);
}
[data-style="retro"] .composer { padding: .5rem; }
[data-style="retro"] .composer-row { padding: .6rem 0 0; }
[data-style="retro"] .icon-btn { color: var(--text); }
[data-style="retro"] .seg { background: var(--panel); border: 0; gap: 4px; padding: 0; }

/* 14. Luxe — black/ivory & gold */
[data-style="luxe"] {
  --font: "EB Garamond", Garamond, Georgia, serif; --font-head: "Cormorant Garamond", Garamond, serif;
  --scale: 1.1; --radius: 2px; --radius-sm: 2px; --pill: 2px;
  --head-weight: 600; --head-transform: uppercase; --head-spacing: .16em; --stripe: 2px;
}
[data-style="luxe"][data-mode="dark"] {
  --bg: #0b0b0b; --panel: #141312; --panel-2: #1b1a18; --border: #3a3226;
  --text: #f3ede0; --muted: #a59a84; --accent: #c9a45c; --accent-text: #0b0b0b;
  --bg-image: radial-gradient(60rem 30rem at 50% -10%, rgba(201, 164, 92, .10), transparent 60%);
}
[data-style="luxe"][data-mode="light"] {
  --bg: #f8f4ec; --panel: #fffdf8; --panel-2: #f3ede0; --border: #dccfae;
  --text: #1d1a14; --muted: #7d725c; --accent: #a8823a; --accent-text: #fff;
  --shadow: 0 10px 30px rgba(120, 90, 30, .08);
}
[data-style="luxe"] .brand {
  background: linear-gradient(90deg, #8a6a2c, #e8cf8f, #a8823a, #f4e2b0, #8a6a2c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-style="luxe"][data-mode="light"] .brand { background-image: linear-gradient(90deg, #6e5220, #a8823a, #7a5a22, #b8913f, #6e5220); }
[data-style="luxe"] .topbar { border-bottom: 1px solid var(--accent); padding-bottom: .8rem; }
[data-style="luxe"] .item-subject { font-family: var(--font); font-weight: 600; letter-spacing: .01em; }
[data-style="luxe"] .btn.primary { background: linear-gradient(135deg, #b38b45, #e2c27a 50%, #a8823a); color: #1a140a; letter-spacing: .1em; text-transform: uppercase; font-size: .85em; }
[data-style="luxe"] .cat { letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }

/* 15. Arctic — cool, icy, calm */
[data-style="arctic"] {
  --font: "Manrope", "Inter", sans-serif; --radius: 14px; --radius-sm: 10px;
  --head-weight: 800; --head-spacing: -.02em;
}
[data-style="arctic"][data-mode="dark"] {
  --bg: #1c2330; --panel: #232c3b; --panel-2: #2a3546; --border: #34425a;
  --text: #e5edf5; --muted: #93a4b8; --accent: #88c0d0; --accent-text: #10202a;
  --bg-image: linear-gradient(180deg, rgba(136, 192, 208, .10), transparent 30rem);
  --shadow: 0 4px 18px rgba(0, 0, 0, .25);
}
[data-style="arctic"][data-mode="light"] {
  --bg: #eef3f8; --panel: #fafcfe; --panel-2: #e7eef5; --border: #d3dee9;
  --text: #22303f; --muted: #66788c; --accent: #4c8db5; --accent-text: #fff;
  --bg-image: linear-gradient(180deg, #d7e8f5, transparent 30rem);
  --shadow: 0 6px 20px rgba(76, 141, 181, .12);
}
[data-style="arctic"] .brand::after { content: " ❄"; color: var(--accent); font-weight: 400; }

/* =========================================================
   Add-box position: top / left / right / bottom
   ========================================================= */
.composer { view-transition-name: composer; }
.list-area { view-transition-name: list-area; }
html[data-pos="left"] .app, html[data-pos="right"] .app { max-width: 72rem; }
@media (min-width: 900px) {
  html[data-pos="left"] .workspace, html[data-pos="right"] .workspace {
    display: grid; gap: 1.25rem; align-items: start;
  }
  html[data-pos="left"] .workspace { grid-template-columns: 22rem minmax(0, 1fr); }
  html[data-pos="right"] .workspace { grid-template-columns: minmax(0, 1fr) 22rem; }
  html[data-pos="right"] .composer { order: 2; }
  html[data-pos="left"] .composer, html[data-pos="right"] .composer { position: sticky; top: 1rem; margin-bottom: 0; }
  html[data-pos="left"] .content, html[data-pos="right"] .content { min-height: 10rem; }
  html[data-pos="left"] .composer-row, html[data-pos="right"] .composer-row { flex-wrap: wrap; }
  html[data-pos="left"] .composer-row .btn, html[data-pos="right"] .composer-row .btn { flex: 1; }
}
html[data-pos="bottom"] .composer {
  position: fixed; z-index: 20; margin: 0;
  left: 50%; translate: -50% 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: calc(min(48rem, 100vw) - 32px);
  box-shadow: var(--shadow), 0 10px 40px rgba(0, 0, 0, .3);
}
html[data-pos="bottom"][data-style="glass"] .composer,
html[data-pos="bottom"][data-style="neon"] .composer,
html[data-pos="bottom"][data-style="blueprint"] .composer,
html[data-pos="bottom"][data-style="chalk"] .composer { background: var(--panel-2); }
html[data-pos="bottom"][data-style="minimal"] .app { max-width: 48rem; }
html[data-pos="bottom"] .content { min-height: 2.6rem; height: 3.2rem; max-height: 30vh; }
html[data-pos="bottom"] .subject { padding-top: .6rem !important; }
html[data-pos="bottom"] .app { padding-bottom: calc(var(--composer-h, 10rem) + 2.5rem); }

/* =========================================================
   Motion
   ========================================================= */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modal-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes chip-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes wiggle { 0%, 100% { rotate: -1.2deg; } 50% { rotate: 1.2deg; } }
@keyframes shake { 0%, 100% { translate: 0; } 25% { translate: -6px 0; } 75% { translate: 6px 0; } }

.app:not(.hidden), .auth:not(.hidden) .auth-card { animation: fade-up .4s cubic-bezier(.2, .8, .2, 1); }
.empty { animation: fade-in .4s ease; }

dialog[open] .modal-card { animation: modal-in .24s cubic-bezier(.2, .8, .2, 1); }
dialog[open]::backdrop { animation: fade-in .22s ease; }
dialog.closing .modal-card { animation: modal-out .16s ease-in forwards; }
dialog.closing::backdrop { animation: fade-out .16s ease-in forwards; }

.btn, .icon-btn, .cat, .seg-btn, .swatch, .style-card, .check, .icon {
  transition: transform .12s ease, background-color .2s, color .2s, border-color .2s, box-shadow .2s, filter .2s;
}
.btn:active, .icon-btn:active, .seg-btn:active, .swatch:active, .style-card:active, .icon:active { transform: scale(.94); }
.cat:active { transform: scale(.95); }
.swatch:hover { transform: scale(1.12); }
.style-card:hover { transform: translateY(-2px); }
.check:hover { transform: scale(1.1); }
.check.pop { animation: pop .35s cubic-bezier(.2, .8, .2, 1); }
.cat.new { animation: chip-in .35s cubic-bezier(.2, 1.4, .4, 1); }
.cat.just-active { animation: pop .3s ease; }
.cat.editing { animation: wiggle .32s ease-in-out infinite; }
.cat.editing:nth-child(even) { animation-delay: -.16s; }
.composer { transition: border-color .25s, box-shadow .25s, background-color .35s; }
.composer:focus-within { box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.item-subject, .item-content { transition: color .3s; }
.item.editing-form { animation: fade-in .2s ease; }
.error.shake, .composer.shake { animation: shake .3s ease; }
#themeBtn svg { transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
#themeBtn.spin svg { transform: rotate(360deg); }
.icon-btn[aria-label="Settings"]:hover svg { transform: rotate(60deg); }
.icon-btn svg { transition: transform .4s ease; }
.seg-btn.active { animation: pop .25s ease; }

/* Page-level cross-fade for theme/style/layout changes (View Transitions API) */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }
::view-transition-group(composer), ::view-transition-group(list-area) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
  }
}

/* Settings: 15 styles need a scrollable dialog */
.modal-card { max-height: calc(100vh - 32px); overflow-y: auto; }
.style-grid .preview { height: 5.4rem; }

/* contrast fixes */
[data-style="retro"][data-mode="light"] .list-head, [data-style="retro"][data-mode="light"] .toggle { color: #fff; }
[data-style="sticky"] .cat-tools .btn.ghost, [data-style="sticky"] .top-actions .icon-btn, [data-style="sticky"] .top-actions .btn.ghost {
  background: var(--panel-2); color: var(--text); border: 0; box-shadow: 1px 2px 4px rgba(0, 0, 0, .2);
}

/* =========================================================
   Logo
   ========================================================= */
.brand-wrap { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.logo { width: 2rem; height: 2rem; flex: none; filter: drop-shadow(0 2px 6px rgba(80, 60, 200, .35)); transition: transform .4s cubic-bezier(.2, 1.4, .4, 1); }
.brand-wrap:hover .logo { transform: rotate(-8deg) scale(1.08); }
.auth-logo { width: 4rem; height: 4rem; margin: 0 auto -.2rem; filter: drop-shadow(0 6px 16px rgba(80, 60, 200, .4)); animation: chip-in .5s cubic-bezier(.2, 1.4, .4, 1); }
[data-style="retro"] .logo { filter: none; width: 1.4rem; height: 1.4rem; }
[data-style="news"] .logo, [data-style="minimal"] .logo { filter: grayscale(1) contrast(1.2); }

/* =========================================================
   Batch select / delete
   ========================================================= */
.list-tools { display: flex; align-items: center; gap: .75rem; }
.bulk-bar {
  position: sticky; top: .5rem; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap;
  padding: .5rem .6rem .5rem .9rem; margin-bottom: .6rem;
  animation: fade-up .25s cubic-bezier(.2, .8, .2, 1);
}
[data-style="glass"] .bulk-bar, [data-style="neon"] .bulk-bar, [data-style="blueprint"] .bulk-bar, [data-style="chalk"] .bulk-bar { background: var(--panel-2); }
.bulk-count { font-weight: 700; }
.bulk-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.btn.danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger-solid:disabled { opacity: .4; cursor: not-allowed; }
.btn.danger-solid:not(:disabled):hover { filter: brightness(1.08); }

.selecting .item { cursor: pointer; user-select: none; }
.selecting .item .item-actions { visibility: hidden; }
.sel-box {
  flex: none; width: 1.4rem; height: 1.4rem; margin-top: .1rem; border-radius: 6px;
  border: 2px solid var(--muted); display: grid; place-items: center; transition: background-color .15s, border-color .15s, transform .15s;
}
.item.selected .sel-box { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.item.selected .sel-box::after { content: ""; width: .35rem; height: .7rem; border: solid var(--accent-text); border-width: 0 2.5px 2.5px 0; rotate: 45deg; translate: 0 -1px; }
.item.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
[data-style="news"] .item.selected, [data-style="minimal"] .item.selected { background: color-mix(in srgb, var(--accent) 10%, transparent); outline: 0; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* =========================================================
   Drag to reorder
   ========================================================= */
.list, .cat-buttons { position: relative; }
.grip {
  flex: none; align-self: stretch; display: grid; place-items: center;
  width: .9rem; margin: -.2rem -.3rem -.2rem -.45rem;
  color: var(--muted); cursor: grab; opacity: 0; touch-action: none;
  transition: opacity .2s, color .2s;
}
.grip svg { width: .6rem; height: .95rem; }
.item:hover .grip { opacity: .65; }
.grip:hover { opacity: 1 !important; color: var(--text); }
@media (hover: none) {
  .grip { opacity: .45; width: 1.4rem; }
  .item, .cat { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
.item { transition: background-color .35s, border-color .35s, box-shadow .25s, color .35s, scale .18s, opacity .2s; }
.item.dragging, .cat.dragging {
  position: relative; z-index: 40; cursor: grabbing;
  scale: 1.03;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35), 0 0 0 2px var(--accent) !important;
  transition: scale .18s, box-shadow .2s;
  animation: none !important;
}
.cat.dragging { scale: 1.1; }
[data-style="sticky"] .item.dragging { rotate: 2deg; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
body.is-dragging .item:not(.dragging) .item-actions { opacity: .2; }
html[data-pos="bottom"] .item { scroll-margin-bottom: calc(var(--composer-h, 10rem) + 2rem); }
.hint-small { font-size: .8rem; margin: .6rem 0 0; }

/* ---------- Importance ("!", "!!", "!!!" at the start of the subject) ---------- */
.item.imp-1 { --imp: #f59e0b; --imp-tint: 7%;  --imp-ring: 1px; }
.item.imp-2 { --imp: #f97316; --imp-tint: 13%; --imp-ring: 1.5px; }
.item.imp-3 { --imp: #ef4444; --imp-tint: 20%; --imp-ring: 2px; }
.item.imp:not(.done) {
  background-image: linear-gradient(100deg, color-mix(in srgb, var(--imp) var(--imp-tint), transparent), color-mix(in srgb, var(--imp) calc(var(--imp-tint) / 3), transparent) 70%);
  border-color: color-mix(in srgb, var(--imp) 55%, var(--border));
  border-left-color: var(--c);
  box-shadow: var(--shadow), 0 0 0 var(--imp-ring) color-mix(in srgb, var(--imp) 60%, transparent);
}
.item.imp-2:not(.done) { box-shadow: var(--shadow), 0 0 0 var(--imp-ring) color-mix(in srgb, var(--imp) 75%, transparent), 0 4px 16px -6px color-mix(in srgb, var(--imp) 55%, transparent); }
.item.imp-3:not(.done) {
  padding-top: .95rem; padding-bottom: .95rem;
  box-shadow: var(--shadow), 0 0 0 var(--imp-ring) var(--imp), 0 6px 24px -6px color-mix(in srgb, var(--imp) 70%, transparent);
  animation: imp-glow 2.4s ease-in-out infinite;
}
@keyframes imp-glow {
  50% { box-shadow: var(--shadow), 0 0 0 var(--imp-ring) var(--imp), 0 6px 34px -2px color-mix(in srgb, var(--imp) 85%, transparent); }
}
.item.imp-2:not(.done) .item-subject { font-size: 1.12rem; }
.item.imp-3:not(.done) .item-subject { font-size: 1.22rem; font-weight: 800; }
.item.imp-3:not(.done) .item-subject { color: color-mix(in srgb, var(--imp) 30%, var(--text)); }

.imp-badge {
  display: inline-grid; place-items: center; vertical-align: .12em;
  min-width: 1.35em; height: 1.35em; padding: 0 .35em; margin-right: .45em;
  border-radius: var(--pill); font: 800 .72em/1 system-ui, sans-serif; letter-spacing: .04em;
  color: color-mix(in srgb, var(--imp) 75%, var(--text));
  background: color-mix(in srgb, var(--imp) 18%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--imp) 70%, transparent);
}
.item.imp-2 .imp-badge, .item.imp-3 .imp-badge { color: #fff; background: var(--imp); border-color: var(--imp); }
.item.imp-3:not(.done) .imp-badge { animation: imp-pulse 2.4s ease-in-out infinite; }
@keyframes imp-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--imp) 60%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--imp) 0%, transparent); }
}
.item.done .imp-badge { color: var(--muted); background: none; border-color: var(--border); }

/* Styles with no card body: keep it a tint + left accent instead of a ring. */
[data-style="news"] .item.imp:not(.done), [data-style="minimal"] .item.imp:not(.done) {
  box-shadow: inset 3px 0 0 var(--imp); padding-left: .8rem; animation: none;
}
[data-style="sticky"] .item.imp:not(.done) { background-image: none; }
[data-style="brutal"] .item.imp:not(.done) { box-shadow: 4px 4px 0 var(--imp); animation: none; }
[data-style="brutal"] .item.imp-3:not(.done) { box-shadow: 6px 6px 0 var(--imp); }

/* Live hint while typing "!" in the add box */
.composer .subject { transition: color .25s; }
.composer[data-imp="1"] .subject { color: color-mix(in srgb, #f59e0b 70%, var(--text)); }
.composer[data-imp="2"] .subject { color: color-mix(in srgb, #f97316 75%, var(--text)); }
.composer[data-imp="3"] .subject { color: color-mix(in srgb, #ef4444 80%, var(--text)); }
.composer[data-imp="3"] { box-shadow: var(--shadow), 0 0 0 2px color-mix(in srgb, #ef4444 55%, transparent); }

@media (prefers-reduced-motion: reduce) {
  .item.imp-3, .item.imp-3 .imp-badge { animation: none !important; }
}

/* ---------- Daily todos ---------- */
.daily-toggle {
  display: inline-flex; align-items: center; gap: .35rem; flex: none;
  margin-right: auto; padding: .35rem .7rem; border-radius: var(--pill);
  border: var(--bw) solid var(--border); background: transparent; color: var(--muted);
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.daily-toggle svg { width: 1em; height: 1em; transition: rotate .45s cubic-bezier(.2, .8, .2, 1); }
.daily-toggle:hover { color: var(--text); border-color: var(--accent); }
.daily-toggle.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.daily-toggle.on svg { rotate: 360deg; }
.daily-toggle.pop { animation: pop .3s ease; }
.daily-toggle.small { margin-right: 0; padding: .25rem .6rem; font-size: .8rem; }
.composer-row .adding-to { flex: 0 1 auto; }
.daily-tag { --c: var(--accent); }
.daily-tag svg { width: .85em; height: .85em; }
.item.done .daily-tag { --c: var(--ok); }
.day-start-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.day-start-row .hint-small { margin: 0; }
@media (max-width: 480px) {
  .adding-to .adding-label { display: none; }
  .edit-row .spacer { display: none; }
  .edit-row .select-wrap { flex: 1 1 5rem; }
  .edit-row .select-wrap select { width: 100%; }
}

/* ---------- Copy done + toast ---------- */
.copy-done { display: inline-flex; align-items: center; gap: .35rem; }
.copy-done svg { width: 1em; height: 1em; }
.copy-done.pop { animation: pop .3s ease; }
.copy-done.shake { animation: shake .3s ease; }
.count-badge {
  min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: .72rem; font-weight: 800;
  background: var(--accent); color: var(--accent-text);
}
.count-badge.hidden { display: none; }
.toast {
  position: fixed; left: 50%; top: 1rem; z-index: 100; max-width: calc(100vw - 2rem);
  translate: -50% -150%; opacity: 0; pointer-events: none;
  padding: .6rem 1rem; border-radius: var(--radius-sm);
  background: var(--text); color: var(--bg); font-weight: 600; font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  transition: translate .35s cubic-bezier(.2, .8, .2, 1), opacity .25s;
}
.toast.show { translate: -50% 0; opacity: 1; }
@media (max-width: 480px) {
  .copy-done > span:not(.count-badge) { display: none; }
}
.list-head { flex-wrap: wrap; gap: .4rem .75rem; }
#count, .list-head .toggle { white-space: nowrap; }
.list-tools { margin-left: auto; }
@media (max-width: 480px) { .list-tools { gap: .5rem; } }
