/* Album Studio — calm, warm, photo-first. */

:root {
  --bg: #f6f2ec;
  --surface: #fffcf8;
  --surface-2: #f0e9df;
  --surface-3: #e8dfd2;
  --ink: #2a2521;
  --ink-2: #5a5149;
  --muted: #8b8178;
  --line: #e4dbcf;
  --line-strong: #d3c7b8;
  --accent: #8a6a4f;
  --accent-strong: #6f523b;
  --accent-soft: #efe4d7;
  --keep: #4c8a62;
  --keep-soft: #e3f0e6;
  --maybe: #c08a2e;
  --maybe-soft: #f7ebd2;
  --reject: #b5544a;
  --reject-soft: #f5e1de;
  --fav: #c2577a;
  --fav-soft: #f6e0e7;
  --error: #b5443a;
  --warning: #b07a1c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  --shadow-lg: 0 10px 40px rgba(40, 25, 10, .18);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --header-h: 60px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100dvh; }
.boot { margin: auto; color: var(--muted); font-family: var(--serif); font-size: 20px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: .005em; margin: 0 0 .4em; }
h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
h4 { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
p { margin: 0 0 .7em; }
a { color: var(--accent-strong); }
kbd { font: 12px var(--sans); background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; margin-right: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
.tight { margin: 0 0 .7em; padding-left: 20px; }
.tight li { margin-bottom: 6px; }
.warn-text { color: var(--warning); }
.danger-text { color: var(--reject) !important; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- icons & buttons ---------- */
.icon { display: inline-flex; width: 18px; height: 18px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 500 14px var(--sans); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--reject); border-color: var(--reject); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #9c4339; }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 10px 24px; font-size: 16px; }
.btn.light { color: #eee; border-color: rgba(255,255,255,.25); }
.btn.light:hover:not(:disabled) { background: rgba(255,255,255,.1); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 999px; border: none; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.tiny { width: 28px; height: 28px; }
.icon-btn.tiny .icon { width: 16px; height: 16px; }
.icon-btn.light { color: #ddd; }
.icon-btn.light:hover { background: rgba(255,255,255,.12); color: #fff; }
.link-btn { background: none; border: none; color: var(--accent-strong); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.input, .select {
  min-height: 38px; padding: 7px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 14px var(--sans); width: 100%;
}
.input.invalid { border-color: var(--reject); box-shadow: 0 0 0 3px var(--reject-soft); }
.select { width: auto; padding-right: 28px; }
.range { accent-color: var(--accent); width: 110px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); }
.inline-field { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.toggle-row { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; padding: 4px 0; }
.toggle-row input, .radio-row input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- header ---------- */
.app-header {
  height: var(--header-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; }
.brand-name { font-family: var(--serif); font-size: 19px; }
.crumb-sep { color: var(--line-strong); font-size: 20px; }
.project-name { border: none; background: none; font: 500 15px var(--sans); color: var(--ink); cursor: pointer; padding: 6px 8px; border-radius: 8px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-name:hover { background: var(--surface-2); }
.tabs { display: flex; gap: 2px; margin-left: 12px; background: var(--surface-2); padding: 3px; border-radius: 999px; }
.tab { display: flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tab-step { width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--surface-3); color: var(--ink-2); }
.tab.active .tab-step { background: var(--accent); color: #fff; }
.tab-count { font-size: 12px; color: var(--muted); }
.counter { font-size: 14px; white-space: nowrap; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); }
.target-over { color: var(--maybe); font-weight: 600; }
.target-under { color: var(--ink-2); }
.target-exact { color: var(--keep); font-weight: 600; }
.save-indicator { font-size: 12.5px; color: var(--muted); white-space: nowrap; min-width: 112px; text-align: right; }
.save-indicator.saving { color: var(--accent); }

.banner { flex: none; display: flex; align-items: center; gap: 12px; padding: 9px 18px; background: var(--maybe-soft); border-bottom: 1px solid #ecd9b2; font-size: 14px; }
.app-main { flex: 1; min-height: 0; overflow: auto; outline: none; }

/* ---------- dashboard ---------- */
.dashboard { max-width: 1180px; margin: 0 auto; padding: 36px 24px 60px; }
.dash-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.dash-head > div:first-child { flex: 1; min-width: 260px; }
.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.project-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: box-shadow .2s, transform .2s; text-align: left; font: inherit; color: inherit; padding: 0; }
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-cover { aspect-ratio: 3 / 2; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { color: var(--line-strong); }
.cover-placeholder .icon { width: 48px; height: 48px; }
.card-body { padding: 14px 16px 16px; }
.card-title { display: flex; align-items: flex-start; gap: 6px; }
.card-title h3 { flex: 1; margin: 0 0 8px; font-size: 20px; }
.card-meta > div { margin-top: 3px; }
.card-stats { display: flex; gap: 14px; font-size: 14px; }
.new-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px; border-style: dashed; color: var(--muted); background: transparent; }
.new-card .icon { width: 30px; height: 30px; }
.storage-line { margin-top: 28px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.storage-line .icon { width: 16px; height: 16px; color: var(--keep); }
.dash-welcome { grid-column: 1 / -1; }

/* ---------- welcome / empty ---------- */
.welcome { max-width: 760px; margin: 30px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 36px; text-align: center; box-shadow: var(--shadow); }
.welcome .lead { font-size: 16px; color: var(--ink-2); }
.welcome-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 24px 0 18px; text-align: left; }
.welcome-option { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: left; transition: border-color .15s, box-shadow .15s; }
.welcome-option:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.welcome-option .icon { width: 26px; height: 26px; color: var(--accent); }
.welcome-option strong { font-size: 16px; }
.welcome-option span { font-size: 13.5px; color: var(--ink-2); }
.welcome-option.primary { border-color: var(--accent); background: var(--accent-soft); }
.help-details { text-align: left; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; }
.help-details summary { cursor: pointer; font-weight: 500; }
.help-details ol { margin: 10px 0 4px; padding-left: 20px; }
.help-details li { margin-bottom: 8px; font-size: 14px; }
.empty-state { padding: 20px; }
.empty-card { max-width: 480px; margin: 60px auto; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; }

/* ---------- library ---------- */
.library { display: grid; grid-template-columns: 236px 1fr; height: 100%; position: relative; }
.filters { border-right: 1px solid var(--line); padding: 18px 14px; overflow: auto; background: var(--surface); }
.filter-group { margin-bottom: 22px; }
.filter-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: none; background: none; border-radius: 8px; cursor: pointer; font: 14px var(--sans); color: var(--ink-2); text-align: left; }
.filter-row:hover { background: var(--surface-2); color: var(--ink); }
.filter-row.active { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.filter-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot-keep { background: var(--keep); } .dot-maybe { background: var(--maybe); } .dot-reject { background: var(--reject); }
.dot-fav { background: var(--fav); } .dot-none { background: transparent; border: 1.5px solid var(--line-strong); }
.dot-km { background: linear-gradient(90deg, var(--keep) 50%, var(--maybe) 50%); } .dot-all { background: var(--ink-2); }
.source-row { padding: 0; }
.source-toggle { flex: 1; display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: none; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; min-width: 0; }
.source-row .icon-btn { opacity: 0; }
.source-row:hover .icon-btn, .source-row .icon-btn:focus-visible { opacity: 1; }
.check-box { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.check-box.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.check-box .icon { width: 12px; height: 12px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 11px; font: 13px var(--sans); color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.pill:hover { border-color: var(--accent); }
.pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill-count { opacity: .65; font-size: 12px; }
.shortcuts-hint { font-size: 13px; }

.grid-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.grid-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg); }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap .icon { position: absolute; left: 10px; color: var(--muted); width: 16px; height: 16px; }
.search-input { padding-left: 32px; width: 220px; border-radius: 999px; }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 18px; background: var(--ink); color: #fff; }
.bulk-bar .btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.bulk-bar .btn:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.bulk-bar .btn-ghost { background: transparent; }
.bulk-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sbtn-keep-text .icon { color: #8fd1a5; } .sbtn-maybe-text .icon { color: #f2c97a; } .sbtn-reject-text .icon { color: #f0a49b; }
.bulk-bar .danger-text { color: #f0a49b !important; }
.grid-scroll { flex: 1; overflow: auto; padding: 16px 18px 40px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile, 190px), 1fr)); gap: 12px; outline: none; }

.tile { position: relative; border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; transition: box-shadow .15s, opacity .2s, transform .15s; overflow: hidden; }
.tile:hover { box-shadow: 0 0 0 1px var(--line-strong), var(--shadow); }
.tile-img { position: relative; aspect-ratio: 1; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.tile-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.tile-img img:not([src]) { display: none; }
.tile-missing { display: none; color: var(--muted); font-size: 12px; padding: 10px; text-align: center; }
.tile.no-image .tile-missing { display: block; }
.tile-name { font-size: 12px; color: var(--ink-2); padding: 6px 9px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.s-keep { box-shadow: 0 0 0 2px var(--keep); }
.tile.s-maybe { box-shadow: 0 0 0 2px var(--maybe); }
.tile.s-reject .tile-img { opacity: .38; filter: grayscale(.5); }
.tile.s-reject .tile-name { text-decoration: line-through; color: var(--muted); }
.tile.selected { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
.tile.focused { outline: 2px dashed var(--accent); outline-offset: 3px; }
.tile.stale { opacity: .55; }
.tile.stale::after { content: 'moved out of this view'; position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 999px; }
.tile-check { position: absolute; top: 7px; left: 7px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.25); color: transparent; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; padding: 0; }
.tile-check .icon { width: 15px; height: 15px; }
.tile:hover .tile-check, .tile.selected .tile-check { opacity: 1; }
.tile.selected .tile-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.tile-badges { position: absolute; top: 7px; right: 7px; display: flex; gap: 4px; }
.badge { min-width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; padding: 0 5px; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.badge .icon { width: 14px; height: 14px; }
.badge-keep { background: var(--keep); } .badge-maybe { background: var(--maybe); } .badge-reject { background: var(--reject); }
.badge-fav { background: #fff; color: var(--fav); } .badge-dup { background: rgba(42,37,33,.75); }
.tile-actions { position: absolute; left: 0; right: 0; bottom: 32px; display: flex; justify-content: center; gap: 6px; padding: 6px; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.tile:hover .tile-actions, .tile.focused .tile-actions { opacity: 1; transform: none; }

.sbtn { display: inline-flex; align-items: center; gap: 7px; justify-content: center; min-width: 34px; height: 34px; border-radius: 999px; border: 1px solid rgba(0,0,0,.08); background: rgba(255,255,255,.94); color: var(--ink-2); cursor: pointer; padding: 0 9px; font: 500 14px var(--sans); box-shadow: 0 1px 4px rgba(0,0,0,.12); transition: background .12s, color .12s, transform .1s; }
.sbtn:active { transform: scale(.94); }
.sbtn.sm { min-width: 32px; height: 32px; padding: 0; }
.sbtn.lg { height: 46px; min-width: 46px; padding: 0 18px; font-size: 15px; }
.sbtn.lg .icon { width: 20px; height: 20px; }
.sbtn-keep:hover, .sbtn-keep.on { background: var(--keep); color: #fff; border-color: var(--keep); }
.sbtn-maybe:hover, .sbtn-maybe.on { background: var(--maybe); color: #fff; border-color: var(--maybe); }
.sbtn-reject:hover, .sbtn-reject.on { background: var(--reject); color: #fff; border-color: var(--reject); }
.sbtn-fav:hover { color: var(--fav); }
.sbtn-fav.on { background: var(--fav); color: #fff; border-color: var(--fav); }

.shortlist-head { padding: 18px 18px 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.big-count { font-family: var(--serif); font-size: 26px; }
.big-number { font-size: 40px; }
.shortlist-head p { flex-basis: 100%; margin: 0; order: 3; }
.shortlist-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.drop-overlay { position: absolute; inset: 0; background: rgba(246, 242, 236, .92); border: 3px dashed var(--accent); border-radius: 14px; display: grid; place-items: center; z-index: 30; pointer-events: none; font-size: 18px; text-align: center; color: var(--accent-strong); }
.drop-overlay .icon { width: 44px; height: 44px; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.menu-item { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 9px 11px; border: none; background: none; border-radius: 8px; cursor: pointer; text-align: left; font: 14px var(--sans); color: var(--ink); }
.menu-item:hover:not(:disabled) { background: var(--surface-2); }
.menu-item:disabled { opacity: .4; cursor: default; }
.menu-item .icon { margin-top: 1px; color: var(--accent); }
.menu-item span { display: flex; flex-direction: column; }
.menu-item small { color: var(--muted); font-size: 12.5px; }

/* ---------- viewer & compare ---------- */
.viewer, .compare { position: fixed; inset: 0; z-index: 100; background: #141210; color: #eee; display: flex; flex-direction: column; }
.viewer-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 54px; flex-wrap: wrap; }
.viewer-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.viewer-title .muted, .compare .muted { color: #9a918a; }
.chip-toggle { border: 1px solid rgba(255,255,255,.25); background: transparent; color: #bbb; border-radius: 999px; padding: 5px 12px; font: 13px var(--sans); cursor: pointer; }
.chip-toggle[aria-pressed="true"] { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.4); }
.viewer-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.viewer-img { position: absolute; max-width: none; max-height: none; transform-origin: 0 0; will-change: transform; cursor: zoom-in; -webkit-user-drag: none; }
.viewer-img.animate { transition: transform .2s ease-out; }
.viewer.zoomed .viewer-img { cursor: grab; }
.viewer.zoomed .viewer-img:active { cursor: grabbing; }
.zoom-controls { display: flex; align-items: center; gap: 2px; background: rgba(255,255,255,.08); border-radius: 999px; padding: 2px; }
.zoom-sign { font-size: 22px; line-height: 1; }
.zoom-label { min-width: 52px; border: none; background: none; color: #eee; font: 600 13px var(--sans); cursor: pointer; }
.hires-note { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; font-size: 12.5px; padding: 4px 12px; border-radius: 999px; pointer-events: none; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: none; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; display: grid; place-items: center; }
.viewer-nav:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.viewer-nav:disabled { opacity: .15; }
.viewer-nav .icon { width: 26px; height: 26px; }
.viewer-nav.prev { left: 14px; } .viewer-nav.next { right: 14px; }
.viewer.zoomed .viewer-nav { display: none; }
.viewer-bottom { display: flex; justify-content: center; padding: 12px 12px calc(14px + env(safe-area-inset-bottom)); }
.viewer-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.viewer-actions .sbtn { background: rgba(255,255,255,.1); color: #eee; border-color: rgba(255,255,255,.18); box-shadow: none; }
.viewer-actions .sbtn-keep:hover, .viewer-actions .sbtn-keep.on { background: var(--keep); border-color: var(--keep); color: #fff; }
.viewer-actions .sbtn-maybe:hover, .viewer-actions .sbtn-maybe.on { background: var(--maybe); border-color: var(--maybe); color: #fff; }
.viewer-actions .sbtn-reject:hover, .viewer-actions .sbtn-reject.on { background: var(--reject); border-color: var(--reject); color: #fff; }
.viewer-actions .sbtn-fav.on { background: var(--fav); border-color: var(--fav); color: #fff; }
.viewer-info { position: absolute; right: 14px; top: 64px; width: 280px; background: rgba(30,27,24,.92); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 14px 16px; font-size: 13px; }
.viewer-info dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; }
.viewer-info dt { color: #9a918a; } .viewer-info dd { margin: 0; word-break: break-word; }

.compare-hint { flex: 1; min-width: 200px; }
.compare-grid { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 0 8px 8px; }
.compare-grid.n2 { grid-template-columns: 1fr 1fr; }
.compare-grid.n3 { grid-template-columns: 1fr 1fr 1fr; }
.compare-grid.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.cmp-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-radius: 10px; background: #1d1a17; border: 2px solid transparent; }
.cmp-pane.focused { border-color: #8a6a4f; }
.cmp-pane.s-keep .cmp-num { background: var(--keep); } .cmp-pane.s-maybe .cmp-num { background: var(--maybe); } .cmp-pane.s-reject .cmp-num { background: var(--reject); }
.cmp-pane.s-reject .cmp-stage img { opacity: .5; }
.cmp-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; }
.cmp-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); font-size: 12px; font-weight: 600; flex: none; }
.cmp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-stage { flex: 1; min-height: 0; overflow: hidden; display: flex; cursor: zoom-in; }
.compare.zoomed .cmp-stage { cursor: zoom-out; }
.cmp-stage img { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .12s ease-out; }
.cmp-foot { display: flex; gap: 6px; padding: 8px; justify-content: center; flex-wrap: wrap; }
.cmp-foot .sbtn { background: rgba(255,255,255,.1); color: #eee; border-color: rgba(255,255,255,.15); box-shadow: none; }
.cmp-foot .sbtn-keep.on, .cmp-foot .sbtn-keep:hover { background: var(--keep); }
.cmp-foot .sbtn-maybe.on, .cmp-foot .sbtn-maybe:hover { background: var(--maybe); }
.cmp-foot .sbtn-reject.on, .cmp-foot .sbtn-reject:hover { background: var(--reject); }
.cmp-foot .sbtn-fav.on { background: var(--fav); }
.pick-btn { background: transparent; color: #eee; border-color: rgba(255,255,255,.3); }
.pick-btn:hover:not(:disabled) { background: rgba(255,255,255,.12) !important; }

/* ---------- layout designer ---------- */
.layout-view { display: flex; flex-direction: column; height: 100%; }
.layout-toolbar { display: flex; align-items: center; gap: 8px 14px; padding: 8px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg); }
.layout-controls, .layout-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.layout-summary { margin-left: auto; }
.summary-line { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.small-seg button { padding: 4px 10px; font-size: 12.5px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.segmented { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 999px; }
.segmented button { border: none; background: none; padding: 6px 14px; border-radius: 999px; font: 500 13.5px var(--sans); color: var(--ink-2); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.layout-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.pages-scroll { overflow: auto; padding: 18px 22px 60px; min-width: 0; }
.issue-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font: 500 13px var(--sans); border: none; cursor: pointer; }
.issue-chip .icon { width: 16px; height: 16px; }
.issue-chip.error { background: var(--reject-soft); color: var(--error); }
.issue-chip.warning { background: var(--maybe-soft); color: #8a5f10; }
.issue-chip.ok { background: var(--keep-soft); color: var(--keep); cursor: default; }
.ready-on { background: var(--keep); border-color: var(--keep); color: #fff; }
.ready-on:hover:not(:disabled) { background: #3f7653 !important; }

.pages { display: flex; flex-direction: column; align-items: center; gap: 22px; --side-w: 310px; }
.pages.view-list { align-items: stretch; }
.spread-label { display: flex; gap: 12px; align-items: baseline; margin-bottom: 8px; font-size: 14px; }
.spread-label strong { font-family: var(--serif); font-weight: 500; font-size: 17px; }
.spread-pages { display: grid; grid-template-columns: minmax(0, var(--side-w)) 14px minmax(0, var(--side-w)); align-items: stretch; background: var(--surface-3); border-radius: 14px; padding: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.spine { background: linear-gradient(90deg, transparent, rgba(60,40,20,.14), transparent); }
.leaf-sides { display: grid; grid-template-columns: minmax(0, var(--side-w)) minmax(0, var(--side-w)); gap: 14px; }
.side { background: var(--surface); border-radius: 10px; padding: 10px 12px 12px; box-shadow: var(--shadow); transition: box-shadow .2s; min-width: 0; }
.side.blank { display: grid; place-items: center; color: var(--muted); font-size: 13px; background: var(--surface-2); box-shadow: none; min-height: 140px; font-style: italic; }
.side.error { box-shadow: 0 0 0 2px var(--error), var(--shadow); }
.side.flash { box-shadow: 0 0 0 4px var(--accent), var(--shadow-lg); }
.side.drop-side { box-shadow: 0 0 0 3px var(--accent); }
.side-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; cursor: grab; flex-wrap: wrap; }
.side-label strong { font-weight: 600; }
.side-no { font-size: 12px; }
.kind-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.kind-toggle button { border: none; background: none; font: 12px var(--sans); padding: 3px 9px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.kind-toggle button.active { background: var(--ink); color: #fff; }
/* A page is square; slot sizes are fractions of its width so prints keep true proportions and always fit. */
.page { aspect-ratio: 1; background: #fbf8f3; border: 1px solid var(--line); border-radius: 6px; display: flex; gap: 4%; padding: 5%; align-items: center; justify-content: center; overflow: hidden; }
.page.kind-pair.orient-landscape { flex-direction: column; }
.page.kind-pair.orient-portrait { flex-direction: row; }
.page.has-error { background: #fdf0ee; }
.slot { position: relative; flex: none; border-radius: 3px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; cursor: pointer; transition: box-shadow .15s, outline .15s; }
.page.kind-pair .slot.orient-landscape { width: 70%; aspect-ratio: 3 / 2; }
.page.kind-pair .slot.orient-portrait { width: 46.7%; aspect-ratio: 2 / 3; }
.page.kind-pair.orient-landscape .slot.orient-portrait { width: 31%; }
.page.kind-pair.orient-portrait .slot.orient-landscape { width: 46.7%; }
.page.kind-feature .slot.orient-landscape { width: 92%; aspect-ratio: 4 / 3; }
.page.kind-feature .slot.orient-portrait { width: 69%; aspect-ratio: 3 / 4; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.slot.empty { border: 1.5px dashed var(--line-strong); background: transparent; }
.slot-empty { font-size: 12px; color: var(--muted); }
.slot.filled { box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.slot.picked { outline: 3px solid var(--accent); outline-offset: 2px; }
.slot.drop-target { outline: 3px solid var(--accent); outline-offset: 2px; }
.slot.can-ok { outline: 2px dashed var(--keep); outline-offset: 2px; }
.slot.can-mismatch { outline: 2px dashed var(--error); outline-offset: 2px; }
.slot-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; padding: 0; }
.slot-remove .icon { width: 14px; height: 14px; }
.slot:hover .slot-remove, .slot:focus-visible .slot-remove { opacity: 1; }
.slot-fav { position: absolute; left: 4px; bottom: 4px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.slot-fav .icon { width: 14px; height: 14px; }
.side-issues { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.side-issues li { display: flex; gap: 6px; align-items: flex-start; margin-top: 3px; }
.side-issues .icon { width: 15px; height: 15px; margin-top: 1px; }
.issue-error { color: var(--error); } .issue-warning { color: #8a5f10; }
.issue-list { padding-left: 0; list-style: none; }
.issue-list li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

.tray { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.tray.drop-target { background: var(--accent-soft); }
.tray-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.tray-body { flex: 1; min-height: 0; overflow: auto; padding-bottom: 20px; }
.tray-section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; padding: 10px 14px 6px; border: none; background: none; cursor: pointer; font: 14px var(--sans); color: var(--ink); text-align: left; }
.tray-section-head .chev { width: 16px; height: 16px; color: var(--muted); }
.tray-count { font-size: 12px; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; color: var(--ink-2); }
.tray-hint { flex-basis: 100%; padding-left: 24px; }
.tray-section.wanted .tray-section-head strong { color: var(--keep); }
.tray-section.wanted { box-shadow: inset 3px 0 0 var(--keep); }
.tray-help { margin: 6px 0 0; }
.tray-grid { padding: 4px 12px 12px; display: grid; grid-template-columns: repeat(auto-fill, 88px); grid-auto-rows: 88px; gap: 8px; align-content: start; justify-content: center; }
.tray-item { position: relative; width: 100%; height: 100%; border: none; padding: 0; background: var(--surface-2); border-radius: 6px; overflow: hidden; cursor: grab; }
.tray-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.tray-item.placed { opacity: .45; }
.tray-item.maybe { box-shadow: inset 0 0 0 2px var(--maybe); }
.tray-item.picked { outline: 3px solid var(--accent); outline-offset: 1px; }
.tray-o { position: absolute; right: 3px; bottom: 3px; font-size: 10px; font-weight: 700; background: rgba(0,0,0,.55); color: #fff; border-radius: 4px; padding: 0 4px; }
.tray-empty { grid-column: 1 / -1; text-align: center; padding: 20px 6px; }
.print-list .list-thumb img { width: 64px; height: 48px; object-fit: contain; background: var(--surface-2); border-radius: 4px; display: block; }
.row-empty td { color: var(--muted); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }

/* ---------- export ---------- */
.export-view { max-width: 1120px; margin: 0 auto; padding: 26px 24px 60px; }
.safety-note { display: flex; gap: 14px; align-items: flex-start; background: var(--keep-soft); color: #2f5a3d; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px; font-size: 14.5px; }
.safety-note .icon { width: 26px; height: 26px; flex: none; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-bottom: 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: 8px; }
.card .field { margin: 8px 0 12px; }
.radio-list { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.radio-row { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.radio-row span:nth-child(2) { flex: 1; }
.radio-row.active { border-color: var(--accent); background: var(--accent-soft); }
.dest-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 8px; }
.layout-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.history h3 { margin-bottom: 12px; }
.status-complete { color: var(--keep); } .status-partial, .status-stopped { color: var(--warning); } .status-failed { color: var(--error); }

/* ---------- dialogs, toasts, progress ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(30, 22, 15, .42); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal-backdrop.leaving { opacity: 0; transition: opacity .15s; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; animation: pop .18s ease-out; color: var(--ink); }
.modal-wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 22px; }
.modal-body { padding: 8px 20px 10px; overflow: auto; font-size: 14.5px; }
.modal-body ul { padding-left: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; align-items: end; }
.form-grid .span2 { grid-column: 1 / -1; }
.choice-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice input { accent-color: var(--accent); width: 17px; height: 17px; }
.choice-name { flex: 1; font-weight: 500; }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); }
.choice.active { border-color: var(--accent); background: var(--accent-soft); }
.choice.disabled { opacity: .55; cursor: default; }
.type-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tag { font-size: 11.5px; background: var(--maybe-soft); color: #8a5f10; border-radius: 999px; padding: 2px 8px; }
.error-list { max-height: 300px; overflow: auto; font-size: 13.5px; }
.shortcut-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.shortcut-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.shortcut-table td:first-child { width: 45%; white-space: nowrap; }

.toast-host { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
body.no-scroll .toast-host { bottom: calc(86px + env(safe-area-inset-bottom)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .2s ease-out; transition: opacity .3s, transform .3s; max-width: min(92vw, 640px); }
.toast.leaving { opacity: 0; transform: translateY(8px); }
.toast.error { background: var(--error); }
.toast.warn { background: #7a5410; }
.toast-action { background: none; border: none; color: #f3d6a4; font: 600 14px var(--sans); cursor: pointer; padding: 2px 4px; }
.progress-host { position: fixed; right: 18px; bottom: 18px; z-index: 250; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.progress-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: 13.5px; }
.progress-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.progress-head strong { flex: 1; font-weight: 600; }
.progress-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-card.ok .progress-fill { background: var(--keep); }
.progress-card.warn .progress-fill { background: var(--maybe); }
.progress-text { margin-top: 6px; color: var(--ink-2); }
.progress-card > .btn { margin-top: 8px; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- touch devices: keep controls visible ---------- */
@media (hover: none) {
  .tile-actions { opacity: 1; transform: none; }
  .tile-check { opacity: .9; }
  .slot-remove { opacity: 1; }
  .source-row .icon-btn { opacity: 1; }
}

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .app-header { flex-wrap: wrap; height: auto; padding: 8px 14px; row-gap: 6px; }
  .tabs { order: 10; margin-left: 0; width: 100%; overflow-x: auto; }
  .save-indicator { min-width: 0; }
  .layout-body { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 860px) {
  .library { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .filters { display: none; border-right: none; border-bottom: 1px solid var(--line); gap: 18px; overflow-x: auto; padding: 10px 14px; max-height: 45vh; }
  .library.show-filters .filters { display: flex; }
  .filters-toggle { display: inline-flex; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(var(--tile, 190px), 42vw), 1fr)); gap: 8px; }
  .filter-group { margin-bottom: 0; min-width: 190px; }
  .shortcuts-hint { display: none; }
  .layout-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 210px; }
  .tray { border-left: none; border-top: 1px solid var(--line); }
  .tray-help { display: none; }
  .tray-grid { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 84px; grid-template-rows: 84px; overflow-x: auto; overflow-y: hidden; }
  .counter { display: none; }
  .brand-name { display: none; }
  .search-input { width: 160px; }
}
@media (max-width: 620px) {
  .spread-pages { grid-template-columns: 1fr; gap: 10px; }
  .spine { display: none; }
  .leaf-sides { grid-template-columns: 1fr; }
  .form-grid, .type-choice { grid-template-columns: 1fr; }
  .compare-grid.n2, .compare-grid.n3, .compare-grid.n4 { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-rows: minmax(40vh, 1fr); overflow: auto; }
  .viewer-nav { display: none; }
  .sbtn.lg span { display: none; }
  .grid-toolbar { padding: 10px 12px; gap: 8px; }
  .grid-scroll { padding: 12px; }
  .size-field { display: none; }
  .dashboard, .export-view { padding: 20px 16px 40px; }
  .pages-scroll { padding: 0 12px 40px; }
  .welcome { padding: 22px 16px; }
}

/* ---------- V2: Google sign-in, sync, account ---------- */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.signin-card { max-width: 520px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 36px 32px; text-align: center; box-shadow: var(--shadow); }
.brand-mark.big { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px; }
.brand-mark.big .icon { width: 34px; height: 34px; }
.signin-card .lead { color: var(--ink-2); font-size: 16px; margin-bottom: 22px; }
.google-btn { gap: 12px; }
.g-logo { width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #4285f4; font: 700 16px/26px Arial, sans-serif; text-align: center; }
.signin-perms { text-align: left; margin-top: 24px; background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }
.signin-perms ul { list-style: none; padding: 0; margin: 6px 0 10px; }
.signin-perms li { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.signin-perms .icon { color: var(--keep); margin-top: 2px; }
.error-text { color: var(--error); margin-top: 12px; }
.sync-indicator { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; color: var(--muted); font: 12.5px var(--sans); cursor: pointer; padding: 6px 8px; border-radius: 999px; white-space: nowrap; }
.sync-indicator:hover { background: var(--surface-2); }
.sync-indicator .icon { width: 17px; height: 17px; }
.sync-indicator.ok .icon { color: var(--keep); }
.sync-indicator.busy { color: var(--accent); }
.sync-indicator.busy .icon { animation: pulse 1s ease-in-out infinite alternate; }
.sync-indicator.warn { color: var(--warning); }
@keyframes pulse { to { opacity: .35; } }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: none; padding: 0; overflow: hidden; background: var(--accent-soft); color: var(--accent-strong); font: 600 15px var(--sans); cursor: pointer; display: grid; place-items: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu-note { padding: 8px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; font-size: 14px; }
.menu-note small { color: var(--muted); }
body.demo .brand-name::after { content: ' · demo'; color: var(--maybe); font-size: 13px; font-family: var(--sans); }

/* ---------- V2: library filters ---------- */
.library.filters-collapsed { grid-template-columns: 1fr; }
.library.filters-collapsed .filters { display: none; }
.filters-toggle { display: inline-flex; }
.active-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-strong); border-radius: 999px; padding: 3px 6px 3px 11px; font: 500 12.5px var(--sans); cursor: pointer; }
.chip .icon { width: 14px; height: 14px; }
.fav-hint { margin: 8px 10px 0; line-height: 1.4; }
.welcome-tip { margin-top: 16px; }

/* ---------- V2: Google Drive folder browser ---------- */
.drive-browser { display: flex; flex-direction: column; gap: 10px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 14px; }
.crumb { border: none; background: none; color: var(--accent-strong); cursor: pointer; padding: 4px 6px; border-radius: 6px; font: inherit; }
.crumb:hover { background: var(--surface-2); }
.crumb.current { color: var(--ink); font-weight: 600; cursor: default; }
.crumbs .crumb-sep { color: var(--muted); font-size: 14px; }
.folder-list { border: 1px solid var(--line); border-radius: var(--radius); max-height: min(50vh, 420px); overflow: auto; }
.folder-list > p { padding: 14px; margin: 0; }
.folder-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.folder-row:last-child { border-bottom: none; }
.folder-check { width: 48px; align-self: stretch; display: grid; place-items: center; cursor: pointer; flex: none; }
.folder-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.folder-open { flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 0; border: none; background: none; cursor: pointer; font: 15px var(--sans); color: var(--ink); text-align: left; min-width: 0; }
.folder-open:hover { color: var(--accent-strong); }
.folder-open span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-open .icon { color: var(--accent); }
.folder-open .chev { color: var(--muted); width: 16px; height: 16px; }
.muted-row { color: var(--ink-2); }
.folder-here, .picked-line { margin: 0; }

@media (max-width: 620px) {
  .hide-sm { display: none; }
  .pages { --side-w: calc(100vw - 48px) !important; }
  .layout-summary { margin-left: 0; }
}
@media (max-width: 860px) {
  .library.filters-collapsed .filters { display: none; }
  .library.show-filters .filters { display: flex; }
  .tray-body { display: flex; flex-direction: column; }
}
.app-header.in-project .brand-name { display: none; }
.app-header.in-project .project-name { max-width: 280px; font-size: 16px; font-family: var(--serif); }
.app-main > .boot { height: 100%; display: grid; place-items: center; text-align: center; padding: 20px; }
.spread, .leaf { width: 100%; max-width: calc(var(--side-w) * 2 + 34px); }
/* iPad portrait: keep the tray beside the pages */
@media (min-width: 701px) and (max-width: 860px) {
  .layout-body { grid-template-columns: minmax(0, 1fr) 230px; grid-template-rows: none; }
  .tray { border-left: 1px solid var(--line); border-top: none; }
  .tray-help { display: block; }
  .tray-grid { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, 88px); grid-auto-columns: auto; grid-template-rows: none; grid-auto-rows: 88px; overflow: visible; }
}
@media (max-width: 700px) {
  .tray-grid { justify-content: start; }
}
