/* Review — dark review UI */

:root {
  --bg: #0c0d11;
  --bg-2: #12131a;
  --panel: #17181f;
  --panel-2: #1e2029;
  --hover: #23242e;
  --line: #22232c;
  --line-2: #30313d;
  --text: #f4f4f6;
  --text-2: #a7abb8;
  --muted: #717684;
  --accent: #6c63ff;
  --accent-strong: #5b54f0;
  --accent-2: #9d94ff;
  --accent-bg: rgba(108, 99, 255, 0.14);
  --amber: #f2c94c;
  --field-bg: #101117;
  --menu-bg: #1e2029;
  --menu-line: #30313d;
  --topbar-bg: rgba(11, 12, 16, 0.85);
  --thumb-bg: #0a0a0d;
  --panel-hover: #1b1c24;
  --sidebar-bg: #101117;
  --row-current: #26272f;
  --seg-bg: #14151c;
  --seg-on: #2b2c37;
  --selbar-bg: rgba(30, 31, 40, 0.94);
  --side-bg: #14151d;
  --composer-bg: #1b1c26;
  --glass: rgba(23, 24, 31, 0.88);
  --glass-line: rgba(255, 255, 255, 0.09);
  --overlay: rgba(255, 255, 255, 0.03);
  --scroll: #2b2c37;
  --scroll-hover: #3d3e4c;
  --track: rgba(255, 255, 255, 0.12);
  --track-2: rgba(255, 255, 255, 0.14);
  --head: #fff;
  --ok: #34c77b;
  --warn: #f5b83d;
  --bad: #ff5c5c;
  --radius: 10px;
  --radius-sm: 7px;
  --topbar: 54px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 4px 14px rgba(0, 0, 0, 0.4);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
.ic { flex: none; display: block; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
kbd {
  font: 11.5px var(--mono);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
}
::selection { background: rgba(108, 99, 255, 0.42); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-hover); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid rgba(108, 99, 255, 0.65); outline-offset: 1px; }

/* ------------------------------------------------------------ controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--hover); border-color: #3d3e4c; text-decoration: none; }
.btn.primary { background: var(--accent-strong); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 6px 18px rgba(91, 84, 240, 0.32); }
.btn.primary:hover { background: #6a63f5; border-color: transparent; box-shadow: 0 8px 22px rgba(91, 84, 240, 0.42); }
.btn.danger { background: #d9423f; border-color: #d9423f; color: #fff; }
.btn.danger:hover { background: #ea5451; }
.btn.block { width: 100%; height: 42px; }
.btn.only-icon { padding: 0; width: 36px; }
.btn:disabled { opacity: 0.5; cursor: default; pointer-events: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--accent-2); background: var(--accent-bg); }
.icon-btn:disabled { opacity: 0.4; pointer-events: none; }
.icon-btn.flip svg { transform: rotate(180deg); }

.link-btn { border: 0; background: none; padding: 0; color: var(--accent-2); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--bad); }

.ctl-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.ctl-btn:hover { background: var(--hover); color: var(--text); }
.ctl-btn.on { color: var(--accent-2); }

.input, .select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #2e2f3a;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea.input { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.25); }
.input[readonly] { color: var(--text-2); }
.select { width: auto; height: 32px; padding: 0 28px 0 10px; appearance: none; cursor: pointer; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2385858f' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field > small { font-size: 12px; line-height: 1.4; }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; margin: -4px 0 8px; }
.form-error:empty { min-height: 0; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 13px; }

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent-2);
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex: none;
}
.spinner.sm { width: 15px; height: 15px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot, .loading { display: grid; place-items: center; min-height: 60vh; flex: 1; }

.bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; width: 100%; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.3s; }
.bar.wide { width: min(320px, 70%); height: 5px; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  flex: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  user-select: none;
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.banner.bad { background: rgba(255, 92, 92, 0.1); border: 1px solid rgba(255, 92, 92, 0.3); color: #ffb3b3; }
.banner.warn { background: rgba(245, 184, 61, 0.08); border: 1px solid rgba(245, 184, 61, 0.28); color: #f6d58f; }
.banner .ic { flex: none; }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line-2); }

/* ------------------------------------------------------------ app frame */

.view { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
html.no-scroll, html.no-scroll body { overflow: hidden; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 16px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 15.5px; letter-spacing: -0.015em; flex: none; }
.logo:hover { text-decoration: none; }
.logo-img { height: 30px; width: auto; display: block; flex: none; }
.auth-card .logo-img { height: 48px; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; margin-left: 10px; overflow: hidden; }
.crumb {
  color: var(--text-2);
  padding: 4px 7px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  min-width: 0;
  border: 1px dashed transparent;
}
a.crumb:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.crumb.current { color: var(--text); font-weight: 600; flex-shrink: 1; }
.crumb.drop-hover { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }
.crumb-sep { color: #55555f; flex: none; display: grid; }
.topbar .actions { display: flex; align-items: center; gap: 6px; flex: none; }
.topbar .actions .btn { height: 32px; }
.storage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex: none;
}
.storage-pill.ok .ic { color: var(--ok); }
.storage-pill.bad { color: #ffb3b3; border-color: rgba(255, 92, 92, 0.45); }
.storage-pill:hover { background: var(--hover); }
.user-btn { border: 0; background: none; padding: 2px; border-radius: 50%; cursor: pointer; display: grid; flex: none; }
.user-btn:hover { box-shadow: 0 0 0 2px var(--line-2); }

.page { padding: 28px 30px 60px; flex: 1; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head .count { color: var(--muted); font-size: 13px; white-space: nowrap; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 70px 24px;
  color: var(--text-2);
  flex: 1;
}
.empty .ic { color: var(--muted); }
.empty h3 { font-size: 17px; color: var(--text); }
.empty p { max-width: 440px; }
.empty .btn { margin-top: 6px; }
.empty.dropzone { border: 1.5px dashed var(--line-2); border-radius: 16px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.empty.dropzone:hover { border-color: var(--accent); background: rgba(108, 99, 255, 0.05); }

/* ------------------------------------------------------------ grids & cards */

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.projects { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.folders { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 26px; gap: 14px; }

.card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s, background 0.15s;
  min-width: 0;
}
.card:hover { border-color: #3a3b47; background: var(--panel-hover); transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); text-decoration: none; }
.card.dragging { opacity: 0.45; }
.card.drop-hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card .meta { padding: 11px 11px 12px 13px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card .meta .row { flex-wrap: nowrap; gap: 4px; }
.card .name { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; min-width: 0; white-space: nowrap; }
.card-more { width: 26px; height: 26px; margin: -3px -4px -3px 0; opacity: 0; }
.card:hover .card-more, .card-more:focus-visible { opacity: 1; }
@media (hover: none) { .card-more { opacity: 1; } }

.cover { aspect-ratio: 16 / 9; background: var(--thumb-bg); overflow: hidden; border-bottom: 1px solid var(--line); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 42px; font-weight: 700; color: rgba(255, 255, 255, 0.85); }

.card.folder { flex-direction: row; align-items: center; }
.folder-cover { width: 64px; height: 64px; flex: none; position: relative; background: var(--thumb-bg); display: grid; place-items: center; overflow: hidden; }
.folder-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.35; }
.folder-ic { position: relative; color: #b3a9ff; display: grid; }
.card.folder .meta { flex: 1; padding: 8px 10px 8px 12px; }

.thumb { aspect-ratio: 16 / 9; background: var(--thumb-bg); position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.thumb:has(.thumb-state:not([hidden])) .thumb-ph { visibility: hidden; }
.thumb-wave { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 14px; background: linear-gradient(180deg, #16141f, #0d0d11); }
.thumb-wave img { width: 100%; height: 64%; object-fit: fill; opacity: 0.85; }
.thumb-wave .ic { position: absolute; left: 10px; bottom: 9px; color: var(--muted); }
.scrub { position: absolute; background-repeat: no-repeat; display: none; pointer-events: none; }
.scrub-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent-2); display: none; pointer-events: none; }
.thumb.scrubbing .scrub, .thumb.scrubbing .scrub-line { display: block; }
.badge {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  color: #fff;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.badge.ver { top: 8px; left: 8px; }
.badge.dur { bottom: 8px; right: 8px; }
.thumb-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18%;
  background: rgba(10, 10, 12, 0.72);
  font-size: 12.5px;
  color: var(--text-2);
  text-align: center;
}
.thumb-state .ic { color: var(--bad); }
.status-tag { display: inline-flex; align-items: center; gap: 5px; color: var(--c); font-weight: 500; flex: none; }
.status-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.cmt-count { display: inline-flex; align-items: center; gap: 4px; flex: none; }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  display: grid;
  place-items: center;
  background: rgba(108, 99, 255, 0.08);
  border: 3px dashed var(--accent);
  opacity: 0;
  transition: opacity 0.12s;
}
.drop-overlay.on { opacity: 1; }
.drop-msg { display: flex; align-items: center; gap: 10px; background: var(--accent); color: #fff; padding: 12px 20px; border-radius: 30px; font-weight: 600; box-shadow: var(--shadow); }

/* ------------------------------------------------------------ menus, modals, toasts */

.menu {
  position: fixed;
  z-index: 200;
  min-width: 210px;
  max-width: 340px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  background: var(--menu-bg);
  border: 1px solid var(--menu-line);
  box-shadow: var(--shadow);
  animation: pop 0.1s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } }
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 5px 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
}
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: #ff8080; }
.menu-item:disabled { opacity: 0.4; pointer-events: none; }
.menu-ic { width: 16px; display: grid; place-items: center; color: var(--text-2); flex: none; }
.menu-item.danger .menu-ic { color: inherit; }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--muted); font-size: 12px; white-space: nowrap; flex: none; }
.menu-check { color: var(--accent-2); display: grid; flex: none; }
.menu-header { padding: 7px 9px 4px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 2px; }

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  padding: 12px;
  animation: fade 0.12s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--panel);
  border: 1px solid var(--menu-line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  animation: pop 0.14s ease-out;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 6px 20px; }
.modal-head h2 { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 10px 20px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.confirm-text p + p { margin-top: 8px; }

.toasts { position: fixed; z-index: 300; top: 64px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  padding: 10px 17px;
  border-radius: 10px;
  background: var(--menu-bg);
  border: 1px solid var(--menu-line);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  max-width: min(520px, calc(100vw - 32px));
  animation: pop 0.15s ease-out;
  transition: opacity 0.3s;
}
.toast.ok { border-color: rgba(62, 207, 142, 0.45); }
.toast.error { border-color: rgba(255, 92, 92, 0.55); color: #ffc2c2; }
.toast.out { opacity: 0; }

/* upload tray */
.tray {
  position: fixed;
  z-index: 90;
  right: 16px;
  bottom: 16px;
  width: min(380px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--menu-line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tray-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; background: var(--panel-2); }
.tray-title { flex: 1; display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px; }
.tray-title .ic { color: var(--ok); }
.tray-list { max-height: 300px; overflow-y: auto; }
.tray.collapsed .tray-list { display: none; }
.tray-item { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 14px; border-top: 1px solid var(--line); }
.tray-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tray-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tray-item.error .tray-sub { color: #ff9a9a; }
.tray-item.error .bar i { background: var(--bad); }
.tray-item.done .bar i { background: var(--ok); }
.tray-item.cancelled { opacity: 0.55; }

/* move dialog */
.move-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; margin: 0 -8px; }
.move-row { display: flex; align-items: center; gap: 9px; border: 0; background: none; color: var(--text); padding: 8px 12px; border-radius: 7px; cursor: pointer; text-align: left; }
.move-row:hover { background: var(--hover); }
.move-row .ic { color: #b3a9ff; }
.move-row span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-row.current { color: var(--muted); }

/* ------------------------------------------------------------ auth & share landing */

.auth-page {
  flex: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(760px 430px at 88% -10%, rgba(255, 150, 102, 0.17), transparent 62%),
    radial-gradient(920px 540px at 50% -22%, rgba(108, 99, 255, 0.3), transparent 66%),
    radial-gradient(720px 520px at 4% 112%, rgba(56, 130, 246, 0.17), transparent 62%),
    radial-gradient(640px 440px at 96% 108%, rgba(214, 84, 255, 0.13), transparent 62%),
    var(--bg);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--glass);
  backdrop-filter: blur(18px);
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  padding: 32px 30px 26px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.auth-card .logo { margin-bottom: 22px; }
.guest-crumbs { margin: 0 0 14px; }
.auth-card h1 { font-size: 21px; margin-bottom: 6px; overflow-wrap: anywhere; }
.auth-card > p.muted { margin-bottom: 20px; }
.auth-card .hint { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.auth-card .empty { padding: 20px 0; }
.share-card { text-align: left; }
.share-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--thumb-bg);
  display: grid;
  place-items: center;
  color: var(--muted);
  margin-bottom: 16px;
  border: 1px solid var(--line);
}
.share-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ------------------------------------------------------------ settings */

.settings { display: flex; flex-direction: column; gap: 22px; }
.set-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 12px; }
.choice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  margin-bottom: 12px;
  cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); background: rgba(108, 99, 255, 0.06); }
.choice input { accent-color: var(--accent); margin: 3px 0 0; }
.choice.disabled { opacity: 0.55; cursor: default; }
.choice-title { font-weight: 600; margin-bottom: 2px; }
.health { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); margin: -4px 0 14px; word-break: break-all; }
.health .dot { margin-top: 5px; }
.health.ok .dot { background: var(--ok); }
.health.bad .dot { background: var(--bad); }
.health.bad { color: #ffb3b3; }
.gdrive-setup { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; margin-bottom: 4px; }
.gdrive-setup summary { cursor: pointer; padding: 11px 0; font-weight: 500; color: var(--text-2); }
.gdrive-setup[open] { padding-bottom: 12px; }
.gdrive-setup .row { margin-bottom: 12px; }
.steps { margin: 0 0 16px; padding-left: 20px; color: var(--text-2); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }

/* ------------------------------------------------------------ asset view */

/* dvh: the height Safari's toolbars leave, not the height behind them */
.asset-view { display: flex; flex: none; min-height: 0; height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); position: relative; }
.m-title-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.ver-btn, .status-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
}
.ver-btn:hover, .status-btn:hover { background: var(--hover); }
.ver-btn.old { border-color: rgba(245, 184, 61, 0.6); color: var(--warn); }
.status-label { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

.viewer { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #000; position: relative; }
.viewer:fullscreen { background: #000; }
.stage { flex: 1; min-height: 0; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.stage video.media, .stage img.media { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage.kind-video video.media { cursor: pointer; }
.stage.kind-image, .stage.kind-video { padding: 0; }
canvas.annot { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
/* touch-action: otherwise a finger stroke scrolls or zooms the page and the pen gets cancelled */
canvas.annot.editing { pointer-events: auto; cursor: crosshair; touch-action: none; }
.stage.drawing { box-shadow: inset 0 0 0 2px var(--accent); }
.stage-msg { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 24px; color: var(--text-2); max-width: 520px; }
.stage-msg h3 { color: var(--text); font-size: 16px; overflow-wrap: anywhere; }
.stage-msg .ic { color: var(--muted); }
.stage-msg.over { position: absolute; inset: 0; max-width: none; justify-content: center; background: rgba(7, 7, 8, 0.92); z-index: 3; }
.pdf-frame { width: 100%; height: 100%; border: 0; background: #2a2a30; }
.wave-stage { position: relative; width: calc(100% - 48px); max-width: 1400px; height: min(60%, 320px); cursor: pointer; border-radius: 10px; overflow: hidden; background: #0f0f13; }
.wave-stage img { width: 100%; height: 100%; object-fit: fill; display: block; opacity: 0.9; }
.wave-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #3c3c46; }
.wave-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(108, 99, 255, 0.2); border-right: 2px solid #fff; pointer-events: none; }

.draw-bar {
  position: absolute;
  z-index: 5;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(26, 26, 31, 0.95);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  max-width: calc(100% - 16px);
  flex-wrap: wrap;
  justify-content: center;
}
.draw-bar .sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
.draw-bar .btn { height: 30px; margin-left: 4px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; margin: 0 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset; }
.swatch.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px #fff; }

.controls { flex: none; background: var(--bg-2); border-top: 1px solid var(--line); padding: 0 10px 6px; user-select: none; }
.timeline { position: relative; height: 34px; cursor: pointer; touch-action: none; margin: 0 4px; }
.tl-track { position: absolute; left: 0; right: 0; bottom: 8px; height: 4px; border-radius: 4px; background: var(--track); overflow: hidden; transition: height 0.1s, bottom 0.1s; }
.timeline:hover .tl-track { height: 6px; bottom: 7px; }
.tl-buf { position: absolute; left: 0; top: 0; bottom: 0; background: var(--track-2); }
.tl-played { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.tl-head { position: absolute; bottom: 4px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--head); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); pointer-events: none; }
.tl-markers { position: absolute; left: 0; right: 0; top: 0; height: 20px; }
.marker {
  position: absolute;
  top: 1px;
  width: 17px;
  height: 17px;
  margin-left: -8.5px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--bg-2);
  background: var(--c);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.1s;
  z-index: 1;
}
.marker:hover { transform: scale(1.25); z-index: 3; }
.marker.done { opacity: 0.4; }
.marker.active { box-shadow: 0 0 0 2px #fff; z-index: 2; }
.tl-hover {
  position: absolute;
  bottom: 30px;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 6;
}
.timeline.hovering .tl-hover { display: flex; }
.tl-thumb { border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.25); background-color: #000; background-repeat: no-repeat; box-shadow: var(--shadow); }
.tl-tc { font: 11.5px var(--mono); background: rgba(0, 0, 0, 0.85); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.ctl-row { display: flex; align-items: center; gap: 2px; min-height: 36px; }
.ctl-row .icon-btn { width: 34px; height: 34px; }
.play-btn { color: var(--text) !important; }
.tc-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 4px 8px;
  border-radius: 6px;
  font: 13px var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.tc-display:hover { background: var(--hover); }
.tc-sep, .tc-dur { color: var(--muted); }
.vol-wrap { display: flex; align-items: center; }
.vol { width: 0; opacity: 0; transition: width 0.15s, opacity 0.15s; accent-color: #fff; height: 4px; margin: 0; }
.vol-wrap:hover .vol, .vol:focus { width: 80px; opacity: 1; margin: 0 8px 0 2px; }

/* ------------------------------------------------------------ side panel: comments & info */

.side { width: 380px; flex: none; display: flex; flex-direction: column; background: var(--side-bg); border-left: 1px solid var(--line); min-height: 0; }
.side-tabs { display: flex; align-items: center; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); }
.tab {
  border: 0;
  background: none;
  padding: 8px 10px 10px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.filter-btn { margin-bottom: 4px; font-size: 12.5px; white-space: nowrap; }
.side-body { flex: 1; overflow-y: auto; min-height: 0; padding: 6px 0; overscroll-behavior: contain; }
.search-toggle { display: none; }
.side-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 50px 30px; color: var(--text-2); }
.side-empty .ic { color: var(--muted); }

.thread { border-bottom: 1px solid var(--line); padding: 4px 0; }
.cmt { padding: 10px 14px 10px 12px; cursor: pointer; border-left: 2px solid transparent; border-radius: 0 10px 10px 0; position: relative; }
.cmt:hover { background: var(--overlay); }
.cmt.active { background: var(--accent-bg); border-left-color: var(--accent); }
.cmt.reply { padding-left: 44px; padding-top: 6px; }
.cmt.done > .cmt-body { color: var(--muted); }
.cmt.done > .cmt-body .tc-chip { opacity: 0.6; }
.cmt-head { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.cmt-author { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cmt-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.cmt-body { margin: 4px 0 0 32px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; color: var(--text); }
.cmt.reply .cmt-body { margin-left: 28px; }
.tc-chip {
  display: inline-block;
  border: 0;
  padding: 1px 7px;
  margin-right: 6px;
  border-radius: 999px;
  background: rgba(242, 201, 76, 0.14);
  color: var(--amber);
  font: 600 11.5px var(--mono);
  cursor: pointer;
  vertical-align: 1px;
}
.tc-chip:hover { background: rgba(242, 201, 76, 0.26); color: #ffd964; }
.draw-tag { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: rgba(255, 71, 87, 0.18); color: #ff8a95; margin-right: 6px; vertical-align: -3px; }
.cmt-foot { margin: 5px 0 0 32px; font-size: 12.5px; }
.cmt-foot .link-btn { color: var(--muted); }
.cmt-foot .link-btn:hover { color: var(--text); }
.cmt .icon-btn { width: 26px; height: 26px; }
.cmt-more { opacity: 0; }
.cmt:hover .cmt-more, .cmt-more:focus-visible { opacity: 1; }
@media (hover: none) { .cmt-more { opacity: 1; } }
.done-btn { color: #55555f; }
.done-btn.on { color: var(--ok); }
.done-btn:hover { color: var(--ok); }
.reply-box { margin: 6px 14px 8px 44px; display: flex; flex-direction: column; gap: 8px; }
.reply-box .btn { height: 30px; padding: 0 12px; }
.cmt .reply-box { margin: 6px 0 2px 32px; }

.composer { flex: none; padding: 10px; border-top: 1px solid var(--line); }
.composer-box { background: var(--composer-bg); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 11px 9px; display: flex; flex-direction: column; gap: 6px; transition: border-color 0.12s, box-shadow 0.12s; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.18); }
.composer-who { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.composer-input {
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  resize: none;
  min-height: 24px;
  max-height: 200px;
  padding: 2px 0;
  line-height: 1.45;
}
.composer-input::placeholder { color: #6b6b76; }
.composer-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; row-gap: 6px; }
.composer-row > .btn:last-child { margin-left: auto; }
.tc-toggle { white-space: nowrap; }
.composer-row .btn { height: 30px; padding: 0 14px; }
.tc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: none;
  color: var(--muted);
  font: 12px var(--mono);
  cursor: pointer;
  text-decoration: line-through;
}
.tc-toggle.on { color: var(--amber); border-color: rgba(242, 201, 76, 0.45); background: rgba(242, 201, 76, 0.09); text-decoration: none; }
.draw-btn.on { color: #fff; background: var(--accent); }
.draft-chip { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 4px 3px 8px; border-radius: 7px; background: rgba(255, 71, 87, 0.1); font-size: 12.5px; }
.draft-chip .link-btn { color: #ff9aa4; }
.draft-chip .icon-btn { width: 24px; height: 24px; }
.composer-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 6px 4px; }

.info { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 18px; }
.info-list { display: grid; grid-template-columns: 116px 1fr; gap: 9px 12px; margin: 0; font-size: 13px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; overflow-wrap: anywhere; }
.shortcuts h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; margin: 0; font-size: 12.5px; align-items: center; }
.shortcuts dd { margin: 0; color: var(--text-2); }

/* share dialog */
.share-dialog { display: flex; flex-direction: column; gap: 14px; }
.share-dialog .banner { margin: 0; }
.share-new { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-2); }
.share-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 4px; }
.share-list { display: flex; flex-direction: column; gap: 12px; }
.share-row { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.share-row:last-child { border-bottom: 0; padding-bottom: 0; }
.share-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }

/* guides, side-by-side compare */
canvas.guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.guides-btn.on, .range-btn.on { color: #fff; background: var(--accent); }
.stage.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: #000; align-items: stretch; justify-items: stretch; }
.pane { position: relative; min-width: 0; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.pane video.media, .pane img.media { width: 100%; height: 100%; object-fit: contain; display: block; }
.pane-label { position: absolute; z-index: 4; top: 8px; left: 8px; right: 8px; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.pane-label > * { pointer-events: auto; }
.pane-ver { font: 700 11.5px var(--mono); background: var(--accent); color: #fff; padding: 2px 7px; border-radius: 5px; flex: none; }
.pane-name { font-size: 12px; background: rgba(0, 0, 0, 0.65); padding: 2px 8px; border-radius: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-label .icon-btn, .pane-audio { width: 26px; height: 26px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); color: var(--text-2); flex: none; }
.pane-audio.on { color: #fff; background: var(--accent); }
.pane-open { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); color: var(--text-2); flex: none; }
.pane-open:hover { color: #fff; }
.pane-label .grow { pointer-events: none; }

/* timeline: comment ranges and the range being marked */
.tl-spans { position: absolute; left: 0; right: 0; top: 19px; height: 3px; pointer-events: none; }
.tl-span { position: absolute; top: 0; height: 3px; border-radius: 2px; background: var(--c); opacity: 0.55; min-width: 2px; }
.tl-span.done { opacity: 0.2; }
.tl-span.active { opacity: 1; box-shadow: 0 0 0 1px #fff; }
.tl-range { position: absolute; bottom: 5px; height: 10px; border-radius: 3px; background: rgba(108, 99, 255, 0.28); border: 1px solid var(--accent-2); pointer-events: none; z-index: 1; }
.tl-range-h { position: absolute; top: -4px; bottom: -4px; width: 10px; pointer-events: auto; cursor: ew-resize; touch-action: none; }
.tl-range-h::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 4px; border-radius: 2px; background: var(--accent-2); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.tl-range-h.in { left: -6px; }
.tl-range-h.out { right: -6px; }
.tc-chip.span { background: rgba(242, 201, 76, 0.24); }
.tc-toggle.span { text-decoration: none; }

/* comment search and filters */
.side-search { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.search-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 31px; padding: 0 9px; border-radius: 8px; background: var(--field-bg); border: 1px solid var(--line-2); color: var(--muted); cursor: text; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.18); }
.search-input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); font: inherit; font-size: 13px; padding: 0; }
.search-input::-webkit-search-cancel-button { filter: invert(0.7); }
.author-btn { gap: 5px; font-size: 12.5px; max-width: 45%; flex: none; }
.author-btn .author-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.author-btn.on { background: var(--accent-bg); }
.filter-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 14px 8px; font-size: 12px; color: var(--muted); }
.export-btn { margin-bottom: 4px; width: 30px; height: 30px; }
.cmt.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(108, 99, 255, 0.35); } 100% { background: transparent; } }

/* @mentions */
.mention { color: #c6c0ff; background: rgba(108, 99, 255, 0.16); border-radius: 4px; padding: 0 2px; font-weight: 600; }
.mention.me { color: #fff; background: rgba(108, 99, 255, 0.55); }
.mention-list { position: fixed; z-index: 250; min-width: 220px; max-width: 320px; max-height: 280px; overflow-y: auto; padding: 5px; border-radius: 12px; background: var(--menu-bg); border: 1px solid var(--menu-line); box-shadow: var(--shadow); }
.mention-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; cursor: pointer; font-size: 13px; }
.mention-item:hover, .mention-item.on { background: var(--hover); }
.mention-item.on { box-shadow: inset 2px 0 0 var(--accent); }
.mention-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* reactions */
.cmt-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.cmt.reply .cmt-foot { margin-left: 28px; }
.react { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); font-size: 12px; cursor: pointer; }
span.react { cursor: default; }
button.react:hover { border-color: var(--muted); }
.react.mine { border-color: rgba(108, 99, 255, 0.6); background: rgba(108, 99, 255, 0.16); color: #d6d1ff; }
.react-e { font-size: 13px; line-height: 1; }
.react-n { font-variant-numeric: tabular-nums; }
.cmt .react-add { width: 24px; height: 24px; color: var(--muted); opacity: 0.6; }
.cmt:hover .react-add, .react-add:focus-visible { opacity: 1; }
.cmt-foot .link-btn { margin-left: 4px; }
.emoji-pop { min-width: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(4, 36px); gap: 2px; }
.emoji { width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; font-size: 19px; cursor: pointer; line-height: 1; }
.emoji:hover { background: var(--hover); }
.emoji.on { background: var(--accent-bg); box-shadow: inset 0 0 0 1px rgba(108, 99, 255, 0.6); }

/* attachments */
.cmt-atts { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0 32px; }
.cmt.reply .cmt-atts { margin-left: 28px; }
.att-img { display: block; width: 84px; height: 64px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); background: #000; }
.att-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-img:hover { border-color: var(--accent-2); }
.att-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); font-size: 12.5px; }
.att-file:hover { border-color: var(--accent-2); color: var(--text); text-decoration: none; }
.att-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.att-size { color: var(--muted); font-size: 11.5px; white-space: nowrap; flex: none; }
.att-pending { display: flex; flex-wrap: wrap; gap: 6px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 3px 0 6px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 12px; color: var(--text-2); }
.att-chip img { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; flex: none; }
.att-chip .att-name { max-width: 140px; }
.att-chip .icon-btn { width: 22px; height: 22px; }
.att-chip.bad { border-color: rgba(255, 92, 92, 0.55); }
.att-chip.bad .att-size { color: #ff9a9a; }
.composer.drop-hover .composer-box { border-color: var(--accent); border-style: dashed; background: var(--accent-bg); }

/* share links: passcode and expiry */
.share-new { align-items: stretch; gap: 10px 16px; }
.share-sec { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; flex: 1 1 auto; }
.share-sec.end { flex: none; }
.share-sec .input { height: 32px; width: auto; min-width: 0; }
.share-sec input[type=text] { flex: 1 1 230px; }
.share-sec.end { margin-left: auto; }
.sbadge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text-2); font-size: 11.5px; white-space: nowrap; }
.sbadge.bad { border-color: rgba(255, 92, 92, 0.5); color: #ff9a9a; }
.share-row.expired .copy-row { opacity: 0.5; }
.share-exp { display: flex; align-items: center; gap: 6px; }

/* notifications */
.bell-btn { position: relative; }
.bell-badge { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font: 700 10px/16px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--bg-2); pointer-events: none; }
.popover.inbox { width: 380px; max-width: calc(100vw - 16px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.inbox-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.inbox-head .link-btn { font-size: 12.5px; }
.inbox-list { overflow-y: auto; max-height: min(520px, calc(100vh - 130px)); padding: 4px; }
.inbox-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 34px 26px; color: var(--text-2); }
.inbox-empty .ic { color: var(--muted); }
.note { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); text-align: left; cursor: pointer; position: relative; }
.note:hover { background: var(--hover); }
.note.unread { color: var(--text); background: rgba(108, 99, 255, 0.06); }
.note-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.note-line b { color: var(--text); }
.note-excerpt { color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.note-meta { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11.5px; min-width: 0; }
.note-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.note-thumb { width: 56px; height: 36px; object-fit: cover; border-radius: 5px; flex: none; background: #000; }
.note-dot { position: absolute; top: 14px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.note.unread .note-thumb { margin-right: 8px; }

/* ------------------------------------------------------------ small screens */

@media (max-width: 900px) {
  .status-label, .pill-text { display: none; }
  .crumb { max-width: 150px; }
}
/* Portrait tablets and phones: the picture on top at its own shape, the comments under it
   scrolling on their own, and the comment box always at the bottom — nothing scrolls away. */
@media (max-width: 900px) and (min-height: 501px) {
  .asset-view { flex-direction: column; }
  .viewer { flex: none; }
  .stage { flex: none; min-height: 160px; height: min(calc(100vw / var(--ar, 1.7778)), 55vh); height: min(calc(100vw / var(--ar, 1.7778)), 55dvh); }
  .stage.compare { height: min(calc(50vw / var(--ar, 1.7778)), 55vh); height: min(calc(50vw / var(--ar, 1.7778)), 55dvh); }
  .side { width: auto; border-left: 0; border-top: 1px solid var(--line); flex: 1; min-height: 0; }
}
/* Phones on their side: picture beside a narrower comment column. The picture is limited by
   the height anyway, so the column can take what the picture doesn't use. */
@media (max-height: 500px) {
  .side { width: clamp(300px, 45vw, 400px); }
}
@media (max-width: 640px) {
  :root { --topbar: 50px; }
  .page { padding: 18px 14px 50px; }
  .topbar { gap: 6px; padding: 0 8px 0 12px; }
  .topbar.m-bar { gap: 4px; padding: 0 6px 0 4px; }
  .topbar.m-bar .actions { gap: 4px; }
  .logo-text { display: none; }
  .crumbs { margin-left: 2px; }
  .crumbs .crumb:not(.current), .crumbs .crumb-sep { display: none; }
  .crumbs .crumb:nth-last-child(3), .crumbs .crumb-sep:nth-last-child(2) { display: block; }
  .storage-pill, .topbar .settings-btn, .topbar .cmp-btn, .topbar .dl-btn { display: none; }
  .topbar .actions .btn span { display: none; }
  .topbar .actions .btn { padding: 0 9px; }
  .ver-btn, .status-btn { padding: 0 7px; gap: 4px; }
  .grid, .grid.projects { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .grid.folders { grid-template-columns: 1fr; gap: 10px; }
  .stage { height: min(calc(100vw / var(--ar, 1.7778)), 42vh); height: min(calc(100vw / var(--ar, 1.7778)), 42dvh); }
  .stage.compare { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; height: min(calc(200vw / var(--ar, 1.7778)), 56vh); height: min(calc(200vw / var(--ar, 1.7778)), 56dvh); }
  .share-sec.end { margin-left: 0; }
  .share-sec input[type=text] { flex-basis: 100%; }
  .page-head { flex-wrap: wrap; row-gap: 6px; }
  .page-head h1 { font-size: 19px; flex: 1 1 100%; }
}
/* Phones either way up: a narrow player, and a comments column where every line counts. */
@media (max-width: 640px), (max-height: 500px) {
  /* iPhone sets the volume with its own buttons; the slider does nothing there */
  .vol-wrap { display: none; }
  .ctl-row .speed { padding: 0 6px; }
  .tc-display { font-size: 12px; padding: 4px 4px; }
  .tc-display .tc-sep, .tc-display .tc-dur { display: none; }
  .side-tabs { padding: 4px 6px 0; gap: 2px; }
  .tab { padding: 8px 8px 10px; }
  .search-toggle { display: inline-flex; margin-bottom: 4px; width: 30px; height: 30px; }
  .side:not(.search-open) .side-search { display: none; }
  .composer { padding: 8px; }
  .composer-who { display: none; }
  /* drawing: the tools take the place of the transport controls instead of covering the picture */
  .viewer.drawing .controls { display: none; }
  .draw-bar { position: static; transform: none; max-width: none; border-radius: 0; border: 0; border-top: 1px solid var(--line); box-shadow: none; background: var(--bg-2); padding: 8px 6px; gap: 2px; }
}
/* Fingers: 16px text so iPhone doesn't zoom into a field on focus, and bigger things to hit. */
@media (pointer: coarse) {
  html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
  button, a { -webkit-tap-highlight-color: transparent; }
  .input, .composer-input, .search-input, textarea, select, input:not([type=checkbox]):not([type=radio]):not([type=range]) { font-size: 16px; }
  .draw-bar .icon-btn { width: 38px; height: 38px; }
  .swatch { width: 28px; height: 28px; margin: 0 3px; }
  .draw-bar .btn { height: 36px; }
  .composer-row .btn { height: 34px; }
}
/* One row of drawing tools down to a 375px-wide phone. */
@media (max-width: 640px), (max-height: 500px) {
  .draw-bar { flex-wrap: nowrap; justify-content: space-between; gap: 2px; padding: 6px; }
  .draw-bar .sep { display: none; }
  .draw-bar .icon-btn { width: 32px; height: 36px; flex: none; }
  .draw-bar .swatch { width: clamp(22px, 6vw, 26px); height: clamp(22px, 6vw, 26px); margin: 0; flex: none; }
  .draw-bar .swatch.on { box-shadow: 0 0 0 2px #fff; }
  .draw-bar .btn { margin-left: 2px; padding: 0 12px; height: 34px; flex: none; }
}
/* iPhone "fullscreen": the viewer laid over the whole page (see fullscreen() in asset.js). */
.viewer.pseudo-fs { position: fixed; inset: 0; z-index: 55; height: auto; background: #000; }
.viewer.pseudo-fs .stage { flex: 1; height: auto; min-height: 0; }

/* ------------------------------------------------------------ project browser (Frame.io-style) */

.proj { display: flex; flex: 1; min-height: 0; align-items: stretch; }
.proj-page { min-width: 0; padding-top: 18px; }
.side-toggle { flex: none; margin-left: -2px; color: var(--muted); }
.side-toggle:hover { color: var(--text); }

/* left rail */
.sidebar {
  width: 252px;
  flex: none;
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  height: calc(100dvh - var(--topbar));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  padding: 12px 9px 24px;
  scrollbar-width: thin;
}
.sidebar.collapsed { display: none; }
.side-back { display: none; }
.side-h {
  display: flex; align-items: center; gap: 6px; width: 100%; height: 30px; padding: 0 8px; margin-top: 6px;
  border: 0; background: none; border-radius: 7px; color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; text-align: left; cursor: pointer;
}
.side-h:hover { color: var(--text-2); background: var(--hover); }
.side-h.static { cursor: default; margin-top: 12px; }
.side-h.static:hover { background: none; color: var(--muted); }
.side-h span { flex: 1; min-width: 0; }
.side-h .side-n { flex: none; }
.side-mini { width: 24px; height: 24px; margin: 0 -4px 0 0; color: var(--muted); }
.side-list { display: flex; flex-direction: column; gap: 1px; }
.side-row {
  display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 6px 0 8px; border-radius: 8px;
  color: var(--text-2); font-size: 13.5px; min-width: 0; position: relative; user-select: none;
}
.side-row:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-row.current { background: var(--row-current); color: var(--text); font-weight: 550; }
.side-row.current > .ic { color: var(--accent-2); }
.side-row.drop-hover { background: var(--accent-bg); box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--text); }
.side-row > .ic { color: var(--muted); }
.side-row.folder > .ic { color: #a79dff; }
.side-row.root > .ic { color: var(--accent-2); }
.side-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-n { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; flex: none; }
.side-row .tw {
  width: 18px; height: 18px; flex: none; display: grid; place-items: center; border: 0; background: none;
  border-radius: 4px; color: var(--muted); padding: 0; cursor: default;
}
.side-row .tw.has { cursor: pointer; }
.side-row .tw.has:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.side-more { width: 22px; height: 22px; opacity: 0; margin-right: -2px; flex: none; }
.side-row:hover .side-more, .side-more:focus-visible { opacity: 1; }
.side-row:hover .side-n:not(:only-child) { display: none; }
.side-row.proj .proj-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin: 0 4px; }

/* head + toolbar */
.proj-page .page-head { margin-bottom: 12px; gap: 10px; }
.proj-page .page-head h1 { font-size: 20px; }
.proj-page .page-head .btn.primary { height: 32px; padding: 0 10px 0 11px; gap: 5px; }
.proj-page .page-head .btn.primary .ic:last-child { margin-left: -2px; opacity: 0.8; }
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line); position: relative;
}
.tool-search { flex: 0 1 260px; min-width: 140px; }
.toolbar .select { height: 30px; font-size: 13px; color: var(--text-2); }
.tool-sort { display: flex; align-items: center; gap: 2px; }
.sort-btn { height: 30px; padding: 0 10px; font-size: 13px; color: var(--text-2); background: transparent; border-color: transparent; gap: 6px; }
.sort-btn:hover { background: var(--hover); border-color: transparent; color: var(--text); }
.tool-ib { width: 28px; height: 28px; color: var(--text-2); }
.seg { display: inline-flex; align-items: center; background: var(--seg-bg); border: 1px solid var(--line-2); border-radius: 9px; padding: 2px; gap: 1px; }
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 25px; padding: 0 8px; border: 0;
  border-radius: 7px; background: none; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }

/* grid */
.items-wrap { position: relative; min-height: 200px; }
.grid.items { --card-min: 230px; grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr)); gap: 16px; align-items: start; }
.grid.items.size-s { --card-min: 170px; gap: 12px; }
.grid.items.size-l { --card-min: 320px; gap: 18px; }
.grid.items .card { user-select: none; -webkit-user-drag: element; }
.grid.items .card .meta { padding: 9px 9px 10px 11px; }
.grid.items.size-s .card .meta { padding: 7px 7px 8px 9px; font-size: 13px; }
.grid.items.size-s .card .sub { font-size: 11.5px; gap: 5px; }

/* folder card: vertical, with a mosaic of what's inside */
.grid.items .card.folder { flex-direction: column; align-items: stretch; }
.grid.items .card.folder .meta { flex: none; padding: 9px 9px 10px 11px; }
.grid.items .card.folder .meta .row .ic { color: #a79dff; flex: none; }
.grid.items .folder-cover {
  width: auto; height: auto; aspect-ratio: 16 / 9; display: grid; gap: 2px; background: var(--thumb-bg); place-items: stretch;
  border-bottom: 1px solid var(--line);
}
.grid.items .folder-cover img { position: static; inset: auto; width: 100%; height: 100%; object-fit: cover; opacity: 0.9; min-height: 0; }
.grid.items .folder-cover.n0 { place-items: center; background: linear-gradient(180deg, #17161f, #121216); }
.grid.items .folder-cover.n2 { grid-template-columns: 1fr 1fr; }
.grid.items .folder-cover.n3, .grid.items .folder-cover.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid.items .folder-cover.n3 img:first-child { grid-row: 1 / 3; }
.card:hover .folder-cover img { opacity: 1; }

/* selection */
.sel-box {
  position: absolute; z-index: 3; top: 8px; left: 8px; width: 20px; height: 20px; border-radius: 5px; padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.75); background: rgba(0, 0, 0, 0.45); color: #fff; display: grid; place-items: center;
  cursor: pointer; opacity: 0; transition: opacity 0.1s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.sel-box .ic { opacity: 0; }
.item:hover .sel-box, .has-sel .sel-box, .sel-box:focus-visible { opacity: 1; }
.item.selected .sel-box { opacity: 1; background: var(--accent); border-color: var(--accent); }
.item.selected .sel-box .ic { opacity: 1; }
.item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); background: #1e1d2e; }
.item.selected.drop-hover { box-shadow: 0 0 0 2px var(--accent); }
.badge.ver { left: auto; right: 8px; top: 8px; }
@media (hover: none) { .sel-box { opacity: 0.85; } }
.marquee { position: fixed; z-index: 70; pointer-events: none; border: 1px solid var(--accent); background: rgba(108, 99, 255, 0.12); border-radius: 2px; }
body.marquee-on { user-select: none; cursor: crosshair; }
.drag-ghost {
  position: fixed; top: -100px; left: -100px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; box-shadow: var(--shadow);
}
.sel-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 45;
  display: flex; align-items: center; gap: 6px; padding: 7px 9px 7px 15px; border-radius: 14px;
  background: var(--selbar-bg); backdrop-filter: blur(14px); border: 1px solid var(--menu-line); box-shadow: var(--shadow); max-width: calc(100vw - 24px);
}
.sel-count { margin-right: 8px; white-space: nowrap; font-size: 13px; }
.sel-count b { font-weight: 700; }
.sel-bar .btn { height: 30px; padding: 0 10px; font-size: 13px; background: transparent; border-color: transparent; color: var(--text-2); gap: 6px; }
.sel-bar .btn:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.sel-bar .btn.danger { color: #ff8080; background: transparent; }
.sel-bar .btn.danger:hover { background: rgba(255, 92, 92, 0.14); }
.sel-bar .icon-btn { margin-left: 4px; }

/* list view */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: clip; background: var(--panel); }
.lrow {
  display: grid; align-items: center; gap: 10px; min-height: 52px; padding: 0 6px 0 8px; color: var(--text); font-size: 13px; position: relative;
  grid-template-columns: 24px 64px minmax(160px, 1fr) 120px 48px 110px 110px 86px 76px 72px 32px;
  border-bottom: 1px solid var(--line); user-select: none;
}
.lrow:last-child { border-bottom: 0; }
.lrow:not(.lhead):hover { background: var(--hover); text-decoration: none; }
.lrow.selected { background: rgba(108, 99, 255, 0.12); box-shadow: inset 2px 0 0 var(--accent); }
.lrow.drop-hover { background: var(--accent-bg); box-shadow: inset 0 0 0 1.5px var(--accent); }
.lrow.dragging { opacity: 0.45; }
.lrow .sel-box { position: static; opacity: 0.35; background: transparent; border-color: var(--line-2); box-shadow: none; }
.lrow:hover .sel-box, .has-sel .lrow .sel-box { opacity: 1; }
.lhead { min-height: 36px; background: var(--bg-2); color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; position: sticky; top: var(--topbar); z-index: 2; }
.lc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc.sortable { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: inherit; padding: 0; cursor: pointer; font: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; }
.lc.sortable:hover, .lc.sortable.on { color: var(--text); }
.lc.sortable .ic { color: var(--accent-2); }
.lc.name { display: flex; flex-direction: column; gap: 1px; font-weight: 550; }
.lc.name .lsub { font-weight: 400; color: var(--muted); font-size: 11.5px; display: flex; gap: 6px; }
.lc.size, .lc.dur, .lc.date, .lc.comments { font-variant-numeric: tabular-nums; }
.lstate:empty { display: none; }
.lstate { color: var(--accent-2); }
.lstate.bad { color: var(--bad); }
.lthumb { width: 64px; height: 36px; aspect-ratio: auto; border-radius: 4px; background: var(--thumb-bg); overflow: hidden; display: grid; place-items: center; }
.lthumb.folder { color: #a79dff; background: var(--thumb-bg); }
.lthumb .thumb-ph .ic { width: 18px; height: 18px; }
.lthumb .thumb-state { gap: 2px; font-size: 0; padding: 0; }
.lthumb .thumb-state span:not(.spinner), .lthumb .thumb-state .bar { display: none; }
.lthumb .thumb-wave { padding: 0 4px; }
.lthumb .thumb-wave .ic { display: none; }
.lrow .card-more { opacity: 0; }
.lrow:hover .card-more, .lrow .card-more:focus-visible { opacity: 1; }
.ver-pill { font-variant-numeric: tabular-nums; }
.proj-page .empty { margin-top: 10px; }

/* small screens */
@media (max-width: 1100px) {
  .lrow { grid-template-columns: 24px 64px minmax(140px, 1fr) 110px 44px 100px 86px 72px 32px; }
  .lc.who, .lc.ver { display: none; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: var(--topbar); left: 0; bottom: 0; height: auto; z-index: 40; width: min(300px, 84vw);
    transform: translateX(-104%); transition: transform 0.2s ease; box-shadow: var(--shadow); display: block;
  }
  .sidebar.collapsed { display: block; }
  .sidebar.open { transform: none; }
  .side-back { display: block; position: fixed; inset: var(--topbar) 0 0 0; z-index: 39; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .side-back.on { opacity: 1; pointer-events: auto; }
  .side-more { opacity: 1; }
  .lrow { grid-template-columns: 24px 56px minmax(120px, 1fr) 100px 90px 70px 32px; }
  .lc.comments, .lc.dur { display: none; }
}
@media (max-width: 640px) {
  .proj-page { padding-top: 14px; }
  .proj-page .page-head { flex-wrap: nowrap; }
  .proj-page .page-head h1 { flex: 1 1 auto; font-size: 18px; }
  .proj-page .page-head .count { display: none; }
  .toolbar { gap: 6px; margin-bottom: 12px; }
  .tool-search { flex: 1 1 100%; order: -1; }
  .toolbar .select { max-width: 46vw; }
  .sort-btn { padding: 0 8px; }
  .sort-btn span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .grid.items, .grid.items.size-s, .grid.items.size-l { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.items.size-l { grid-template-columns: 1fr; }
  .lrow { grid-template-columns: 24px 48px minmax(0, 1fr) 32px; gap: 8px; padding-left: 4px; min-height: 48px; }
  .lc.status, .lc.date, .lc.size { display: none; }
  .lrow .sel-box { opacity: 1; }
  .sel-bar { left: 8px; right: 8px; transform: none; max-width: none; padding: 6px 6px 6px 10px; gap: 2px; flex-wrap: wrap; justify-content: center; }
  .sel-count { flex: 1 1 100%; text-align: center; margin: 2px 0 4px; }
  .sel-what { display: none; }
  .sel-bar .btn { padding: 0 8px; gap: 4px; }
}

/* ------------------------------------------------------------ light theme */

/* Same design language on a light ground: white surfaces, soft grey chrome,
   the same indigo accent. Picked per browser from the topbar sun/moon button
   (localStorage 'rv_theme'; index.html applies it before first paint). */
[data-theme="light"] {
  --bg: #f3f3f6;
  --bg-2: #ececf0;
  --panel: #ffffff;
  --panel-2: #f3f3f7;
  --hover: #e8e8ee;
  --line: #e1e1e8;
  --line-2: #d0d0da;
  --text: #17181d;
  --text-2: #555864;
  --muted: #878b99;
  --accent: #6c63ff;
  --accent-strong: #5b54f0;
  --accent-2: #5a51e8;
  --accent-bg: rgba(108, 99, 255, 0.1);
  --shadow: 0 18px 50px rgba(23, 24, 45, 0.14), 0 4px 14px rgba(23, 24, 45, 0.07);
  --field-bg: #ffffff;
  --menu-bg: #ffffff;
  --menu-line: #dddde4;
  --topbar-bg: rgba(253, 253, 254, 0.85);
  --thumb-bg: #e7e7ed;
  --panel-hover: #fafafc;
  --sidebar-bg: #eeeef2;
  --row-current: #e6e3fc;
  --seg-bg: #e9e9ef;
  --seg-on: #ffffff;
  --selbar-bg: rgba(255, 255, 255, 0.94);
  --side-bg: #f7f7fa;
  --composer-bg: #ffffff;
  --glass: rgba(255, 255, 255, 0.85);
  --glass-line: rgba(23, 24, 45, 0.09);
  --overlay: rgba(23, 24, 45, 0.045);
  --scroll: #c3c3cf;
  --scroll-hover: #a6a6b6;
  color-scheme: light;
}
/* The picture and its transport controls stay a dark island in both themes;
   re-declaring the dark tokens inside .viewer keeps every control readable. */
[data-theme="light"] .viewer {
  --bg: #0c0d11;
  --bg-2: #12131a;
  --panel: #17181f;
  --panel-2: #1e2029;
  --hover: #23242e;
  --line: #22232c;
  --line-2: #30313d;
  --text: #f4f4f6;
  --text-2: #a7abb8;
  --muted: #717684;
  --accent-bg: rgba(108, 99, 255, 0.14);
  --track: rgba(255, 255, 255, 0.14);
  --track-2: rgba(255, 255, 255, 0.18);
  --head: #fff;
  background: #000;
}
[data-theme="light"] .auth-page {
  background:
    radial-gradient(760px 430px at 88% -10%, rgba(255, 150, 102, 0.22), transparent 62%),
    radial-gradient(920px 540px at 50% -22%, rgba(108, 99, 255, 0.2), transparent 66%),
    radial-gradient(720px 520px at 4% 112%, rgba(56, 130, 246, 0.14), transparent 62%),
    radial-gradient(640px 440px at 96% 108%, rgba(214, 84, 255, 0.12), transparent 62%),
    var(--bg);
}
/* Amber timecode chips need a deeper amber to stay legible on white. */
[data-theme="light"] .tc-chip { color: #8a6d00; background: rgba(242, 201, 76, 0.32); }
[data-theme="light"] .tc-chip:hover { color: #6e5700; background: rgba(242, 201, 76, 0.48); }
[data-theme="light"] .tc-toggle.on { color: #8a6d00; border-color: rgba(178, 138, 18, 0.5); background: rgba(242, 201, 76, 0.16); }
[data-theme="light"] .grid.items .folder-cover.n0 { background: linear-gradient(180deg, #efedfd, #e2defa); }
[data-theme="light"] .card:hover { box-shadow: 0 12px 30px rgba(23, 24, 45, 0.12); }
[data-theme="light"] .btn.primary { box-shadow: 0 6px 18px rgba(91, 84, 240, 0.26); }
[data-theme="light"] .btn.primary:hover { box-shadow: 0 8px 22px rgba(91, 84, 240, 0.34); }
[data-theme="light"] .mention { color: #5a51e8; }
[data-theme="light"] .mention.me { color: #fff; }

/* ---- cover picker */
.cover-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cover-actions .muted { font-size: 12.5px; flex: 1; min-width: 200px; }
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; max-height: 56vh; overflow-y: auto; padding: 2px; }
.cover-grid > .muted { grid-column: 1 / -1; }
.cover-cell { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--thumb-bg); cursor: pointer; aspect-ratio: 16 / 10; }
.cover-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-cell:hover { border-color: var(--accent); }
.cover-cell.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cover-cell .cover-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 7px 5px; font-size: 11px; color: #fff; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.65)); }
.cover-frame-btn { position: absolute; top: 6px; right: 6px; z-index: 1; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(10, 10, 14, 0.55); color: #fff; cursor: pointer; backdrop-filter: blur(6px); }
.cover-frame-btn:hover { background: var(--accent-strong); border-color: transparent; }
.frame-video { width: 100%; max-height: 52vh; background: #000; border-radius: 10px; display: block; }
.frame-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.frame-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.frame-time { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 12.5px; min-width: 44px; text-align: right; }

/* ---- Drive folder link dialog + badge */
.drive-account { margin: 2px 0 10px; }
.drive-roots { display: flex; gap: 8px; margin-bottom: 10px; }
.drive-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-bottom: 8px; }
.drive-crumb { background: none; border: 0; color: var(--text-2); font: inherit; font-size: 13px; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.drive-crumb:hover { background: var(--panel-2); color: var(--text); }
.drive-crumb.here { color: var(--text); font-weight: 600; }
.drive-crumb-sep { color: var(--muted); display: inline-flex; }
.drive-list { display: flex; flex-direction: column; gap: 6px; max-height: 290px; overflow-y: auto; margin-bottom: 12px; }
.drive-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.drive-row:hover { border-color: var(--line-2); }
.drive-row svg { color: var(--text-2); flex: none; }
.drive-url { display: flex; gap: 8px; margin-bottom: 14px; }
.drive-url input { flex: 1; min-width: 0; }
.drive-foot { display: flex; align-items: center; gap: 8px; }
.drive-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 7px 1px 5px; margin-left: 8px; vertical-align: 1px; white-space: nowrap; }
.drive-badge svg { display: block; }
