@import url('https://fonts.googleapis.com/css2?family=Spectral:wght@400;500;600;700&family=Hanken+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --paper: #E9E6DE;
  --card: #FCFBF8;
  --ink: #23201B;
  --ink-soft: #6B645B;
  --line: #D8D4C9;
  --string: #B23A2E;
  --string-deep: #8E2C22;
  --danger: #9A3327;
  --focus: #1F5FA6;
  --input-bg: #FFFFFF;
  --chip-bg: #F1EEE6;
  --cork-bg: #C2A06A;
  --cork-dot: rgba(0,0,0,.10);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(33,29,23,.05), 0 6px 18px rgba(33,29,23,.06);
  --glass-bg: rgba(255,255,255,.50);
  --glass-bd: rgba(255,255,255,.62);
  --glass-hi: rgba(255,255,255,.70);
  --glass-field: rgba(255,255,255,.42);
  --glass-btn: rgba(255,255,255,.46);
}

:root[data-theme="paperwhite"] {
  --paper: #EEF1F4; --card: #FFFFFF; --ink: #1B2230; --ink-soft: #5B6675; --line: #DCE1E8;
  --string: #BE4034; --string-deep: #972E24; --danger: #A33327; --focus: #2563EB;
  --input-bg: #FFFFFF; --chip-bg: #EDF0F4; --cork-bg: #BCA981; --cork-dot: rgba(0,0,0,.10);
}
:root[data-theme="sage"] {
  --paper: #E7EDE5; --card: #FBFCFA; --ink: #232A23; --ink-soft: #5E6A5B; --line: #D3DBCF;
  --string: #5B7A4F; --string-deep: #466038; --danger: #9A3327; --focus: #3B6FA0;
  --input-bg: #FFFFFF; --chip-bg: #E4EADF; --cork-bg: #BEAE7C; --cork-dot: rgba(0,0,0,.10);
}
:root[data-theme="sand"] {
  --paper: #ECE4D6; --card: #FBF7EF; --ink: #2A2620; --ink-soft: #6E6557; --line: #DCD2C0;
  --string: #B26233; --string-deep: #8C4A24; --danger: #97331F; --focus: #2F6FA0;
  --input-bg: #FFFFFF; --chip-bg: #ECE2CF; --cork-bg: #C7A772; --cork-dot: rgba(0,0,0,.10);
}
:root[data-theme="slate"] {
  --paper: #ECEEF1; --card: #FFFFFF; --ink: #1E232B; --ink-soft: #5E6773; --line: #DBDFE5;
  --string: #3F6FB0; --string-deep: #2F5790; --danger: #A33327; --focus: #2563EB;
  --input-bg: #FFFFFF; --chip-bg: #E7EAEE; --cork-bg: #B6A887; --cork-dot: rgba(0,0,0,.10);
}
:root[data-theme="charcoal"] {
  --paper: #1C1A17; --card: #262320; --ink: #ECE7DD; --ink-soft: #A79E90; --line: #38332C;
  --string: #C8503F; --string-deep: #A23B2D; --danger: #D9694F; --focus: #5B9BD5;
  --input-bg: #211E1A; --chip-bg: #322E27; --cork-bg: #4A3B27; --cork-dot: rgba(0,0,0,.20);
}
:root[data-theme="midnight"] {
  --paper: #0F1722; --card: #18222F; --ink: #E6ECF3; --ink-soft: #93A1B3; --line: #263441;
  --string: #4F8FE0; --string-deep: #3D72B8; --danger: #E0654F; --focus: #6FB0FF;
  --input-bg: #141D29; --chip-bg: #1F2A38; --cork-bg: #243446; --cork-dot: rgba(0,0,0,.28);
}
:root[data-theme="forest"] {
  --paper: #11160F; --card: #1A2217; --ink: #E7EEE0; --ink-soft: #9DAB92; --line: #28321F;
  --string: #7FA86B; --string-deep: #5E8A4C; --danger: #D9694F; --focus: #6FB0FF;
  --input-bg: #161D12; --chip-bg: #212B1B; --cork-bg: #2C3A22; --cork-dot: rgba(0,0,0,.25);
}
:root[data-theme="plum"] {
  --paper: #18121E; --card: #221A2B; --ink: #ECE3F0; --ink-soft: #A99BB3; --line: #322840;
  --string: #C56DA8; --string-deep: #9F4E84; --danger: #E0654F; --focus: #B58BE0;
  --input-bg: #1C1524; --chip-bg: #281F33; --cork-bg: #342843; --cork-dot: rgba(0,0,0,.28);
}
:root[data-theme="graphite"] {
  --paper: #121212; --card: #1E1E1E; --ink: #F1F1F1; --ink-soft: #9A9A9A; --line: #313131;
  --string: #565B61; --string-deep: #3E4247; --danger: #C56B5E; --focus: #9AA0A6;
  --input-bg: #181818; --chip-bg: #262626; --cork-bg: #2E2E2E; --cork-dot: rgba(0,0,0,.30);
}
:root[data-theme="charcoal"], :root[data-theme="midnight"], :root[data-theme="forest"],
:root[data-theme="plum"], :root[data-theme="graphite"] {
  --glass-bg: rgba(26,26,32,.46);
  --glass-bd: rgba(255,255,255,.16);
  --glass-hi: rgba(255,255,255,.10);
  --glass-field: rgba(255,255,255,.07);
  --glass-btn: rgba(255,255,255,.09);
}
:root[data-theme="crt"] {
  --paper: #010801; --card: #050F05; --ink: #33FF33; --ink-soft: #1AAD1A; --line: #0C3A0C;
  --string: #66FF66; --string-deep: #33CC33; --danger: #FF4444; --focus: #33FF33;
  --input-bg: #020A02; --chip-bg: #0A1E0A; --cork-bg: #000000; --cork-dot: transparent;
  --radius: 6px;
  --shadow: 0 0 0 1px #0C3A0C, 0 4px 16px rgba(0,0,0,.8);
  --glass-bg: rgba(0,10,0,.82);
  --glass-bd: rgba(51,255,51,.22);
  --glass-hi: rgba(51,255,51,.10);
  --glass-field: rgba(51,255,51,.07);
  --glass-btn: rgba(51,255,51,.10);
}
:root[data-theme="crt"] body { font-family: 'IBM Plex Mono', monospace; }
:root[data-theme="crt"] .btn-primary { color: var(--paper); }
:root[data-theme="crt"] .wm-text { font-family: 'IBM Plex Mono', monospace; letter-spacing: .06em; }
:root[data-theme="crt"] label, :root[data-theme="crt"] legend { color: #1AAD1A; }
:root[data-theme="crt"] .board-canvas {
  background-color: #000000; background-image: none;
  box-shadow: inset 0 0 80px rgba(51,255,51,.04);
}
:root[data-theme="crt"] .board-stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 16;
  background: repeating-linear-gradient(0deg, transparent 0px, transparent 3px, rgba(0,0,0,.10) 3px, rgba(0,0,0,.10) 4px);
}
:root[data-theme="crt"] .bcard { background: #050F05; box-shadow: 0 0 0 1px #0C3A0C, 0 0 12px rgba(51,255,51,.12); }
:root[data-theme="crt"] .bcard .cap { color: #33FF33; text-shadow: 0 0 6px rgba(51,255,51,.55); }
:root[data-theme="crt"] .bcard .pin { background: #33FF33; box-shadow: 0 0 6px rgba(51,255,51,.8); }
:root[data-theme="crt"] .bcard.postit { background: #030D03; }
:root[data-theme="crt"] .bcard.postit .cap { color: #33FF33; text-shadow: 0 0 6px rgba(51,255,51,.55); }
:root[data-theme="crt"] .bcard.postit .meta { color: #1AAD1A; }
:root[data-theme="crt"] .bcard.postit.done { background: #020802; }
:root[data-theme="crt"] .bcard .shot,
:root[data-theme="crt"] .bcard img.favicon,
:root[data-theme="crt"] .item-thumb,
:root[data-theme="crt"] .urlfav {
  filter: grayscale(1) brightness(.85) sepia(.4) hue-rotate(85deg) saturate(5) contrast(1.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--paper); z-index: 5;
}
.wordmark { display: flex; align-items: center; gap: 10px; }
.logo-mark { flex: none; display: block; }
.logo-mark .warp { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.logo-mark .weft { stroke: var(--string); stroke-width: 3.4; stroke-linecap: round; }
.wm-text { font-family: 'Spectral', serif; font-weight: 600; font-size: 21px; letter-spacing: -0.01em; color: var(--ink); }
.wm-loom { color: var(--string); }
.topright { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who {
  font-family: 'Hanken Grotesk', sans-serif; font-size: 14px; color: var(--ink-soft);
  max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-btn {
  background: none; border: none; color: var(--ink-soft);
  cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; align-items: center;
}
.icon-btn:hover { color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.tabs {
  display: flex; gap: 4px; max-width: 1000px; margin: 14px auto 0;
  padding: 4px; background: var(--chip-bg); border: 1px solid var(--line); border-radius: 12px;
}
.tab {
  flex: 1 1 0; font: inherit; font-family: 'Hanken Grotesk', sans-serif; font-weight: 600;
  font-size: 14px; color: var(--ink-soft); text-align: center;
  background: transparent; border: 1px solid transparent; border-radius: 9px;
  padding: 8px 12px; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tab:disabled { opacity: .45; cursor: not-allowed; }
.tab:disabled:hover { color: var(--ink-soft); }

main { max-width: 1000px; margin: 0 auto; padding: 18px 20px 80px; }
.view.hidden { display: none; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.capture, .quickadd { margin-bottom: 26px; }

.inbox-grid { display: flex; flex-direction: column; gap: 24px; }
.inbox-grid .capture { margin-bottom: 0; }
.col-head { margin: 0 2px 12px; }
.col-head h2, .list-head h2 { font-family: 'Spectral', serif; font-size: 18px; font-weight: 600; margin: 0; }
@media (min-width: 840px) {
  .inbox-grid { display: grid; grid-template-columns: 360px 1fr; gap: 26px; align-items: start; }
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
label, legend {
  display: block; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px;
}
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"],
input[type="search"], input[type="number"], textarea, select {
  width: 100%; max-width: 100%; padding: 9px 11px; font: inherit;
  color: var(--ink); background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.more { margin-bottom: 14px; }
.more > summary { cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); padding: 4px 0; user-select: none; }
.more[open] > summary { margin-bottom: 10px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions.split { justify-content: space-between; align-items: center; }

.btn {
  font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; background: var(--card); color: var(--ink);
}
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn-primary { background: var(--string); color: #fff; border-color: var(--string-deep); }
.btn-primary:hover { background: var(--string-deep); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { color: var(--ink); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); padding-left: 4px; }
.btn-danger-ghost:hover { text-decoration: underline; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

.list-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px 12px; flex-wrap: wrap; gap: 8px; }
.list-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.recent-count { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); }
.inbox-search { margin: 0 0 12px; }

.bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 12px;
  background: var(--chip-bg); border: 1px solid var(--line); border-radius: 8px;
}
.bulk-bar.hidden { display: none; }
.bulk-count { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.bulk-spacer { flex: 1 1 auto; }
.bulk-action { display: flex; align-items: center; gap: 6px; }
.bulk-action input[type="text"] { width: 120px; padding: 6px 8px; }
.bulk-action select { padding: 6px 8px; width: auto; }
.bulk-check { display: none; flex: none; align-self: flex-start; margin-top: 10px; width: 16px; height: 16px; }
.item-list.bulk-mode .bulk-check { display: inline-block; }
.item-list.bulk-mode .inbox-grip { display: none; }

.item-list { display: flex; flex-direction: column; gap: 10px; }
.inbox-node { display: flex; align-items: flex-start; gap: 8px; margin-left: calc(var(--depth, 0) * 24px); }
.inbox-grip { flex: none; display: flex; align-items: center; justify-content: center; width: 18px; margin-top: 8px; color: var(--ink-soft); cursor: grab; touch-action: none; }
.inbox-grip:active { cursor: grabbing; }
.inbox-node.dragging { opacity: .5; }
.inbox-node.tree-collapsed { display: none; }
.inbox-node.pending { opacity: .55; }
.inbox-node.pending .item { cursor: default; }
.inbox-node.drag-over .item { outline: 3px dashed var(--string); outline-offset: 2px; }
.inbox-node .item { flex: 1 1 auto; min-width: 0; }
.inbox-pin { flex: none; align-self: flex-start; margin-top: 2px; background: none; border: none; padding: 4px; color: var(--ink-soft); cursor: pointer; border-radius: 6px; }
.inbox-pin:hover { color: var(--ink); background: var(--input-bg); }
.inbox-pin.pinned { color: var(--focus); }
.inbox-toggle {
  flex: none; width: 26px; height: 26px; margin-top: 7px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--card); color: var(--ink-soft); font: inherit; font-size: 16px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.inbox-toggle:hover { color: var(--ink); border-color: var(--ink-soft); }
.inbox-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.inbox-toggle.spacer { visibility: hidden; }
.item {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 15px 13px 24px;
  cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit;
  display: flex; align-items: center; gap: 12px;
}
.item-main { flex: 1 1 auto; min-width: 0; }
.item-thumb { flex: none; width: 48px; height: 48px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.item::before {
  content: ""; position: absolute; left: 10px; top: 16px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--string); box-shadow: inset 0 1px 1px rgba(255,255,255,.5);
}
.item:hover { border-color: var(--ink-soft); }
.item:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.item-title { font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.item-meta {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink-soft);
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
}
.badge {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-soft);
}

.task-group { margin-bottom: 22px; }
.group-head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 12px; }
.group-head h2 { font-family: 'Spectral', serif; font-size: 17px; margin: 0; font-weight: 600; color: var(--ink); }
.group-head .count { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); }
.group-overdue h2 { color: var(--danger); }
.group-today h2 { color: var(--string); }
.group-nodate h2 { color: var(--ink-soft); }
.group-done h2 { color: var(--ink-soft); }

.task {
  display: flex; align-items: center; gap: 13px; background: var(--card); border: 1px solid var(--line);
  border-radius: 13px; box-shadow: var(--shadow); padding: 13px 15px; margin-bottom: 9px;
}
.task-check { width: 18px; height: 18px; flex: none; accent-color: var(--string); cursor: pointer; }
.task-title { flex: 1 1 auto; text-align: left; background: none; border: none; font: inherit; color: var(--ink); cursor: pointer; padding: 2px 0; word-break: break-word; }
.task-title:hover { color: var(--string-deep); }
.task-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.task.done .task-title { text-decoration: line-through; color: var(--ink-soft); }
.task-controls { display: flex; align-items: center; gap: 12px; flex: none; }
.task-prio { font-family: 'IBM Plex Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 6px; color: #fff; flex: none; }
.task-prio.p-high { background: var(--danger); }
.task-prio.p-medium { background: var(--string); }
.task-prio.p-low { background: var(--ink-soft); }
.task-due-block { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.task-due-text { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.task-countdown { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.task-countdown.is-overdue { color: var(--string-deep); font-weight: 600; }
.task-countdown.is-soon { color: var(--string); }

.check-field { margin-top: 4px; }
.check-row { display: flex; align-items: center; gap: 9px; text-transform: none; letter-spacing: 0; font-family: 'Hanken Grotesk', sans-serif; font-size: 14px; color: var(--ink); cursor: pointer; }
.check-row input { width: 18px; height: 18px; flex: none; accent-color: var(--string); }

/* Settings theme swatches */
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.swatch {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 10px; border-radius: 11px; cursor: pointer; width: 100%;
  background: var(--card); border: 1.5px solid var(--line); font: inherit;
}
.swatch:hover { border-color: var(--ink-soft); }
.swatch.on { border-color: var(--string); box-shadow: inset 0 0 0 1px var(--string); }
.swatch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.swatch-chips { display: flex; gap: 3px; }
.swatch-chip { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.12); }
.swatch-chip.dot { border-radius: 50%; border: none; }
.swatch-name {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--chip-bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.chip button { border: none; background: none; cursor: pointer; color: var(--ink-soft); font-size: 14px; line-height: 1; padding: 0; }
.chip button:hover { color: var(--danger); }

.back { background: none; border: none; cursor: pointer; color: var(--ink-soft); font: inherit; padding: 4px 0; margin-bottom: 12px; }
.back:hover { color: var(--ink); }

.taskfields { border: 1px dashed var(--line); border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.taskfields.hidden { display: none; }
.taskfields legend { padding: 0 6px; }
.repeat-field { margin-bottom: 0; }
.repeat-hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); }
.repeat-hint.hidden { display: none; }
.repeat-opts { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.repeat-opts.hidden { display: none; }
.repeat-interval { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.repeat-interval input { width: 64px; }
.repeat-weekdays { display: flex; flex-wrap: wrap; gap: 6px; }
.repeat-weekdays.hidden, .repeat-monthday.hidden { display: none; }
.repeat-weekdays .wd { border: 1px solid var(--line); background: var(--input-bg); color: var(--ink); border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; min-width: 44px; }
.repeat-weekdays .wd[aria-pressed="true"] { background: var(--focus); border-color: var(--focus); color: var(--paper, #fff); }
.repeat-monthday { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.repeat-monthday input { width: 64px; }
.repeat-monthday label { margin: 0; }
.repeat-note { color: var(--ink-soft); }
.data-card { margin-top: 14px; }
.data-title { font-size: 16px; margin: 0 0 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.export-result { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); }
.export-result a { color: var(--focus); }
.trash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.trash-head h1 { margin: 0; }
.trash-note { color: var(--ink-soft); font-size: 13px; margin: 0 0 14px; }
.trash-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--card); }
.trash-main { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.trash-type { flex: none; font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.trash-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-actions { flex: none; display: flex; gap: 12px; }
.linklike { background: none; border: none; color: var(--focus); cursor: pointer; font: inherit; padding: 0; text-align: left; }
.linklike:hover { text-decoration: underline; }
.linklike.danger { color: var(--danger); }
.collections-head, .collection-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.collections-head { justify-content: space-between; }
.collections-head h1, .collection-head h1 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.collection-swatch { flex: none; width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--line); background: transparent; display: inline-block; }
.collection-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); margin-bottom: 8px; cursor: pointer; color: var(--ink); }
.collection-row:hover { border-color: var(--focus); }
.coll-item { margin-bottom: 8px; }
.collection-rname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.collection-count { flex: none; font-size: 12px; color: var(--ink-soft); background: var(--input-bg); border-radius: 999px; padding: 2px 9px; }
.collection-actions { display: flex; gap: 14px; margin-bottom: 14px; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.review-head h1 { margin: 0; }
.review-days { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.review-progress { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.review-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--card); max-width: 520px; }
.review-title { margin: 10px 0 6px; }
.review-excerpt { color: var(--ink-soft); font-size: 14px; line-height: 1.5; margin: 0 0 10px; white-space: pre-wrap; }
.review-tags { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.qc-note { font-size: 13px; color: var(--ink-soft); margin: 4px 0 10px; }
.google-status { font-size: 13px; margin: 4px 0 10px; color: var(--ink-soft); }
.google-status.connected { color: var(--string); font-weight: 600; }

.attach-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.attach-row { display: flex; align-items: center; gap: 10px; font-size: 13px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; background: var(--input-bg); }
.attach-row.image { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; }
.attach-preview { display: block; width: 100%; max-width: 280px; max-height: 220px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--paper, #fff); }
.attach-fallback { font-size: 12px; color: var(--ink-soft); }
.attach-meta { display: flex; align-items: center; gap: 10px; }
.attach-kind { flex: none; min-width: 38px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--paper, transparent); font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .04em; text-align: center; color: var(--ink-soft); }
.attach-name { flex: 1 1 auto; min-width: 0; word-break: break-all; }
.attach-row a { color: var(--focus); text-decoration: none; word-break: break-all; }
.attach-row a:hover { text-decoration: underline; }
.attach-row button { border: none; background: none; cursor: pointer; color: var(--ink-soft); font-size: 16px; line-height: 1; }
.attach-row button:hover { color: var(--danger); }

.attach-gallery-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--card);
}
.attach-gallery-row.orphan { border-color: var(--danger); border-style: dashed; }
.attach-gallery-thumb, .attach-gallery-fallback {
  flex: none; width: 48px; height: 48px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--line); background: var(--paper, transparent);
}
.attach-gallery-fallback { display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--ink-soft); }
.attach-gallery-kind {
  flex: none; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--line); font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: .04em; color: var(--ink-soft);
}
.attach-gallery-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.attach-gallery-name { color: var(--focus); text-decoration: none; word-break: break-all; }
.attach-gallery-name:hover { text-decoration: underline; }
.attach-gallery-sub { font-size: 12px; color: var(--ink-soft); }
.attach-gallery-sub.orphan-label { color: var(--danger); }

.attach-head-right { display: flex; align-items: center; gap: 10px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn {
  padding: 6px 14px; border: none; background: var(--card); color: var(--ink-soft);
  cursor: pointer; font-size: 13px; font-family: inherit;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { background: var(--string); color: #fff; }

.attach-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 16px; }
.attach-card {
  position: relative; background: #fff; border-radius: 3px; padding: 7px 7px 9px;
  box-shadow: 0 2px 6px rgba(0,0,0,.28); box-sizing: border-box;
}
.attach-card.orphan { outline: 2px dashed var(--danger); outline-offset: 2px; }
.attach-card-link { display: block; text-decoration: none; }
.attach-card .pin {
  position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px;
  border-radius: 50%; background: var(--string); box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.attach-card .shot { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #ece9e2; border-radius: 2px; }
.attach-card .kind-shot {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1;
  background: #ece9e2; border-radius: 2px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #5b5b5b;
}
.attach-card .cap {
  display: block; font-family: 'IBM Plex Mono', monospace; font-size: 10px; line-height: 1.25;
  color: #3a382f; margin-top: 6px; max-height: 2.5em; overflow: hidden; word-break: break-all;
}
.attach-card .card-meta { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: #7c744a; margin-top: 4px; }
.attach-card .card-meta.used { color: #5b7a4f; }
.attach-card.orphan .card-meta.used { color: var(--danger); }
.attach-card-trash {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--danger); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.attach-card-trash:hover { opacity: .85; }

.tag-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-suggest-status { font-size: 12px; color: var(--ink-soft); }
.related-results { margin-top: 8px; }
.related-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.related-row .linklike { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-status { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); }
.tag-chip { border: 1px solid var(--line); background: var(--input-bg); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.tag-chip:hover { border-color: var(--focus); color: var(--focus); }
.url-open { display: inline-block; margin-top: 7px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--focus); text-decoration: none; }
.url-open:hover { text-decoration: underline; }
.url-open.hidden { display: none; }
.urlfav { flex: none; width: 18px; height: 18px; border-radius: 3px; object-fit: contain; }
.urlpreview { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.urlpreview:empty { display: none; }
.urlshot { flex: none; width: 88px; height: 88px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.urltitle { min-width: 0; font-size: 13px; color: var(--ink-soft); word-break: break-word; }

.meta-line { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); margin: 14px 0 0; word-break: break-all; }

.list-parent, #d-list-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-parent { flex-direction: column; align-items: stretch; }
.list-parent-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.list-parent-row .linklike { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-children { margin: 10px 0; }
.list-lbl { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); }
.list-head-sm { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); margin: 4px 0 6px; }
.list-empty { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); }
.list-child { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list-child .linklike { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-child-ctrl { display: flex; gap: 5px; flex: none; }
.btn.btn-sm { padding: 5px 11px; font-size: 13px; }
.iconbtn { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; line-height: 1; }
.iconbtn:hover { color: var(--ink); border-color: var(--ink-soft); }
.iconbtn[disabled] { opacity: .4; cursor: default; }
.iconbtn.danger:hover { color: var(--danger); border-color: var(--danger); }
.list-pick { width: auto; min-width: 160px; max-width: 100%; display: inline-block; }

.empty {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--ink-soft);
  text-align: center; padding: 30px 10px; border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty.hidden { display: none; }

/* ---- Board (added in a later phase; kept here so the stylesheet is complete) ---- */
.board-stage { position: relative; height: 68vh; min-height: 320px; }
body.board-mode main { max-width: none; margin: 0; padding: 0; }
body.board-mode .board-canvas { border-left: none; border-right: none; border-radius: 0; }
body.board-mode #board-hint { margin: 6px 0; }
.board-canvas {
  position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch;
  background-color: var(--cork-bg);
  background-image: radial-gradient(var(--cork-dot) 1px, transparent 1.5px);
  background-size: 13px 13px;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 0 40px rgba(0,0,0,.20);
  cursor: grab; scrollbar-width: none; -ms-overflow-style: none;
}
.board-canvas::-webkit-scrollbar { width: 0; height: 0; display: none; }
.board-canvas.panning { cursor: grabbing; }
.board-canvas.connecting { cursor: crosshair; }
.board-sizer { position: relative; }
.board-world { position: relative; width: 1200px; height: 900px; transform-origin: 0 0; }
.board-lines { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.board-lines line { stroke-width: 2; opacity: .8; }
.board-lines line.hier { stroke-width: 3.2; opacity: .95; }
.bcard.tree-hidden { display: none; }
.expand-glyph {
  position: absolute; right: -7px; bottom: -7px; z-index: 2; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center; background: var(--card);
  border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); cursor: pointer; transform: rotate(-8deg);
}
.expand-glyph .lk-scribble { fill: none; stroke: var(--string); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.expand-glyph.open { transform: rotate(-8deg) scale(1.05); }
.expand-glyph.open .lk-scribble { fill: var(--string); stroke: var(--string); }
.board-canvas.connecting .board-lines { pointer-events: auto; }
.board-canvas.connecting .board-lines line { pointer-events: stroke; cursor: pointer; stroke-width: 12; }
.board-cards { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.board-toolbar { position: absolute; z-index: 6; top: 12px; left: 12px; right: 12px; display: flex; justify-content: center; pointer-events: none; }
.bt-glass {
  pointer-events: auto; width: 100%; max-width: 720px; display: flex; gap: 9px; align-items: center;
  flex-wrap: wrap; padding: 9px; border-radius: 16px; background: var(--glass-bg); border: 1px solid var(--glass-bd);
  box-shadow: 0 12px 30px rgba(0,0,0,.20), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
}
.bt-search { flex: 0 0 100%; display: flex; align-items: center; padding: 8px 12px; border-radius: 12px; background: var(--glass-field); border: 1px solid var(--glass-bd); }
.b-search { flex: 1 1 auto; min-width: 0; width: 100%; border: none; background: transparent; color: var(--ink); font: inherit; font-size: 14px; outline: none; padding: 0; }
.bt-actions { display: flex; gap: 8px; flex: 1 1 auto; flex-wrap: wrap; }
.bt-secondary { display: flex; gap: 8px; flex: none; align-items: center; }
.bt-zoom { display: flex; gap: 6px; }
.board-toolbar .btn { background: var(--glass-btn); border: 1px solid var(--glass-bd); color: var(--ink); }
.board-toolbar .btn.btn-primary { background: var(--string); border-color: var(--string); color: #fff; }
.zoombtn { min-width: 42px; font-weight: 700; font-size: 17px; line-height: 1; padding: 9px 10px; }
.tagdots { display: inline-flex; gap: 2px; align-items: center; margin-right: 5px; vertical-align: middle; }
.tagdots i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }
.tagdots i:last-child { width: 6px; height: 6px; opacity: .55; }
#b-tagsbtn.on { color: var(--ink); border-color: var(--string); }
.tag-clear { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--string); color: #fff; font-size: 12px; line-height: 1; font-weight: 700; margin-left: 5px; vertical-align: middle; pointer-events: auto; }
.bubble-overlay { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; background: var(--glass-bg); border-radius: var(--radius); -webkit-backdrop-filter: blur(30px) saturate(150%); backdrop-filter: blur(30px) saturate(150%); }
.bubble-overlay.hidden { display: none; }
.bubble-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px 18px; position: relative; z-index: 2; }
.bubble-title { font-family: 'Spectral', serif; font-weight: 600; font-size: 20px; color: var(--ink); line-height: 1.1; }
.bubble-sub { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.bubble-field { position: absolute; left: 0; right: 0; top: 62px; bottom: 0; overflow: hidden; }
.bubble-empty { padding: 20px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-soft); }
.lk-bubble {
  position: absolute; border: none; cursor: pointer; padding: 0; color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -7px 16px rgba(0,0,0,.22), inset 0 7px 14px rgba(255,255,255,.30), 0 10px 22px rgba(0,0,0,.26);
  animation: lkpop .42s cubic-bezier(.34,1.56,.64,1) both, lkbob var(--bob, 6s) ease-in-out .42s infinite;
}
.lk-bubble:active { animation-play-state: paused; }
.lk-bubble.on { outline: 3px solid #fff; outline-offset: 3px; }
.lk-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; pointer-events: none; width: 78%; }
.lk-label { font-family: 'Hanken Grotesk', sans-serif; font-weight: 700; line-height: 1; text-shadow: 0 1px 2px rgba(0,0,0,.28); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-count { font-family: 'IBM Plex Mono', monospace; opacity: .85; }
@keyframes lkbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes lkpop { 0% { opacity: 0; transform: scale(.4); } 100% { opacity: 1; transform: scale(1); } }
.connect-hint {
  position: absolute; z-index: 7; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0;
  white-space: nowrap; pointer-events: none; color: var(--ink); padding: 8px 14px; border-radius: 999px;
  background: var(--glass-bg); border: 1px solid var(--glass-bd);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
}
.connect-hint.hidden { display: none; }
.bcard {
  position: absolute; width: 132px; box-sizing: border-box; background: #fff; border-radius: 3px;
  padding: 7px 7px 9px; box-shadow: 0 2px 6px rgba(0,0,0,.28); cursor: grab;
  touch-action: none; -webkit-user-select: none; user-select: none;
  transform: rotate(var(--tilt, 0deg)); transition: box-shadow .12s ease;
}
.bcard:active { cursor: grabbing; box-shadow: 0 5px 14px rgba(0,0,0,.34); }
.bcard .pin { position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--string); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.bcard .shot { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #ece9e2; border-radius: 2px; }
.bcard .linkshot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #5b5b5b; text-align: center; padding: 6px; }
.bcard .linkshot .glyph { font-size: 20px; line-height: 1; }
.bcard .linkshot .host { font-family: 'IBM Plex Mono', monospace; font-size: 9px; word-break: break-all; }
.bcard .cap { font-family: 'IBM Plex Mono', monospace; font-size: 10px; line-height: 1.25; color: #3a382f; margin-top: 6px; max-height: 2.5em; overflow: hidden; }
.bcard.postit { width: 116px; background: #F6E7A0; padding: 10px 10px 12px; }
.bcard.postit .cap { font-size: 11px; max-height: 5.4em; color: #4a4530; margin-top: 0; }
.bcard.postit .meta { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: #7c744a; margin-top: 6px; }
.bcard.postit.done { background: #E3E7D6; }
.bcard.postit .done-mark { font-size: 11px; margin-right: 4px; }
.bcard.dim { opacity: .22; }
.bcard.match { box-shadow: 0 0 0 2px var(--focus), 0 2px 6px rgba(0,0,0,.28); }
.bcard.sel { box-shadow: 0 0 0 2px var(--string), 0 2px 6px rgba(0,0,0,.28); }
.bcard.drop-target { outline: 3px dashed var(--string); outline-offset: 3px; box-shadow: 0 0 0 2px var(--string), 0 8px 18px rgba(0,0,0,.36); }
.relpop { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30; width: min(280px, 86vw); margin: 0; }
.relpop.hidden { display: none; }
.board-hint { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); text-align: center; margin: 12px 0 0; }
.board-banner { position: absolute; top: 10px; left: 12px; z-index: 18; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,.14); max-width: calc(100% - 24px); }
.board-banner.hidden { display: none; }
.board-banner span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px;
  font-size: 14px; box-shadow: var(--shadow); z-index: 20;
}
.toast.hidden { display: none; }
.toast.error { background: var(--string-deep); color: #fff; }

/* ---- Our own auth screens (email/password, not part of the GAS layout) ---- */
.auth-wrap { max-width: 420px; margin: 60px auto; padding: 0 20px; }
.auth-forms { display: flex; flex-direction: column; gap: 22px; }
.error { color: var(--danger); font-size: 13px; min-height: 1.2em; margin: 8px 0 0; }
.auth-switch { font-size: 13px; color: var(--ink-soft); text-align: center; margin: 14px 0 0; }
.auth-or { text-align: center; font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin: -10px 0; }
#google-signin { text-align: center; text-decoration: none; }

/* Generic fallback for classList.toggle('hidden', ...) on an element whose
   other class(es) don't already have their own scoped `.foo.hidden` rule
   above (the convention everywhere else in this file). Same specificity as
   a single-class rule like .btn, so it only wins by coming last - added a
   real, live bug in Settings (Connect/Disconnect both showing at once)
   where .btn/.linklike/.field never had a matching hidden rule. */
.hidden { display: none; }

@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .task { flex-wrap: wrap; }
  .task-controls { flex-basis: 100%; padding-left: 32px; margin-top: 6px; justify-content: flex-start; }
  .who { max-width: 30vw; }
  .collections-head { flex-wrap: wrap; }
  .collections-head h1 { flex: 1 1 100%; overflow: visible; text-overflow: clip; }
  .collections-head .btn { flex: none; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
