:root {
  --bg: #0a0a0a;
  --bg-elevated: #0e0e0e;
  --paper: #121212;
  --ink: #f2f2f2;
  --text: #e4e4e4;
  --muted: #9a9a9a;
  --accent: #da1e28;
  --accent-strong: #b31921;
  --border: #2e2e2e;
  --border-subtle: #1c1c1c;
  --radius: 0px;
  --radius-min: 0px;
  /* Единый шрифт интерфейса (Windows / macOS / fallback) */
  --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Roboto", "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 15px;
  --font-size-sm: 13px;
  --font-size-xs: 12px;
  --font-size-md: 14px;
  --font-size-lg: 17px;
  --font-size-title: 1.2rem;
  --font-size-display: clamp(32px, 9vw, 80px);
  --font-size-2xs: 10px;
  /* Поверхности в духе «панельного» тёмного UI */
  --ui-surface: #111111;
  --ui-surface-raised: #161616;
  --ui-surface-hover: #1c1c1c;
  --ui-chrome: #131313;
  --ui-shadow: 0 4px 32px rgba(0, 0, 0, 0.55);
  /* Единые отступы шапок секций (панели, модалки, фильтр, уведомления) */
  --section-header-pad-y: 10px;
  --section-header-pad-x: 14px;
  /* Компактные кнопки chrome */
  --btn-pad-y: 7px;
  --btn-pad-x: 12px;
  --btn-font: var(--font-size-sm);
  --btn-min-height: 32px;
  --gap-ui: 8px;
  /* Всплывающие блоки (тулбар, композер, дропдаун) */
  --popover-bg: var(--ui-surface-raised);
  --popover-border: var(--border);
  /* Скролл как у панели «Правки» (Firefox scrollbar-color + WebKit ниже) */
  --panel-scrollbar-track: #0f0f0f;
  --panel-scrollbar-thumb: #3a3a3a;
}

/* Единый скролл: правки, тост, уведомления, шторка обсуждения */
.panel-comments,
.general-comment-body-list,
.notif-dropdown-body,
.discussion-slide-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--panel-scrollbar-thumb) var(--panel-scrollbar-track);
}

.panel-comments::-webkit-scrollbar,
.general-comment-body-list::-webkit-scrollbar,
.notif-dropdown-body::-webkit-scrollbar,
.discussion-slide-scroll::-webkit-scrollbar {
  width: 8px;
}

.panel-comments::-webkit-scrollbar-track,
.general-comment-body-list::-webkit-scrollbar-track,
.notif-dropdown-body::-webkit-scrollbar-track,
.discussion-slide-scroll::-webkit-scrollbar-track {
  background: var(--panel-scrollbar-track);
}

.panel-comments::-webkit-scrollbar-thumb,
.general-comment-body-list::-webkit-scrollbar-thumb,
.notif-dropdown-body::-webkit-scrollbar-thumb,
.discussion-slide-scroll::-webkit-scrollbar-thumb {
  background: var(--panel-scrollbar-thumb);
  border-radius: 4px;
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    180deg,
    var(--bg-elevated) 0%,
    var(--bg) 38%,
    #080808 100%
  );
}

.bg-shape {
  position: fixed;
  border-radius: 0;
  filter: blur(50px);
  opacity: 0.35;
  z-index: 0;
  display: none;
}

.bg-shape.a {
  width: 260px;
  height: 260px;
  background: #8b0000;
  top: -70px;
  right: -70px;
}

.bg-shape.b {
  width: 220px;
  height: 220px;
  background: #4a0000;
  bottom: -60px;
  left: -60px;
}

/* ── Fullscreen review layout ──────────────────────────── */
.review-body {
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  background: var(--bg);
}

.review-layout {
  position: fixed;
  inset: 0;
  background: var(--bg);
}

.stream-player-fs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 1;
}

/* Между видео (z-index 1) и оверлеем маркеров (2); ниже topbar/bottombar */
.buffering-indicator {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.2s ease;
}

.buffering-indicator.hidden {
  display: none;
}

.buffering-indicator-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 28px;
  border-radius: var(--radius-min);
  background: rgba(22, 22, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  max-width: min(320px, 86vw);
  text-align: center;
}

.buffering-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(218, 30, 40, 0.95);
  border-radius: 50%;
  animation: buffering-spin 0.75s linear infinite;
}

@keyframes buffering-spin {
  to {
    transform: rotate(360deg);
  }
}

.buffering-label {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.buffering-hint {
  font-size: var(--font-size-xs);
  color: var(--muted);
  line-height: 1.35;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1050px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}

.hero {
  padding: 16px 6px 12px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 52px);
  letter-spacing: 1px;
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
}

.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
  box-shadow: var(--ui-shadow);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.auth-layout {
  max-width: 760px;
}

.row-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* ── Login screen ───────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.login-title {
  margin: 0 0 42px;
  font-size: var(--font-size-display);
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
  user-select: none;
  text-align: center;
  transform: translateX(10px);
}

.login-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--gap-ui);
  width: min(390px, 90vw);
}

.login-input {
  width: 100%;
  text-align: center;
  font-size: var(--font-size-md);
  padding: 12px 14px;
  background: var(--ui-surface-raised);
  border: 1px solid var(--border);
  color: var(--ink);
  outline: none;
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: rgba(218, 30, 40, 0.45);
}

.login-btn {
  width: auto;
  padding: 10px 28px;
  align-self: center;
}

.login-hint {
  margin-top: 14px;
  min-height: 18px;
  font-size: var(--font-size-sm);
  color: var(--muted);
}

.row {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  align-items: center;
}

.hero-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #202020;
  font-size: 12px;
}

.project-draft-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.projects-list {
  display: grid;
  gap: 8px;
}

.project-row {
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--ui-surface-raised);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: background 0.12s;
}

.project-row:hover {
  background: var(--ui-surface-hover);
}

.project-row-actions {
  display: flex;
  gap: 8px;
}

.app-hero {
  margin-bottom: 22px;
}

.app-hero-title {
  margin: 0;
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.app-hero--no-title.hero-bar {
  justify-content: flex-end;
}

.app-page .hero-actions {
  gap: 14px;
  align-items: center;
}

.app-page .hero-actions > * {
  display: inline-flex;
  align-items: center;
  height: 16px;
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 400;
  line-height: 1;
}

/* Сильнее правила выше: иначе .hidden не скрывает ссылку «Панель» у не-админов */
.app-page .hero-actions > *.hidden {
  display: none !important;
}

.app-page .tag {
  padding: 0;
  border: none;
  background: transparent;
  color: #b8b8b8;
}

.app-page #logoutBtn {
  width: auto;
  border: none;
  background: transparent;
  color: #d2d2d2;
  padding: 0;
  margin: 0;
}

.app-page #logoutBtn:hover {
  color: #ffffff;
  text-decoration: underline;
  background: transparent;
}

.app-page .app-clean-section {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

.app-section-block {
  padding: 12px 0;
}

.app-section-title {
  margin: 0 0 10px;
  font-size: var(--font-size-title);
  font-weight: 600;
  color: var(--text);
}

.app-projects-section {
  padding-top: 14px;
}

.app-main-btn {
  width: auto;
  min-width: 240px;
  font-size: 17px;
  padding: 14px 16px;
  letter-spacing: 0.3px;
}

/* Выше .notif-dropdown (z-index 200) и прочих оверлеев шапки, иначе клики не доходят до кнопок модалки */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.72);
}

.app-modal-dialog {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--ui-surface);
  border: 1px solid var(--border);
  padding: 0;
  box-shadow: var(--ui-shadow);
}

.app-modal-wide {
  width: min(920px, calc(100vw - 24px));
}

.app-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-ui);
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  background: var(--ui-surface);
}

.app-modal-head h2 {
  margin: 0;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.app-modal-body {
  padding: 16px;
}

/* Карточки на странице проектов — как выпадающий блок уведомлений */
.ui-surface-block {
  background: var(--ui-surface);
  border: 1px solid var(--border);
  box-shadow: var(--ui-shadow);
  padding: 0;
  margin-bottom: 18px;
}

.ui-surface-block .list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-ui);
  margin: 0;
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  border-bottom: 1px solid var(--border);
  background: var(--ui-surface);
}

.ui-surface-block .list-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Как «Обновить» (.tiny), но красная */
button.app-new-project-btn.tiny {
  min-width: unset;
  background: var(--accent);
  color: #fff;
  border: none;
}

button.app-new-project-btn.tiny:hover {
  background: var(--accent-strong);
  color: #fff;
}

.ui-surface-block-body {
  padding: 14px 16px;
}

.ui-surface-block .projects-tree {
  margin-top: 0;
  padding: 10px 12px 14px;
}

.app-form-grid {
  display: grid;
  gap: 10px;
}

.app-modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.app-modal-actions button {
  width: auto;
  min-width: 180px;
}

.projects-tree {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.app-page .projects-tree {
  gap: 12px;
}

.project-group-card {
  border: 1px solid var(--border);
  background: var(--ui-surface);
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.app-page .project-group-card {
  border: 1px solid var(--border);
  background: var(--ui-surface-raised);
  padding: 16px 18px;
}

.project-group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.project-group-actions {
  display: grid;
  grid-template-columns: 150px 42px;
  gap: 8px;
  flex-shrink: 0;
  justify-content: end;
}

.project-title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.project-expand-btn {
  width: 26px;
  min-width: 26px;
  height: 22px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.version-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.version-open-inline-btn {
  width: auto;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}

.edit-trigger-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.project-title-line.show-edit-icon .edit-trigger-btn,
.version-title-line.show-edit-icon .edit-trigger-btn,
.project-title-line:hover .edit-trigger-btn,
.version-title-line:hover .edit-trigger-btn {
  opacity: 1;
  pointer-events: auto;
}

.project-title-icon-btn {
  width: auto;
  padding: 3px 7px;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}

.delete-icon-btn {
  min-width: 34px;
  justify-content: center;
}

.project-title-edit-input {
  width: min(360px, 100%);
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  padding: 6px 8px;
  font-size: 14px;
}

.project-title-small {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.project-role-small {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.version-list {
  display: grid;
  gap: 7px;
}

.version-row {
  border: 1px solid var(--border);
  background: var(--ui-surface-raised);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.app-page .version-row {
  border: 1px solid var(--border);
  background: var(--ui-surface);
  padding: 10px 12px;
}

.version-title {
  font-size: 14px;
  font-weight: 600;
}

.version-prefix {
  font-size: 14px;
  font-weight: 600;
  color: #d6d6d6;
}

.version-row .tiny {
  flex-shrink: 0;
}

.version-actions {
  display: grid;
  grid-template-columns: 42px;
  gap: 8px;
  justify-content: end;
}

.project-group-actions .tiny:not(.delete-icon-btn),
.version-actions .tiny:not(.delete-icon-btn) {
  width: 150px;
  justify-content: center;
}

.token-project-select {
  background: var(--ui-surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.token-output {
  min-height: 84px;
  background: var(--ui-surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--font-size-xs);
  line-height: 1.4;
}

@media (max-width: 720px) {
  .hero-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-main-btn {
    width: 100%;
    min-width: 0;
  }

  .project-group-head,
  .version-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-group-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .version-actions {
    width: 100%;
  }
}

.review-shell {
  display: grid;
  grid-template-columns: 70% 30%;
  gap: 14px;
}

.review-comments-bottom .comment-form {
  margin-bottom: 12px;
}

.comments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.review-media,
.review-comments {
  min-width: 0;
}

.media-frame {
  width: 100%;
  height: 440px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
}

.comment-form {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  border-radius: 0;
  border: 1px solid var(--border);
  padding: 10px 12px;
  min-height: 94px;
  resize: vertical;
  font-size: var(--font-size-md);
  font-family: inherit;
}

.link-btn {
  display: inline-block;
  margin-bottom: 8px;
  color: #0f3b39;
}

/* ── Sliding comments panel ─────────────────────────────── */
.comments-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(320px, 88vw);
  padding: 20px 16px;
  background: var(--ui-surface-raised);
  border-left: 1px solid var(--border);
  box-shadow: var(--ui-shadow);
  z-index: 25;
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.24s ease;
  overflow: hidden;
}

.comments-panel.panel-visible {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-ui);
  margin: -20px -16px 14px;
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  border-bottom: 1px solid var(--border);
  background: var(--ui-surface);
  flex-shrink: 0;
}

.panel-title {
  margin: 0;
  font-size: var(--font-size-title);
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--ink);
}

.panel-title.ui-title-mini {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: var(--gap-ui);
}

.panel-header-actions .tiny {
  width: auto;
}

.panel-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--font-size-xs);
  opacity: 0.92;
}

.comments-panel .panel-subtitle,
#commentsStats {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-comments {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 8px;
  margin: 12px 0 0;
}

/* ── Обсуждение: правая шторка (как .comments-panel) ───── */
.discussion-slide-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.discussion-slide-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.24s ease;
  pointer-events: auto;
}

.discussion-slide-root.is-open .discussion-slide-backdrop {
  opacity: 1;
}

.discussion-slide-sheet {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw);
  height: 100%;
  max-height: 100vh;
  padding: 20px 16px;
  box-sizing: border-box;
  background: var(--ui-surface-raised);
  border-left: 1px solid var(--border);
  box-shadow: var(--ui-shadow);
  transform: translateX(100%);
  transition: transform 0.24s ease;
  pointer-events: auto;
  overflow: hidden;
}

.discussion-slide-root.is-open .discussion-slide-sheet {
  transform: translateX(0);
}

.discussion-slide-sheet > .panel-header {
  margin: -20px -16px 12px;
}

.discussion-sheet-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0;
}

.discussion-slide-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Карточка «о какой правке» над перепиской */
.discussion-slide-meta {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-min);
  background: var(--ui-surface);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
  line-height: 1.45;
}

/* Лента сообщений — как чат: зазоры и пузыри */
.discussion-slide-replies {
  margin-top: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 0 6px;
}

.discussion-slide-replies .reply-row {
  margin: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-min);
  padding: 10px 12px;
  background: var(--ui-surface);
  transition: background 0.12s ease;
}

.discussion-slide-replies .reply-row:hover {
  background: var(--ui-surface-hover);
}

.discussion-slide-replies .reply-row-head {
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 10px;
}

.discussion-slide-replies .reply-time {
  margin-left: auto;
  flex-shrink: 0;
}

.discussion-slide-replies .reply-row p.reply-body {
  margin: 8px 0 0;
}

.discussion-slide-footer {
  flex-shrink: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--gap-ui);
}

.discussion-reply-textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  box-sizing: border-box;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border: 1px solid var(--border);
  border-radius: var(--radius-min);
  background: var(--ui-surface);
  color: var(--ink);
  font-size: var(--font-size-md);
  font-family: inherit;
  line-height: 1.4;
}

.discussion-slide-actions {
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-ui);
}

.discussion-slide-actions .discussion-finish-btn {
  margin-right: auto;
}

.discussion-slide-actions .discussion-send-btn {
  min-height: var(--btn-min-height);
}

.stream-player {
  width: 100%;
  height: 70vh;
  max-height: 70vh;
  background: #000;
}

.video-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  cursor: default;
}

.video-overlay.overlay-active {
  pointer-events: auto;
  cursor: crosshair;
  outline: 2px dashed rgba(218, 30, 40, 0.8);
  outline-offset: -2px;
}

@keyframes draw-ants-march {
  to {
    stroke-dashoffset: -28;
  }
}

/* Позицию/размер задаёт JS (fixed, прямоугольник кадра в viewport). */
.draw-draft-svg,
.draw-saved-wrap {
  pointer-events: none;
  overflow: visible;
}

/* Без 100%×100% внутренний svg остаётся inline с дефолтным box — штрих «плывёт» по Y и обрезается внизу. */
.draw-draft-svg,
.draw-saved-wrap > svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Черновой штрих: «муравьи» */
.draw-draft-line {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.25px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 9 6;
  stroke-dashoffset: 0;
  animation: draw-ants-march 0.7s linear infinite;
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.95));
}

.draw-composer-line {
  fill: none;
  stroke: rgba(255, 92, 82, 0.35);
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.draw-ants-under {
  fill: none;
  stroke: rgba(0, 0, 0, 0.75);
  stroke-width: 3.5px;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}

.draw-ants {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.25px;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 9 6;
  stroke-dashoffset: 0;
  animation: draw-ants-march 0.7s linear infinite;
  pointer-events: none;
}

/* Цвет штриха как у точки: open / done / тред */
.draw-saved-wrap.draw-saved-open .draw-ants {
  stroke: #ffffff;
}

.draw-saved-wrap.draw-saved-open .draw-ants-under {
  stroke: rgba(0, 0, 0, 0.75);
}

.draw-saved-wrap.draw-saved-open:hover .draw-ants {
  stroke: #fff8e1;
}

.draw-saved-wrap.draw-saved-done .draw-ants {
  stroke: #1fbe52;
}

.draw-saved-wrap.draw-saved-done .draw-ants-under {
  stroke: rgba(0, 0, 0, 0.65);
}

.draw-saved-wrap.draw-saved-done:hover .draw-ants {
  stroke: #4adf7a;
}

.draw-saved-wrap.draw-saved-thread-unread .draw-ants {
  stroke: #f2d649;
}

.draw-saved-wrap.draw-saved-thread-unread .draw-ants-under {
  stroke: rgba(0, 0, 0, 0.65);
}

.draw-saved-wrap.draw-saved-thread-unread:hover .draw-ants {
  stroke: #fff3a0;
}

.draw-saved-wrap.draw-saved-thread-read .draw-ants {
  stroke: #c4b060;
}

.draw-saved-wrap.draw-saved-thread-read .draw-ants-under {
  stroke: rgba(0, 0, 0, 0.65);
}

.draw-saved-wrap.draw-saved-thread-read:hover .draw-ants {
  stroke: #e8d88a;
}

/* Толстый невидимый штрих для клика и перетаскивания */
.draw-saved-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: grab;
}

.draw-saved-hit:active {
  cursor: grabbing;
}

@media (prefers-reduced-motion: reduce) {
  .draw-draft-line,
  .draw-ants {
    animation: none;
    stroke-dasharray: none;
  }
}

.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

.pin.saved {
  background: #ffffff;
  cursor: pointer;
  pointer-events: auto;
}

/* Кисть: якорь точки скрыт; тулбар от position в данных */
.pin.saved.pin-draw-anchor {
  opacity: 0;
  pointer-events: none;
  width: 2px;
  height: 2px;
  min-width: 0;
  min-height: 0;
  border: none;
  box-shadow: none;
  background: transparent !important;
}

.pin.saved.done {
  background: #1fbe52;
  border-color: #1fbe52;
}

.pin.saved.thread-unread {
  background: #f2d649;
  border-color: #f2d649;
}

.pin.saved.thread-read {
  background: #a89450;
  border-color: #c4b060;
}

.pin.saved.active {
  background: #ffffff;
  transform: translate(-50%, -50%) scale(1.2);
}

/* Выбранная в списке правка с маркером — мягкое свечение в цвете акцента */
.pin.saved.pin-sidebar-focus {
  z-index: 6;
  border-color: rgba(255, 255, 255, 0.92);
  animation: pin-sidebar-pulse 2.2s ease-in-out infinite;
}

@keyframes pin-sidebar-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(218, 30, 40, 0.38),
      0 0 14px rgba(218, 30, 40, 0.2),
      0 2px 8px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(218, 30, 40, 0.52),
      0 0 22px rgba(218, 30, 40, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.35);
  }
}

/* Общая правка без точки: лёгкая рамка на кадре */
.video-general-highlight {
  position: absolute;
  inset: 12px;
  border-radius: var(--radius-min);
  pointer-events: none;
  z-index: 2;
  border: 1px solid rgba(218, 30, 40, 0.4);
  box-shadow:
    inset 0 0 0 1px rgba(218, 30, 40, 0.1),
    0 0 28px rgba(218, 30, 40, 0.08);
  animation: video-general-highlight-breathe 2.8s ease-in-out infinite;
}

@keyframes video-general-highlight-breathe {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

.pin.draft {
  background: #ffffff;
}

.hidden {
  display: none;
}

/* ── Player chrome ──────────────────────────────────────── */
.player-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* Above side toggles so notification dropdown is not covered */
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px 14px;
  background: rgba(19, 19, 19, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  pointer-events: none;
}

.player-topbar > * {
  pointer-events: auto;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.topbar-meta {
  font-size: var(--font-size-xs);
  color: var(--muted);
  white-space: nowrap;
}

.topbar-btn {
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  width: auto;
}

a.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  background: var(--ui-surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

a.topbar-btn:hover {
  background: var(--ui-surface-hover);
  color: var(--ink);
}

.player-bottombar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 12px 16px 16px;
  background: rgba(19, 19, 19, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

/* ── Guest review mode (customer link) ─────────────────────────────── */
.review-body.is-review-guest .notif-bell-wrap,
.review-body.is-review-guest #filterPopoverWrap,
.review-body.is-review-guest #exportGeneralBtn,
.review-body.is-review-guest #customerReviewLinkBtn {
  display: none !important;
}

.filter-popover-wrap {
  position: absolute;
  left: 14px;
  top: 70px;
  z-index: 35;
}

.filter-drawer-toggle {
  width: auto;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  background: var(--ui-surface-raised);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.comments-drawer-toggle {
  position: absolute;
  right: 14px;
  top: 70px;
  /* Must sit above .player-topbar (z-index: 30) */
  z-index: 35;
  width: auto;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  background: var(--ui-surface-raised);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.comments-drawer-toggle.active {
  background: rgba(218, 30, 40, 0.9);
  color: #fff;
}

/* Выпадающая панель фильтра — как уведомления (не шторка на всю высоту) */
.filter-drawer {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(300px, calc(100vw - 28px));
  max-height: min(420px, 72vh);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  z-index: 200;
  background: var(--ui-surface);
  border: 1px solid var(--border);
  box-shadow: var(--ui-shadow);
  box-sizing: border-box;
}

.filter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-ui);
  margin: 0;
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  border-bottom: 1px solid var(--border);
  background: var(--ui-surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.filter-drawer-title {
  margin: 0;
}

.filter-drawer-subtitle {
  margin: 0;
  padding: 10px var(--section-header-pad-x) 0;
  color: var(--muted);
  font-size: var(--font-size-xs);
  line-height: 1.4;
}

.filter-drawer-options {
  margin-top: 8px;
  padding: 0 var(--section-header-pad-x) var(--section-header-pad-y);
  display: grid;
  gap: var(--gap-ui);
}

.filter-btn {
  width: 100%;
  text-align: left;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  transition: background 0.12s;
}

.filter-btn:hover {
  background: var(--ui-surface-hover);
}

.filter-btn.active {
  background: rgba(218, 30, 40, 0.2);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--accent);
}

.filter-drawer-options button.filter-btn.ghost {
  background: transparent;
  color: var(--text);
}

.filter-drawer-options button.filter-btn.ghost:hover {
  background: var(--ui-surface-hover);
  color: var(--ink);
}

/* ── Timeline ───────────────────────────────────────────── */
.timeline-wrap {
  position: relative;
  margin-bottom: 10px;
}

.timeline-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.timeline-track-block {
  position: relative;
  flex: 1;
  min-width: 0;
  padding-top: 24px;
}

.timeline-time-display {
  flex-shrink: 0;
  align-self: center;
  padding-bottom: 2px;
}

/* Маркеры позиционируются calc()-формулой с учётом ширины thumb (16px) */
.timeline-markers {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
}

.timeline-range-overlay {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 24px;
  display: none;
  z-index: 1;
  cursor: crosshair;
}

.timeline-range-sel {
  position: absolute;
  top: 6px;
  height: 12px;
  border-radius: var(--radius-min);
  background: rgba(239, 83, 80, 0.32);
  border: 1px solid rgba(239, 83, 80, 0.85);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
  display: none;
  pointer-events: none;
}

.timeline-range-sel.timeline-range-sel--in-only {
  animation: range-in-marker-pulse 1.25s ease-in-out infinite;
}

@keyframes range-in-marker-pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 0 10px rgba(239, 83, 80, 0.45);
  }
  50% {
    opacity: 0.88;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, 0 0 16px rgba(239, 83, 80, 0.65);
  }
}

.timeline-markers > * {
  pointer-events: auto;
}

#playbackTimeline {
  position: relative;
  z-index: 0;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 0;
  background: rgba(255,255,255,0.18);
  accent-color: var(--accent);
  display: block;
  cursor: pointer;
  outline: none;
  border: none;
}

#playbackTimeline::-webkit-slider-runnable-track {
  height: 4px;
  background: rgba(255,255,255,0.18);
}

#playbackTimeline::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  margin-top: -5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

#playbackTimeline::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* Volume control */
.volume-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.vol-icon {
  padding: 6px 8px;
  font-size: 14px;
  min-width: unset;
}

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: rgba(255,255,255,0.25);
  outline: none;
  cursor: pointer;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.vol-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* ── Controls row ───────────────────────────────────────── */
.controls-row {
  display: grid;
  grid-template-columns: auto auto auto auto auto minmax(340px, 1fr) auto auto;
  align-items: center;
  gap: var(--gap-ui);
}

.ctrl-btn {
  width: auto;
  white-space: nowrap;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  line-height: 1.25;
  flex-shrink: 0;
}

/* Play: красный треугольник; pause: две планки */
.play-pause-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding-left: 10px;
  padding-right: 10px;
  color: var(--ink);
  background: var(--ui-surface-raised);
  border: 1px solid var(--border);
}

.play-pause-btn:hover {
  background: var(--ui-surface-hover);
}

.play-pause-btn__svg {
  display: block;
}

.play-pause-btn__triangle {
  fill: var(--accent);
}

.play-pause-btn__pause {
  display: none;
}

.play-pause-btn__pause .play-pause-btn__svg {
  fill: currentColor;
}

.play-pause-btn.is-playing .play-pause-btn__play {
  display: none;
}

.play-pause-btn.is-playing .play-pause-btn__pause {
  display: inline-flex;
}

.play-pause-btn.is-playing .play-pause-btn__pause svg {
  fill: var(--ink);
}

/* Квадрат «стоп» и прочие иконки в ряду */
.ctrl-btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding-left: 10px;
  padding-right: 10px;
  color: var(--ink);
}

.stop-btn:hover {
  color: var(--text);
}

.mode-toggle-btn {
  min-width: 92px;
  text-align: center;
}

.mode-instruction-tooltip {
  position: fixed;
  z-index: 80;
  width: min(320px, calc(100vw - 24px));
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  border-radius: var(--radius-min);
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  box-shadow: var(--ui-shadow);
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: 1.45;
  letter-spacing: 0.01em;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.mode-instruction-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: var(--popover-bg);
  border-right: 1px solid var(--popover-border);
  border-bottom: 1px solid var(--popover-border);
  transform: translateX(-50%) rotate(45deg);
}

.mode-instruction-tooltip.hidden {
  display: none;
}

.ctrl-btn.ghost {
  background: var(--ui-surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
}

.ctrl-btn.ghost:hover {
  background: var(--ui-surface-hover);
  color: var(--ink);
}

.time-display {
  white-space: nowrap;
  color: var(--ink);
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  flex-shrink: 0;
}

.time-sep {
  color: var(--muted);
  margin: 0 3px;
}

.timecode-form {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: stretch;
  gap: var(--gap-ui);
  min-width: 340px;
}

/* Подсветка только по краям поля + мягкий glow (режим ввода диапазона) */
.timecode-form.range-compose-active {
  padding: 2px 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

@keyframes range-compose-edge-glow {
  0%,
  100% {
    border-color: rgba(239, 83, 80, 0.35);
    box-shadow:
      inset 5px 0 14px -4px rgba(239, 83, 80, 0.55),
      inset -5px 0 14px -4px rgba(239, 83, 80, 0.55),
      0 0 18px -8px rgba(239, 83, 80, 0.35);
  }

  50% {
    border-color: rgba(255, 138, 128, 0.55);
    box-shadow:
      inset 7px 0 22px -3px rgba(255, 120, 110, 0.65),
      inset -7px 0 22px -3px rgba(255, 120, 110, 0.65),
      0 0 26px -6px rgba(239, 83, 80, 0.5);
  }
}

.timecode-form.range-compose-active textarea {
  border-radius: var(--radius-min);
  border: 1px solid rgba(239, 83, 80, 0.4);
  background: rgba(255, 255, 255, 0.98);
  color: #111;
  animation: range-compose-edge-glow 2s ease-in-out infinite;
  transition: border-color 0.2s ease;
}

.timecode-form.range-compose-active textarea:focus-visible {
  outline: 2px solid rgba(255, 138, 128, 0.75);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .timecode-form.range-compose-active textarea {
    animation: none;
    border-color: rgba(239, 83, 80, 0.55);
    box-shadow:
      inset 5px 0 12px -4px rgba(239, 83, 80, 0.45),
      inset -5px 0 12px -4px rgba(239, 83, 80, 0.45),
      0 0 16px -6px rgba(239, 83, 80, 0.3);
  }
}

.timecode-form input[type=number] {
  display: none;
}

.timecode-form textarea {
  min-height: var(--btn-min-height);
  height: var(--btn-min-height);
  resize: none;
  padding: var(--btn-pad-y) 10px;
  font-size: var(--btn-font);
  width: 100%;
  overflow: hidden;
  line-height: 1.25;
  background: var(--ui-surface-raised);
  border: 1px solid var(--border);
  color: var(--ink);
  align-self: center;
}

.timecode-form .tc-badge {
  align-self: center;
}

.timecode-form .ctrl-btn {
  justify-self: end;
  align-self: center;
}

@media (max-width: 1200px) {
  .controls-row {
    grid-template-columns: auto auto auto 1fr;
  }

  .timecode-form {
    min-width: 0;
  }

  .volume-ctrl {
    justify-self: end;
  }
}

.tc-badge {
  background: rgba(242, 242, 242, 0.94);
  color: #141414;
  padding: var(--btn-pad-y) 8px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: var(--btn-min-height);
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-sizing: border-box;
  cursor: default;
  user-select: none;
}

/* ── Right-edge panel trigger ───────────────────────────── */
.panel-edge-trigger {
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 100%;
  z-index: 15;
}

.small {
  font-size: 12px;
}

.timeline-marker {
  position: absolute;
  top: 8px;
  transform: translateX(calc(-50% + 2px));
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.12s;
  padding: 0;
}

.timeline-range-band {
  position: absolute;
  top: 7px;
  height: 12px;
  border-radius: var(--radius-min);
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.45);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  cursor: pointer;
  pointer-events: auto;
}

.timeline-range-band.selected {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.3);
}

.timeline-range-band.sidebar-range-focus {
  box-shadow:
    0 0 0 2px rgba(218, 30, 40, 0.5),
    0 2px 12px rgba(218, 30, 40, 0.2);
  z-index: 4;
}

.timeline-range-handle {
  position: absolute;
  top: -3px;
  width: 8px;
  height: 18px;
  z-index: 6;
  border-radius: var(--radius-min);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.14s ease;
}

.timeline-range-band.selected .timeline-range-handle,
.timeline-range-band:hover .timeline-range-handle {
  opacity: 1;
}

.timeline-range-handle.left {
  left: -5px;
  cursor: ew-resize;
}

.timeline-range-handle.right {
  right: -5px;
  cursor: ew-resize;
}

.timeline-range-band.done {
  background: rgba(31, 190, 82, 0.34);
  border-color: #1fbe52;
}

.timeline-range-band.thread-unread {
  background: rgba(242, 214, 73, 0.34);
  border-color: #f2d649;
}

.timeline-range-band.thread-read {
  background: rgba(160, 140, 70, 0.28);
  border-color: #a89450;
}

.timeline-range-band.customer {
  background: rgba(218, 30, 40, 0.34);
  border-color: #da1e28;
}

.timeline-marker:hover {
  transform: translateX(calc(-50% + 2px)) scale(1.4);
}

.timeline-marker.done {
  background: #1fbe52;
  border-color: #1fbe52;
}

.timeline-marker.thread-unread {
  background: #f2d649;
  border-color: #f2d649;
}

.timeline-marker.thread-read {
  background: #a89450;
  border-color: #c4b060;
}

.timeline-marker.customer {
  background: #da1e28;
  border-color: #da1e28;
}

.timeline-marker.sidebar-marker-focus {
  transform: translateX(calc(-50% + 2px)) scale(1.22);
  box-shadow:
    0 0 0 3px rgba(218, 30, 40, 0.42),
    0 1px 6px rgba(0, 0, 0, 0.55);
  z-index: 5;
}

.timeline-marker.sidebar-marker-focus:hover {
  transform: translateX(calc(-50% + 2px)) scale(1.32);
}

.general-comment-toast {
  position: fixed;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  z-index: 40;
  width: min(620px, calc(100vw - 32px));
  min-width: 320px;
  max-width: 620px;
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  border-left: 3px solid #ffffff;
  color: var(--ink);
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  padding-left: calc(var(--section-header-pad-x) + 2px);
  box-shadow: var(--ui-shadow);
  cursor: pointer;
  overflow: visible;
}

.general-comment-toast.open  { border-left-color: #ffffff; }
.general-comment-toast.done  { border-left-color: #1fbe52; }
.general-comment-toast.thread-unread {
  border-left-color: #f2d649;
}

.general-comment-toast.thread-read {
  border-left-color: #a89450;
}

.general-comment-actions {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  box-shadow: var(--ui-shadow);
  white-space: nowrap;
}

.general-comment-actions.toast-actions-visible {
  display: flex;
}

.general-comment-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--gap-ui);
  margin-bottom: 4px;
}

/* Время в тосте — без «чипа» как у tc-badge в плеере (легче читается на карточке) */
.general-comment-time {
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: #ffffff;
}

.general-comment-count-badge {
  margin-left: auto;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  background: var(--ui-surface);
  line-height: 1.2;
}

.general-comment-body-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 6px;
  max-height: min(280px, 48vh);
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.general-toast-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 2px;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  color: inherit;
  transition: background 0.12s ease;
}

.general-comment-body-list .general-toast-item:not(.general-toast-item--single) {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-width: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.general-toast-item-main {
  flex: 1;
  min-width: 0;
  padding-right: 0;
  transition: padding-right 0.12s ease;
}

.general-comment-body-list .general-toast-item:not(.general-toast-item--single):hover .general-toast-item-main {
  /* место под абсолютный тулбар (~4 кнопки + зазоры), чтобы текст не уезжал под кнопки */
  padding-right: 152px;
}

.general-toast-item-toolbar {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--popover-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-min);
  box-shadow: var(--ui-shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.general-comment-body-list .general-toast-item:not(.general-toast-item--single):hover .general-toast-item-toolbar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.general-comment-body-list .general-toast-item:last-child {
  border-bottom: none;
}

.general-toast-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.general-toast-item--focused {
  background: rgba(255, 255, 255, 0.06);
}

.general-toast-item--resolved .general-toast-item-body {
  opacity: 0.68;
}

.general-toast-item-body {
  display: block;
  font-size: var(--font-size-md);
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Одна правка — обычный текст, без кнопки/«селектора» */
.general-toast-item--single {
  cursor: inherit;
  pointer-events: none;
  padding-top: 2px;
}

.toast-edit-wrap {
  margin-top: 8px;
}

.toast-edit-area {
  width: 100%;
  min-height: 72px;
  background: var(--ui-surface);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: var(--btn-pad-y) 10px;
  font-size: var(--font-size-md);
  line-height: 1.45;
  resize: vertical;
  box-sizing: border-box;
}

.toast-edit-actions {
  display: flex;
  gap: var(--gap-ui);
  margin-top: 6px;
}

/* log-box (fixed bottom-left, hidden by default) */
.log-box {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 100;
  width: 300px;
  max-height: 180px;
  overflow-y: auto;
  background: rgba(0,0,0,0.92);
  color: #3f9;
  font-size: 10px;
  padding: 4px 6px;
  margin: 0;
  border: 1px solid #1a3a1a;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Строка правки: сетка (чекбокс | основной блок) */
.comment-item-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: start;
}

.comment-item-check {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

.comment-check-slot {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.comment-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-comments .comment-item-main {
  gap: 14px;
}

.panel-comments .comment-item-meta {
  padding-bottom: 12px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.comment-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  font-size: var(--font-size-sm);
}

.panel-comments .comment-item-head {
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
}

.comment-status-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
  box-sizing: border-box;
}

.panel-comments .comment-item.open .comment-status-mark {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.panel-comments .comment-item.done .comment-status-mark {
  background: #1fbe52;
}

/* Ось обсуждения: непрочитанные ответы в треде (только у открытых правок) */
.panel-comments .comment-item.open.thread-unread .comment-status-mark {
  background: #e6c82e;
  box-shadow: 0 0 0 1px rgba(230, 200, 46, 0.45);
}

/* Прочитанный тред: заметно от «в работе» без 💬 (важно для диапазонов без пина на кадре) */
.panel-comments .comment-item.open.thread-read .comment-status-mark {
  background: rgba(176, 152, 88, 0.95);
  box-shadow: 0 0 0 1px rgba(120, 100, 55, 0.55);
}

.panel-comments .comment-item.customer .comment-status-mark {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 3px rgba(218, 30, 40, 0.4);
}

.panel-comments .comment-item.customer.done .comment-status-mark {
  box-shadow: 0 0 0 2px rgba(218, 30, 40, 0.45);
}

.panel-comments .comment-author-tag {
  align-self: center;
  margin-left: 0;
  flex-shrink: 0;
}

.comment-author-block {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
  flex-wrap: nowrap;
}

/* Как .panel-title.ui-title-mini, без uppercase (имя автора) */
.panel-comments .comment-author-block .comment-author-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: none;
}

.comment-author-name {
  font-weight: 600;
  color: var(--ink);
}

.panel-comments .comment-item-main .comment-body {
  padding-left: 0;
  margin-top: 2px;
  font-size: var(--font-size-base);
  line-height: 1.55;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.01em;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.comment-open-thread-btn {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px !important;
  font-size: var(--font-size-xs) !important;
  line-height: 1.2;
}

/* Оверлей / тост / таймлайн: тот же чип, без margin-left: auto панели */
.overlay-thread-discuss-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px !important;
  font-size: var(--font-size-xs) !important;
  line-height: 1.2;
}

.pin-saved-callout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  max-width: min(340px, 90vw);
  pointer-events: auto;
  user-select: none;
  z-index: 7;
}

.pin-saved-callout .pin-saved-body-label {
  min-width: 0;
  flex: 1 1 auto;
  max-width: min(240px, 72vw);
}

.pin-saved-callout .overlay-thread-discuss-btn {
  pointer-events: auto;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Подпись + чип обсуждения — один блок по центру bbox, без наслоения двух absolute */
.draw-saved-callout {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  max-width: min(340px, 90vw);
  pointer-events: auto;
  user-select: none;
  z-index: 7;
}

.draw-saved-callout .draw-saved-body-label {
  position: static;
  transform: none;
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  max-width: min(240px, 40vw);
  z-index: auto;
}

.draw-saved-callout .overlay-thread-discuss-btn {
  pointer-events: auto;
  flex-shrink: 0;
  margin-top: 1px;
}

.general-toast-thread-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.comment-replies-badge {
  display: inline-block;
  min-width: 1.1em;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--ui-surface-raised);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.comment-item.open.thread-unread .comment-replies-badge,
.comment-replies-badge-unread {
  background: rgba(242, 214, 73, 0.28);
  border-color: rgba(242, 214, 73, 0.55);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(242, 214, 73, 0.12);
}

.comment-item.open.thread-read .comment-replies-badge {
  background: var(--ui-surface-raised);
  border-color: var(--border);
  color: var(--muted);
}

.comments-panel-hint {
  margin: 0 12px 8px;
  font-size: var(--font-size-xs);
  line-height: 1.35;
  color: var(--muted);
}

.panel-comments .comment-tc {
  font-variant-numeric: tabular-nums;
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
  line-height: 1.35;
  cursor: default;
  user-select: none;
  transition: color 0.12s ease;
}

.panel-comments .comment-tc:hover {
  color: var(--text);
}

.comment-body {
  color: var(--ink);
  font-size: var(--font-size-md);
  line-height: 1.45;
  padding-left: 2px;
}

h2 {
  margin: 0 0 12px;
  font-size: var(--font-size-title);
  font-weight: 600;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
}

input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
select,
button {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: var(--font-size-md);
  background: var(--ui-surface-raised);
  color: var(--ink);
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}

button:not(.pin):not(.timeline-marker):not(.ghost):hover {
  transform: none;
  background: var(--accent-strong);
}

button.ghost {
  background: var(--ui-surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
}

button.ghost:hover {
  background: var(--ui-surface-hover);
  color: var(--ink);
}

/* Компактные кнопки: не на всю ширину, единая высота/шрифт */
button.ctrl-btn,
button.tiny,
button.topbar-btn,
button.filter-drawer-toggle,
button.comments-drawer-toggle,
button.vol-icon,
button.filter-btn,
button.notif-bell-btn {
  width: auto;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  line-height: 1.25;
}

.hint {
  color: var(--muted);
  margin: 10px 0 0;
}

.preview {
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--font-size-md);
  word-break: break-all;
}

.comments {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.comments li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--ui-surface-raised);
}

/* Панель правок: карточки с gap между строками */
.panel-comments.comments {
  gap: 10px;
}

.panel-comments.comments li.comment-item {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--ui-surface);
  padding: 12px 14px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.panel-comments.comments li.comment-item:hover {
  background: var(--ui-surface-hover);
  border-color: var(--border);
}

.panel-comments.comments li.panel-comments-empty {
  border: none;
  background: transparent;
  padding: 16px 10px;
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-sm);
  text-align: center;
  border-radius: 0;
}

.comment-item.open {
  border-left: 3px solid #ffffff;
}

.comment-item.done {
  border-left: 3px solid #1fbe52;
}

.comment-item.thread-unread {
  border-left: 3px solid #f2d649;
}

.comment-item.thread-read {
  border-left: 3px solid rgba(180, 160, 90, 0.65);
}

.comment-item.customer {
  border-left: 3px solid #da1e28;
}

/* В панели правок статус — точка в шапке, без цветной полосы по краю карточки */
.panel-comments.comments li.comment-item.open,
.panel-comments.comments li.comment-item.done,
.panel-comments.comments li.comment-item.thread-unread,
.panel-comments.comments li.comment-item.thread-read,
.panel-comments.comments li.comment-item.customer {
  border-left: 1px solid var(--border-subtle);
}

.comment-author-tag {
  margin-left: auto;
  background: var(--ui-surface-raised);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 6px;
  font-size: var(--font-size-xs);
  line-height: 1.2;
  text-transform: lowercase;
  border-radius: var(--radius-min);
}

.comment-item {
  cursor: pointer;
}

.comment-item.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.comment-item.resolved {
  opacity: 0.72;
}

.comment-actions {
  margin-top: var(--gap-ui);
  display: flex;
  gap: var(--gap-ui);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, max-height 0.18s ease;
}

.comment-item.actions-visible .comment-actions {
  opacity: 1;
  max-height: 120px;
  overflow: visible;
  pointer-events: auto;
  transform: translateY(0);
}

#commentQuickModal .comment-actions {
  margin-top: 0;
  opacity: 1;
  max-height: none;
  overflow: visible;
  pointer-events: auto;
  transform: none;
  transition: none;
}

/* Скрыто: .hidden одна слабее #commentQuickModal.modal — усиливаем явно */
#commentQuickModal.modal.hidden {
  display: none !important;
}

/* Открыто: центрирование диалога */
#commentQuickModal.modal:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: center;
}

#commentQuickModal .comment-quick-dialog.modal-dialog {
  margin: 0;
  width: min(440px, 92vw);
  max-height: min(560px, 85vh);
  /* grid + minmax(0,1fr): средняя зона скроллится, футер не обрезается (flex+max-height давал клип) */
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: start;
  /* hidden: иначе раздутое поле/textarea выталкивает футер с кнопками за край экрана */
  overflow: hidden;
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  box-shadow: var(--ui-shadow);
  padding-left: calc(var(--section-header-pad-x) + 2px);
  border-left-width: 3px;
  border-left-style: solid;
  border-left-color: #ffffff;
}

#commentQuickModal .comment-quick-dialog.comment-quick-status-open {
  border-left-color: #ffffff;
}

#commentQuickModal .comment-quick-dialog.comment-quick-status-done {
  border-left-color: #1fbe52;
}

#commentQuickModal .comment-quick-dialog.comment-quick-status-thread-unread {
  border-left-color: #f2d649;
}

#commentQuickModal .comment-quick-dialog.comment-quick-status-thread-read {
  border-left-color: #a89450;
}

#commentQuickModal .comment-quick-dialog.comment-quick-status-customer {
  border-left-color: #da1e28;
}

#commentQuickModal .modal-header {
  background: var(--popover-bg);
  flex-shrink: 0;
}

#commentQuickModal .modal-header h3 {
  text-transform: none;
  letter-spacing: 0.03em;
}

#commentQuickModal .comment-quick-modal-body {
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  background: rgba(8, 8, 8, 0.35);
  border-bottom: 1px solid var(--popover-border);
}

.comment-quick-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  line-height: 1.5;
  font-size: var(--font-size-md);
}

#commentQuickBody.comment-quick-body--editing {
  display: block;
  width: 100%;
  min-height: 120px;
  max-height: min(220px, 36vh);
  margin: 0;
  padding: 10px 12px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  background: rgba(8, 8, 8, 0.58);
  color: var(--ink);
  font-size: var(--font-size-md);
  line-height: 1.45;
  font-family: inherit;
  overflow: auto;
  cursor: text;
}

#commentQuickBody.comment-quick-body--editing:focus {
  outline: none;
  border-color: rgba(218, 30, 40, 0.45);
  box-shadow: 0 0 0 1px rgba(218, 30, 40, 0.2);
}

.comment-quick-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--popover-bg);
  border-top: 1px solid var(--popover-border);
}

#commentQuickModal .comment-quick-footer .comment-actions {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  opacity: 1;
  max-height: none;
  overflow: visible;
  pointer-events: auto;
}

#commentQuickModal .comment-quick-footer .tiny:not(.pin-toolbar-btn) {
  width: auto;
  min-width: 110px;
}

#commentQuickModal .comment-actions button.pin-toolbar-btn.inline-dismiss-btn {
  flex-shrink: 0;
  font-size: 1.05rem;
  line-height: 1;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255, 255, 255, 0.12);
}

#commentQuickModal .comment-actions button.pin-toolbar-btn.inline-dismiss-btn:hover {
  background: rgba(28, 28, 28, 0.65);
  border-color: rgba(255, 255, 255, 0.22);
}

.comment-quick-dialog {
  width: min(440px, 92vw);
}

.tiny {
  width: auto;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font);
  line-height: 1.25;
}

.delete-confirm {
  background: #c0392b !important;
  color: #fff !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
}

.resolve-check {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #1fbe52;
  cursor: pointer;
  flex: 0 0 auto;
}

.pin-toolbar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  padding: 4px;
  z-index: 12;
  pointer-events: auto;
  box-shadow: var(--ui-shadow);
}

/* Иконки маркера / тоста / списка правок / инлайн-редактора: единый chrome */
.pin-toolbar button.pin-toolbar-btn,
.general-comment-actions button.pin-toolbar-btn,
.general-toast-item-toolbar button.pin-toolbar-btn,
.comment-actions button.pin-toolbar-btn,
.inline-composer button.pin-toolbar-btn {
  position: relative;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  background: var(--ui-surface);
  color: var(--ink);
  border: 1px solid var(--border-subtle);
  transform: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.pin-toolbar button.pin-toolbar-btn:hover,
.general-comment-actions button.pin-toolbar-btn:hover,
.general-toast-item-toolbar button.pin-toolbar-btn:hover,
.comment-actions button.pin-toolbar-btn:hover,
.inline-composer button.pin-toolbar-btn:hover {
  transform: none;
  background: var(--ui-surface-hover);
  border-color: var(--border);
  color: var(--ink);
}

.pin-toolbar button.pin-toolbar-btn:focus-visible,
.general-comment-actions button.pin-toolbar-btn:focus-visible,
.general-toast-item-toolbar button.pin-toolbar-btn:focus-visible,
.comment-actions button.pin-toolbar-btn:focus-visible,
.inline-composer button.pin-toolbar-btn:focus-visible {
  outline: 2px solid rgba(218, 30, 40, 0.45);
  outline-offset: 1px;
}

.pin-toolbar button.pin-toolbar-btn.action-delete:hover,
.general-comment-actions button.pin-toolbar-btn.action-delete:hover,
.general-toast-item-toolbar button.pin-toolbar-btn.action-delete:hover,
.comment-actions button.pin-toolbar-btn.action-delete:hover,
.inline-composer button.pin-toolbar-btn.action-delete:hover {
  border-color: rgba(218, 30, 40, 0.45);
  color: #ffb3b8;
}

/* Подсказки в стиле поповера (вместо системного title) */
.pin-toolbar button.pin-toolbar-btn::after,
.general-comment-actions button.pin-toolbar-btn::after,
.general-toast-item-toolbar button.pin-toolbar-btn::after,
.comment-actions button.pin-toolbar-btn::after,
.inline-composer button.pin-toolbar-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 5px 10px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--text);
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  border-radius: var(--radius-min);
  box-shadow: var(--ui-shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  z-index: 20;
}

.pin-toolbar button.pin-toolbar-btn:hover::after,
.pin-toolbar button.pin-toolbar-btn:focus-visible::after,
.general-comment-actions button.pin-toolbar-btn:hover::after,
.general-comment-actions button.pin-toolbar-btn:focus-visible::after,
.general-toast-item-toolbar button.pin-toolbar-btn:hover::after,
.general-toast-item-toolbar button.pin-toolbar-btn:focus-visible::after,
.comment-actions button.pin-toolbar-btn:hover::after,
.comment-actions button.pin-toolbar-btn:focus-visible::after,
.inline-composer button.pin-toolbar-btn:hover::after,
.inline-composer button.pin-toolbar-btn:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

/* Подсказки тулбара в окне правки — вверх, чтобы не резались низом диалога */
#commentQuickModal .comment-actions button.pin-toolbar-btn::after {
  top: auto;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
}

#commentQuickModal .comment-actions button.pin-toolbar-btn:hover::after,
#commentQuickModal .comment-actions button.pin-toolbar-btn:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.pin-toolbar button.pin-toolbar-btn.delete-confirm::after,
.general-comment-actions button.pin-toolbar-btn.delete-confirm::after,
.general-toast-item-toolbar button.pin-toolbar-btn.delete-confirm::after,
.comment-actions button.pin-toolbar-btn.delete-confirm::after,
#commentQuickModal .comment-actions button.pin-toolbar-btn.delete-confirm::after {
  display: none;
}

.pin-toolbar button.pin-toolbar-btn.delete-confirm,
.general-comment-actions button.pin-toolbar-btn.delete-confirm,
.general-toast-item-toolbar button.pin-toolbar-btn.delete-confirm,
.comment-actions button.pin-toolbar-btn.delete-confirm {
  width: auto;
  min-width: 76px;
  padding: 0 8px !important;
  font-size: var(--font-size-xs) !important;
  line-height: 1.2 !important;
  background: rgba(218, 30, 40, 0.22) !important;
  color: #ffc9c9 !important;
  border-color: rgba(218, 30, 40, 0.65) !important;
}

/* Инлайн-редактор: поле ввода + строка действий (без верхней полосы с таймкодом).
   Узел на #reviewLayout, чтобы не перекрывался #draftPin */
.inline-composer {
  position: absolute;
  transform: translate(14px, 14px);
  width: min(320px, 78vw);
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 32;
  pointer-events: auto;
}

/* Диапазон: якорь — верх полосы выделения на таймлайне, блок уходит вверх */
.inline-composer.inline-composer--range {
  transform: translate(-50%, calc(-100% - 14px));
}

/* Крестик вместо «Отмена» — как иконка тулбара */
.inline-composer button.pin-toolbar-btn.inline-dismiss-btn {
  flex-shrink: 0;
  font-size: 1.05rem;
  line-height: 1;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255, 255, 255, 0.12);
}

.inline-composer button.pin-toolbar-btn.inline-dismiss-btn:hover {
  background: rgba(28, 28, 28, 0.65);
  border-color: rgba(255, 255, 255, 0.22);
}

.inline-field-wrap {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 8, 8, 0.58);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.inline-composer textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  max-height: min(220px, 38vh);
  resize: vertical;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: var(--btn-pad-y) 10px;
  font-size: var(--font-size-md);
  line-height: 1.45;
  box-sizing: border-box;
}

.inline-composer textarea::placeholder {
  color: rgba(154, 154, 154, 0.85);
}

.inline-composer textarea:focus {
  outline: none;
}

.inline-field-wrap:focus-within {
  border-color: rgba(218, 30, 40, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(218, 30, 40, 0.2);
}

.inline-actions {
  margin-top: 10px;
  display: flex;
  gap: var(--gap-ui);
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 0 2px;
}

.inline-actions .tiny:not(.pin-toolbar-btn) {
  width: auto;
  min-width: 110px;
}

.pin-hover-tooltip {
  position: absolute;
  max-width: 280px;
  padding: var(--btn-pad-y) var(--section-header-pad-x);
  border: 1px solid var(--popover-border);
  background: var(--popover-bg);
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: 1.45;
  z-index: 6;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--ui-shadow);
}

/* Постоянная подпись текста правки над точечным маркером (внутри .video-overlay) */
.overlay-comment-body-label,
.pin-saved-body-label {
  max-width: 280px;
  padding: var(--btn-pad-y) var(--section-header-pad-x);
  border: 1px solid var(--popover-border);
  background: var(--popover-bg);
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: 1.45;
  z-index: 6;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--ui-shadow);
}

/* Подпись у сохранённого штриха кисти: центр bounding box штриха (0..1) */
.draw-saved-body-label {
  position: absolute;
  max-width: min(280px, 42vw);
  padding: var(--btn-pad-y) var(--section-header-pad-x);
  border: 1px solid var(--popover-border);
  background: var(--popover-bg);
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: 1.45;
  z-index: 5;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--ui-shadow);
  transform: translate(-50%, -50%);
}

.status-pill {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 2px 8px;
  font-size: var(--font-size-xs);
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

/* Ревью: все модалки — выше шторок/дропдаунов внутри плеера (z-index до 200) и выше соседних .modal в DOM */
.review-body > .modal {
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 1;
}

.modal-dialog {
  position: relative;
  width: min(720px, 92vw);
  margin: 6vh auto;
  background: var(--ui-surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--ui-shadow);
  z-index: 2;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-ui);
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  border-bottom: 1px solid var(--border);
  background: var(--ui-surface);
}

.modal-header h1,
.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.modal-body {
  padding: 14px;
}

#commentQuickModal .comment-quick-modal-body.modal-body {
  padding: 14px;
}

.modal-replies {
  margin-top: 0;
  max-height: 40vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Правая шторка обсуждения: не ограничивать 40vh (иначе пустота между лентой и полем ввода) */
#modalReplies.discussion-slide-replies {
  max-height: none;
  overflow: visible;
  gap: 10px;
}

.reply-row {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 12px;
  background: transparent;
  transition: background 0.12s;
}

.reply-row:hover {
  background: var(--ui-surface-hover);
}

.reply-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
}

.reply-time {
  font-size: var(--font-size-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.reply-body {
  margin: 0;
}

.reply-row p.reply-body {
  margin: 6px 0 0;
}

.author-name {
  color: var(--ink);
  font-weight: 700;
}

.modal-compose {
  margin-top: var(--gap-ui);
  padding-top: var(--gap-ui);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--gap-ui);
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--gap-ui);
}

.modal-actions-discussion {
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.export-choice-dialog {
  width: min(520px, 92vw);
}

.guest-intro-dialog {
  width: min(560px, 92vw);
}

.guest-intro-dialog ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.guest-intro-dialog li {
  margin: 6px 0;
}

.guest-intro-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.export-format-label {
  display: block;
  margin-top: var(--gap-ui);
  margin-bottom: 6px;
  font-size: var(--font-size-sm);
  color: var(--muted);
}

.export-format-select {
  width: 100%;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border: 1px solid var(--border);
  border-radius: var(--radius-min);
  background: var(--ui-surface-raised);
  color: var(--text);
  font-size: var(--font-size-md);
}

.export-choice-grid {
  display: grid;
  gap: var(--gap-ui);
  margin-top: var(--gap-ui);
}

.export-choice-btn {
  width: 100%;
  text-align: left;
  min-height: var(--btn-min-height);
  padding: calc(var(--btn-pad-y) + 3px) var(--btn-pad-x);
  font-size: var(--btn-font);
  line-height: 1.25;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  transition: background 0.12s;
}

.export-choice-dialog .export-choice-btn.ghost {
  background: transparent;
}

.export-choice-dialog .export-choice-btn.ghost:hover {
  background: var(--ui-surface-hover);
  color: var(--ink);
}

.customer-link-dialog {
  width: min(480px, 92vw);
}

#customerLinkModal:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: center;
}

#customerLinkModal .modal-dialog {
  margin: 0;
}

.modal-title-text {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.customer-link-body {
  margin-top: 0;
  display: grid;
  gap: var(--gap-ui);
}

.customer-link-field {
  display: grid;
  gap: 5px;
}

.customer-link-label {
  font-size: var(--font-size-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.customer-link-url-row {
  display: flex;
  gap: var(--gap-ui);
  align-items: center;
}

.customer-link-url-row input {
  flex: 1;
  min-width: 0;
  min-height: var(--btn-min-height);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--font-size-sm);
  color: var(--ink);
  background: var(--ui-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-min);
  outline: none;
}

.customer-link-copied {
  font-size: var(--font-size-sm);
  color: #4caf50;
  margin-top: 4px;
}

.customer-link-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--gap-ui);
  margin-top: 6px;
}

.logs pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--ui-surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  font-size: var(--font-size-xs);
}

/* ── Notification bell ─────────────────────────────────── */
.notif-bell-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notif-bell-btn {
  color: #ef5350;
  padding: 4px 8px;
  position: relative;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notif-bell-btn:hover {
  color: #ff6f6b;
}

.notif-bell-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
}

.notif-bell-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent);
  color: #fff;
  font-size: var(--font-size-2xs);
  font-weight: 700;
  border-radius: var(--radius-min);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Сильнее .notif-badge { display: flex }, иначе .hidden не скрывает счётчик при 0 непрочитанных */
.notif-badge.hidden {
  display: none !important;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 440px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--ui-surface);
  border: 1px solid var(--border);
  z-index: 200;
  box-shadow: var(--ui-shadow);
  box-sizing: border-box;
}

/* Сильнее .notif-dropdown { display: flex }, иначе .hidden не скрывает панель */
.notif-dropdown.hidden {
  display: none;
}

.notif-dropdown.history-mode {
  width: min(520px, 94vw);
  max-height: min(72vh, 640px);
}

.notif-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--ui-surface);
  z-index: 1;
}

.notif-dropdown-head-actions {
  display: inline-flex;
  gap: var(--gap-ui);
  align-items: center;
  flex-shrink: 0;
}

.notif-dropdown-head-actions .ghost {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Прокрутка только у списка — шапка на полную ширину, без полосы рядом с кнопками */
.notif-dropdown-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.notif-dropdown-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Small uppercase section title (like "Уведомления") */
.ui-title-mini {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notif-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  min-width: 0;
}

.notif-item:hover {
  background: var(--ui-surface-hover);
}

.notif-item.unread {
  background: rgba(218, 30, 40, 0.08);
}

.notif-item.unread:hover {
  background: rgba(218, 30, 40, 0.12);
}

.notif-item-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: var(--font-size-sm);
  color: var(--text);
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notif-item-title strong {
  color: var(--ink);
}

.notif-item-title.client-notif strong {
  color: var(--accent);
}

.notif-item-body {
  font-size: var(--font-size-xs);
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notif-item-time {
  font-size: var(--font-size-xs);
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.notif-empty {
  padding: 20px var(--section-header-pad-x);
  font-size: var(--font-size-sm);
  color: var(--muted);
  text-align: center;
}

.notifications-history-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.notifications-history-shell {
  width: min(980px, 94vw);
  margin: 24px auto;
  border: 1px solid var(--border);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow);
}

.notifications-history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-ui);
  padding: var(--section-header-pad-y) var(--section-header-pad-x);
  border-bottom: 1px solid var(--border);
  background: var(--ui-surface);
}

.notifications-history-title {
  margin: 0;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.notifications-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notifications-history-actions {
  display: flex;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.comment-item.is-focused {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.comment-item.comment-item-canvas-on {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

@media (max-width: 900px) {
  .grid2 {
    grid-template-columns: 1fr;
  }

  .project-draft-grid {
    grid-template-columns: 1fr;
  }

  .hero-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .review-shell {
    grid-template-columns: 1fr;
  }

  .player-controls {
    grid-template-columns: 1fr;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .notif-dropdown {
    width: min(92vw, 360px);
    right: -6px;
  }

  .filter-drawer {
    width: min(92vw, 300px);
  }
}

/* ── Monpan (админ-обзор) ───────────────────────────────── */
.monpan-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.monpan-stat-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--ui-surface-raised);
}

.monpan-stat-value {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--ink);
}

.monpan-stat-label {
  font-size: var(--font-size-xs);
  color: var(--muted);
  margin-top: 4px;
}

.monpan-user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.monpan-search {
  min-width: 180px;
  max-width: 280px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--ui-surface);
  color: var(--ink);
  font-size: var(--font-size-sm);
}

.monpan-table-wrap {
  overflow-x: auto;
  margin-top: 4px;
}

.monpan-users-footnote {
  margin-top: 12px;
  max-width: 65rem;
  line-height: 1.45;
}

.monpan-users-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.monpan-picker-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.monpan-user-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--ui-surface);
  color: var(--ink);
  font-size: var(--font-size-sm);
}

.monpan-user-detail {
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
  background: var(--ui-surface-raised);
  border-radius: 6px;
}

.monpan-user-detail-grid {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr;
  gap: 8px 14px;
  align-items: start;
  font-size: var(--font-size-sm);
}

.monpan-detail-k {
  color: var(--muted);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.monpan-detail-projects {
  line-height: 1.4;
  word-break: break-word;
}

.monpan-detail-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.monpan-access-modal .app-modal-head h2 {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.monpan-access-hint {
  margin-bottom: 10px;
}

.monpan-access-filter {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--ui-surface);
  color: var(--ink);
  font-size: var(--font-size-sm);
}

.monpan-access-row--hidden {
  display: none !important;
}

.monpan-access-loading {
  margin: 12px 0;
}

.monpan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.monpan-table th,
.monpan-table td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.monpan-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.monpan-table code {
  font-size: 11px;
  word-break: break-word;
  display: block;
  max-width: 420px;
}

.monpan-projects-td {
  max-width: 22rem;
}

.monpan-projects-cell {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  word-break: break-word;
}

.monpan-table-actions {
  white-space: nowrap;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

button.monpan-btn-danger {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.45);
}

button.monpan-btn-danger:hover {
  color: #fff;
  background: #b42318;
  border-color: #b42318;
}

.monpan-access-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(55vh, 520px);
  overflow-y: auto;
  margin-top: 8px;
}

.monpan-access-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  background: var(--ui-surface-raised);
}

.monpan-access-row--owner {
  opacity: 0.92;
}

.monpan-access-check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 160px;
  cursor: pointer;
}

.monpan-access-name {
  font-weight: 500;
  color: var(--ink);
}

.monpan-access-lock {
  color: var(--muted);
  font-size: 10px;
}

select.monpan-access-role {
  min-width: 120px;
}
