/* ============================================================================
   PNG Notes — Apple-style design system
   Local-first visual note library. No external assets, no network, no webfonts.
   ========================================================================= */

/* ─── Accent palettes ──────────────────────────────────────────────────── */
:root                       { --accent: #0071e3; --accent-soft: #0071e31f; --accent-ink: #ffffff; }
:root[data-accent="purple"] { --accent: #6e5ae6; --accent-soft: #6e5ae61f; }
:root[data-accent="pink"]   { --accent: #ec4899; --accent-soft: #ec48991f; }
:root[data-accent="orange"] { --accent: #f97316; --accent-soft: #f973161f; }
:root[data-accent="green"]  { --accent: #10a95b; --accent-soft: #10a95b1f; }
:root[data-accent="teal"]   { --accent: #0d9488; --accent-soft: #0d94881f; }
:root[data-accent="graphite"]{ --accent: #6b7280; --accent-soft: #6b72801f; }

/* ─── Light theme ──────────────────────────────────────────────────────── */
:root {
  --bg:            #f5f5f7;
  --bg-deep:       #ececee;
  --panel:         #ffffff;
  --panel-2:       #fbfbfd;
  --chrome:        rgba(250,250,252,.72);
  --sidebar:       rgba(240,240,243,.72);
  --content-bg:    #ffffff;
  --text:          #1d1d1f;
  --text-2:        rgba(60,60,67,.62);
  --text-3:        rgba(60,60,67,.38);
  --hairline:      rgba(0,0,0,.085);
  --hairline-soft: rgba(0,0,0,.05);
  --hover:         rgba(0,0,0,.045);
  --active:        rgba(0,0,0,.075);
  --fill:          rgba(120,120,128,.12);
  --fill-2:        rgba(120,120,128,.2);

  --shadow-1: 0 1px 1px rgba(0,0,0,.03), 0 2px 6px rgba(0,0,0,.04);
  --shadow-2: 0 2px 6px rgba(0,0,0,.06), 0 12px 32px rgba(0,0,0,.10);
  --shadow-3: 0 8px 24px rgba(0,0,0,.14), 0 32px 80px rgba(0,0,0,.22);

  --r-xs: 7px;  --r-sm: 10px;  --r-md: 14px;
  --r-lg: 20px; --r-xl: 28px;  --r-pill: 980px;

  --fs-title: 28px;
  --gutter: 28px;

  --ease: cubic-bezier(.32,.72,0,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --spring: cubic-bezier(.34,1.4,.42,1);
  --dur: .34s;
}

/* ─── Dark theme ───────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #000000;
  --bg-deep:       #000000;
  --panel:         #1c1c1e;
  --panel-2:       #232326;
  --chrome:        rgba(28,28,30,.72);
  --sidebar:       rgba(28,28,30,.68);
  --content-bg:    #161618;
  --text:          #f5f5f7;
  --text-2:        rgba(235,235,245,.62);
  --text-3:        rgba(235,235,245,.34);
  --hairline:      rgba(255,255,255,.12);
  --hairline-soft: rgba(255,255,255,.07);
  --hover:         rgba(255,255,255,.06);
  --active:        rgba(255,255,255,.10);
  --fill:          rgba(120,120,128,.28);
  --fill-2:        rgba(120,120,128,.42);

  --shadow-1: 0 1px 1px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.4);
  --shadow-2: 0 2px 8px rgba(0,0,0,.5), 0 16px 40px rgba(0,0,0,.55);
  --shadow-3: 0 12px 40px rgba(0,0,0,.6), 0 40px 90px rgba(0,0,0,.7);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #000; --bg-deep: #000; --panel: #1c1c1e; --panel-2: #232326;
    --chrome: rgba(28,28,30,.72); --sidebar: rgba(28,28,30,.68); --content-bg: #161618;
    --text: #f5f5f7; --text-2: rgba(235,235,245,.62); --text-3: rgba(235,235,245,.34);
    --hairline: rgba(255,255,255,.12); --hairline-soft: rgba(255,255,255,.07);
    --hover: rgba(255,255,255,.06); --active: rgba(255,255,255,.10);
    --fill: rgba(120,120,128,.28); --fill-2: rgba(120,120,128,.42);
    --shadow-1: 0 1px 1px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.4);
    --shadow-2: 0 2px 8px rgba(0,0,0,.5), 0 16px 40px rgba(0,0,0,.55);
    --shadow-3: 0 12px 40px rgba(0,0,0,.6), 0 40px 90px rgba(0,0,0,.7);
  }
}

/* ─── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", "Segoe UI", Roboto, "Noto Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea { background: none; border: 0; outline: none; }
h1,h2,h3,h4,p { margin: 0; }
img { display: block; max-width: 100%; }
svg { display: block; }
::selection { background: var(--accent); color: #fff; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb {
  background: var(--fill-2); border-radius: 99px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ─── App frame ────────────────────────────────────────────────────────── */
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 268px minmax(0,1fr);
  grid-template-rows: 54px minmax(0,1fr);
  grid-template-areas: "title title" "side main";
  background: var(--bg);
}
.app.sidebar-collapsed { grid-template-columns: 0 minmax(0,1fr); }

/* ─── Unified toolbar ──────────────────────────────────────────────────── */
.titlebar {
  grid-area: title;
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--chrome);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--hairline);
  z-index: 40;
  -webkit-app-region: drag;
}
.titlebar > * { -webkit-app-region: no-drag; }
.tb-left  { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; }
.tb-center{ flex: 1 1 auto; display: flex; justify-content: center; }
.tb-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.tb-traffic { display: flex; gap: 8px; padding-right: 4px; }
.tb-traffic i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.tb-traffic i:nth-child(1){ background:#ff5f57; } .tb-traffic i:nth-child(2){ background:#febc2e; } .tb-traffic i:nth-child(3){ background:#28c840; }
.tb-traffic { display: none; }
@media (min-width: 1000px) { .tb-traffic { display: flex; } }
.tb-title {
  font-size: 14px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}

/* ─── Buttons ──────────────────────────────────────────────────────────── */
.icon-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--spring);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.is-on { color: var(--accent); background: var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 14px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 560; letter-spacing: -.005em;
  background: var(--fill); color: var(--text);
  transition: transform .16s var(--spring), filter .16s var(--ease), background .16s var(--ease), opacity .16s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover  { filter: brightness(.96); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { background: #ff3b30; color: #fff; }
.btn.sm { height: 26px; padding: 0 11px; font-size: 12px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ─── Segmented control ────────────────────────────────────────────────── */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--fill); border-radius: var(--r-sm);
}
.segmented button {
  height: 26px; padding: 0 14px; border-radius: 7px;
  font-size: 12.5px; font-weight: 540; color: var(--text-2);
  transition: background .22s var(--ease), color .22s var(--ease), box-shadow .22s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active {
  background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-1);
}

/* ─── Search field ─────────────────────────────────────────────────────── */
.search-field {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 8px 0 9px; width: 236px;
  background: var(--fill); border-radius: var(--r-sm);
  color: var(--text-3);
  transition: box-shadow .2s var(--ease), background .2s var(--ease), width .3s var(--ease);
}
.search-field svg { width: 14px; height: 14px; flex: none; }
.search-field input { flex: 1; min-width: 0; font-size: 13px; color: var(--text); }
.search-field input::placeholder { color: var(--text-3); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field:focus-within {
  background: var(--panel); box-shadow: 0 0 0 3.5px var(--accent-soft), inset 0 0 0 1px var(--accent);
}
.search-kbd {
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 4px;
  flex: none;
}
@media (max-width: 900px) { .search-field { width: 150px; } .search-kbd { display: none; } }
@media (max-width: 700px) { .search-field { width: 40px; padding: 0; justify-content: center; } .search-field input { display: none; } }

/* ─── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  grid-area: side; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--hairline);
  overflow: hidden;
  transition: opacity .2s var(--ease);
}
.app.sidebar-collapsed .sidebar { opacity: 0; pointer-events: none; }
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 4px; }
.nav-group { margin-bottom: 14px; }
.nav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 5px; font-size: 11px; font-weight: 640;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-3);
}
.nav-head button {
  width: 20px; height: 20px; border-radius: 5px; color: var(--text-3);
  display: none; align-items: center; justify-content: center;
}
.nav-head button svg { width: 13px; height: 13px; }
.nav-head:hover button { display: inline-flex; }
.nav-head button:hover { background: var(--hover); color: var(--text); }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; height: 29px; padding: 0 8px; margin-bottom: 1px;
  border-radius: var(--r-xs); font-size: 13.5px; color: var(--text);
  text-align: left; position: relative;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-item .ni-icon { width: 16px; height: 16px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.nav-item .ni-icon svg { width: 16px; height: 16px; }
.nav-item .ni-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .ni-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.nav-item .ni-chevron { width: 13px; height: 13px; color: var(--text-3); transition: transform .22s var(--ease); flex: none; }
.nav-item .ni-chevron svg { width: 13px; height: 13px; }
.nav-item .ni-actions { display: none; gap: 2px; }
.nav-item:hover { background: var(--hover); }
.nav-item.is-active { background: var(--accent); color: #fff; }
.nav-item.is-active .ni-icon, .nav-item.is-active .ni-count, .nav-item.is-active .ni-chevron { color: rgba(255,255,255,.85); }
.nav-item.is-active .ni-action:hover { background: rgba(255,255,255,.22); }
.nav-item:hover .ni-actions { display: flex; }
.nav-item:hover .ni-count { display: none; }
.nav-item.is-active:hover .ni-count { display: none; }
.nav-item .ni-action {
  width: 19px; height: 19px; border-radius: 5px; display: inline-flex;
  align-items: center; justify-content: center; color: inherit;
}
.nav-item .ni-action svg { width: 12px; height: 12px; }
.nav-item .ni-action:hover { background: var(--active); }
.nav-item.drop-target { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.subtopics { padding-left: 18px; overflow: hidden; }
.subtopics.collapsed { display: none; }
.nav-item.sub { height: 27px; font-size: 13px; color: var(--text-2); }
.nav-item.sub .ni-icon { color: var(--text-3); }
.nav-item.sub.is-active { color: #fff; }
.nav-item.sub::before {
  content: ""; position: absolute; left: -1px; top: 0; bottom: 0;
  width: 1px; background: var(--hairline);
}
.nav-empty { padding: 6px 8px; font-size: 12.5px; color: var(--text-3); }

.sidebar-foot {
  padding: 10px; border-top: 1px solid var(--hairline-soft);
  display: flex; flex-direction: column; gap: 8px;
}
.storage { padding: 0 2px; }
.storage-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-bottom: 5px; }
.storage.top span:last-child { color: var(--text-2); }
.storage-bar { height: 5px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.storage-bar i { display: block; height: 100%; width: 0%; border-radius: 99px; background: var(--accent); transition: width .5s var(--ease), background .3s; }
.storage-bar i.warn { background: #ff9f0a; }
.storage-bar i.crit { background: #ff3b30; }
.sidebar-new {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; border-radius: var(--r-sm); font-size: 13px; font-weight: 540;
  color: var(--text-2); background: var(--fill);
  transition: background .16s, color .16s, transform .16s var(--spring);
}
.sidebar-new svg { width: 14px; height: 14px; }
.sidebar-new:hover { background: var(--fill-2); color: var(--text); }
.sidebar-new:active { transform: scale(.97); }
/* Browsers without vibrancy: fall back to opaque chrome so contrast holds. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .titlebar { background: var(--bg); }
  .sidebar  { background: var(--bg-deep); }
  .lb-tool, .lb-close, .lb-nav { background: rgba(40,40,44,.9); }
}
.sidebar-scrim { display: none; }

/* ─── Main content ─────────────────────────────────────────────────────── */
.main {
  grid-area: main; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--content-bg);
  overflow: hidden;
}
.content-head {
  padding: 22px var(--gutter) 14px;
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--hairline-soft);
  background: var(--content-bg);
  position: relative; z-index: 5;
}
.ch-main { flex: 1 1 320px; min-width: 0; }
.ch-title {
  font-size: var(--fs-title); font-weight: 700; letter-spacing: -.028em;
  display: flex; align-items: center; gap: 10px; line-height: 1.15;
}
.ch-title .ch-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.ch-sub { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.ch-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.content {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 20px var(--gutter) 80px;
  scroll-behavior: smooth;
}
.content:focus { outline: none; }

/* ─── Note grid ────────────────────────────────────────────────────────── */
.grid {
  display: grid; gap: var(--grid-gap, 18px);
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min, 210px), 1fr));
  align-items: start;
}
.card {
  position: relative; background: var(--panel); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), opacity .2s;
  animation: cardIn .42s var(--ease-out) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.card.selected { box-shadow: 0 0 0 3px var(--accent), var(--shadow-2); }
.card.dragging { opacity: .45; }
.card-thumb {
  position: relative; aspect-ratio: 4/3; background: var(--fill);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card-thumb img { transform: scale(1.035); }
.card-thumb .ph { color: var(--text-3); }
.card-thumb .ph svg { width: 30px; height: 30px; }
.card-badge {
  position: absolute; top: 9px; right: 9px; height: 22px; padding: 0 8px;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,.55); color: #fff; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.card-badge svg { width: 11px; height: 11px; }
.card-star {
  position: absolute; top: 9px; left: 9px; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(0,0,0,.45); color: #fff;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transition: opacity .2s, transform .2s var(--spring);
}
.card-star svg { width: 13px; height: 13px; }
.card-star.on { opacity: 1; color: #ffcc00; }
.card:hover .card-star { opacity: 1; }
.card-star:active { transform: scale(.85); }
.card-body { padding: 11px 13px 13px; }
.card-title {
  font-size: 13.5px; font-weight: 600; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta {
  margin-top: 2px; font-size: 11.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.card-meta .sep { opacity: .5; }
.card-tags { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; max-height: 20px; overflow: hidden; }
.tag {
  font-size: 10.5px; font-weight: 560; padding: 1.5px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.tag.neutral { background: var(--fill); color: var(--text-2); }

/* ─── List view ────────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: grid; grid-template-columns: 46px minmax(0,1fr) 130px 110px 92px;
  gap: 12px; align-items: center;
  padding: 7px 12px; border-radius: var(--r-sm);
  transition: background .14s; cursor: default;
}
.row:hover { background: var(--hover); }
.row.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.row-thumb { width: 46px; height: 34px; border-radius: var(--r-xs); overflow: hidden; background: var(--fill); display: flex; align-items: center; justify-content: center; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-thumb svg { width: 15px; height: 15px; color: var(--text-3); }
.row-name { font-size: 13.5px; font-weight: 540; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.row-cell { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
.row:hover .row-actions { opacity: 1; }
.row.is-fav .row-name::after { content: "★"; color: #ffb300; margin-left: 6px; font-size: 11px; }
.list-head {
  display: grid; grid-template-columns: 46px minmax(0,1fr) 130px 110px 92px;
  gap: 12px; padding: 0 12px 8px; font-size: 11px; font-weight: 640;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--hairline-soft); margin-bottom: 6px;
}
@media (max-width: 900px) { .row, .list-head { grid-template-columns: 46px minmax(0,1fr) 92px; } .row-cell.hide-sm, .list-head .hide-sm { display: none; } }

/* ─── Board view ───────────────────────────────────────────────────────── */
.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.column {
  flex: 0 0 262px; background: var(--panel-2); border-radius: var(--r-lg);
  padding: 12px; border: 1px solid var(--hairline-soft);
  transition: background .18s, box-shadow .18s;
}
.column.drop-target { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.column-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 0 2px;
}
.column-title { font-size: 13px; font-weight: 640; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-count { font-size: 11.5px; color: var(--text-3); }
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 44px; }
.mini {
  display: flex; gap: 9px; align-items: center; background: var(--panel);
  padding: 6px; border-radius: var(--r-md); box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease), box-shadow .2s; cursor: default;
}
.mini:hover { transform: translateX(2px); box-shadow: var(--shadow-2); }
.mini.selected { box-shadow: 0 0 0 2.5px var(--accent), var(--shadow-1); }
.mini-thumb { width: 44px; height: 36px; border-radius: var(--r-xs); overflow: hidden; background: var(--fill); display: flex; align-items: center; justify-content: center; flex: none; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-thumb svg { width: 14px; height: 14px; color: var(--text-3); }
.mini-title { font-size: 12.5px; font-weight: 540; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { font-size: 10.5px; color: var(--text-3); }
.column-add {
  width: 100%; height: 30px; border-radius: var(--r-md); margin-top: 8px;
  color: var(--text-3); font-size: 12.5px; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.column-add:hover { background: var(--hover); color: var(--text); }
.column-add svg { width: 13px; height: 13px; }

/* ─── Empty state ──────────────────────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 70px 24px; gap: 6px; animation: cardIn .5s var(--ease-out) both;
}
.empty-icon {
  width: 76px; height: 76px; border-radius: 22px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.empty-icon svg { width: 34px; height: 34px; }
.empty h2 { font-size: 19px; font-weight: 660; letter-spacing: -.02em; }
.empty p { font-size: 13.5px; color: var(--text-2); max-width: 420px; }
.empty-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }
.empty-hints { margin-top: 22px; display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.empty-hint { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.empty-hint kbd {
  background: var(--fill); border-radius: 5px; padding: 2px 6px;
  font-size: 11px; font-family: inherit; font-weight: 600; color: var(--text-2);
}

/* ─── Section header inside content ────────────────────────────────────── */
.section-head {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 12px; font-size: 12px; font-weight: 660;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-3);
}
.section-head:first-child { margin-top: 4px; }
.section-head .line { flex: 1; height: 1px; background: var(--hairline-soft); }

/* ─── Drop overlay ─────────────────────────────────────────────────────── */
.drop-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in srgb, var(--content-bg) 62%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.drop-card {
  padding: 40px 56px; border-radius: var(--r-xl); text-align: center;
  border: 2.5px dashed var(--accent); background: var(--panel);
  box-shadow: var(--shadow-3);
  animation: popIn .4s var(--spring) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(.9) } to { opacity: 1; transform: none } }
.drop-icon {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.drop-icon svg { width: 28px; height: 28px; }
.drop-title { font-size: 17px; font-weight: 640; letter-spacing: -.02em; }
.drop-sub { font-size: 13px; color: var(--text-2); margin-top: 5px; }

/* ─── Toasts ───────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 420; display: flex; flex-direction: column-reverse; gap: 9px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--panel); box-shadow: var(--shadow-2);
  font-size: 13px; font-weight: 540; max-width: 460px;
  border: 1px solid var(--hairline-soft);
  animation: toastIn .38s var(--spring) both;
  pointer-events: auto;
}
.toast.out { animation: toastOut .26s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94) } to { opacity: 1; transform: none } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96) } }
.toast .t-icon {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.toast .t-icon svg { width: 12px; height: 12px; }
.toast.ok .t-icon   { background: #34c759; }
.toast.err .t-icon  { background: #ff3b30; }
.toast.info .t-icon { background: var(--accent); }
.toast .t-action { color: var(--accent); font-weight: 600; margin-left: 2px; }

/* ─── Modal / sheet ────────────────────────────────────────────────────── */
.modal-root { position: fixed; inset: 0; z-index: 300; display: none; }
.modal-root.open { display: block; }
.modal-scrim {
  position: absolute; inset: 0; background: rgba(0,0,0,.28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadeIn .22s var(--ease);
}
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(460px, calc(100vw - 32px));
  background: var(--panel); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3); border: 1px solid var(--hairline-soft);
  padding: 24px; animation: modalIn .42s var(--spring) both;
  max-height: calc(100dvh - 60px); overflow: auto;
}
.modal.wide { width: min(720px, calc(100vw - 32px)); }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%,-46%) scale(.94) } to { opacity: 1; transform: translate(-50%,-50%) scale(1) } }
.modal.closing { animation: modalOut .2s var(--ease) forwards; }
@keyframes modalOut { to { opacity: 0; transform: translate(-50%,-50%) scale(.96) } }
.modal h2 { font-size: 19px; font-weight: 680; letter-spacing: -.022em; }
.modal .m-sub { font-size: 13px; color: var(--text-2); margin-top: 5px; }
.modal .m-body { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal .m-foot { margin-top: 22px; display: flex; gap: 10px; justify-content: flex-end; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input {
  width: 100%; height: 36px; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--fill); font-size: 14px;
  transition: box-shadow .18s var(--ease), background .18s;
}
.input:focus { background: var(--panel); box-shadow: 0 0 0 3.5px var(--accent-soft), inset 0 0 0 1.5px var(--accent); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 92px; line-height: 1.5; }
.swatches { display: flex; gap: 9px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; position: relative;
  transition: transform .2s var(--spring);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.swatch:hover { transform: scale(1.1); }
.swatch.on::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--accent);
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px; border-radius: var(--r-pill); background: var(--fill);
  font-size: 12.5px; font-weight: 540; color: var(--text-2);
  transition: background .16s, color .16s, transform .16s var(--spring);
}
.chip:hover { background: var(--fill-2); color: var(--text); }
.chip:active { transform: scale(.95); }
.chip.on { background: var(--accent); color: #fff; }

/* iOS-style switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch .sw-label { font-size: 14px; }
.switch .sw-label small { display: block; font-size: 12px; color: var(--text-3); }
.toggle {
  width: 46px; height: 28px; border-radius: 99px; background: var(--fill-2);
  position: relative; flex: none; transition: background .26s var(--ease);
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .26s var(--ease);
}
.toggle.on { background: #34c759; }
.toggle.on::after { transform: translateX(18px); }

.menu-list { display: flex; flex-direction: column; gap: 2px; margin: -4px; }
.menu-row {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: var(--r-sm); font-size: 13.5px; text-align: left; width: 100%;
  transition: background .14s;
}
.menu-row:hover { background: var(--hover); }
.menu-row .mr-icon { width: 18px; height: 18px; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.menu-row .mr-icon svg { width: 16px; height: 16px; }
.menu-row .mr-label { flex: 1; min-width: 0; }
.menu-row .mr-label small { display: block; font-size: 11.5px; color: var(--text-3); }
.menu-row .mr-kbd { font-size: 11px; color: var(--text-3); }
.menu-row.danger { color: #ff3b30; }
.menu-row.danger .mr-icon { color: #ff3b30; }

/* ─── Lightbox ─────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 350; display: flex; flex-direction: column;
  background: rgba(10,10,12,.86);
  -webkit-backdrop-filter: blur(30px) saturate(150%); backdrop-filter: blur(30px) saturate(150%);
  animation: fadeIn .24s var(--ease);
  color: #fff;
}
.lb-top {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: linear-gradient(rgba(0,0,0,.42), transparent);
}
.lb-info { flex: 1; min-width: 0; }
.lb-title { font-size: 15px; font-weight: 620; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-size: 12px; color: rgba(255,255,255,.62); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.lb-canvas { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; will-change: transform; }
.lb-canvas img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); border-radius: 4px;
  transition: transform .3s var(--ease);
}
.lb-canvas.grabbing { cursor: grabbing; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, transform .2s var(--spring);
  opacity: 0;
}
.lb-nav svg { width: 20px; height: 20px; }
.lb-nav.prev { left: 18px; } .lb-nav.next { right: 18px; }
.lb-stage:hover .lb-nav { opacity: 1; }
.lb-nav:hover { background: rgba(255,255,255,.24); }
.lb-nav:active { transform: translateY(-50%) scale(.9); }
.lb-bottom {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 16px 26px;
  background: linear-gradient(transparent, rgba(0,0,0,.5));
}
.lb-tool {
  height: 34px; min-width: 34px; padding: 0 12px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.14); color: #fff; font-size: 12.5px; font-weight: 560;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transition: background .18s, transform .18s var(--spring);
}
.lb-tool svg { width: 15px; height: 15px; }
.lb-tool:hover { background: rgba(255,255,255,.26); }
.lb-tool:active { transform: scale(.94); }
.lb-close {
  position: absolute; top: 12px; right: 16px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; color: #fff;
  background: rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
}
.lb-close:hover { background: rgba(255,255,255,.28); }
.lb-strip {
  display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto;
  background: rgba(0,0,0,.32); border-top: 1px solid rgba(255,255,255,.08);
}
.lb-thumb {
  width: 62px; height: 50px; border-radius: 9px; overflow: hidden; flex: none;
  opacity: .5; transition: opacity .2s, box-shadow .2s;
  background: rgba(255,255,255,.08);
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-thumb.on { opacity: 1; box-shadow: 0 0 0 2.5px var(--accent); }

/* ─── Command palette ──────────────────────────────────────────────────── */
.palette-root { position: fixed; inset: 0; z-index: 400; display: none; }
.palette-root.open { display: block; }
.palette-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.24); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fadeIn .18s; }
.palette {
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%);
  width: min(620px, calc(100vw - 28px));
  background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  border: 1px solid var(--hairline-soft); overflow: hidden;
  animation: paletteIn .32s var(--spring) both;
}
@keyframes paletteIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(.97); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.palette input {
  width: 100%; height: 52px; padding: 0 18px; font-size: 16px;
  border-bottom: 1px solid var(--hairline-soft);
}
.palette input::placeholder { color: var(--text-3); }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 7px; }
.p-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: var(--r-sm); width: 100%; text-align: left; font-size: 13.5px;
}
.p-item .pi-icon { width: 20px; height: 20px; color: var(--text-2); display: flex; align-items: center; justify-content: center; flex: none; }
.p-item .pi-icon svg { width: 16px; height: 16px; }
.p-item .pi-main { flex: 1; min-width: 0; }
.p-item .pi-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-item.on { background: var(--accent); color: #fff; }
.p-item.on .pi-sub, .p-item.on .pi-icon { color: rgba(255,255,255,.8); }
.p-item mark { background: transparent; color: var(--accent); font-weight: 700; }
.p-item.on mark { color: #fff; text-decoration: underline; }
.p-empty { padding: 26px; text-align: center; color: var(--text-3); font-size: 13px; }
.p-group { padding: 9px 12px 4px; font-size: 11px; font-weight: 640; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }

/* ─── Context menu ─────────────────────────────────────────────────────── */
.ctx-root { position: fixed; inset: 0; z-index: 500; display: none; }
.ctx-root.open { display: block; }
.ctx {
  position: absolute; min-width: 208px; padding: 5px;
  background: var(--panel); border-radius: var(--r-md); box-shadow: var(--shadow-3);
  border: 1px solid var(--hairline-soft);
  animation: ctxIn .18s var(--ease-out) both;
}
@keyframes ctxIn { from { opacity: 0; transform: scale(.95) translateY(-4px) } to { opacity: 1; transform: none } }
.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; border-radius: var(--r-xs); font-size: 13px; text-align: left;
}
.ctx-item svg { width: 15px; height: 15px; color: var(--text-2); flex: none; }
.ctx-item .ci-kbd { margin-left: auto; font-size: 11px; color: var(--text-3); }
.ctx-item:hover { background: var(--accent); color: #fff; }
.ctx-item:hover svg, .ctx-item:hover .ci-kbd { color: rgba(255,255,255,.85); }
.ctx-item.danger { color: #ff3b30; }
.ctx-item.danger svg { color: #ff3b30; }
.ctx-item.danger:hover { background: #ff3b30; color: #fff; }
.ctx-item.danger:hover svg { color: #fff; }
.ctx-sep { height: 1px; background: var(--hairline-soft); margin: 4px 6px; }

/* ─── Shortcuts sheet ──────────────────────────────────────────────────── */
.shortcuts-root { position: fixed; inset: 0; z-index: 380; display: none; }
.shortcuts-root.open { display: block; }
.sc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; }
@media (max-width: 620px) { .sc-grid { grid-template-columns: 1fr; } }
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--hairline-soft); }
.sc-row span:last-child { display: flex; gap: 4px; }
kbd {
  background: var(--fill); border-radius: 5px; padding: 2px 6px;
  font-size: 11px; font-family: inherit; font-weight: 620; color: var(--text-2);
  border: 1px solid var(--hairline-soft); white-space: nowrap;
}

/* ─── Bulk bar ─────────────────────────────────────────────────────────── */
.bulkbar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 260; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 16px; border-radius: var(--r-pill);
  background: var(--panel); box-shadow: var(--shadow-3);
  border: 1px solid var(--hairline-soft);
  animation: toastIn .38s var(--spring) both;
}
.bulkbar .bb-count { font-size: 13px; font-weight: 620; margin-right: 4px; white-space: nowrap; }
.bulkbar .bb-sep { width: 1px; height: 20px; background: var(--hairline); }
.bulkbar .icon-btn { color: var(--text-2); }
.bulkbar .icon-btn.danger { color: #ff3b30; }

/* ─── Inspector / note detail ──────────────────────────────────────────── */
.detail { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 0; height: 100%; }
@media (max-width: 980px) { .detail { grid-template-columns: 1fr; } }
.detail-main { overflow-y: auto; padding: 22px var(--gutter) 90px; }
.detail-side { border-left: 1px solid var(--hairline-soft); overflow-y: auto; padding: 20px; background: var(--panel-2); }
.detail-title {
  font-size: 24px; font-weight: 700; letter-spacing: -.026em; width: 100%;
  padding: 4px 0; border-bottom: 1.5px solid transparent;
}
.detail-title:focus { border-bottom-color: var(--accent); }
.detail-note { width: 100%; min-height: 110px; font-size: 14px; line-height: 1.62; color: var(--text); padding: 6px 0; resize: vertical; }
.shots { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.shot { border-radius: var(--r-lg); overflow: hidden; background: var(--fill); box-shadow: var(--shadow-1); position: relative; animation: cardIn .4s var(--ease-out) both; }
.shot img { width: 100%; max-height: 62vh; object-fit: contain; background: var(--fill); }
.shot-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; color: var(--text-2); background: var(--panel); }
.shot-bar .sb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-block { margin-bottom: 22px; }
.side-title { font-size: 11px; font-weight: 660; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 9px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid var(--hairline-soft); }
.kv dt { color: var(--text-3); }
.kv dd { color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62%; }

/* ─── Utilities ────────────────────────────────────────────────────────── */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.pulse { animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }
.muted { color: var(--text-2); }
.center-col { display: flex; flex-direction: column; align-items: center; }

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .app { grid-template-columns: 268px minmax(0,1fr); }
  .app:not(.sidebar-collapsed) .sidebar { box-shadow: var(--shadow-3); }
  .app.sidebar-collapsed .sidebar { opacity: 1; pointer-events: auto; transform: translateX(-100%); }
  .sidebar { position: fixed; top: 54px; bottom: 0; left: 0; width: 268px; z-index: 120; transform: translateX(-100%); transition: transform .34s var(--ease), opacity .2s; }
  .app:not(.sidebar-collapsed) .sidebar { transform: none; }
  .app.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .sidebar-scrim { display: block; position: fixed; inset: 54px 0 0; background: rgba(0,0,0,.3); z-index: 110; animation: fadeIn .2s; }
  .app .main { grid-column: 1 / -1; }
  .app { grid-template-columns: minmax(0,1fr); }
  .tb-center { display: none; }
  :root { --gutter: 16px; --fs-title: 23px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .btn-label { display: none; }
  .detail-side { border-left: 0; border-top: 1px solid var(--hairline-soft); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print {
  .sidebar, .titlebar, .content-head, .toasts, .bulkbar { display: none !important; }
  body, .main, .content { overflow: visible !important; height: auto !important; background: #fff !important; }
}
