:root {
  --bg: #e8ecee;
  --panel: #ffffff;
  --ink: #16202a;
  --muted: #5e6b76;
  --line: #d3dadf;
  --hover: #f1f4f6;
  --accent: #d7265b;          /* TikTok */
  --accent-soft: #fbe6ec;
  --radius: 10px;
  color-scheme: light;
}
body[data-platform="facebook"] { --accent: #2d5bd3; --accent-soft: #e4ebfb; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171c; --panel: #1b2229; --ink: #e6ebef; --muted: #93a1ad;
    --line: #2c353e; --hover: #232c34; --accent: #f05a84; --accent-soft: #3a1f29;
    color-scheme: dark;
  }
  body[data-platform="facebook"] { --accent: #6f93f0; --accent-soft: #1f2a44; }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Onest", system-ui, sans-serif;
  font-size: 15px; line-height: 1.45;
  background: var(--bg); color: var(--ink);
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Вход ---------- */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 16px;
}
.login form {
  width: min(360px, 100%); background: var(--panel); border-radius: var(--radius);
  padding: 32px 28px; display: grid; gap: 14px; border: 1px solid var(--line);
}
.login h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.login label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.login input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink);
}
.login .error { color: #c62f2f; margin: 0; font-size: 14px; }
.btn-primary {
  margin-top: 6px; padding: 11px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--ink); color: var(--panel); font-weight: 600;
}

/* ---------- Каркас ---------- */
.app { display: grid; grid-template-columns: 320px 1fr; height: 100%; }
.side {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.side-top { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.platforms {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--bg); border-radius: 9px;
}
.platforms button {
  border: 0; background: transparent; padding: 8px; border-radius: 7px; cursor: pointer;
  font-weight: 500; color: var(--muted);
}
.platforms button[aria-pressed="true"] { background: var(--panel); color: var(--accent); font-weight: 600; }

.list { overflow-y: auto; flex: 1; padding-bottom: 16px; }
/* Разделы списка: у каждого свой цвет, чтобы сразу было видно, где «Новые», а где «Недоступные». */
.section-head {
  --sec: #5e6b76; --sec-bg: #eef1f4;
  position: sticky; top: 0; z-index: 1; background: var(--sec-bg); color: var(--sec);
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding: 9px 16px 9px 13px; border-left: 4px solid var(--sec);
  font-size: 15px; font-weight: 700;
}
.section-head:first-child { margin-top: 0; }
.section-count { min-width: 26px; text-align: center; padding: 1px 8px; border-radius: 999px; background: var(--sec); color: #fff; font-size: 12px; }
.sec-test        { --sec: #7a4fc2; --sec-bg: #f1ebfb; }
.sec-new         { --sec: #1f8a4c; --sec-bg: #e6f5ec; }
.sec-monthly     { --sec: #2d5bd3; --sec-bg: #e7eefc; }
.sec-requests    { --sec: #b26a00; --sec-bg: #fdf1df; }
.sec-unavailable { --sec: #6b7280; --sec-bg: #eceef1; }
@media (prefers-color-scheme: dark) {
  .section-head { --sec-bg: #222a32; }
  .sec-test { --sec: #b28cf0; } .sec-new { --sec: #4cc583; } .sec-monthly { --sec: #7d9df2; }
  .sec-requests { --sec: #f0a94a; } .sec-unavailable { --sec: #9aa4ae; }
  .sec-test, .sec-new, .sec-monthly, .sec-requests, .sec-unavailable { --sec-bg: #222a32; }
}
.section-empty { padding: 8px 16px 6px; font-size: 13px; color: var(--muted); }
.profile { border-left: 3px solid transparent; border-bottom: 1px solid var(--line); }
.profile-open {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 9px 16px 4px 13px; cursor: pointer;
}
.profile:hover { background: var(--hover); }
.profile[aria-current="true"] { background: var(--accent-soft); border-left-color: var(--accent); }
.profile-social { padding: 2px 16px 9px 13px; font-size: 12px; color: var(--muted); }
.profile-social.none { font-style: italic; }
.social-links { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.social-link { color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: none; }
.social-link:hover { text-decoration: underline; }
.visit { margin-top: 1px; }
.profile .name { font-weight: 600; }
.profile .pid { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.profile .counts { font-size: 13px; font-variant-numeric: tabular-nums; }
.profile .counts.none { color: var(--muted); }

.side-bottom {
  border-top: 1px solid var(--line); padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted);
}
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); text-decoration: underline; }

/* ---------- Центр ---------- */
.main { overflow-y: auto; padding: 28px 32px 48px; min-width: 0; }
.placeholder { color: var(--muted); margin-top: 18vh; text-align: center; }
.title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.title h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.title .pid { color: var(--muted); font-size: 16px; font-variant-numeric: tabular-nums; }
.crumb { border: 0; background: none; cursor: pointer; padding: 0; font-size: 28px; font-weight: 600; color: var(--muted); }
.crumb:hover { color: var(--ink); }

.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; max-width: 900px; }
.folder {
  text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius);
  padding: 18px 20px 20px; cursor: pointer; display: grid; gap: 4px; align-content: start;
}
.folder:hover { border-color: var(--accent); }
.folder:disabled { cursor: default; opacity: .55; border-color: var(--line); }
.folder svg { width: 30px; height: 30px; color: var(--accent); margin-bottom: 10px; }
.folder .count { font-size: 44px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.folder .label { color: var(--muted); }
.note { color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile {
  position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; border-radius: 8px; overflow: hidden;
  background: var(--line); cursor: pointer;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .badge {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 12px; padding: 2px 7px 2px 5px; border-radius: 5px; display: flex; align-items: center; gap: 3px;
  font-variant-numeric: tabular-nums;
}
.tile .badge svg { width: 12px; height: 12px; }
.tile-wrap { position: relative; }
.tile-wrap .tile { width: 100%; display: block; }
.tile-actions {
  position: absolute; top: 6px; left: 6px; right: 6px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end;
  opacity: 0; pointer-events: none;
}
.tile-wrap:hover .tile-actions, .tile-wrap:focus-within .tile-actions { opacity: 1; pointer-events: auto; }
@media (hover: none) { .tile-actions { opacity: 1; pointer-events: auto; } }
.tile-actions > button {
  border: 0; border-radius: 6px; padding: 4px 8px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: rgba(15, 20, 25, .78); color: #fff;
}
.tile-actions > button:hover { background: var(--accent); }
.tile-menu {
  position: absolute; top: 30px; right: 0; z-index: 3; min-width: 180px; display: grid; gap: 2px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.tile-menu[hidden] { display: none; }
.tile-menu-title { font-size: 12px; color: var(--muted); padding: 2px 6px 4px; }
.tile-menu button { border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.tile-menu button:hover { background: var(--hover); color: var(--accent); }
.folder-status { margin: -10px 0 14px; min-height: 1.2em; color: var(--muted); font-size: 14px; }
.folder-status.error { color: #c62f2f; }
.tile .fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; font-size: 12px; color: var(--muted); word-break: break-all; }

/* ---------- Просмотр ---------- */
.viewer {
  position: fixed; inset: 0; background: rgba(8, 11, 14, .94); z-index: 10;
  display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); color: #fff;
}
.viewer[hidden] { display: none; }
.viewer-bar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; font-size: 14px; }
.viewer-bar .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.viewer-bar a, .viewer-bar button { color: #fff; background: none; border: 0; cursor: pointer; font-size: 14px; }
.viewer-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 64px 24px; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: calc(100dvh - 80px); object-fit: contain; }
.nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0;
  background: rgba(255, 255, 255, .08); color: #fff; border-radius: 8px; cursor: pointer; font-size: 26px;
}
.nav:hover { background: rgba(255, 255, 255, .18); }
.nav.prev { left: 8px; } .nav.next { right: 8px; }

/* ---------- Редактор фото ---------- */
.editor {
  --ed-bg: #101418; --ed-panel: #181e24; --ed-line: #2b343d; --ed-text: #e6ebef; --ed-muted: #93a1ad;
  position: fixed; inset: 0; z-index: 20; background: var(--ed-bg); color: var(--ed-text);
  display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr);
}
.editor[hidden], .editor [hidden] { display: none !important; }  /* иначе display:grid у полей перебивает hidden */
.editor button {
  background: #232b33; border: 1px solid var(--ed-line); color: var(--ed-text);
  padding: 7px 11px; border-radius: 7px; cursor: pointer; font-size: 14px;
}
.editor button:hover:not(:disabled) { border-color: var(--ed-muted); }
.editor button:disabled { opacity: .4; cursor: default; }
.editor button[aria-pressed="true"] { border-color: var(--accent); color: #fff; background: #2a3440; }
.editor .ed-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ed-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--ed-line); }
.ed-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ed-muted); font-size: 14px; }
.ed-body { display: grid; grid-template-columns: 270px 1fr; min-height: 0; }
.ed-tools { background: var(--ed-panel); border-right: 1px solid var(--ed-line); overflow-y: auto; padding: 6px 16px 16px; }
.ed-tools section { padding: 12px 0 14px; border-bottom: 1px solid var(--ed-line); display: grid; gap: 9px; }
.ed-tools h2 { margin: 0; font-size: 14px; font-weight: 600; }
.ed-hint, .ed-size { margin: 0; font-size: 13px; color: var(--ed-muted); }
.ed-size { padding-top: 12px; font-variant-numeric: tabular-nums; }
.ed-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-wide { width: 100%; }
.ed-slider { display: grid; gap: 4px; font-size: 13px; color: var(--ed-muted); }
.ed-slider input { width: 100%; accent-color: var(--accent); }
.ed-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ed-text); cursor: pointer; }
.ed-check input { margin-top: 2px; accent-color: var(--accent); }
.ed-stage { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; padding: 16px 16px 104px; }
.ed-bar button { flex-shrink: 0; }
.ed-wrap { position: relative; }
.ed-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#ed-mask { pointer-events: none; }
#ed-mask.active { pointer-events: auto; cursor: crosshair; touch-action: none; }
.ed-crop {
  position: absolute; outline: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .6);
  cursor: move; touch-action: none;
  background-image: linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)), linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)),
                    linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)), linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35));
  background-size: 1px 100%, 1px 100%, 100% 1px, 100% 1px;
  background-position: 33.33% 0, 66.66% 0, 0 33.33%, 0 66.66%;
  background-repeat: no-repeat;
}
.ed-wrap { overflow: hidden; }
.ed-crop span { position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 3px; }
.ed-crop [data-handle="nw"] { left: -2px; top: -2px; cursor: nwse-resize; }
.ed-crop [data-handle="ne"] { right: -2px; top: -2px; cursor: nesw-resize; }
.ed-crop [data-handle="sw"] { left: -2px; bottom: -2px; cursor: nesw-resize; }
.ed-crop [data-handle="se"] { right: -2px; bottom: -2px; cursor: nwse-resize; }
.ed-crop-confirm {
  position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; background: var(--ed-panel); border: 1px solid var(--ed-line);
  padding: 8px 10px 8px 14px; border-radius: 9px; font-size: 14px; font-variant-numeric: tabular-nums;
}
.ed-crop-confirm[hidden] { display: none; }
.ed-status { position: absolute; bottom: 14px; left: 16px; right: 16px; margin: 0; text-align: center; font-size: 14px; color: var(--ed-muted); }
.ed-status.error { color: #ff8a8a; }

/* ---------- Редактор видео ---------- */
.tile-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ve-stage { grid-template-rows: 1fr auto; padding: 16px 16px 40px; gap: 14px; }
.ve-view { position: relative; overflow: hidden; background: #000; }
.ve-view video { position: absolute; max-width: none; }
.ve-controls { width: min(100%, 900px); display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 4px 12px; }
#ve-result { grid-column: 3; justify-self: end; white-space: normal; text-align: right; }  /* под дорожками: ширина дорожки не прыгает */
.ve-time { font-size: 13px; color: var(--ed-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
#ve-play { width: 40px; }
.ve-timeline { position: relative; height: 34px; background: #2a333c; border-radius: 6px; cursor: pointer; touch-action: none; }
.ve-cut { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .65); border-radius: 6px 0 0 6px; pointer-events: none; }
.ve-cut-r { right: 0; left: auto; border-radius: 0 6px 6px 0; }
.ve-handle { position: absolute; top: -3px; bottom: -3px; width: 10px; margin-left: -5px; background: #fff; border-radius: 3px; cursor: ew-resize; }
.ve-playhead { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--accent); pointer-events: none; }
.ve-tracks { display: grid; gap: 6px; }
.ve-timeline.scissors { cursor: copy; outline: 2px solid #ffd23f; }
.editor .ve-mark {
  position: absolute; top: -12px; bottom: 0; width: 20px; margin-left: -10px; padding: 0; border: 0; border-radius: 0;
  background: linear-gradient(90deg, transparent 9px, #ffd23f 9px, #ffd23f 11px, transparent 11px); cursor: pointer;
  font-size: 11px; line-height: 12px; color: #16202a; z-index: 1;
}
.editor .ve-mark::before {
  content: "×"; position: absolute; top: 0; left: 3px; width: 14px; height: 12px; border-radius: 3px;
  background: #ffd23f; font-weight: 700;
}
.editor .ve-mark:hover { filter: hue-rotate(-50deg) saturate(2); }
.ve-lane { position: relative; height: 26px; background: #1f272f; border-radius: 6px; overflow: hidden; }
.ve-lane[hidden] { display: none; }
.ve-music-bar {
  position: absolute; top: 3px; bottom: 3px; background: #2f8f5b; border-radius: 4px; cursor: grab; touch-action: none;
  display: flex; align-items: center; padding: 0 8px; font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.12) 0 2px, transparent 2px 6px);
}
.ve-music-bar:active { cursor: grabbing; }
.ve-music-label {
  position: absolute; left: 8px; top: 0; bottom: 0; display: flex; align-items: center; z-index: 2;
  font-size: 12px; color: #fff; white-space: nowrap; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.ve-lane .ve-cut { z-index: 1; }
.ve-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; max-height: 160px; overflow-y: auto; }
.ve-list li { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.editor .ve-list .ve-time-link { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--ed-text); font-variant-numeric: tabular-nums; }
.ve-modes { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.ve-modes legend { padding: 0 0 4px; }
.ve-between { justify-content: space-between; align-items: center; }
.ve-file { display: block; text-align: center; background: #232b33; border: 1px solid var(--ed-line); border-radius: 7px; padding: 7px 11px; cursor: pointer; font-size: 14px; }
.ve-file:hover { border-color: var(--ed-muted); }
.ve-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ve-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.ve-dialog { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; z-index: 2; }
.ve-dialog[hidden] { display: none; }
.ve-dialog-box { background: var(--ed-panel); border: 1px solid var(--ed-line); border-radius: 10px; padding: 20px; max-width: 460px; display: grid; gap: 14px; }
.ve-dialog-box p { margin: 0; font-size: 16px; }
#veditor .ed-crop-confirm { top: 10px; bottom: auto; }
.ve-stage { padding-top: 64px; }

/* ---------- Склейка ---------- */
.title-actions { margin-left: auto; align-self: center; display: flex; gap: 8px; }
.btn-trash {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-weight: 600;
}
.btn-trash svg { width: 18px; height: 18px; }
.btn-trash:hover { color: #c62f2f; border-color: #c62f2f; }
.tile-actions > .tile-del:hover { background: #c62f2f; }
.viewer-bar { position: relative; z-index: 2; gap: 8px; }  /* меню «Перенести» поверх фото */
/* Кнопки просмотра — настоящие кнопки, чтобы их было видно с первого раза. */
.viewer-bar > button, .viewer-move-wrap > button {
  padding: 8px 14px; border-radius: 8px; font-weight: 600;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28);
}
.viewer-bar > button:hover, .viewer-move-wrap > button:hover { background: rgba(255, 255, 255, .22); }
.viewer-bar > #viewer-edit, .viewer-bar > #viewer-restore { background: var(--accent); border-color: var(--accent); }
.viewer-bar > #viewer-delete:hover { background: #c62f2f; border-color: #c62f2f; color: #fff; }
.viewer-bar > #viewer-close { background: none; border-color: transparent; }
.viewer-bar #viewer-open { opacity: .75; margin: 0 6px; }
#viewer-pos { margin-right: 6px; opacity: .8; }
.viewer-move-wrap { position: relative; display: inline-flex; }
.viewer-move-wrap[hidden] { display: none; }
.viewer-bar .viewer-menu { top: 28px; color: var(--ink); }
.viewer-bar .viewer-menu button { color: var(--ink); }
.btn-subfolder { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 600; }
.btn-subfolder:hover { color: var(--ink); border-color: var(--muted); }
.btn-subfolder svg { width: 16px; height: 16px; }
.sub-count { min-width: 22px; text-align: center; padding: 0 6px; border-radius: 999px; background: var(--hover); color: var(--ink); font-variant-numeric: tabular-nums; }
.tile-caption { margin: 4px 2px 0; font-size: 12px; color: var(--muted); line-height: 1.3; }
.trash-note { margin: -12px 0 14px; max-width: 70ch; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 10px;
  background: #16202a; color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: 14px;
}
.toast[hidden] { display: none; }
.toast #toast-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.toast button { border: 0; border-radius: 7px; padding: 6px 12px; cursor: pointer; font-weight: 600; background: var(--accent); color: #fff; flex-shrink: 0; }
.toast .toast-close { background: transparent; padding: 6px 8px; font-size: 18px; line-height: 1; }
.btn-concat {
  align-self: center; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--panel); color: var(--accent); font-weight: 600;
}
.btn-concat:hover { background: var(--accent-soft); }
.cc-picker { padding-top: 12px; }
.cc-picker h2 { margin: 14px 0 8px; font-size: 14px; font-weight: 600; }
.cc-intro { margin-bottom: 4px; }
.cc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.editor .cc-pick, .editor .cc-thumb {
  position: relative; aspect-ratio: 9 / 16; padding: 0; overflow: hidden; border-radius: 6px; border: 2px solid transparent; background: #000;
}
.editor .cc-pick.in { border-color: var(--accent); }
.cc-pick img, .cc-pick video, .cc-thumb img, .cc-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cc-dur, .cc-num, .cc-count {
  position: absolute; background: rgba(0, 0, 0, .7); color: #fff; font-size: 11px; padding: 1px 5px; border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.cc-dur { right: 4px; bottom: 4px; }
.cc-count { left: 4px; top: 4px; background: var(--accent); }
.cc-count:empty { display: none; }
.cc-num { left: 4px; top: 4px; font-size: 13px; font-weight: 700; background: var(--accent); }
.cc-stage { grid-template-rows: 1fr auto; padding: 16px 16px 44px; gap: 12px; }
.cc-player { display: grid; justify-items: center; align-content: start; gap: 8px; min-height: 0; height: 100%; }
.cc-player video { max-width: 100%; max-height: calc(100dvh - 330px); background: #000; border-radius: 6px; }
.cc-strip-wrap { width: 100%; display: grid; gap: 6px; }
.cc-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; min-height: 150px; align-items: flex-start; }
.cc-card { flex: 0 0 76px; display: grid; gap: 4px; }
.cc-card.playing .cc-thumb { border-color: #ffd23f; }
.cc-card-actions { display: flex; gap: 2px; }
.editor .cc-card-actions button { flex: 1; padding: 2px 0; font-size: 13px; }

/* ---------- Телефон ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { max-height: 46vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 20px 16px 40px; }
  .title h1, .crumb { font-size: 22px; }
  .folders { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .folder { padding: 12px; }
  .folder .count { font-size: 30px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .viewer-stage { padding: 0 0 16px; }
  .nav { width: 40px; height: 52px; }
  .ed-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .ed-tools { order: 2; max-height: 40vh; border-right: 0; border-top: 1px solid var(--ed-line); }
  .ed-bar { flex-wrap: wrap; }
  .ed-name { flex-basis: 100%; order: -1; }
}
@media (prefers-reduced-motion: no-preference) {
  .profile, .folder { transition: background-color .12s, border-color .12s; }
}

/* ---------- Этап 4: разделы и «Готово к загрузке» ---------- */
.profile .ready-counts { color: #0f8b7d; }
@media (prefers-color-scheme: dark) { .profile .ready-counts { color: #4cc7b8; } }
.profile[draggable="true"] { cursor: grab; }
.profile.dragging { opacity: .45; }
.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
/* Кнопка «В раздел…» — и на телефоне, и на компьютере (вдобавок к перетаскиванию). */
.profile-section { position: relative; padding: 0 16px 9px 13px; }
.profile-section-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 5px 10px; font-size: 13px; cursor: pointer; }
.section-menu { position: static; margin-top: 6px; box-shadow: none; }  /* в потоке: список на телефоне низкий, поверх меню обрезалось бы */
.ready-head { margin: 26px 0 12px; font-size: 15px; font-weight: 600; color: #0f8b7d; }
@media (prefers-color-scheme: dark) { .ready-head { color: #4cc7b8; } }
.folder-ready { border-color: #9fd9d1; }

/* ---------- Пометки, статус, комментарии ---------- */
.flags { display: flex; gap: 6px; margin-top: 8px; }
.flags:empty { display: none; }
.flag-wrap { position: relative; }
.flag { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 11px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.flag-priority { color: #c2410c; border-color: #fdba74; background: #fff7ed; }
.flag-stop { color: #b91c1c; border-color: #fca5a5; background: #fef2f2; }
.flags-menu { left: 0; right: auto; top: 34px; min-width: 220px; }
.profile { position: relative; }
.profile .tag { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.tag-priority { color: #c2410c; }
.tag-stop { color: #b91c1c; }
.profile.st-done { background: #e3f1dc; }
.profile.st-progress { background: #fff6d6; }
.status-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 16px; pointer-events: none; }
.st-done .status-icon { background: #b7dfa5; color: #1f6b2c; }
.st-progress .status-icon { background: #ffe69a; color: #8a5a00; }
@media (prefers-color-scheme: dark) {
  .profile.st-done { background: #1f3322; } .profile.st-progress { background: #3a3218; }
  .flag-priority, .flag-stop { background: var(--panel); }
  .tag-priority, .flag-priority { color: #fb923c; } .tag-stop, .flag-stop { color: #f87171; }
}
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn-status, .btn-comment { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); border-radius: 8px; padding: 7px 12px; cursor: pointer; font: inherit; font-size: 14px; }
.btn-done[aria-pressed="true"] { background: #d9ead3; border-color: #93c47d; color: #1f6b2c; }
.btn-progress[aria-pressed="true"] { background: #fff2cc; border-color: #f1c232; color: #8a5a00; }
.btn-status:hover, .btn-comment:hover { border-color: var(--accent); }
.cm { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 18, .45); display: grid; place-items: center; padding: 16px; }
.cm[hidden] { display: none; }
.cm-box { width: min(480px, 100%); max-height: 80vh; display: flex; flex-direction: column; gap: 10px; padding: 16px;
  background: var(--panel); color: var(--ink); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.cm-head { display: flex; align-items: center; gap: 8px; }
.cm-head h2 { font-size: 16px; margin: 0; flex: 1; }
.cm-head button { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.cm-list { overflow-y: auto; display: grid; gap: 6px; }
.cm-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--hover); white-space: pre-wrap; word-break: break-word; }
.cm-item span { flex: 1; }
.cm-del { border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted); }
.cm-del:hover { color: #c62f2f; }
#cm-text { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; background: var(--bg); color: var(--ink); resize: vertical; }
.cm-foot { display: flex; align-items: center; gap: 10px; }
.cm-status { flex: 1; font-size: 13px; color: var(--muted); }
#cm-send { border: 0; border-radius: 8px; padding: 8px 16px; cursor: pointer; font: inherit; font-weight: 600; background: var(--accent); color: #fff; }
#cm-send:disabled { opacity: .6; cursor: default; }
/* Метки кадров для фото — голубые, чтобы не путать с ножницами. */
.ve-timeline.frames { cursor: crosshair; outline: 2px solid #4cc3ff; }
.editor .ve-frame-mark { filter: hue-rotate(160deg) saturate(1.6); }
#ve-frames-mode[aria-pressed="true"] { outline: 2px solid #4cc3ff; }
.ve-view { transition: transform .15s; }

/* ---------- Загрузка на talkytimes ---------- */
.btn-upload { display: inline-flex; align-items: center; align-self: flex-start; white-space: nowrap; gap: 6px; border: 0; border-radius: 8px; padding: 8px 16px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 14px; background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.btn-upload:hover { filter: brightness(1.08); }
.profile .limit-line { color: var(--muted); }
.profile .limit-line.limit-out { color: #c62f2f; font-weight: 600; }
.up-limit { margin-bottom: 4px; }
#up-picker .ed-wide { margin-top: 6px; }
.up-preview { place-items: center; }
.up-preview img, .up-preview video { max-width: 100%; max-height: calc(100dvh - 330px); border-radius: 6px; background: #000; }
#upload .cc-stage { padding-bottom: 70px; }  /* подсказка снизу в две строки не налезает на «В наборе» */
#up-total.up-over { color: #ff8a8a; white-space: normal; }

/* ---------- Проверка: на модерации / отклонённые, фильтры ---------- */
.ring { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; }
.ring-mod { background: radial-gradient(circle, #f97316 0 35%, #facc15 38% 100%); }
.ring-dec { background: radial-gradient(circle, #7f1d1d 0 35%, #ef4444 38% 100%); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 6px; vertical-align: 1px; }
.dot-mod { background: #f97316; }
.dot-dec { background: #dc2626; }
.flags { flex-wrap: wrap; }
.flag { display: inline-flex; align-items: center; gap: 5px; }
.flag.mode-only { outline: 2px solid var(--accent); }
.flag.mode-exclude { opacity: .6; text-decoration: line-through; }
.flag-mode { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.flags-menu button[aria-pressed="true"] { font-weight: 700; color: var(--accent); }
.flag-done { color: #1f6b2c; } .flag-progress { color: #8a5a00; }
.check-head { margin: 26px 0 12px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.folder-mod { border-color: #fcd34d; }
.folder-dec { border-color: #fca5a5; }
.tile-stamp { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 6px 8px; border-radius: 6px; font-size: 12px; line-height: 1.35;
  white-space: pre-line; display: grid; gap: 2px; color: #fff; opacity: 0; pointer-events: none; transition: opacity .12s; }
.tile-wrap:hover .tile-stamp, .tile-wrap:focus-within .tile-stamp { opacity: 1; }
@media (hover: none) { .tile-stamp { opacity: 1; } }
.stamp-mod { background: rgba(138, 90, 0, .88); }
.stamp-dec { background: rgba(127, 29, 29, .9); }
.stamp-deleted { color: #fecaca; font-weight: 600; }
/* «Готово» + «Проверка»: колонка шириной в две папки; «Проверка» по центру, под ней две колонки (Фото над Видео) */
.ready-check { max-width: 460px; }
.folders.folders-2 { grid-template-columns: 1fr 1fr; }
.folders.folders-1 { grid-template-columns: 1fr; }
.check-title { margin: 30px 0 6px; font-size: 22px; font-weight: 700; text-align: center; }
.check-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check-col .check-head { margin: 8px 0 10px; justify-content: center; }
