/* Kept: warm and cosy. Same palette and fonts as Nani's Notebook (the blog). */
@font-face { font-family: 'Fraunces'; src: url(fonts/fraunces-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Fraunces'; src: url(fonts/fraunces-latin-ext-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; src: url(fonts/inter-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; src: url(fonts/inter-latin-ext-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #fbf8f3; --bg-soft: #f3ede3; --side: #f6f0e6; --surface: #ffffff; --ink: #221d17; --ink-soft: #4a433a; --muted: #776e62;
  --line: #e8e0d3; --hover: #f1e9dc; --accent: #d9622b; --accent-ink: #b14a17; --on-accent: #ffffff; --accent-soft: #fbe5d6;
  --bad: #c2412d; --good: #3f8a52; --warn: #c58a12;
  --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 8px 28px rgba(60, 40, 20, .07);
  --shadow-up: 0 2px 4px rgba(60, 40, 20, .06), 0 16px 40px rgba(60, 40, 20, .12);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --r: 16px; --r-sm: 11px; --sidew: 268px; --panelw: 350px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f; --bg-soft: #1e1a15; --side: #1b1713; --surface: #221d17; --ink: #f0e9de; --ink-soft: #d2c8b9; --muted: #9d9284;
    --line: #342d24; --hover: #2a241d; --accent: #f08a52; --accent-ink: #f5a276; --on-accent: #1d120a; --accent-soft: #3b2517;
    --bad: #ff8a75; --good: #7fcf95; --warn: #f0c060;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
    --shadow-up: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 44px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); display: flex; flex-direction: column; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

/* ---- top bar */
.top { display: flex; align-items: center; gap: 14px; padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top)); flex: none; background: var(--bg); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 22px var(--serif); letter-spacing: -.01em; width: calc(var(--sidew) - 32px); }
.logo img { width: 30px; height: 30px; }
.search { flex: 1; max-width: 680px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 0 16px; box-shadow: var(--shadow); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg { color: var(--muted); width: 18px; height: 18px; }
.search input { flex: 1; border: 0; background: transparent; padding: 10px 0; outline: none; min-width: 0; }
.search kbd { font: 12px var(--sans); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.sync { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer; padding: 6px 12px; border-radius: 99px; white-space: nowrap; margin-left: auto; }
.sync:hover { color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
[data-state="synced"] .dot { background: var(--good); }
[data-state="syncing"] .dot { background: var(--accent); animation: pulse 1s infinite alternate; }
[data-state="offline"] .dot, [data-state="local"] .dot { background: var(--warn); }
[data-state="badkey"] .dot, [data-state="error"] .dot, [data-state="signedout"] .dot { background: var(--bad); }
@keyframes pulse { to { opacity: .3; } }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; color: var(--ink-soft); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.on { background: var(--accent-soft); color: var(--accent-ink); }
.menu-btn { display: none; }

/* ---- columns */
.layout { flex: 1; display: grid; grid-template-columns: var(--sidew) 1fr; min-height: 0; }
.layout.with-panel { grid-template-columns: var(--sidew) 1fr var(--panelw); }
.side, .main, .tabs-panel { overflow-y: auto; min-height: 0; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 14px 12px 28px; }
.main { padding: 26px 34px 130px; outline: none; }
.tabs-panel { background: var(--side); border-left: 1px solid var(--line); padding: 16px 14px 28px; }

/* ---- sidebar */
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 10px; border: 0; background: transparent; text-align: left; cursor: pointer; text-decoration: none; color: var(--ink-soft); min-height: 36px; position: relative; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.nav-item.on svg { color: var(--accent); }
.nav-item.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.nav-item.before::before { content: ''; position: absolute; left: 8px; right: 8px; top: -2px; height: 3px; border-radius: 3px; background: var(--accent); }
.nav-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item svg { width: 18px; height: 18px; color: var(--muted); }
.nav-item .hash { width: 18px; text-align: center; color: var(--muted); font-weight: 600; }
.side h3 { display: flex; align-items: center; justify-content: space-between; gap: 6px; font: 600 11.5px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 10px 6px; }
.side h3 .h-acts { display: flex; gap: 2px; }
.side h3 button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: 600 12px var(--sans); text-transform: none; letter-spacing: 0; padding: 2px 7px; border-radius: 7px; }
.side h3 button:hover { background: var(--hover); color: var(--ink); }
.side h3 button.on { color: var(--accent-ink); background: var(--accent-soft); }
.side .filter { width: calc(100% - 8px); margin: 0 4px 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 13.5px; outline: none; }
.side .bottom { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.side .hint { margin: 14px 6px 0; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); font-size: 13.5px; color: var(--ink-soft); }
.side .hint a { color: var(--accent-ink); font-weight: 600; }
.side .more-link { color: var(--muted); font-size: 13px; }

/* ---- page head and toolbar */
.crumb { font: 600 12px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 6px; }
.head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.head .t { flex: 1; min-width: 240px; }
h1 { font: 600 clamp(26px, 3.2vw, 36px)/1.15 var(--serif); margin: 0 0 6px; letter-spacing: -.02em; word-break: break-word; }
h1 .rename { border: 0; background: transparent; cursor: pointer; color: var(--muted); vertical-align: middle; padding: 4px; border-radius: 8px; opacity: 0; transition: opacity .15s; }
.head:hover h1 .rename, h1 .rename:focus { opacity: 1; }
h1 .rename:hover { color: var(--accent); background: var(--hover); }
h1 input { font: inherit; letter-spacing: inherit; border: 0; border-bottom: 2px solid var(--accent); background: transparent; outline: none; width: 100%; padding: 0; }
.meta { color: var(--muted); font-size: 14px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg button svg { width: 16px; height: 16px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
select.sel, .sel { padding: 7px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap; color: var(--ink-soft); transition: background .12s, border-color .12s, transform .12s; }
.btn:hover { background: var(--hover); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 11px; font-size: 12.5px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .badge-on { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }

.add { display: flex; gap: 8px; margin: 0 0 22px; }
.add input, .field input, .field textarea, .field select { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); outline: none; }
.add input { border-radius: 99px; padding-left: 18px; box-shadow: var(--shadow); }
.add .btn { border-radius: 99px; }
.add input:focus, .field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---- grid of cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 20px; }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); transition: transform .16s, box-shadow .16s, border-color .16s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.card.picked { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.card .thumb { display: block; aspect-ratio: 16 / 9; position: relative; overflow: hidden; text-decoration: none;
  background: linear-gradient(135deg, hsl(var(--h) 62% 90%), hsl(calc(var(--h) + 35) 55% 80%)); }
@media (prefers-color-scheme: dark) { .card .thumb { background: linear-gradient(135deg, hsl(var(--h) 30% 24%), hsl(calc(var(--h) + 35) 28% 17%)); } }
.card .thumb img.pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .thumb .tile { position: absolute; inset: 0; display: grid; place-items: center; }
.card .thumb .tile img { width: 44px; height: 44px; border-radius: 12px; background: var(--surface); padding: 6px; box-shadow: var(--shadow); }
.card .thumb .tile b { font: 600 46px var(--serif); color: hsl(var(--h) 45% 32%); }
@media (prefers-color-scheme: dark) { .card .thumb .tile b { color: hsl(var(--h) 55% 72%); } }
.card .cbody { padding: 12px 14px 14px; display: grid; gap: 4px; flex: 1; align-content: start; }
.card .title { font-weight: 600; line-height: 1.32; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.card .title:hover { color: var(--accent-ink); }
.card .site { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.card .site span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .note { font-size: 13px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .pick { position: absolute; top: 10px; left: 10px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow); opacity: 0; transition: opacity .12s; cursor: pointer; }
.card .pick input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.card:hover .pick, .card.picked .pick, .selecting .card .pick { opacity: 1; }
.card .cacts { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.card:hover .cacts, .card:focus-within .cacts { opacity: 1; }
.cacts button, .acts button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 9px; cursor: pointer; color: var(--ink-soft); background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: var(--shadow); }
.cacts button:hover, .acts button:hover { color: var(--ink); background: var(--surface); }
.cacts button.del:hover, .acts button.del:hover { color: var(--bad); }
.cacts svg, .acts svg { width: 16px; height: 16px; }
.card.drop-before::before, .card.drop-after::after { content: ''; position: absolute; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--accent); z-index: 2; }
.card.drop-before::before { left: -12px; }
.card.drop-after::after { right: -12px; }
.dragging { opacity: .45; }

/* ---- list rows */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row { position: relative; display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; column-gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); min-height: 58px; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--hover); }
.row.picked { background: var(--accent-soft); }
.row .pick { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.row.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.row.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.fav { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; overflow: hidden; flex: none; }
.fav img { width: 22px; height: 22px; display: block; }
.site .fav, .site .fav img { width: 16px; height: 16px; font-size: 9px; border-radius: 4px; }
.txt { min-width: 0; }
.row .title { display: block; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .title:hover { color: var(--accent-ink); }
.sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub .note { color: var(--ink-soft); }
.sub.wrap { white-space: normal; }
.chip { white-space: nowrap; display: inline-block; padding: 0 8px; border-radius: 99px; background: var(--bg-soft); color: var(--ink-soft); font-size: 12px; margin-left: 6px; text-decoration: none; line-height: 20px; }
a.chip:hover { color: var(--accent-ink); }
.chip.dup { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.chip.keep { background: transparent; color: var(--good); border: 1px solid currentColor; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; font-weight: 500; color: var(--accent-ink); background: var(--accent-soft); border-radius: 99px; padding: 0 8px; line-height: 20px; text-decoration: none; }
.tag:hover { filter: brightness(.97); text-decoration: underline; }
.sub .tag { margin-left: 4px; }
.acts { display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.acts button { box-shadow: none; background: transparent; }
.row:hover .acts, .row:focus-within .acts, .acts.keep { opacity: 1; }
.more { display: none !important; }
.card .cmore { position: absolute; right: 6px; bottom: 6px; opacity: 1; }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.win { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 600 12px var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 26px 2px 10px; }
.win:first-child { margin-top: 0; }
.empty { text-align: center; color: var(--muted); padding: 60px 24px; border: 1.5px dashed var(--line); border-radius: var(--r); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.empty b { color: var(--ink); display: block; font: 600 20px var(--serif); margin-bottom: 6px; }
.show-more { display: block; margin: 18px auto 0; }

/* ---- cards for settings, import… */
.card-s { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); max-width: 780px; }
.card-s h2 { font: 600 20px var(--serif); margin: 0 0 6px; }
.card-s p { margin: 6px 0 12px; }
.muted { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.field textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.field small { font-weight: 400; color: var(--muted); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.drop-zone { display: grid; place-items: center; gap: 4px; text-align: center; padding: 30px; border: 2px dashed var(--line); border-radius: var(--r); cursor: pointer; color: var(--muted); }
.drop-zone.over, .drop-zone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.drop-zone b { color: var(--ink); font: 600 18px var(--serif); }
.found { list-style: none; padding: 0; margin: 12px 0; }
.found li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; }
.found .bad { color: var(--bad); }
.how { font-size: 14px; }
.how summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; }
.how li { margin: 3px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.stats div { background: var(--bg-soft); border-radius: 12px; padding: 12px 14px; }
.stats b { display: block; font: 600 24px var(--serif); }
.stats span { color: var(--muted); font-size: 13px; }
.ok { color: var(--good); font-weight: 600; }
.err { color: var(--bad); font-weight: 600; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--bg-soft); color: var(--muted); white-space: nowrap; }
.badge.saved { background: transparent; color: var(--good); }
.badge.private { background: #5b3d8a; color: #fff; }

/* ---- open tabs panel (extension) */
.tabs-panel h2 { font: 600 19px var(--serif); margin: 0; display: flex; align-items: center; justify-content: space-between; }
.tabs-panel .opts { display: grid; gap: 10px; margin: 14px 0; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.tabs-panel .opts label { font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.tabs-panel .opts label.check { display: flex; color: var(--ink-soft); }
.wh { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 2px 6px; }
.wh button.fold { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer; font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 0; }
.wh button.fold svg { width: 14px; height: 14px; transition: transform .15s; }
.wh.closed button.fold svg { transform: rotate(-90deg); }
.trow { display: grid; grid-template-columns: auto auto 1fr auto; gap: 9px; align-items: center; padding: 6px 8px; border-radius: 10px; cursor: grab; font-size: 13.5px; }
.trow:hover { background: var(--hover); }
.trow .tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .fav, .trow .fav img { width: 16px; height: 16px; font-size: 9px; border-radius: 4px; }
.trow input { accent-color: var(--accent); margin: 0; }
.panel-note { font-size: 12.5px; color: var(--muted); margin: 14px 4px 0; }
.panel-foot { position: sticky; bottom: -28px; background: var(--side); padding: 12px 0; border-top: 1px solid var(--line); margin-top: 12px; }
.wide { width: 100%; justify-content: center; }

/* ---- selection bar, dialogs, toast */
.selbar { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 18px; border-radius: 18px; background: var(--ink); color: var(--bg); box-shadow: 0 14px 40px rgba(0, 0, 0, .3); max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; }
.selbar b { margin-right: 4px; }
.selbar .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); box-shadow: none; }
.selbar .btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
dialog { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); padding: 22px; width: min(480px, calc(100% - 24px)); box-shadow: 0 24px 70px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(30, 20, 10, .45); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 14px; font: 600 21px var(--serif); }
dialog .row-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
dialog .pick-list { max-height: 52vh; overflow-y: auto; display: grid; gap: 2px; margin: 0 -6px; }
dialog .share-url { display: flex; gap: 8px; margin: 10px 0; }
dialog .share-url input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); font-size: 13.5px; }
dialog .opts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
dialog .opts-grid .btn { justify-content: flex-start; padding: 12px 14px; }
dialog .opts-grid .btn small { display: block; font-weight: 400; color: var(--muted); }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; margin-bottom: 12px; }
.tag-suggest button { border: 1px dashed var(--line); background: transparent; border-radius: 99px; padding: 1px 10px; font-size: 12px; cursor: pointer; color: var(--muted); }
.tag-suggest button:hover { border-color: var(--accent); color: var(--accent-ink); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; transition: .2s; z-index: 30; pointer-events: none; background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
.scrim { display: none; }

/* ---- narrower screens */
@media (max-width: 1180px) {
  .layout.with-panel { grid-template-columns: var(--sidew) 1fr; }
  .layout.with-panel .tabs-panel { position: fixed; right: 0; top: 63px; bottom: 0; width: min(var(--panelw), 92vw); z-index: 15; box-shadow: -12px 0 40px rgba(0, 0, 0, .18); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .top { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .menu-btn { display: inline-grid; }
  .logo { width: auto; font-size: 20px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .search kbd, .sync #syncText { display: none; }
  .sync { padding: 9px; }
  .layout, .layout.with-panel { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(310px, 86vw); z-index: 25; transform: translateX(-100%); transition: transform .22s; padding-top: max(18px, env(safe-area-inset-top)); }
  body.drawer .side { transform: none; box-shadow: 12px 0 40px rgba(0, 0, 0, .25); }
  body.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(30, 20, 10, .4); z-index: 24; }
  .main { padding: 18px 14px 130px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
  .card .cbody { padding: 10px 34px 12px 11px; }
  .card .site .chip.dup { display: none; }
  .card .title { font-size: 14.5px; }
  .card .note, .card .tags { display: none; }
  .card .cacts { display: none; }
  .card .pick { opacity: 0; }
  .selecting .card .pick { opacity: 1; }
  .row { grid-template-columns: auto 1fr auto; padding: 10px 12px; column-gap: 10px; }
  .row .pick { display: none; }
  .selecting .row .pick { display: block; }
  .selecting .row { grid-template-columns: auto auto 1fr auto; }
  .acts { opacity: 1; }
  .acts button:not(.more) { display: none; }
  .acts .more { display: grid !important; }
  .acts.keep button { display: grid; }
  .toolbar .label { display: none; }
  .head .t { min-width: 0; }
  dialog .opts-grid { grid-template-columns: 1fr; }
}
