:root {
  --page: #000000;
  --card: #1C1C1E;
  --card-raised: #2C2C2E;
  --line: #2C2C2E;
  --line-strong: #3A3A3C;
  --text: #F2F2F7;
  --text-2: #AEAEB2;
  --text-3: #8E8E93;
  --accent: #FF6B3D;
  --accent-soft: rgba(255,107,61,0.16);
  --green: #30D158;
  --green-soft: rgba(48,209,88,0.16);
  --orange: #FF9F0A;
  --red: #FF453A;
  --red-soft: rgba(255,69,58,0.16);
  --radius: 14px;
  --row: 40px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--text);
  line-height: 1.4;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }
[hidden] { display: none !important; }

svg.i {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* Header */
.header {
  position: sticky; top: 0; z-index: 100;
  min-height: 52px;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 24px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(0,0,0,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}

.header h1 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 7px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px; background: var(--green); flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 12.5 3.2 3.2L17 9' stroke='black' stroke-width='2.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 100%;
}
.list-name { font-weight: 600; color: var(--text-2); padding-left: 10px; border-left: 1px solid var(--line-strong); }

.sync {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-3);
  white-space: nowrap; flex: 1; min-width: 0;
}
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; transition: background .2s; }
.sync[data-state="saved"] i { background: var(--green); }
.sync[data-state="saving"] i, .sync[data-state="pending"] i { background: var(--orange); }
.sync[data-state="saving"] i { animation: pulse 1s infinite; }
.sync[data-state="offline"] i, .sync[data-state="error"] i { background: var(--red); }
.sync[data-state="offline"], .sync[data-state="error"] { color: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

.progress { display: flex; align-items: center; gap: 10px; }
.progress-bar-wrap { width: 160px; height: 6px; background: var(--card-raised); border-radius: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: var(--green); border-radius: 6px; transition: width 0.4s ease; }
.progress-text { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 110px; text-align: right; }

.toolbar { display: flex; align-items: center; gap: 4px; }

.search {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 8px 0 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text-3); margin-right: 4px;
  transition: border-color .2s;
}
.search:focus-within { border-color: var(--accent); }
.search svg.i { width: 15px; height: 15px; }
.search input {
  width: 150px; background: none; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 13px;
}
.search input::-webkit-search-cancel-button { filter: invert(.6); }
.search kbd {
  font-family: var(--font); font-size: 11px; color: var(--text-3);
  border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 5px;
}
.search:focus-within kbd { display: none; }

.icon-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 7px;
  color: var(--text-3); cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.icon-btn svg.i { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--card-raised); color: var(--text); }
.icon-btn.delete:hover { background: var(--red-soft); color: var(--red); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; color: var(--text-3); }
.icon-btn.tb { width: 32px; height: 32px; }
.icon-btn.tb svg.i { width: 18px; height: 18px; }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 38px; z-index: 200;
  min-width: 210px; padding: 6px;
  background: var(--card-raised); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  display: flex; flex-direction: column;
}
.menu button {
  text-align: left; background: none; border: none; color: var(--text);
  font-size: 13px; padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.menu button:hover { background: var(--accent); color: #fff; }

/* Layout */
.layout { display: flex; align-items: flex-start; gap: 20px; padding: 20px 24px 80px; }
.container { flex: 1 1 auto; min-width: 0; container-type: inline-size; }


/* Category card */
.category {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 14px; overflow: hidden;
}
.category.complete { border-color: rgba(48,209,88,.35); }

.category-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer; user-select: none;
}
.category.open .category-header { border-bottom: 1px solid var(--line); }

.category-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border: none; cursor: pointer;
}
button.category-icon:hover { filter: brightness(1.3); }
.category.complete .category-icon { background: var(--green-soft); color: var(--green); }

.category-title {
  font-size: 17px; font-weight: 700; letter-spacing: -0.2px;
  flex: 1; min-width: 0; cursor: text;
}

[contenteditable="true"], [contenteditable="plaintext-only"] {
  outline: none; box-shadow: 0 1.5px 0 var(--accent);
  user-select: text; -webkit-user-select: text;
}

.cat-progress { width: 60px; height: 4px; background: var(--card-raised); border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.cat-progress > div { height: 100%; background: var(--green); border-radius: 4px; transition: width .3s; }

.category-count {
  font-size: 12px; color: var(--text-2); background: var(--card-raised);
  padding: 3px 10px; border-radius: 20px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.category.complete .category-count { color: var(--green); background: var(--green-soft); }

.category-actions { display: flex; gap: 2px; }
.category-actions .icon-btn { opacity: 0; }
.category-header:hover .category-actions .icon-btn { opacity: 1; }

.category-toggle { color: var(--text-3); display: flex; transition: transform 0.25s; }
.category.open .category-toggle { transform: rotate(180deg); }

.category-body { display: none; padding: 6px 16px 14px; }
.category.open .category-body {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  column-gap: 24px; row-gap: 12px; align-items: stretch;
}
.category-body .add-sub-btn { grid-column: 1 / -1; }

/* Columns */
.subcategory { display: flex; flex-direction: column; min-width: 0; }
.sub-header { height: 36px; display: flex; align-items: center; justify-content: space-between; }
.sub-header .sub-delete { opacity: 0; }
.sub-header:hover .sub-delete { opacity: 1; }
.sub-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: 0.2px; cursor: text; }
.sub-label small { font-weight: 500; color: var(--text-3); margin-left: 6px; }

.sub-items { display: flex; flex-direction: column; min-height: 8px; }
.sub-items.drop-target { background: var(--accent-soft); border-radius: 8px; }

/* Rows */
.checklist-item {
  height: var(--row); flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 6px 4px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.checklist-item.dragging { opacity: .4; }
.checklist-item.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } 100% { background: var(--card); } }

.grip {
  width: 10px; align-self: stretch; flex-shrink: 0; margin-right: -6px;
  cursor: grab; opacity: 0; color: var(--text-3);
  background-image: radial-gradient(currentColor 1px, transparent 1.3px);
  background-size: 5px 5px; background-position: center; background-repeat: repeat-y;
  background-clip: content-box; padding: 10px 0;
}
.checklist-item:hover .grip { opacity: .7; }

.checklist-item input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px;
  border: 1.75px solid var(--line-strong); border-radius: 50%;
  flex-shrink: 0; cursor: pointer; position: relative;
  background: transparent; transition: all 0.15s;
}
.checklist-item input[type="checkbox"]:hover { border-color: var(--text-3); }
.checklist-item input[type="checkbox"]:checked { background: var(--green); border-color: var(--green); }
.checklist-item input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 6px; top: 2.5px;
  width: 5px; height: 10px; border: solid #000; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checklist-item input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.item-text {
  flex: 1; min-width: 0; font-size: 14px; color: var(--text);
  transition: color 0.2s; cursor: text;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Under redigering visas hela texten och raden får växa */
.checklist-item.editing { height: auto; min-height: var(--row); }
.checklist-item.editing .item-text { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }

/* Hela texten när man hovrar över en avkortad rad */
.peek {
  position: fixed; z-index: 300; pointer-events: none;
  font-size: 14px; line-height: 1.4; color: var(--text);
  white-space: normal; overflow-wrap: anywhere;
  background: var(--card-raised); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 6px 10px; margin: -7px 0 0 -11px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .12s;
}
.peek.show { opacity: 1; }
.peek a { color: var(--accent); }
.peek mark { background: rgba(255,214,10,.3); color: inherit; border-radius: 3px; }
.peek.checked { color: var(--text-3); text-decoration: line-through; }
.item-text a { color: var(--accent); text-decoration: none; }
.item-text a:hover { text-decoration: underline; }
.item-text mark { background: rgba(255,214,10,.3); color: inherit; border-radius: 3px; }
.checklist-item.checked .item-text { color: var(--text-3); text-decoration: line-through; }

.checklist-item .item-delete { opacity: 0; }
.checklist-item:hover .item-delete { opacity: 1; }

/* Länkkolumn: syns bara på rader som har länk (och vid hover) */
.sub-header { gap: 6px; }
.sub-header .sub-label { flex: 1; }
.link-head {
  font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
  color: var(--text-3); opacity: 0; transition: opacity .15s; padding-right: 4px;
}
.link-head.has, .subcategory:hover .link-head { opacity: .8; }
.link-slot { flex-shrink: 0; display: flex; justify-content: flex-end; }
.link-add { width: 26px; height: 26px; opacity: 0; }
.checklist-item:hover .link-add, .link-add:focus-visible { opacity: .6; }
.link-add:hover { opacity: 1 !important; color: var(--accent); }
.link-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 132px; height: 24px;
  padding: 0 9px 0 7px; border-radius: 999px; text-decoration: none;
  font-size: 12px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.link-chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.link-chip .i { width: 13px; height: 13px; flex-shrink: 0; stroke-width: 2.2; }
.link-chip:hover { background: rgba(255,107,61,.26); border-color: rgba(255,107,61,.45); }
.link-chip mark { background: rgba(255,214,10,.3); color: inherit; border-radius: 3px; }
.checklist-item.checked .link-chip { opacity: .55; }
.peek.url { width: auto; max-width: min(460px, calc(100vw - 16px)); font-size: 12.5px; color: var(--text-2); word-break: break-all; margin: 0; }

.link-pop {
  position: fixed; z-index: 320; width: 320px; max-width: calc(100vw - 16px);
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--card-raised); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.link-pop[hidden] { display: none; }
.lp-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--text); min-width: 0; }
.lp-title span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lp-title .i { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.lp-url { font-size: 12px; color: var(--accent); word-break: break-all; text-decoration: none; line-height: 1.4; max-height: 5.6em; overflow: auto; }
.lp-url:hover { text-decoration: underline; }
.link-pop input {
  height: 34px; padding: 0 10px; border-radius: 8px; font: inherit; font-size: 13px;
  background: var(--card); color: var(--text); border: 1px solid var(--line-strong); outline: none;
}
.link-pop input:focus { border-color: var(--accent); }
.link-pop input.bad { border-color: var(--red); }
.link-pop input::placeholder { color: var(--text-3); }
.lp-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 2px; }
.lp-btn {
  height: 30px; padding: 0 11px; border-radius: 8px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; text-decoration: none;
  font: inherit; font-size: 12.5px; font-weight: 600; background: var(--line); color: var(--text);
}
.lp-btn .i { width: 13px; height: 13px; }
.lp-btn:hover { filter: brightness(1.2); }
.lp-btn.primary { background: var(--accent); color: #fff; }
.lp-btn.danger { color: var(--red); margin-right: auto; }

/* Add row */
.add-item-row { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: flex; gap: 6px; }
.add-item-input {
  flex: 1; min-width: 0; height: 34px;
  font-family: var(--font); font-size: 13px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 9px;
  background: var(--card-raised); color: var(--text); outline: none;
  transition: border-color 0.2s;
}
.add-item-input:focus { border-color: var(--accent); }
.add-item-input::placeholder { color: var(--text-3); }
.add-item-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 9px; background: var(--accent); color: #fff;
  cursor: pointer; transition: filter 0.15s;
}
.add-item-btn:hover { filter: brightness(1.12); }

.add-sub-btn, .add-category-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  font-family: var(--font); font-weight: 600;
  background: transparent; border: 1px dashed var(--line-strong); color: var(--text-3);
  cursor: pointer; transition: all 0.15s;
}
.add-sub-btn { font-size: 12px; padding: 8px; border-radius: 9px; }
.add-category-btn { font-size: 14px; padding: 14px; border-radius: var(--radius); }
.add-sub-btn:hover, .add-category-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 14px; }

/* Notes */
.notes {
  flex: 0 0 var(--notes-w, 360px); position: sticky; top: 72px;
  height: calc(100vh - 144px); min-height: 300px;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 16px;
}
.notes-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.notes-collapse { margin-left: auto; }

.notes-resizer {
  position: absolute; left: -16px; top: 0; bottom: 0; width: 14px;
  cursor: col-resize; touch-action: none; z-index: 5;
}
.notes-resizer::after {
  content: ''; position: absolute; left: 6px; top: 50%; width: 3px; height: 44px; margin-top: -22px;
  border-radius: 3px; background: var(--line-strong); opacity: 0; transition: opacity .15s, background .15s, height .15s;
}
.notes:hover .notes-resizer::after { opacity: 1; }
.notes-resizer:hover::after, body.resizing .notes-resizer::after { opacity: 1; background: var(--accent); height: 100%; top: 0; margin-top: 0; }
body.resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
body.resizing .notes textarea { pointer-events: none; }
.notes.will-collapse { opacity: .4; }

.notes-rail {
  display: none; flex: 0 0 44px; position: sticky; top: 72px;
  height: calc(100vh - 144px); min-height: 200px;
  flex-direction: column; align-items: center; gap: 12px; padding: 10px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text-2); cursor: pointer; font: inherit;
  transition: border-color .15s, background .15s;
}
.notes-rail:hover { border-color: var(--accent); background: #232326; }
.notes-rail .category-icon { width: 30px; height: 30px; border-radius: 8px; }
.rail-label { writing-mode: vertical-rl; font-size: 13px; font-weight: 600; letter-spacing: .3px; }
.notes-rail .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.notes-rail:not(.has-notes) .dot { display: none; }
body.notes-collapsed .notes { display: none; }
body.notes-collapsed .notes-rail { display: flex; }

/* Kort som dras */
.category.dragging-cat { opacity: .4; outline: 2px dashed var(--accent); outline-offset: -2px; }
body.dragging-cat .category-body { pointer-events: none; }
.category.dragging-cat .category-body { display: none !important; }
.category.dragging-cat .category-header { border-bottom: none; }
.notes-title .category-icon { width: 30px; height: 30px; border-radius: 8px; cursor: default; }
.notes textarea {
  flex: 1; width: 100%; resize: none;
  font-family: var(--font); font-size: 14px; line-height: 1.6; color: var(--text);
  background: var(--card-raised); border: 1px solid transparent; border-radius: 10px;
  padding: 12px 14px; outline: none; transition: border-color 0.2s;
}
.notes textarea:focus { border-color: var(--accent); }
.notes textarea::placeholder { color: var(--text-3); }

/* Icon picker */
.popover {
  position: absolute; z-index: 300;
  display: grid; grid-template-columns: repeat(6, 34px); gap: 4px; padding: 8px;
  background: var(--card-raised); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.popover button {
  width: 34px; height: 34px; border-radius: 8px; border: none; cursor: pointer;
  background: none; color: var(--text-2); display: flex; align-items: center; justify-content: center;
}
.popover button:hover, .popover button.sel { background: var(--accent-soft); color: var(--accent); }

/* Toasts */
.toasts {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  background: #3A3A3C; color: var(--text);
  padding: 10px 12px 10px 16px; border-radius: 12px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: toastIn .2s ease;
  max-width: calc(100vw - 32px);
}
.toast button {
  background: none; border: none; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer;
  padding: 2px 4px;
}
.toast.out { opacity: 0; transform: translateY(8px); transition: all .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 480px; max-height: 80vh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 8px 16px 16px; overflow: auto; font-size: 14px; }
.modal-body p { color: var(--text-2); margin: 8px 0; }
.hist-row, .key-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line);
}
.hist-row:first-child, .key-row:first-child { border-top: none; }
.hist-row span { flex: 1; }
.hist-row small { color: var(--text-3); font-variant-numeric: tabular-nums; }
.hist-row button {
  background: var(--accent-soft); color: var(--accent); border: none; border-radius: 7px;
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.key-row span { flex: 1; color: var(--text-2); }
.key-row kbd {
  font-family: var(--font); font-size: 12px; background: var(--card-raised);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 7px;
}

/* Lock */
.lock { position: fixed; inset: 0; z-index: 600; background: var(--page); display: flex; align-items: center; justify-content: center; padding: 20px; }
.lock-card {
  width: 100%; max-width: 320px; text-align: center;
  display: flex; flex-direction: column; gap: 12px; align-items: stretch;
}
.lock-icon { width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 14px; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; }
.lock-icon svg.i { width: 28px; height: 28px; }
.lock-card h2 { font-size: 22px; }
.lock-card p { color: var(--text-2); font-size: 14px; }
.lock-card input {
  height: 44px; padding: 0 14px; font: inherit; font-size: 16px;
  background: var(--card-raised); color: var(--text);
  border: 1px solid transparent; border-radius: 10px; outline: none; text-align: center;
}
.lock-card input:focus { border-color: var(--accent); }
.lock-card button { height: 44px; border: none; border-radius: 10px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.lock-error { color: var(--red); font-size: 13px; min-height: 18px; }

/* Touch devices have no hover: show the controls */
@media (hover: none) {
  .category-actions .icon-btn, .sub-header .sub-delete, .checklist-item .item-delete { opacity: 1; }
  .link-add { opacity: .35; }
  .link-head { opacity: .8; }
  .grip { display: none; }
  .search kbd { display: none; }
}

@media (max-width: 1100px) {
  .progress-bar-wrap { width: 100px; }
}

@media (max-width: 860px) {
  .layout { flex-direction: column; align-items: stretch; }
  .notes { position: static; flex: none; height: 280px; order: 1; }
  .notes-resizer { display: none; }
  .notes-rail { position: static; order: 1; height: auto; min-height: 0; flex: none; flex-direction: row; padding: 10px 14px; }
  .rail-label { writing-mode: horizontal-tb; }
  .header { flex-wrap: wrap; row-gap: 8px; }
  .toolbar { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
}

@media (max-width: 560px) {
  .header { padding-left: 14px; padding-right: 14px; gap: 10px; }
  .sync span { display: none; }
  .list-name { display: none; }
  .progress-bar-wrap { width: 60px; }
  .progress-text { min-width: 0; }
  .cat-progress { display: none; }
  .category-header { gap: 10px; padding: 12px; }
  .category-title { font-size: 16px; }
  .layout { padding: 12px 10px 80px; }
  .category.open .category-body { grid-template-columns: minmax(0, 1fr); padding: 6px 12px 12px; }
}

/* Korten följer sin egen bredd: smalt utrymme ger en kolumn */
@container (max-width: 620px) {
  .container .category.open .category-body { grid-template-columns: minmax(0, 1fr); }
  .container .cat-progress { display: none; }
}

@media print {
  .header { position: static; }
  .toolbar, .sync, .add-item-row, .add-sub-btn, .add-category-btn,
  .icon-btn, .category-toggle, .grip, .toasts, .notes-rail, .notes-resizer { display: none !important; }
  body.notes-collapsed .notes { display: flex !important; }
  .category-body { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .category { break-inside: avoid; }
  .layout { display: block; }
  .notes { position: static; height: auto; margin-top: 16px; }
  .notes textarea { min-height: 200px; }
  .checklist-item { height: auto; min-height: var(--row); }
  .item-text { white-space: normal; overflow-wrap: anywhere; }
  .peek, .link-pop, .link-add { display: none !important; }
}
