:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;

  /* Sage palette */
  --bg-app: #f5f7f6;
  --bg-surface: #ffffff;
  --text-main: #20312b;
  --muted: #64736f;
  --line: #dfe7e3;
  --accent: #176c53;
  --accent-hover: #135a46;
  --accent-light: #e8f2ed;

  /* Platform */
  --color-vk: #0077ff;
  --color-telegram: #24a1de;

  /* Semantic */
  --color-danger: #ac3c30;
  --color-danger-bg: #fff0ed;
  --color-danger-border: #f0d5d0;
  --color-warning: #78350f;

  /* Radius scale */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  color: var(--text-main);
  background: var(--bg-app);
}
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; }
button, input { font: inherit; }
button, .button, input, select, textarea, summary, a, label, .thumb { touch-action: manipulation; }
button, .button { min-height: 38px; border: 1px solid transparent; border-radius: var(--radius-md); padding: 8px 14px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center; font-weight: 600; text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button img, .button img { width: 17px; height: 17px; flex: 0 0 17px; }
a { color: inherit; }
button:hover:not(:disabled), .button:hover { filter: brightness(.95); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) { height: 38px; min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); padding: 8px 10px; color: inherit; }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--accent); }
input[type="radio"], input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; }
select, textarea { font: inherit; color: inherit; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 9px; min-height: 38px; max-width: 100%; }
h1, h2, p { margin: 0; }
h1 { font-size: 22px; font-weight: 700; }
h1 span { font-size: 14px; font-weight: 400; color: var(--muted); }
h2 { font-size: 15px; font-weight: 650; }
.topbar { min-height: 70px; padding: 14px 32px; border-bottom: 1px solid var(--line); display: flex; gap: 20px; align-items: center; justify-content: space-between; background: var(--bg-surface); box-shadow: 0 1px 8px #213a2c04; }
#connection-link { text-decoration: none; }
.main-nav { display: flex; gap: 6px; align-items: center; margin-right: auto; margin-left: 30px; align-self: stretch; }
.main-nav a { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 7px; text-decoration: none; padding: 10px 16px; border-radius: 9px; white-space: nowrap; border: 0; }
.main-nav a:hover { background: #f3f6f4; }
.main-nav a[aria-current="page"] { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.main-nav .count { background: #fff9; padding: 2px 6px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.status { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.status div > span { display: none; }
.status strong { font-weight: 500; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #ba8030; }
.status.session .status-dot { background: #23896c; }
.status.none .status-dot { background: #a4a8ad; }
.workspace { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: calc(100vh - 70px); }
.sidebar { padding: 24px 20px; border-right: 1px solid var(--line); background: var(--bg-surface); min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 38px; margin-bottom: 12px; }
.section-head h2 { display: flex; align-items: center; gap: 9px; }
.count { font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.add-source { display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 6px; margin-bottom: 20px; }
.icon-button { width: 32px; height: 32px; min-height: 32px; padding: 7px; background: transparent; border-color: transparent; flex: 0 0 32px; }
.add-button { width: 38px; height: 38px; background: #e9ecef; }
.source-list { display: grid; gap: 4px; }
.source-row { display: flex; align-items: center; border-left: 3px solid transparent; padding: 10px 5px 10px 9px; min-width: 0; gap: 4px; border-radius: var(--radius-md); margin: 3px 0; }
.source-row.selected { border-left-color: var(--accent); background: #edf5f0; }
.source-choice { display: flex; align-items: center; flex: 1; min-width: 0; gap: 10px; cursor: pointer; }
.source-text { display: grid; gap: 4px; min-width: 0; }
.source-text strong { font-size: 13px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.source-text small { color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.source-actions { display: flex; align-items: center; gap: 4px; }
.source-layout-label { display: grid; gap: 2px; color: var(--muted); font-size: 10px; line-height: 1.1; }
.source-layout-label select { max-width: 108px; min-height: 30px; padding: 3px 22px 3px 6px; font-size: 12px; }
.source-actions img { width: 15px; height: 15px; opacity: .65; }
.source-warning { color: #95661f !important; }
.source-empty { color: var(--muted); padding: 14px 0 24px; font-size: 13px; }
.connection { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 18px; }
summary { cursor: pointer; font-size: 13px; color: #62676d; width: fit-content; }
details[open] > summary { margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.connection .button { width: 100%; margin: 14px 0; font-size: 13px; }
.callback-form { display: grid; gap: 9px; }
.callback-form label { color: var(--muted); font-size: 12px; }
.callback-form button { font-size: 12px; }
.secondary { color: #42484e; border-color: #d7dbde; background: #fff; }
.primary { color: #fff; background: var(--accent); min-width: 135px; }
.primary img { filter: invert(1); }
.content { min-width: 0; padding: 32px 34px; max-width: 1700px; margin: 0 auto; width: 100%; }
.download-section { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--bg-surface); }
.source-heading { min-width: 0; padding-top: 1px; flex: 1; }
.source-heading h2 { font-size: 22px; line-height: 1.35; overflow-wrap: anywhere; }
.album-link { display: inline-flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.album-link:hover { color: var(--accent); }
.album-link img { width: 13px; height: 13px; }
#run-form { width: 360px; max-width: 100%; flex: 0 0 360px; }
.source-picker { position: relative; margin-top: 14px; width: 360px; max-width: 100%; }
.source-picker > summary { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); color: #42484e; overflow-wrap: anywhere; }
.source-picker[open] > summary { margin-bottom: 0; }
.source-picker-menu { position: absolute; z-index: 5; top: calc(100% + 5px); left: 0; right: 0; padding: 12px; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 12px 35px #20392b18; }
.select-all { padding: 12px 0; border-bottom: 1px solid var(--line); }
.source-options { max-height: 300px; overflow-y: auto; }
.source-option { padding: 10px 2px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.source-option:hover { background: #f3f6f5; }
.source-option .source-text { flex: 1; }
.source-position { min-width: 20px; text-align: right; color: var(--muted); font-size: 12px; }
.download-toolbar { display: flex; gap: 12px; align-items: flex-end; }
.download-media-settings { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 9px 11px; color: var(--muted); font-size: 12px; }
.download-media-settings summary { cursor: pointer; color: var(--text-main); font-weight: 600; }
.media-type-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 14px; padding-top: 10px; }
.vk-access-settings label { display: grid; gap: 6px; padding-top: 10px; color: var(--text-main); font-weight: 600; }
.vk-access-settings select { width: 100%; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-main); padding: 8px; font: inherit; }
.vk-access-settings p { margin: 8px 0 0; line-height: 1.45; }
.downloaded-files { display: grid; gap: 4px; margin-top: 6px; }
.downloaded-files:empty { display: none; }
.downloaded-files a { width: fit-content; max-width: 100%; overflow-wrap: anywhere; font-size: 12px; }
.limit-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #62676d; }
.limit-label input { width: 64px !important; flex: 0 0 64px; }
.download-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.download-range label { display: grid; gap: 6px; color: #62676d; font-size: 12px; }
.download-range .full-row { grid-column: 1 / -1; }
.download-range select { width: 100%; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); color: inherit; padding: 8px; font: inherit; }
.download-range small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.watermark-settings { margin-top: 15px; }
.wm-mode, .wm-preset > label, .wm-fields label { display: grid; gap: 6px; font-size: 12px; }
.wm-mode select, .wm-preset input:not([type="checkbox"]), .wm-preset select { width: 100%; box-sizing: border-box; min-width: 0; padding: 8px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); }
.wm-preset { padding: 12px; margin: 10px 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.wm-heading, .wm-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.wm-heading img { width: 80px; height: 44px; object-fit: contain; background: repeating-conic-gradient(#e9e9e9 0% 25%,white 0% 50%) 50% / 12px 12px; }
.wm-heading label { display: flex; gap: 4px; align-items: center; font-size: 12px; }
.wm-move { display: flex; gap: 4px; margin-left: auto; }
.wm-move button { min-width: 30px; padding: 5px; }
.wm-preset-name { margin: 8px 0; }
.wm-preset-details { border-top: 1px solid var(--line); margin-top: 8px; }
.wm-preset-details > summary { padding: 9px 2px 2px; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.wm-preset-detail-content { padding-top: 4px; }
.wm-preset-empty { margin: 12px 0; padding: 18px; color: var(--muted); background: #f8faf9; border: 1px dashed var(--line); border-radius: var(--radius-md); font-size: 13px; text-align: center; }
.wm-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 12px 0; }
.wm-full { grid-column: 1 / -1; }
.settings-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.settings-fields label { display: grid; gap: 8px; font-size: 12px; color: #62676d; }
.settings-fields input[type="range"] { width: 100%; margin: 0; }
.settings-fields output { font-size: 12px; }
.upscale-setting { margin-bottom: 14px; line-height: 1.5; }
.settings-fields .sizing-side-field { grid-column: 1 / -1; }
#sizing-side { width: 100%; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); color: inherit; font: inherit; padding: 8px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 12px; }
#confirm-delete-history-wrap[hidden] { display: none; }
.progress { margin: 22px 0; }
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 32px; font-size: 13px; margin-bottom: 10px; }
.progress-head strong { font-weight: 600; }
.progress-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.cancel-button { border-color: #e2c5c2; background: #fff3f1; }
progress { display: block; width: 100%; height: 6px; border: none; border-radius: 4px; overflow: hidden; accent-color: var(--accent); background: #edf0ee; }
progress::-webkit-progress-bar { background: #edf0ee; }
progress::-webkit-progress-value { background: var(--accent); }
.progress p { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.job-details { margin-top: 9px; }
.job-details summary { font-size: 12px; }
.job-sources { max-height: 280px; overflow-y: auto; font-size: 12px; }
.job-source { padding: 9px 0; border-bottom: 1px solid var(--line); }
.job-source-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.job-source strong { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.job-source-head span { flex-shrink: 0; color: var(--muted); }
.job-source small { display: block; margin-top: 5px; color: var(--muted); overflow-wrap: anywhere; }
#event-log { max-height: 160px; overflow: auto; color: var(--muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.results { padding-top: 22px; }
.delete-button { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); font-size: 12px; padding-right: 0; }
.delete-button img { width: 15px; height: 15px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 16px; }
.thumb { display: block; min-width: 0; text-decoration: none; }
.gallery .thumb { position: relative; }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fafafa; }
.thumb:hover img { border-color: #829d92; }
.gallery .thumb.is-telegram img { border-color: #54a9eb; box-shadow: 0 0 0 1px #54a9eb; background: #f0f7fd; }
.gallery .thumb.is-telegram:hover img { border-color: #24a1de; box-shadow: 0 2px 8px rgba(36, 161, 222, 0.3); }
.empty { min-height: 250px; display: grid; place-content: center; justify-items: center; gap: 16px; color: #92979d; font-size: 13px; }
.empty img { width: 36px; height: 36px; opacity: .3; }
#alerts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  max-width: clamp(280px, calc(100vw - 32px), 420px);
}
.alert {
  pointer-events: auto;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 16px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.08);
  background: #14532d;
  color: #f0fdf4;
  border-color: #166534;
  overflow-wrap: anywhere;
  cursor: pointer;
  animation: alert-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.alert.toast-out {
  opacity: 0;
  transform: translateY(6px) scale(0.96);
}
.alert.error {
  background: #7f1d1d;
  color: #fef2f2;
  border-color: #991b1b;
}
.alert.warning {
  background: #78350f;
  color: #fffbeb;
  border-color: #92400e;
}
@keyframes alert-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
dialog { max-width: min(430px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 25px; color: inherit; box-shadow: 0 24px 100px #16342630; }
dialog::backdrop { background: #122a2366; }
dialog h2 { font-size: 19px; }
dialog p { margin: 14px 0 24px; line-height: 1.6; font-size: 14px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.danger { color: #fff; background: var(--color-danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (min-width: 1600px) { .content { padding-right: 48px; } .gallery { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 270px minmax(0, 1fr); }
  .content { padding: 26px 24px; }
  .download-section { display: grid; gap: 18px; }
  #run-form { width: 100%; }
  .download-toolbar { justify-content: space-between; }
  .settings-fields { max-width: 360px; }
}
@media (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 8px 12px;
    min-height: 52px;
    flex-wrap: wrap;
    gap: 6px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  }
  .topbar h1 {
    font-size: 18px;
  }
  .topbar-log-btn {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 11.5px;
    gap: 4px;
  }
  .main-nav {
    order: 3;
    width: 100%;
    margin: 2px 0 0;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 2px;
  }
  .main-nav::-webkit-scrollbar {
    display: none;
  }
  .main-nav a {
    flex: 1 0 auto;
    min-width: 68px;
    padding: 8px 8px;
    font-size: 12px;
    justify-content: center;
    border-radius: 8px;
    text-align: center;
  }
  .main-nav .count {
    padding: 1px 5px;
    font-size: 10.5px;
  }
  .status {
    max-width: 140px;
  }
  .workspace {
    display: block;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 12px;
  }
  .source-list {
    max-height: 240px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .source-actions {
    flex-direction: row;
  }
  .connection {
    margin-top: 14px;
    padding-top: 12px;
  }
  .connection[open] {
    max-width: 100%;
  }
  .content {
    padding: 14px 12px calc(24px + env(safe-area-inset-bottom, 0px)) !important;
    max-width: 100%;
  }
  .source-heading h2 {
    font-size: 18px;
  }
  .download-section {
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-radius: 12px;
  }
  #run-form {
    width: 100%;
    flex: none;
  }
  .source-picker {
    width: 100%;
  }
  .source-picker-menu {
    position: static;
    box-shadow: none;
    border: 1px solid var(--line);
    margin-top: 8px;
  }
  .download-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .download-toolbar .limit-label {
    justify-content: space-between;
    width: 100%;
    font-size: 13px;
  }
  .download-toolbar .limit-label input {
    width: 90px !important;
    flex: 0 0 90px;
    height: 40px;
  }
  .download-toolbar button.primary {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
  }
  .download-range {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .download-range label {
    font-size: 13px;
  }
  .media-type-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .empty {
    min-height: 160px;
  }
  #alerts {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
    max-width: none;
    align-items: center;
  }
  dialog:not(.prepared-modal):not(.wm-preview-dialog):not(.mempost-account-dialog) {
    width: calc(100% - 24px);
    max-width: 480px;
    padding: 18px 16px;
    border-radius: 14px;
  }
  .dialog-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    width: 100%;
  }
  .dialog-actions button {
    width: 100%;
    min-height: 44px;
  }
}
@media (max-width: 380px) {
  .download-range { grid-template-columns: 1fr; }
}

/* Tooltip & Popover system (Light Theme) */
.tip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
}
.label-heading {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #edf2ef;
  color: #495852;
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  cursor: help;
  user-select: none;
  border: 1px solid #c7d2cc;
  transition: background 0.08s ease, color 0.08s ease, border-color 0.08s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}
.tip-badge:hover,
.tip-badge:focus-visible {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.tip-popover {
  position: fixed;
  z-index: 1000;
  width: 275px;
  max-width: min(275px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  box-sizing: border-box;
  background: #ffffff;
  color: #202723;
  border: 1px solid #cfd8d4;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(18, 36, 26, 0.14), 0 2px 6px rgba(18, 36, 26, 0.06);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.05s ease, visibility 0.05s;
  pointer-events: none;
  font-weight: 400;
  text-align: left;
}
.tip-popover::before,
.tip-popover::after {
  content: '';
  position: absolute;
  left: var(--arrow-x, 20px);
  transform: translateX(-50%);
  border-style: solid;
  pointer-events: none;
}
.tip-popover[data-placement="top"]::before {
  top: 100%;
  bottom: auto;
  border-width: 6px;
  border-color: #cfd8d4 transparent transparent transparent;
}
.tip-popover[data-placement="top"]::after {
  top: calc(100% - 1px);
  bottom: auto;
  border-width: 5px;
  border-color: #ffffff transparent transparent transparent;
}
.tip-popover[data-placement="bottom"]::before,
.tip-popover:not([data-placement])::before {
  bottom: 100%;
  top: auto;
  border-width: 6px;
  border-color: transparent transparent #cfd8d4 transparent;
}
.tip-popover[data-placement="bottom"]::after,
.tip-popover:not([data-placement])::after {
  bottom: calc(100% - 1px);
  top: auto;
  border-width: 5px;
  border-color: transparent transparent #ffffff transparent;
}
.tip-popover p {
  margin: 4px 0;
  color: #4a5750;
}
.tip-popover p:first-child {
  margin-top: 0;
}
.tip-popover p:last-child {
  margin-bottom: 0;
}
.tip-popover p strong, .tip-popover strong {
  color: #17211c;
  font-weight: 600;
}
.tip-title {
  font-weight: 700;
  font-size: 12px;
  color: #16241e;
  margin-bottom: 6px;
  display: block;
}
.tip-modes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.tip-mode-item {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f7faf8;
  border: 1px solid #e3ebe7;
  transition: background 0.08s ease, border-color 0.08s ease;
}
.tip-mode-item.active {
  background: #edf7f2;
  border-color: #2e7d5a;
}
.tip-mode-header {
  display: block;
  font-size: 11.5px;
  color: #19231e;
}
.tip-mode-item.active .tip-mode-header {
  color: #1b5e40;
  font-weight: 700;
}
.tip-mode-desc {
  display: block;
  font-size: 11px;
  line-height: 1.4;
  color: #55645e;
  margin-top: 2px;
}
.tip-mode-item.active .tip-mode-desc {
  color: #264336;
}

/* Tooltip shows ONLY when hovering or focusing directly on the question mark */
.tip-badge:hover + .tip-popover,
.tip-badge:focus-visible + .tip-popover,
.tip-popover.is-open {
  opacity: 1;
  visibility: visible;
}

/* Review shortcuts badge */
.review-shortcuts-wrap {
  margin: 4px 0 8px;
}
.shortcuts-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #52605a;
  background: #edf3f0;
  padding: 4px 10px;
  border-radius: 14px;
  user-select: none;
}
.tip-popover kbd, .shortcuts-badge kbd {
  background: #f0f4f2;
  border: 1px solid #ccd6d0;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  color: #26362e;
  box-shadow: 0 1px 0 #ccd6d0;
}

/* Watermark Preview Modal */
.wm-preview-dialog {
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  max-width: 96vw;
  max-height: 94vh;
  box-shadow: 0 24px 64px rgba(10, 20, 15, 0.35);
  margin: auto;
}
.wm-preview-dialog::backdrop {
  background: rgba(15, 23, 19, 0.65);
  backdrop-filter: blur(4px);
}
.wm-preview-window {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  width: 1040px;
  max-width: 96vw;
  height: 85vh;
  max-height: 800px;
}
.wm-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
  flex-shrink: 0;
}
.wm-preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wm-preview-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: #202723;
}
.wm-preview-title img {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}
.wm-preview-format-tabs {
  display: flex;
  background: #eef2ef;
  padding: 3px;
  border-radius: 7px;
  gap: 3px;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
}
.wm-format-btn {
  border: none;
  background: transparent;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 550;
  color: #55625b;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
  min-height: auto;
  white-space: nowrap;
  flex: 0 0 auto;
}
.wm-format-btn:hover {
  color: #171b18;
}
.wm-format-btn.active {
  background: #ffffff;
  color: var(--accent);
  font-weight: 650;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.wm-preview-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.wm-preview-stage-container {
  display: flex;
  flex-direction: column;
  background: #181b19;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.wm-preview-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  position: relative;
  user-select: none;
}
#wm-preview-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  cursor: crosshair;
  background: repeating-conic-gradient(#202522 0% 25%, #181b19 0% 50%) 50% / 16px 16px;
}
#wm-preview-canvas.grabbing {
  cursor: grabbing;
}
.wm-preview-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: #111412;
  color: #92a099;
  font-size: 11.5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.wm-format-criteria-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.wm-format-criteria-badge.is-verified {
  background: #143322;
  color: #6ee7b7;
  border: 1px solid #1f5136;
}
.wm-format-criteria-badge.is-failed {
  background: #3a1515;
  color: #fca5a5;
  border: 1px solid #6b2121;
}
.wm-drag-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wm-btn-reset-pos {
  background: #242b26;
  color: #d1dbd5;
  border-color: #38423b;
  font-size: 11.5px;
  padding: 4px 10px;
  min-height: 28px;
  gap: 5px;
  border-radius: 5px;
}
.wm-btn-reset-pos:hover {
  background: #2e3831;
  color: #ffffff;
}
.wm-btn-reset-pos img {
  width: 13px;
  height: 13px;
  filter: invert(0.8);
}
.wm-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: #ffffff;
  border-left: 1px solid var(--line);
  overflow-y: auto;
}
.wm-prev-control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf0ee;
}
.wm-prev-control-group:last-of-type {
  border-bottom: none;
}
.wm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.wm-field select {
  height: 34px;
  padding: 6px 8px;
  border: 1px solid #cfd3d6;
  border-radius: 5px;
  background: #ffffff;
  font: inherit;
}
.wm-val-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: #edf7f2;
  padding: 2px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.wm-range-row {
  display: grid;
  grid-template-columns: 1fr 62px;
  gap: 10px;
  align-items: center;
}
.wm-range-row input[type="range"] {
  height: 6px;
  cursor: pointer;
}
.wm-range-row input[type="number"] {
  height: 32px;
  padding: 4px 6px;
  font-size: 12px;
  text-align: center;
}
.wm-pos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.wm-coords-display {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.wm-pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-width: 140px;
  margin: 4px auto 6px;
}
.wm-pos-grid button {
  height: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 13px;
  border: 1px solid #d4dcd7;
  background: #f8faf9;
  border-radius: 4px;
  color: #38453f;
  cursor: pointer;
  transition: all 0.1s ease;
}
.wm-pos-grid button:hover {
  background: #e8f0eb;
  border-color: var(--accent);
  color: var(--accent);
}
.wm-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}
.wm-preset-preview-btn {
  font-size: 12px;
  padding: 4px 10px;
  min-height: 30px;
  gap: 5px;
}
.wm-preset-preview-btn img {
  width: 14px;
  height: 14px;
}
.wm-legacy-actions {
  margin-top: 10px;
}
@media (max-width: 860px) {
  .wm-preview-dialog {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .wm-preview-window {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }
  .wm-preview-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .wm-preview-title h3 {
    font-size: 14px;
  }
  .wm-preview-format-tabs {
    order: 3;
    width: 100%;
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 3px;
    gap: 4px;
  }
  .wm-preview-format-tabs::-webkit-scrollbar {
    display: none;
  }
  .wm-format-btn {
    flex: 0 0 auto;
    text-align: center;
    padding: 6px 11px;
    font-size: 11px;
    white-space: nowrap;
  }
  .wm-preview-content {
    grid-template-columns: 1fr;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .wm-preview-stage-container {
    min-height: 200px;
    max-height: 35dvh;
  }
  .wm-preview-panel {
    padding: 12px 12px calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .wm-preview-actions button {
    min-height: 44px;
  }
}

.vk-posting-panel {margin:0;border:1px solid #cfdfec;border-radius:16px;background:#fff;box-shadow:0 5px 22px #172f4908;overflow:hidden;}
.posting-hubs {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start;interpolate-size:allow-keywords;}
.posting-hubs > .vk-posting-panel {min-width:0;overflow:visible;border:0;border-radius:0;background:transparent;box-shadow:none;}
.posting-hubs > .vk-posting-panel > summary {position:relative;z-index:1;box-sizing:border-box;width:100%;margin:0;border:1px solid #cfdfec;border-radius:16px;background:#fff;box-shadow:0 5px 22px #172f4908;transition:background-color .25s ease,border-color .25s ease,border-radius .25s ease,box-shadow .25s ease;}
.posting-hubs > .tg-posting-panel > summary {border-color:#cce5f0;}
.posting-hubs > .vk-posting-panel[open] > summary {border-color:#99c5f4;border-bottom-color:transparent;border-radius:16px 16px 0 0;background:#f3f8ff;box-shadow:0 5px 22px #172f4908;}
.posting-hubs > .tg-posting-panel[open] > summary {border-color:#91cfe9;border-bottom-color:transparent;background:#effaff;}
.posting-hubs > .vk-posting-panel > .vk-posting-content {box-sizing:border-box;width:calc(200% + 16px);block-size:0;margin-top:-1px;border:1px solid #99c5f4;border-radius:0 16px 16px 16px;background:#fff;box-shadow:0 5px 22px #172f4908;opacity:0;overflow:hidden;transition:block-size .36s cubic-bezier(.22,1,.36,1),opacity .24s ease;}
.posting-hubs > .tg-posting-panel > .vk-posting-content {margin-left:calc(-100% - 16px);border-color:#91cfe9;border-radius:16px 0 16px 16px;}
.posting-hubs > .vk-posting-panel::details-content {overflow:visible;transition:content-visibility .36s allow-discrete;}
.posting-hubs > .vk-posting-panel[open] > .vk-posting-content {block-size:auto;opacity:1;}
.tg-posting-panel {border-color:#cce5f0;}
.tg-posting-panel .vk-step-number {background:#e6f6fc;color:#1685b9;}
.tg-posting-panel .vk-launch {border-color:#cae8f5;background:#f1faff;}
.vk-posting-panel > summary {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 20px;cursor:pointer;list-style:none;font-weight:650;color:#203247;}
.vk-posting-panel > summary::-webkit-details-marker {display:none;}
.vk-posting-panel > summary::after {content:'⌄';order:3;font-size:20px;color:#76879b;line-height:1;}
.vk-posting-panel[open] > summary::after {transform:rotate(180deg);}
.vk-posting-panel[open] > summary {border-bottom:1px solid #e2eaf0;}
.vk-panel-title,.vk-panel-summary {display:flex;align-items:center;gap:8px;}
.vk-panel-title {font-size:16px;}
.vk-panel-title img {width:23px;height:23px;}
.vk-panel-summary {margin-left:auto;color:#617386;font-size:12px;font-weight:500;white-space:nowrap;}
.vk-panel-summary > span:first-child {font-weight:750;color:#243e5a;}
.vk-status-pill {padding:5px 9px;border-radius:999px;background:#eef2f6;color:#64768a;font-size:11px;}
.vk-status-pill.is-connected {background:#e8f5ed;color:#23764b;}
.vk-posting-content {padding:0 20px 20px;}
.vk-posting-topline {display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 0;border-bottom:1px solid #e9eff3;}
.vk-connection-state {display:inline-flex;align-items:center;gap:7px;color:#80552c;font-size:12px;font-weight:600;}
.vk-connection-state::before {content:'';width:8px;height:8px;border-radius:50%;background:#d39a52;}
.vk-connection-state.is-connected {color:#23764b;}
.vk-connection-state.is-connected::before {background:#39a76c;}
.vk-posting-topline button {min-height:32px;padding:5px 10px;font-size:12px;}
.vk-posting-layout {display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:22px;align-items:start;}
.vk-posting-main {min-width:0;}
.vk-step {padding:20px 0;border-bottom:1px solid #e9eff3;}
.vk-step:last-child {border-bottom:0;padding-bottom:0;}
.vk-step-heading {display:flex;align-items:flex-start;gap:11px;margin-bottom:14px;}
.vk-step-heading > div {flex:1;min-width:0;}
.vk-step-heading h3,.vk-launch h3 {margin:0 0 3px;font-size:15px;color:#263a51;}
.vk-step-heading p {margin:0;color:#738397;font-size:12px;line-height:1.45;}
.vk-step-heading button {font-size:12px;min-height:32px;padding:5px 9px;white-space:nowrap;}
.vk-step-number {display:grid;place-items:center;flex:0 0 23px;width:23px;height:23px;border-radius:7px;background:#e8f2ff;color:#1368c3;font-size:12px;font-weight:750;}
.vk-selected-heading {display:flex;justify-content:space-between;gap:10px;margin:0 0 10px 34px;font-size:12px;}
.vk-selected-heading .muted {font-size:11px;}
.vk-posting-selected {display:flex;gap:9px;min-width:0;overflow-x:auto;padding:2px 2px 9px 34px;scrollbar-width:thin;}
.vk-selected-item {position:relative;flex:0 0 112px;width:112px;border:1px solid #dbe7f3;border-radius:9px;background:#f8fbff;overflow:hidden;}
.vk-selected-item img {display:block;width:100%;height:76px;object-fit:contain;background:#eef3f8;}
.vk-selected-item span {display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:6px 7px 3px;font-size:10px;color:#4f6174;}
.vk-selected-status {display:block;padding:0 7px 5px;font-size:9px;font-weight:600;color:#d97706;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.vk-selected-item.is-uncertain {border-color:#fcd34d;background:#fffdfa;}
.vk-selected-item.is-failed {border-color:#fca5a5;background:#fffafa;}
.vk-selected-item.is-failed .vk-selected-status {color:#dc2626;}
.vk-selected-item.is-paused .vk-selected-status {color:#6b7280;}
.vk-remove {position:absolute;right:3px;top:3px;display:grid;place-items:center;width:23px;height:23px;min-height:0;padding:0;border:1px solid #d3dce6;border-radius:6px;background:#fff;color:#526981;font-size:17px;line-height:1;cursor:pointer;}
.vk-remove:hover {color:#bb3737;border-color:#e7aaaa;}
.vk-empty {margin:0;padding:14px;border:1px dashed #d6e2ec;border-radius:9px;background:#f9fbfd;color:#75869a;font-size:12px;line-height:1.5;}
.vk-posting-selected > .vk-empty {width:100%;}
.vk-posting-groups {margin:0;padding:0 0 0 34px;min-width:0;border:0;}
#vk-posting-groups,#tg-posting-groups {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
#vk-posting-groups > .vk-empty {grid-column:1 / -1;}
.vk-group-item {display:grid;gap:4px;min-width:0;padding:10px;border:1px solid #dbe4eb;border-radius:9px;background:#fff;overflow-wrap:anywhere;cursor:pointer;transition:border-color 0.15s, background-color 0.15s, box-shadow 0.15s;}
.vk-group-item:hover {border-color:#80b8f4;}
.vk-group-item.is-checked {border-color:#80b8f4;background:#f1f7ff;box-shadow:inset 0 0 0 1px #c5e0fb;}
.vk-group-item label {display:flex;align-items:flex-start;gap:8px;min-width:0;cursor:pointer;color:#31465b;font-size:12px;font-weight:650;line-height:1.4;}
.vk-group-item label span {min-width:0;}
.vk-group-item input[type=checkbox] {flex:0 0 16px;width:16px;height:16px;margin:0;accent-color:#0077ff;cursor:pointer;}
.vk-group-wm-btn {justify-self:start;min-height:25px;margin-left:24px;padding:2px 6px;border:0;background:transparent;color:#637d9c;text-align:left;font-size:11px;white-space:normal;}
.vk-group-wm-btn:hover {color:#116cd0;text-decoration:underline;}
.vk-posting-fields {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:11px;padding-left:34px;}
.vk-posting-fields label,.vk-posting-panel #vk-posting-common-field {display:grid;gap:5px;min-width:0;color:#53687d;font-size:11px;font-weight:600;}
.vk-posting-panel input:not([type=checkbox]),.vk-posting-panel select,.vk-posting-panel textarea {box-sizing:border-box;width:100%;min-width:0;max-width:100%;padding:8px 9px;border:1px solid #d8e3ec;border-radius:8px;background:#fff;color:#24394f;font:inherit;}
.vk-posting-panel input:focus-visible,.vk-posting-panel select:focus-visible,.vk-posting-panel textarea:focus-visible {outline:2px solid #7db8f9;outline-offset:1px;}
.vk-posting-panel #vk-posting-common-field,.vk-posting-panel #tg-posting-common-field {margin:12px 0 0 34px;}
.vk-posting-panel #vk-posting-common-field[hidden],.vk-posting-panel #tg-posting-common-field[hidden],.vk-posting-panel #vk-posting-browser-panel[hidden],.vk-posting-panel #vk-posting-cancel[hidden],.vk-posting-panel #tg-posting-cancel[hidden] {display:none;}
.vk-help {margin:10px 0 0 34px;color:#8291a1;font-size:11px;line-height:1.5;}
.vk-clip-schedule-options {display:flex;flex-wrap:wrap;align-items:center;gap:12px 18px;margin:12px 0 0 34px;padding:10px 14px;background:#f6f9fc;border:1px solid #e2ecf5;border-radius:8px;}
.vk-checkbox-inline {display:flex;align-items:center;gap:7px;color:#2c4056;font-size:12px;font-weight:600;cursor:pointer;}
.vk-checkbox-inline input[type=checkbox] {width:16px;height:16px;margin:0;accent-color:#0077ff;cursor:pointer;}
.vk-clips-per-day-fields {display:flex;align-items:center;gap:8px;font-size:12px;color:#53687d;font-weight:600;}
.vk-clips-per-day-fields label {display:flex;align-items:center;gap:4px;}
.vk-clips-per-day-fields input[type=number] {width:52px;padding:4px 6px;text-align:center;border:1px solid #d8e3ec;border-radius:6px;font:inherit;font-weight:600;}
.vk-posting-side {position:sticky;top:14px;display:grid;gap:10px;min-width:0;padding-top:18px;}
.vk-launch {padding:16px;border:1px solid #c8ddf5;border-radius:12px;background:#f3f8ff;}
.vk-launch p {margin:7px 0 12px;color:#536b84;font-size:12px;line-height:1.5;}
#vk-posting-next-step.is-clickable,#tg-posting-next-step.is-clickable {cursor:pointer;color:#0877df;font-weight:600;text-decoration:underline dotted;}
#vk-posting-next-step.is-clickable:hover,#tg-posting-next-step.is-clickable:hover {color:#065ea0;text-decoration:underline;}
#vk-posting-next-step.is-error-step,#tg-posting-next-step.is-error-step {color:#b42318;background:#fef3f2;border:1px solid #fecdca;border-radius:6px;padding:6px 10px;font-weight:600;}
@keyframes vkGroupsPulse {
  0%, 100% { outline: 2px solid transparent; box-shadow: none; }
  50% { outline: 2px solid #0877df; box-shadow: 0 0 12px rgba(8,119,223,0.4); }
}
.vk-groups-highlight {animation: vkGroupsPulse 0.7s ease-in-out 2;border-radius: 8px;}
.vk-launch button {display:block;width:100%;margin-top:7px;white-space:normal;}
#vk-posting-plan,#tg-posting-plan {background:#0877df;border-color:#0877df;color:#fff;}
#vk-posting-plan:hover:not(:disabled),#tg-posting-plan:hover:not(:disabled) {background:#0869c2;border-color:#0869c2;}
#vk-posting-plan:disabled,#tg-posting-plan:disabled {background:#b6cadb;border-color:#b6cadb;color:#fff;}
.vk-launch .vk-help {margin:9px 0 0;color:#8291a4;font-size:10px;}
#vk-posting-status,#tg-posting-status {margin:0;padding:0 2px;color:#607286;font-size:11px;line-height:1.45;overflow-wrap:anywhere;}
#vk-posting-status:empty,#tg-posting-status:empty {display:none;}
#vk-posting-status.is-error,#tg-posting-status.is-error {color:#b42318;background:#fef3f2;border:1px solid #fecdca;border-radius:6px;padding:7px 10px;font-size:11.5px;font-weight:600;display:block;}
.vk-side-details {padding:10px 12px;border:1px solid #e0e8ef;border-radius:10px;background:#fff;min-width:0;}
.vk-side-details > summary {cursor:pointer;color:#435a70;font-size:12px;font-weight:650;}
.vk-side-details > .muted {font-size:11px;line-height:1.5;}
.vk-posting-actions {display:flex;flex-wrap:wrap;gap:7px;margin:10px 0;}
.vk-posting-actions button {max-width:100%;white-space:normal;font-size:11px;}
#vk-posting-browser-panel {display:grid;gap:7px;overflow-wrap:anywhere;font-size:11px;}
.vk-posting-job {margin:10px 0 0;padding:9px;border:1px solid #e1eaf1;border-radius:8px;background:#fafcfe;overflow-wrap:anywhere;}
.vk-posting-job > summary {font-size:11px;line-height:1.4;}
.vk-job-items {display:grid;gap:6px;max-height:220px;overflow:auto;list-style:none;margin:9px 0;padding:0;}
.vk-job-items li {display:grid;gap:2px;padding:7px;border-radius:6px;background:#fff;border:1px solid #edf1f5;color:#627487;font-size:10px;line-height:1.35;}
.vk-job-items strong {color:#31465b;}
.vk-job-items li p {margin:2px 0;color:#a44444;}
.vk-job-items a {color:#1173cf;}
.vk-posting-dialog {width:min(850px,95vw);max-height:90vh;border:1px solid #dce5e1;border-radius:14px;padding:20px;overflow:auto;}
.vk-posting-dialog table {width:100%;border-collapse:collapse;}
.vk-posting-dialog th,.vk-posting-dialog td {text-align:left;padding:9px;border-bottom:1px solid #e5ebe8;}
.vk-plan-table-wrap {max-height:55vh;overflow:auto;}
.vk-plan-table-wrap table {min-width:530px;}
.vk-plan-table-wrap th {position:sticky;top:0;z-index:1;background:#fff;color:#60778c;font-size:11px;}
.vk-plan-table-wrap td {color:#334a5f;font-size:12px;vertical-align:middle;}
.vk-plan-post {display:flex;align-items:center;gap:9px;min-width:160px;}
.vk-plan-post img {flex:0 0 48px;width:48px;height:48px;object-fit:contain;border-radius:6px;background:#edf3f8;}
.vk-plan-post > span {display:grid;gap:2px;min-width:0;}
.vk-plan-post small {color:#8b9aac;font-size:10px;}
@media (max-width:1100px) {.posting-hubs {grid-template-columns:minmax(0,1fr);} .posting-hubs > .vk-posting-panel > .vk-posting-content {width:100%;margin-left:0;border-radius:0 0 16px 16px;}}
@media (prefers-reduced-motion:reduce) {.posting-hubs > .vk-posting-panel::details-content,.posting-hubs > .vk-posting-panel > .vk-posting-content,.posting-hubs > .vk-posting-panel > summary {transition:none;}}
@media (max-width:900px) {.vk-posting-layout {grid-template-columns:minmax(0,1fr);} .vk-posting-side {position:static;grid-template-columns:repeat(2,minmax(0,1fr));padding-top:0;} .vk-launch {grid-row:span 2;} #vk-posting-status,#tg-posting-status {grid-column:1 / -1;grid-row:3;}}
@media (max-width:620px) {.vk-posting-panel > summary {padding:13px;flex-wrap:wrap;} .vk-panel-summary {margin-left:0;} .vk-status-pill {display:none;} .vk-posting-content {padding:0 13px 14px;} .vk-step-heading {flex-wrap:wrap;} .vk-step-heading button {margin-left:34px;} #vk-posting-groups,#tg-posting-groups {grid-template-columns:1fr;} .vk-posting-fields {grid-template-columns:repeat(2,minmax(0,1fr));} .vk-posting-side {display:grid;grid-template-columns:1fr;} .vk-launch {grid-row:auto;} #vk-posting-status,#tg-posting-status {grid-column:auto;grid-row:auto;}}
.tg-send-button {position:absolute;top:9px;right:44px;z-index:1;width:29px;height:29px;min-height:0;padding:3px;border:1px solid var(--line);border-radius:5px;background:#fff;box-shadow:0 1px 4px #0002;cursor:pointer;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease,opacity .15s ease;contain:layout paint;display:flex;align-items:center;justify-content:center;}
.tg-send-button[hidden] {display:none;}
.tg-send-button:hover:not(:disabled):not(.tg-is-sent) {border-color:#229ED9;box-shadow:0 2px 6px rgba(34,158,217,.25);}
.tg-send-button img {width:21px;height:21px;flex:0 0 21px;display:block;pointer-events:none;}
.tg-selection-mark {display:none;position:absolute;right:-5px;bottom:-5px;width:17px;height:17px;align-items:center;justify-content:center;border:2px solid #fff;border-radius:50%;background:#229ed9;color:#fff;font-size:11px;line-height:1;}
.tg-send-button.tg-is-selected {background:#e8f7ff;border-color:#229ed9;box-shadow:0 0 0 2px #229ed9;}
.tg-is-selected .tg-selection-mark {display:flex;}
.tg-send-button.tg-is-posted {background:#f1f3f5;border-color:#d7dcde;box-shadow:none;cursor:not-allowed;opacity:.55;}
.tg-send-button.tg-is-posted img {filter:grayscale(1) opacity(.45);}
.tg-send-button:focus-visible {outline-color:#229ED9;}
.tg-send-button:disabled,
.tg-send-button.tg-is-sent {background:#f1f3f5;border-color:#d7dcde;box-shadow:none;cursor:not-allowed;opacity:.55;}
.tg-send-button:disabled img,
.tg-send-button.tg-is-sent img {filter:grayscale(1) opacity(.45);}
.vk-select-button {position:absolute;top:9px;right:9px;z-index:1;width:29px;height:29px;min-height:0;padding:3px;border:1px solid var(--line);border-radius:5px;background:#fff;box-shadow:0 1px 4px #0002;cursor:pointer;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;contain:layout paint;}
.vk-select-button[hidden] {display:none;}
.vk-select-button:hover:not(:disabled):not(.vk-is-posted) {border-color:#0077ff;box-shadow:0 2px 6px rgba(0,119,255,.25);}
.vk-select-button img {width:21px;height:21px;flex:0 0 21px;display:block;pointer-events:none;}
.vk-selection-mark {display:none;position:absolute;right:-5px;bottom:-5px;width:17px;height:17px;align-items:center;justify-content:center;border:2px solid #fff;border-radius:50%;background:#0077ff;color:#fff;font-size:11px;line-height:1;}
.vk-select-button.vk-is-selected {background:#e6f1ff;border-color:#0077ff;box-shadow:0 0 0 2px #0077ff;}
.vk-is-selected .vk-selection-mark {display:flex;}
.vk-select-button:focus-visible {outline-color:#0077ff;}
.vk-select-button:disabled,
.vk-select-button.vk-is-posted {background:#f1f3f5;border-color:#d7dcde;box-shadow:none;cursor:not-allowed;opacity:.55;}
.vk-select-button:disabled img,
.vk-select-button.vk-is-posted img {filter:grayscale(1) opacity(.45);}
.vk-select-button.vk-is-posted .vk-selection-mark {display:none !important;}
.source-help {font-size:12px;line-height:1.5;margin:8px 0 14px;}
.telegram-connection form {display:grid;gap:12px;margin:12px 0;}
.telegram-connection label {display:grid;gap:6px;margin:10px 0;}
.telegram-connection input {width:100%;min-width:0;box-sizing:border-box;}
.telegram-connection [hidden] {display:none;}
.telegram-error {color:#b42318;}
.connection summary .count {font-size:11px;margin-left:6px;}
.vk-group-item {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px;background:#f9fbf9;border:1px solid #dce5e1;border-radius:8px;flex:1 1 260px;}
.vk-group-item label {display:flex;align-items:center;gap:6px;cursor:pointer;min-width:0;flex:1;}
.vk-group-item .vk-group-wm-btn {font-size:12px;padding:4px 8px;white-space:nowrap;margin:0;}
.posting-hubs .vk-group-item {display:grid;align-items:start;gap:6px;}
.posting-group-title {display:flex;align-items:center;flex-wrap:wrap;gap:3px 8px;min-width:0;}
.posting-hubs .posting-group-title label {flex:0 1 auto;min-width:0;}
.posting-group-link {color:#0877bf;font-size:11px;text-decoration:none;overflow-wrap:anywhere;}
.posting-group-link:hover {text-decoration:underline;}
.posting-group-no-link {color:#8b99a8;font-size:11px;}
.posting-group-actions {display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding-left:24px;}
.posting-hubs .vk-group-item .posting-photo-limit {align-items:center;flex-wrap:wrap;gap:6px;padding:6px 8px;background:#edf4fa;border-radius:6px;font-size:12px;}
.posting-photo-limit select {max-width:100%;min-height:29px;padding:3px 6px;font:inherit;}
.posting-hubs .posting-group-actions .vk-group-wm-btn {margin:0;padding:2px 0;font-size:11px;}
.posting-group-hide {min-height:25px;padding:2px 7px;border:1px solid #dce5ef;border-radius:6px;background:#fff;color:#61758a;font-size:11px;cursor:pointer;}
.posting-group-hide:hover {border-color:#9db9d6;color:#2b587f;}
.posting-hidden-groups {margin:12px 0 0 34px;padding:9px 11px;border:1px solid #e0e8ef;border-radius:9px;background:#fafcfe;}
.posting-hidden-groups[hidden] {display:none;}
.posting-hidden-groups > summary {margin:0;color:#536b83;font-size:12px;font-weight:650;cursor:pointer;}
.posting-hidden-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:10px;}
.posting-hidden-item {display:flex;align-items:center;flex-wrap:wrap;gap:5px 8px;min-width:0;padding:8px;border:1px solid #e3ebf2;border-radius:7px;background:#fff;font-size:12px;overflow-wrap:anywhere;}
.posting-hidden-item > span:first-child {font-weight:650;color:#40566c;}
.posting-hidden-item > .posting-group-hide {margin-left:auto;}
@media (max-width:620px) {.posting-hidden-list {grid-template-columns:minmax(0,1fr);} .posting-hidden-groups {margin-left:34px;}}
.watermark-items-checkboxes {display:flex;flex-direction:column;gap:6px;max-height:160px;overflow-y:auto;padding:8px;border:1px solid #dce5e1;border-radius:8px;background:#fff;margin:6px 0;}
.watermark-checkbox-row {display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer;}
.watermark-checkbox-row img {width:24px;height:24px;object-fit:contain;background:#eee;border-radius:4px;}
.worker-watermark-container {margin-top:10px;}

/* Unified Watermark Center */
.watermarks-view { max-width: 1200px; margin: 0 auto; padding: 8px 0 32px; }
.watermarks-header { margin-bottom: 22px; }
.watermarks-header h2 { font-size: 22px; font-weight: 700; color: #171b18; margin: 0 0 6px; }
.watermarks-header p { margin: 0; font-size: 14px; }
.wm-hub-tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 7px 0 12px; margin-bottom: 8px; background: var(--bg-app); scrollbar-width: thin; }
.wm-hub-tab { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0; padding: 9px 14px; border: 1px solid #dce5e1; border-radius: 10px; background: #fff; color: #53635a; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.wm-hub-tab:hover { border-color: #a9c7b5; color: #1e5a3c; }
.wm-hub-tab[aria-selected="true"] { background: var(--accent-light); border-color: #a9cdb9; color: var(--accent); }
.wm-hub-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px; background: #edf1ee; color: #53635a; font-size: 11px; }
.wm-hub-tab[aria-selected="true"] .wm-hub-tab-count { background: #d5e9dc; color: var(--accent); }
.wm-hub-grid { display: block; }
.wm-hub-card { min-width: 0; background: #ffffff; border: 1px solid #dce5e1; border-radius: 14px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.wm-hub-card-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid #edf2ef; margin-bottom: 18px; }
.wm-hub-card-icon { font-size: 22px; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; background: #f0f5f2; border-radius: 10px; flex-shrink: 0; }
.wm-hub-card-head h3 { margin: 0 0 3px; font-size: 17px; font-weight: 650; color: #1f2722; }
.wm-hub-card-head .pin-hint { margin: 0; font-size: 13px; color: #5a6660; }
.wm-hub-card-icon img { width: 21px; height: 21px; object-fit: contain; }
.wm-hub-tools { margin-bottom: 14px; }
.wm-hub-tools input[type="search"] { width: min(100%, 440px); min-height: 38px; padding: 7px 11px; border: 1px solid #d4ded9; border-radius: 8px; background: #fff; font: inherit; font-size: 13px; }
.wm-hub-tools input[type="search"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wm-hub-no-match { margin: 14px 0; color: var(--muted); font-size: 13px; }
.wm-hub-accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); align-items: start; gap: 10px; }
.wm-hub-target-card { display: grid; align-items: start; gap: 6px; min-width: 0; padding: 6px 10px; background: #f9fbf9; border: 1px solid #dce5e1; border-radius: 8px; transition: border-color 0.15s, box-shadow 0.15s; }
.wm-hub-target-card:hover { border-color: #bad5c8; box-shadow: 0 3px 10px rgba(0,0,0,0.04); }
.wm-hub-target-card.is-dirty { border-color: #e0c998; }
.wm-hub-target-card .posting-group-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 650; }
.wm-hub-target-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; }
.wm-hub-current { min-width: 0; color: #64716a; font-size: 11.5px; }
.wm-hub-current strong { color: #263d30; font-weight: 650; }
.wm-hub-target-card .posting-group-actions { padding-left: 0; }
.wm-hub-target-actions { margin-left: auto; }
.wm-hub-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 31px; padding: 5px 10px; border: 1px solid #83b998; border-radius: 7px; background: #e8f5ec; color: #17663b; font-size: 12px; font-weight: 700; cursor: pointer; }
.wm-hub-toggle::after { content: '▾'; font-size: 14px; line-height: 1; }
.wm-hub-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.wm-hub-toggle:hover { border-color: #4f9e70; background: #d8efdf; }
.wm-hub-toggle:focus-visible { outline: 2px solid #17663b; outline-offset: 2px; }
.wm-hub-hidden-groups { margin-left: 0; }
.wm-hub-visibility-feedback { margin: 8px 0 0; color: #b42318; font-size: 12px; }
.wm-hub-target-controls { display: flex; flex-direction: column; gap: 12px; padding: 12px 4px 8px; border-top: 1px solid #e1ebe5; }
.wm-hub-target-controls[hidden] { display: none; }
.wm-hub-mode-select { width: 100%; height: 36px; padding: 6px 10px; border: 1px solid #d4ded9; border-radius: 7px; background: #ffffff; font-size: 13px; font-weight: 500; }
.wm-hub-single-row { display: flex; align-items: center; gap: 10px; }
.wm-hub-single-select { flex: 1; min-width: 0; height: 36px; padding: 6px 10px; border: 1px solid #d4ded9; border-radius: 7px; background: #ffffff; font-size: 13px; }
.wm-hub-thumb-preview-wrap { width: 44px; height: 36px; display: flex; align-items: center; justify-content: center; background: #eef2ef; border: 1px solid #d4ded9; border-radius: 6px; flex-shrink: 0; overflow: hidden; }
.wm-hub-thumb-preview { max-width: 38px; max-height: 30px; object-fit: contain; }
.wm-hub-items-grid, .wm-hub-video-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; max-height: 160px; overflow-y: auto; padding: 8px; border: 1px solid #dce5e1; border-radius: 8px; background: #ffffff; }
.wm-hub-checkbox-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #e5ede8; border-radius: 6px; font-size: 12px; cursor: pointer; transition: background 0.12s, border-color 0.12s; background: #fafcfa; }
.wm-hub-checkbox-item:hover { background: #f0f6f2; border-color: #bad3c5; }
.wm-hub-checkbox-item.is-checked { background: #eaf5ee; border-color: #3b9b66; font-weight: 600; color: #1e5a3c; }
.wm-hub-checkbox-item img { width: 22px; height: 22px; object-fit: contain; background: #fff; border-radius: 3px; flex-shrink: 0; }
.wm-hub-checkbox-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wm-hub-photo-block { display: flex; flex-direction: column; gap: 10px; }
.wm-hub-single-wrap[hidden], .wm-hub-items-wrap[hidden] { display: none; }
.wm-hub-apply-video-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #2e3e35; cursor: pointer; user-select: none; margin: 6px 0 2px; }
.wm-hub-apply-video-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.wm-hub-video-section { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; background: #f3f7f4; border: 1px dashed #b8d4c4; border-radius: 8px; margin-top: 4px; }
.wm-hub-video-section[hidden] { display: none; }
.wm-hub-video-header { font-size: 13px; font-weight: 700; color: #1e5a3c; }
.wm-hub-video-mode-select { width: 100%; height: 36px; padding: 6px 10px; border: 1px solid #d4ded9; border-radius: 7px; background: #ffffff; font-size: 13px; font-weight: 500; }
.wm-hub-video-single-wrap { display: flex; flex-direction: column; gap: 6px; }
.wm-hub-video-single-wrap[hidden] { display: none; }
.wm-hub-video-single-select { flex: 1; min-width: 0; height: 36px; padding: 6px 10px; border: 1px solid #d4ded9; border-radius: 7px; background: #ffffff; font-size: 13px; }
.wm-hub-video-thumb-preview { max-width: 38px; max-height: 30px; object-fit: contain; }
.wm-hub-video-items-wrap { display: flex; flex-direction: column; gap: 6px; }
.wm-hub-video-items-wrap[hidden] { display: none; }
.wm-hub-action-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.wm-hub-save-feedback { font-size: 12px; font-weight: 550; }
.wm-hub-save-feedback.is-saving { color: #55665e; }
.wm-hub-save-feedback.is-success { color: #1e7e45; }
.wm-hub-save-feedback.is-error { color: #b42318; }
.wm-hub-empty { padding: 24px; text-align: center; color: #6d7b74; font-size: 13.5px; background: #fafbfa; border-radius: 10px; border: 1px dashed #d5ded9; grid-column: 1 / -1; }
.wm-hub-presets-card #watermark-presets-panel { margin-top: 4px; }
.wm-mode-hint { display: block; min-height: 2.8em; color: #5a6660; font-size: 12px; line-height: 1.45; }
.wm-actions { align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid #edf2ef; border-bottom: 1px solid #edf2ef; }
#wm-message { min-height: 1.4em; margin: 8px 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.wm-hub-mode-label { display: grid; gap: 6px; }
.wm-hub-action-row { flex-wrap: wrap; }
@media (max-width: 768px) {
  .watermarks-view { padding: 4px 0 24px; }
  .watermarks-header h2 { font-size: 19px; }
  .watermarks-header p { font-size: 12.5px; }
  .wm-hub-card { padding: 14px 12px; }
  .wm-hub-card-head { gap: 10px; padding-bottom: 12px; margin-bottom: 14px; }
  .wm-hub-card-icon { width: 36px; height: 36px; font-size: 18px; }
  .wm-hub-card-head h3 { font-size: 15px; }
  .wm-hub-tools input[type="search"] { width: 100%; max-width: 100%; }
  .wm-hub-accounts-grid { grid-template-columns: 1fr; gap: 8px; }
  .wm-hub-target-card { padding: 10px 12px; }
  .wm-hub-items-grid, .wm-hub-video-items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wm-hub-toggle { min-height: 38px; }
}
@media (max-width: 480px) {
  .wm-heading { gap: 6px; }
  .wm-heading img { width: 58px; height: 38px; }
  .wm-preset-preview-btn span { display: none; }
  .wm-preset-preview-btn { width: 34px; min-width: 34px; padding: 6px; justify-content: center; }
  .wm-move { margin-left: auto; }
}

.worker-delete-account { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.worker-delete-account summary { color: var(--color-danger); cursor: pointer; }
.worker-delete-confirm-label { display: block; margin: 10px 0 8px; font-size: 13px; font-weight: 500; color: var(--color-danger); }
.worker-delete-confirm-label input { width: 100%; max-width: 320px; margin-top: 5px; display: block; }
.danger-text { color: var(--color-danger); }
button.danger { background: var(--color-danger); color: #ffffff; border-color: var(--color-danger); }
button.danger:hover:not(:disabled) { background: #963227; }

.telegram-bot-settings {display:grid;gap:8px;margin-top:10px;}
.telegram-bot-settings label {display:grid;gap:5px;}
.telegram-bot-settings label:has(input[type="checkbox"]) {display:flex;align-items:flex-start;gap:7px;}
.telegram-bot-settings input:not([type="checkbox"]), .telegram-bot-settings textarea {width:100%;min-width:0;box-sizing:border-box;}
.telegram-bot-settings p {margin:0;}
.telegram-bot-settings [data-bot-bindings] {overflow-wrap:anywhere;font-size:12px;}

.preview-failed { position: relative; min-height: 80px; background: #edf2ef; }
.preview-failed::after { content: 'Загрузить снова'; position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; color: #334d40; font-size: 12px; text-align: center; background: #edf2efeb; }
.preview-failed:focus-visible { outline: 3px solid #426f56; outline-offset: 2px; }
.paged-grid-more { display: flex; margin: 18px auto; min-height: 44px; max-width: 100%; }
.library-sync-status { margin: 0; padding: 5px 12px; background: #fff2cf; color: #664d00; font-size: 12px; }
