﻿@charset "utf-8";
/* CSS Document */

:root,
html[data-theme="light"] {
  color-scheme: light;

  --font-family-base: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --space-0: 0;
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 6px;
  --space-4: 8px;
  --space-5: 10px;
  --space-6: 12px;
  --space-7: 16px;
  --space-8: 20px;
  --space-9: 24px;
  --space-10: 32px;
  --space-11: 40px;

  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-control: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --font-size-2xs: 10px;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 13px;
  --font-size-lg: 14px;
  --font-size-xl: 16px;
  --font-size-2xl: 18px;
  --font-size-title: 28px;
  --line-height-tight: 1;
  --line-height-snug: 1.2;
  --line-height-normal: 1.35;
  --line-height-relaxed: 1.5;

  --control-height-xs: 23px;
  --control-height-sm: 27px;
  --control-height-md: 36px;
  --control-height-lg: 44px;
  --icon-size-sm: 14px;
  --icon-size-md: 16px;
  --icon-size-lg: 20px;

  --color-page: #F9F9F9;
  --color-surface: #FFFFFF;
  --color-surface-subtle: #FAFAFA;
  --color-surface-muted: #F3F3F3;
  --color-surface-hover: #E8E8E8;
  --color-surface-active: #D8D8D8;
  --color-border: #D8D8D8;
  --color-border-strong: #CCCCCC;
  --color-text: #454545;
  --color-text-muted: #7F7F7F;
  --color-text-subtle: #9CA3AF;
  --color-ink: #3B3B3B;
  --color-ink-hover: #5C5C5C;
  --color-on-ink: #FFFFFF;

  --color-brand: #2BBB75;
  --color-brand-hover: #27A868;
  --color-brand-active: #1B7A41;
  --color-brand-soft: #D1F5E4;
  --color-brand-soft-text: #1A3D2B;
  --color-on-brand: #092114;

  --color-success: #16A34A;
  --color-success-soft: #DCFCE7;
  --color-success-text: #166534;
  --color-warning: #D97706;
  --color-warning-soft: #FEF3C7;
  --color-warning-text: #92400E;
  --color-danger: #DC2626;
  --color-error: var(--color-danger);
  --color-danger-soft: #FEF2F2;
  --color-danger-text: #991B1B;
  --color-info: #2563EB;
  --color-info-soft: #EFF6FF;
  --color-info-text: #1D4ED8;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.35);
  --focus-ring: 0 0 0 2px rgba(43, 187, 117, 0.28);
  --export-zone-width: 379px;
  --min-tile-size: 250px;
  --progress-percent: 0%;
  --thumb-color: #808080;

  --primary-sidebar-width: 65px;
  --primary-sidebar-expanded-width: 176px;
  --secondary-sidebar-width: 120px;
  --sidebar-width: calc(var(--primary-sidebar-width) + var(--secondary-sidebar-width));

  /* Compatibility aliases for the existing portal CSS. */
  --radius: var(--radius-md);
  --border-color: var(--color-border);
  --border: 0.5px solid var(--color-border);
  --spread-border: 0.5px solid var(--color-border-strong);
  --text-main: var(--color-text);
  --text-secondary: var(--color-text-muted);
  --bg-main: var(--color-surface);
  --bg-hover-icon: var(--color-surface-hover);
  --bg-grey: var(--color-surface-muted);
  --bg-project: var(--color-surface-subtle);
  --bg-grey-light: var(--color-page);
  --bg-grey-project: var(--color-surface-subtle);
  --bg-dark: var(--color-ink);
  --bg-active: var(--color-ink-hover);
  --bg-activer: var(--color-ink-hover);
  --bg-secondary: var(--color-page);
  --bg-tertiary: var(--color-surface-muted);
  --bg-card: var(--color-surface);
  --accent: var(--color-text);
  --accent-color: var(--color-info);
  --accent-blue: var(--color-info);
  --green: var(--color-brand);
  --red: var(--color-danger-soft);
  --text-primary: var(--color-text);
  --text-muted: var(--color-text-muted);
  --muted-text: var(--color-text-muted);
  --color-border-muted: var(--color-border);
  --color-surface-overlay: var(--color-surface);
  --sidebar-green: var(--color-brand);
  --sidebar-green-dark: var(--color-brand-hover);
  --sidebar-green-soft: var(--color-brand-soft);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --color-page: #101210;
  --color-surface: #171A18;
  --color-surface-subtle: #1F2420;
  --color-surface-muted: #252B26;
  --color-surface-hover: #2F3731;
  --color-surface-active: #3A443D;
  --color-border: #343B35;
  --color-border-strong: #465047;
  --color-text: #E9EEE9;
  --color-text-muted: #A8B2AA;
  --color-text-subtle: #7E8B82;
  --color-ink: #E9EEE9;
  --color-ink-hover: #CBD6CD;
  --color-on-ink: #101210;

  --color-brand: #2BBB75;
  --color-brand-hover: #35C983;
  --color-brand-active: #6BDDA3;
  --color-brand-soft: #173B2A;
  --color-brand-soft-text: #B9F3D3;
  --color-on-brand: #081A10;

  --color-success: #4ADE80;
  --color-success-soft: #123521;
  --color-success-text: #BBF7D0;
  --color-warning: #FBBF24;
  --color-warning-soft: #3A2A0D;
  --color-warning-text: #FDE68A;
  --color-danger: #F87171;
  --color-error: var(--color-danger);
  --color-danger-soft: #3B1717;
  --color-danger-text: #FECACA;
  --color-info: #60A5FA;
  --color-info-soft: #172B4D;
  --color-info-text: #BFDBFE;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.55);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.72);
  --focus-ring: 0 0 0 2px rgba(43, 187, 117, 0.36);
}

* {
  font-family: var(--font-family-base);
}

body {
  font-family: var(--font-family-base);
}

html,
body {
  margin: 0;
  font-family: var(--font-family-base);
  background: var(--color-page);
  color: var(--text-main);
  font-size: var(--font-size-sm);
  overflow: hidden;
  /* РћРљРћРќР§РђРўР•Р›Р¬РќРћР• Р‘Р›РћРљРР РћР’РђРќРР• РџР РћРљР РЈРўРљР РЎРўР РђРќРР¦Р« */
}


/* --- 1. Р‘РђР—Рђ (РљР°СЂРєР°СЃ) --- */
/* РўРѕР»СЊРєРѕ РїРѕРІРµРґРµРЅРёРµ Рё СЃР±СЂРѕСЃ СЃС‚РёР»РµР№. Р‘РµР· С†РІРµС‚РѕРІ Рё СЂР°Р·РјРµСЂРѕРІ. */
.btn {
  border-radius: var(--radius);
  display: inline-flex;       /* inline-flex Р»СѓС‡С€Рµ РґР»СЏ РєРЅРѕРїРѕРє, С‡С‚РѕР±С‹ РѕРЅРё СЃС‚РѕСЏР»Рё РІ СЂСЏРґ */
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-base);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;      /* РќР° СЃР»СѓС‡Р°Р№, РµСЃР»Рё РєРЅРѕРїРєР° Р±СѓРґРµС‚ СЃСЃС‹Р»РєРѕР№ <a> */
  border: 1px solid transparent; /* Р РµР·РµСЂРІРёСЂСѓРµРј РјРµСЃС‚Рѕ РїРѕРґ СЂР°РјРєСѓ, С‡С‚РѕР±С‹ СЂР°Р·РјРµСЂС‹ РЅРµ РїСЂС‹РіР°Р»Рё */
  box-sizing: border-box;     /* Р’Р°Р¶РЅРѕ РґР»СЏ С‚РѕС‡РЅС‹С… СЂР°Р·РјРµСЂРѕРІ */
}

/* Р‘Р°Р·РѕРІС‹Рµ РЅР°СЃС‚СЂРѕР№РєРё РёРєРѕРЅРєРё РІРЅСѓС‚СЂРё РєРЅРѕРїРєРё */
.btn svg {
  flex-shrink: 0;
  fill: currentColor;
  /* Р Р°Р·РјРµСЂС‹ РёРєРѕРЅРєРё Р±СѓРґСѓС‚ Р·Р°РґР°РІР°С‚СЊСЃСЏ РІ РєР»Р°СЃСЃР°С… СЂР°Р·РјРµСЂРѕРІ РЅРёР¶Рµ */
}


/* --- 2. Р РђР—РњР•Р Р« (Р“РµРѕРјРµС‚СЂРёСЏ) --- */

/* S (Small) вЂ” Р’Р°С€Р° С‚РµРєСѓС‰Р°СЏ РјР°Р»РµРЅСЊРєР°СЏ РєРЅРѕРїРєР° (27px) */
.btn-sm {
  height: var(--control-height-sm);
  padding-inline: var(--space-4);
  font-size: var(--font-size-md);
  gap: var(--space-3);
}
.btn-sm svg {
  width: var(--icon-size-sm);
  height: var(--icon-size-sm);
}

/* M (Medium) вЂ” РЎС‚Р°РЅРґР°СЂС‚РЅР°СЏ РєРЅРѕРїРєР° (РїРѕРІС‹С€Рµ) */
.btn-md {
  height: var(--control-height-md);
  padding-inline: var(--space-6);
  font-size: var(--font-size-lg);
  gap: var(--space-4);
}
.btn-md svg {
  width: var(--icon-size-md);
  height: var(--icon-size-md);
}

/* L (Large) вЂ” Р‘РѕР»СЊС€Р°СЏ Р·Р°РјРµС‚РЅР°СЏ РєРЅРѕРїРєР° */
.btn-lg {
  height: var(--control-height-lg);
  padding-inline: var(--space-7);
  font-size: var(--font-size-xl);
  gap: var(--space-5);
}
.btn-lg svg {
  width: var(--icon-size-lg);
  height: var(--icon-size-lg);
}


/* --- 3. РЎРљРРќР« (Р¦РІРµС‚Р°) --- */

/* РўРµРјРЅР°СЏ (Solid) */
.btn-dark {
  background-color: var(--bg-dark);
  color: var(--color-on-ink);
}
.btn-dark:hover {
  background-color: var(--bg-active);
}

/* РЎРІРµС‚Р»Р°СЏ СЃ РѕР±РІРѕРґРєРѕР№ (Outline) */
.btn-outline {
  background-color: transparent;
  color: var(--bg-dark);
  border-color: var(--bg-dark); /* РљСЂР°СЃРёРј СЂР°РјРєСѓ */
}
.btn-outline:hover {
  background-color: var(--bg-grey);
}

/* РњРѕР¶РЅРѕ РґРѕР±Р°РІРёС‚СЊ СЃРєРѕР»СЊРєРѕ СѓРіРѕРґРЅРѕ РІР°СЂРёР°РЅС‚РѕРІ, РЅР°РїСЂРёРјРµСЂ, РђРєС†РµРЅС‚РЅР°СЏ */
.btn-primary {
  background-color: var(--green); /* Р’Р°С€ Р·РµР»РµРЅС‹Р№ РёР· РїРµСЂРµРјРµРЅРЅС‹С… */
  color: var(--color-on-brand);
}




/* --- Р“Р РЈРџРџРђ РљРќРћРџРћРљ (Split Button) --- */

.btn-group {
  display: inline-flex;       /* Р’С‹СЃС‚СЂР°РёРІР°РµРј РєРЅРѕРїРєРё РІ СЂСЏРґ */
  vertical-align: middle;
}

/* 1. РЈР±РёСЂР°РµРј СЃРєСЂСѓРіР»РµРЅРёСЏ РЅР° СЃС‚С‹РєРµ */

/* РЈ РїРµСЂРІРѕР№ РєРЅРѕРїРєРё СѓР±РёСЂР°РµРј РїСЂР°РІС‹Рµ СѓРіР»С‹ */
.btn-group > .btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* РЈ РїРѕСЃР»РµРґРЅРµР№ РєРЅРѕРїРєРё СѓР±РёСЂР°РµРј Р»РµРІС‹Рµ СѓРіР»С‹ */
.btn-group > .btn:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  
  /* Р Р°Р·РґРµР»РёС‚РµР»СЊ!
     Р”РѕР±Р°РІР»СЏРµРј С‚РѕРЅРєСѓСЋ Р»РёРЅРёСЋ СЃР»РµРІР° РѕС‚ СЃС‚СЂРµР»РєРё.
     РСЃРїРѕР»СЊР·СѓРµРј РїРѕР»СѓРїСЂРѕР·СЂР°С‡РЅС‹Р№ Р±РµР»С‹Р№, С‡С‚РѕР±С‹ Р±С‹Р»Рѕ РІРёРґРЅРѕ РЅР° С‚РµРјРЅРѕРј С„РѕРЅРµ.
     Р•СЃР»Рё С„РѕРЅ СЃРІРµС‚Р»С‹Р№ - Р»РёРЅРёСЋ РїРѕС‡С‚Рё РЅРµ Р±СѓРґРµС‚ РІРёРґРЅРѕ (РјРѕР¶РЅРѕ РЅР°СЃС‚СЂРѕРёС‚СЊ РѕС‚РґРµР»СЊРЅРѕ).
  */
  border-left: 1px solid rgba(255, 255, 255, 0.15); 
}

/* Р”Р»СЏ Outline (РєРѕРЅС‚СѓСЂРЅС‹С…) РєРЅРѕРїРѕРє Р»РѕРіРёРєР° С‡СѓС‚СЊ РґСЂСѓРіР°СЏ:
   Р§С‚РѕР±С‹ РґРІРѕР№РЅР°СЏ СЂР°РјРєР° РЅРµ Р±С‹Р»Р° Р¶РёСЂРЅРѕР№ (1px + 1px),
   СЃРґРІРёРіР°РµРј РІС‚РѕСЂСѓСЋ РєРЅРѕРїРєСѓ РІР»РµРІРѕ РЅР° 1px */
.btn-group > .btn-outline + .btn-outline {
  margin-left: -1px;
  border-left: 1px solid var(--bg-dark); /* Р’РѕР·РІСЂР°С‰Р°РµРј С†РІРµС‚ СЂР°РјРєРё */
}


/* --- РЈРўРР›РРўРђ: РљРЅРѕРїРєР° С‚РѕР»СЊРєРѕ СЃ РёРєРѕРЅРєРѕР№ --- */
/* Р§С‚РѕР±С‹ РєРІР°РґСЂР°С‚РёРє СЃРѕ СЃС‚СЂРµР»РєРѕР№ РЅРµ Р±С‹Р» С€РёСЂРѕРєРёРј, РєР°Рє РѕР±С‹С‡РЅР°СЏ РєРЅРѕРїРєР° */
.btn.btn-icon-only {
  padding-inline: 0;      /* РЈР±РёСЂР°РµРј Р±РѕРєРѕРІС‹Рµ РѕС‚СЃС‚СѓРїС‹ С‚РµРєСЃС‚Р° */
  width: 20px;            /* Р¤РёРєСЃРёСЂРѕРІР°РЅРЅР°СЏ С€РёСЂРёРЅР° */
  justify-content: center; /* Р¦РµРЅС‚СЂРёСЂСѓРµРј РёРєРѕРЅРєСѓ СЃС‚СЂРѕРіРѕ */
  padding: 0;
}

/* Р•СЃР»Рё РєРЅРѕРїРєР° Medium - С€РёСЂРёРЅР° Р±РѕР»СЊС€Рµ */
.btn-md.btn-icon-only {
  width: 36px; 
}


/* --- РќРћР’Р«Р™ Р РђР—РњР•Р : XS (Extra Small) --- */
/* Р”Р»СЏ С‚РµС… СЃР°РјС‹С… РєРЅРѕРїРѕРє 23px */
.btn-xs {
  height: var(--control-height-xs);
  font-size: var(--font-size-sm);
  padding-inline: var(--space-2);
  gap: var(--space-2);
}

/* РќР°СЃС‚СЂРѕР№РєР° РёРєРѕРЅРєРё РґР»СЏ XS */
.btn-xs svg { 
  width: 15px; /* РР»Рё 12px, Р·Р°РІРёСЃРёС‚ РѕС‚ РґРµС‚Р°Р»СЊРЅРѕСЃС‚Рё РёРєРѕРЅРєРё */
  height: 15px;
}

/* Р•СЃР»Рё РєРЅРѕРїРєР° XS РґРѕР»Р¶РЅР° Р±С‹С‚СЊ РєРІР°РґСЂР°С‚РЅРѕР№ (С‚РѕР»СЊРєРѕ РёРєРѕРЅРєР°) */
.btn-xs.btn-icon-only {
  width: 23px;
  min-width: 23px;  /* Р“Р°СЂР°РЅС‚РёСЂСѓРµРј РјРёРЅРёРјР°Р»СЊРЅСѓСЋ С€РёСЂРёРЅСѓ */
  max-width: 23px;  /* РџСЂРµРґРѕС‚РІСЂР°С‰Р°РµРј СЂР°СЃС‚СЏР¶РµРЅРёРµ */
  padding: 0;
  flex-shrink: 0;   /* РќРµ СЃР¶РёРјР°РµРј РІ flexbox */
}


/* --- РќРћР’Р«Р™ РЎРљРРќ: Ghost (РџСЂРёР·СЂР°С‡РЅР°СЏ) --- */
/* РџСЂРѕР·СЂР°С‡РЅР°СЏ, Р±РµР· СЂР°РјРѕРє. РџРѕСЏРІР»СЏРµС‚СЃСЏ С„РѕРЅ С‚РѕР»СЊРєРѕ РїСЂРё РЅР°РІРµРґРµРЅРёРё. */
.btn-ghost {
  background-color: transparent;
  color: var(--text-main);  /* Р¦РІРµС‚ РёРєРѕРЅРєРё/С‚РµРєСЃС‚Р° РїРѕ СѓРјРѕР»С‡Р°РЅРёСЋ */
  border-color: transparent; /* Р Р°РјРєР° РїСЂРѕР·СЂР°С‡РЅР°СЏ, РЅРѕ РјРµСЃС‚Рѕ Р·Р°РЅРёРјР°РµС‚ (С‡С‚РѕР±С‹ РЅРµ РїСЂС‹РіР°Р»Рѕ) */
  padding: 0;
}

.btn-ghost:hover {
  background-color: var(--border-color); /* Р¦РІРµС‚ С„РѕРЅР° РїСЂРё РЅР°РІРµРґРµРЅРёРё */
  color: var(--text-main); /* Р¦РІРµС‚ РёРєРѕРЅРєРё РїСЂРё РЅР°РІРµРґРµРЅРёРё (РјРѕР¶РЅРѕ РїРѕРјРµРЅСЏС‚СЊ, РµСЃР»Рё РЅСѓР¶РЅРѕ) */
}

/* Р’ РІР°С€РµРј РѕСЂРёРіРёРЅР°Р»Рµ Р±С‹Р»Рѕ stroke-width. 
   Р•СЃР»Рё РІР°С€Рё РёРєРѕРЅРєРё Р»РёРЅРµР№РЅС‹Рµ (outline), РґРѕР±Р°РІР»СЏРµРј СЌС‚Рѕ: */
.btn-ghost svg {
  stroke-width: 1px;
}

/* Active state for filter buttons */
.btn-ghost.filter-active {
  background-color: var(--bg-dark);  /* Black background */
  color: var(--color-on-ink);  /* White icon */
}

.btn-ghost.filter-active:hover {
  background-color: var(--bg-active);  /* Slightly lighter on hover */
  color: var(--color-on-ink);
}

/* Active state for view mode buttons (export-view-rows, export-view-compact, export-view-large) */
.btn-ghost.is-active {
  background-color: var(--bg-dark);  /* Black background */
  color: var(--color-on-ink);  /* White icon */
}

.btn-ghost.is-active:hover {
  background-color: var(--bg-active);  /* Slightly lighter on hover */
  color: var(--color-on-ink);
}

/* Disabled state for ghost buttons (gray icon, no hover effect) */
.btn-ghost.is-disabled,
.btn-ghost:disabled {
  color: var(--color-text-subtle);  /* Gray icon */
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ghost.is-disabled:hover,
.btn-ghost:disabled:hover {
  background-color: transparent;  /* No hover effect */
  color: var(--color-text-subtle);
}












.sidebar-avatar {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: var(--color-surface-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  border-bottom: var(--border);
}


.sidebar {
  grid-area: sidebar;
  position: static;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  z-index: 100;
  overflow: hidden;
}

.sidebar.has-open-language-switcher {
  z-index: 10000;
  overflow: visible;
}

.primary-sidebar {
  width: var(--primary-sidebar-width);
  min-width: var(--primary-sidebar-width);
  height: 100%;
  background: var(--sidebar-green);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  border-left: var(--border);
  box-sizing: border-box;
  overflow: hidden;
  transition: width 0.3s ease-in-out, min-width 0.3s ease-in-out;
}

.primary-sidebar.has-open-language-switcher {
  overflow: visible;
}

.sidebar-brand {
  height: 65px;
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.48);
  box-sizing: border-box;
}

.sidebar-brand-toggle {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: none;
}

.sidebar-brand-toggle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.sidebar-brand-logo-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand-logo {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: block;
}

.sidebar-brand-logo--compact {
  width: 25px;
  height: 25px;
}

.sidebar-brand-logo--expanded {
  display: none;
  width: 85px;
  height: auto;
}

.sidebar-brand-sidebar-icon {
  width: 19px;
  height: 19px;
  padding: 4px;
  display: none;
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-control);
  box-sizing: content-box;
  transition: background-color 0.16s ease-in-out, color 0.16s ease-in-out;
}

.sidebar-brand-sidebar-icon:hover,
.sidebar-brand-toggle:focus-visible .sidebar-brand-sidebar-icon {
  color: #FFFFFF;
  background: rgba(0, 0, 0, 0.16);
}

.sidebar-brand-sidebar-icon:active {
  color: #FFFFFF;
  background: rgba(0, 0, 0, 0.26);
  transition-duration: 0.08s;
}

.sidebar[data-sidebar-expanded="false"] .primary-sidebar:hover .sidebar-brand-logo--compact,
.sidebar[data-sidebar-expanded="false"] .sidebar-brand-toggle:focus-visible .sidebar-brand-logo--compact {
  display: none;
}

.sidebar[data-sidebar-expanded="false"] .primary-sidebar:hover .sidebar-brand-sidebar-icon,
.sidebar[data-sidebar-expanded="false"] .sidebar-brand-toggle:focus-visible .sidebar-brand-sidebar-icon {
  display: block;
}

.sidebar[data-sidebar-expanded="true"] .sidebar-brand-logo--compact {
  display: none;
}

.sidebar[data-sidebar-expanded="true"] .sidebar-brand-toggle {
  justify-content: space-between;
  padding-inline: 22px 18px;
}

.sidebar[data-sidebar-expanded="true"] .sidebar-brand-logo--expanded {
  display: block;
}

.sidebar[data-sidebar-expanded="true"] .sidebar-brand-sidebar-icon {
  display: block;
}

.sidebar[data-sidebar-expanded="true"] .primary-sidebar {
  width: var(--primary-sidebar-expanded-width);
  min-width: var(--primary-sidebar-expanded-width);
}

.secondary-sidebar {
  position: relative;
  width: var(--secondary-sidebar-width);
  min-width: var(--secondary-sidebar-width);
  height: 100%;
  margin-top: 0;
  background: var(--sidebar-green-soft);
  border-right: var(--border);
  border-left: var(--border);
  box-sizing: border-box;
  overflow: hidden;
}

.secondary-sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--sidebar-green-soft);
  border-bottom: 1px solid rgba(255, 255, 255, 0.48);
  box-sizing: border-box;
  pointer-events: none;
}

.global-container.creator-mode-active,
.global-container.presentation-mode-active {
  --sidebar-width: var(--primary-sidebar-width);
}

.global-container.creator-mode-active .secondary-sidebar,
.global-container.presentation-mode-active .secondary-sidebar {
  display: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.sidebar-nav--primary {
  padding: 0;
}

.sidebar-nav-btn {
  position: relative;
  width: 100%;
  height: 55px;
  min-height: 55px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-sizing: border-box;
  transition: color 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.sidebar[data-sidebar-expanded="true"] .sidebar-nav-btn {
  justify-content: flex-start;
  padding-inline: 22px 12px;
}

.sidebar-nav-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 5px;
  border-radius: 0;
  background: transparent;
}

.icon-wrapper {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: transparent;
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: currentColor;
  transition: color 0.2s ease-in-out;
}

.nav-icon-img {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
  opacity: 0.86;
  transition: opacity 0.16s ease-in-out, filter 0.16s ease-in-out;
}

.btn-text {
  font-size: 12px;
  font-weight: 600;
  color: #3B3B3B;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.sidebar .btn-text {
  color: rgba(255, 255, 255, 0.82);
}

.primary-sidebar .btn-text {
  display: none;
}

.sidebar[data-sidebar-expanded="true"] .primary-sidebar .btn-text {
  display: inline;
  opacity: 1;
  visibility: visible;
}

.sidebar-nav-btn--active {
  color: #FFFFFF;
}

.sidebar-nav-btn--active .btn-text {
  color: #FFFFFF;
}

.sidebar-nav-btn--active .nav-icon-img {
  opacity: 1;
  filter: brightness(1.12);
}

.sidebar-nav-btn--active::before {
  background: var(--color-surface);
}

.sidebar-nav-btn:hover {
  color: #FFFFFF;
}

.sidebar-nav-btn:hover .btn-text {
  color: #FFFFFF;
}

.sidebar-nav-btn:hover .nav-icon-img {
  opacity: 1;
  filter: brightness(1.16);
}

.sidebar-nav-btn:hover .icon-wrapper,
.sidebar-nav-btn--active .icon-wrapper {
  background: transparent;
}

.sidebar-nav-btn.is-disabled,
.sidebar-nav-btn:disabled {
  cursor: default;
  opacity: 0.46;
}

.sidebar-nav-btn.is-disabled:hover,
.sidebar-nav-btn:disabled:hover {
  color: rgba(255, 255, 255, 0.86);
}

.sidebar-nav-btn.is-disabled:hover .btn-text,
.sidebar-nav-btn:disabled:hover .btn-text {
  color: rgba(255, 255, 255, 0.82);
}

.sidebar-nav-btn.is-disabled:hover .nav-icon-img,
.sidebar-nav-btn:disabled:hover .nav-icon-img {
  opacity: 0.86;
  filter: none;
}

#sidebar-btn-creator {
  border-bottom: 1px solid rgba(255, 255, 255, 0.38);
}

.sidebar-nav-divider {
  width: 100%;
  height: 1px;
  margin: 0;
  background: rgba(255, 255, 255, 0.38);
}

.sidebar-spacer {
  flex: 1 1 auto;
}

.sidebar-toggle-btn {
  color: #FFFFFF;
  background: transparent;
  border: 0;
}

/* --- РЎРўРР›Р Р”Р›РЇ Р’Р•Р РҐРќР•Р™ РџРђРќР•Р›Р --- */


/* --- РЎРўРР›Р Р”Р›РЇ РћР‘Р›РђРЎРўР РЎРџР РђР’Рђ РћРў РЎРђР™Р”Р‘РђР Рђ --- */
.sidebar-subnav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  padding: 65px 0 0;
}

.sidebar-subnav[data-category-panel] {
  display: none;
}

.sidebar[data-active-category="magazines"] .sidebar-subnav[data-category-panel="magazines"] {
  display: flex;
}

.sidebar-subcategory-btn {
  width: 100%;
  height: var(--secondary-sidebar-width);
  min-height: var(--secondary-sidebar-width);
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  transition: background 0.16s ease-in-out, color 0.16s ease-in-out, opacity 0.16s ease-in-out;
}

.sidebar-subcategory-btn--active {
  background: var(--sidebar-green-soft);
}

.sidebar-subcategory-btn:hover:not(:disabled) {
  background: rgba(32, 184, 117, 0.08);
}

.sidebar-subcategory-btn.is-disabled,
.sidebar-subcategory-btn:disabled {
  cursor: default;
  opacity: 0.52;
}

.sidebar-subcategory-thumb {
  width: 85px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sidebar-subcategory-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-subcategory-thumb--icon {
  position: relative;
}

.sidebar-subcategory-thumb--icon img {
  object-fit: contain;
}

.sidebar-subcategory-thumb--icon .subcategory-icon-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sidebar-subcategory-thumb--icon .subcategory-icon-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.sidebar-subcategory-btn:hover:not(:disabled) .subcategory-icon-overlay {
  opacity: 1;
}

.sidebar-subcategory-btn.is-disabled .sidebar-subcategory-thumb img,
.sidebar-subcategory-btn:disabled .sidebar-subcategory-thumb img {
  filter: grayscale(0.35);
}

.sidebar-subcategory-label {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-main);
  text-align: center;
}

.global-container.presentation-mode-active .preferences-dropdown[data-finish-control] {
  display: none;
}

.main-layout {
  margin-left: 100px;
  /* РІРјРµСЃС‚Рѕ padding-left */
  height: 100vh;
  width: calc(100% - 100px);
  /* С‡С‚РѕР±С‹ СѓС‡РµСЃС‚СЊ С€РёСЂРёРЅСѓ СЃР°Р№РґР±Р°СЂР° */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Р±Р»РѕРєРёСЂСѓРµРј РѕР±С‰РёР№ СЃРєСЂРѕР»Р» СЃС‚СЂР°РЅРёС†С‹ */
  background-color: var(--bg-main);
}


/* --- РћР‘РќРћР’Р›Р•РќРќР«Р™ TOP-BAR --- */
.top-bar {
  grid-area: top-bar;
  flex-shrink: 0;
  background-color: var(--bg-main);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px 0 8px;
  gap: 0;
  height: 65px;
  z-index: 200; /* Above sidebar (100) */
}

.topbar-hidden-control {
  display: none !important;
}

/* Hamburger menu button */
.hamburger-menu-btn {
  /* Inherits from .icons-square-button */
  border: none !important; /* Override border from parent class */
  padding-left: 8px;
}

/* Top-bar logo */
.top-bar-logo {
  height: 20px;
  width: auto;
  display: block;
  margin-left: 10px;
}

/* Spacer to push items to the right */
.top-bar-spacer {
  flex-grow: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  height: 100%;
  flex: 0 0 auto;
  margin-left: auto;
}

.topbar-uv-scale {
  align-items: center;
  gap: var(--space-2);
}

.topbar-uv-scale-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.topbar-uv-scale-input {
  width: 62px;
  font-size: var(--font-size-sm);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  text-align: right;
}

.inline-control-label {
  margin-left: var(--space-3);
  font-size: var(--font-size-md);
  font-weight: 500;
}

.link-button {
  background: none;
  border: 0;
  color: var(--color-info);
  font-weight: 500;
  padding: 0 var(--space-4);
  cursor: pointer;
  font-size: var(--font-size-md);
}

.overflow-ellipsis-label {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.topbar-separator {
  width: 1px;
  height: 26px;
  background: var(--border-color);
}

.topbar-icon-btn,
.topbar-text-btn {
  height: 34px;
  min-width: 34px;
  border: 0;
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.16s ease-in-out, color 0.16s ease-in-out;
}

.topbar-icon-btn {
  padding: 0;
  color: var(--color-text-muted);
}

.topbar-icon-btn:hover,
.topbar-text-btn:hover {
  background: var(--bg-grey);
}

/* User profile wrapper */
.user-profile-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* User profile button */
.user-profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 12px;
  border: none;
  background: var(--color-surface);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background-color 0.2s;
}

.user-profile-btn:hover {
  background: var(--bg-grey);
}

/* User avatar */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface-active);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar-initials {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
}

/* Username */
.username {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
}

/* Credit balance badge (shown next to username) */
.credit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-width: 66px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  margin-left: 0;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.credit-badge:hover {
  background: var(--bg-grey);
  color: var(--text-main);
}
.credit-badge.credit-badge--low {
  background: var(--color-surface);
  color: var(--text-main);
}
.credit-badge.credit-badge--empty {
  background: var(--color-surface);
  color: var(--text-main);
}

.credit-menu-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.credit-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  z-index: 9999;
  box-sizing: border-box;
}

.credit-dropdown.is-open {
  display: flex;
}

.credit-dropdown-label {
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.credit-dropdown-value {
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
  color: var(--text-secondary);
}

.credit-dropdown-add {
  width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--text-secondary);
  border-radius: var(--radius);
  color: var(--text-main);
  background: var(--color-surface);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.credit-dropdown-add:hover {
  background: var(--bg-grey);
}

/* в”Ђв”Ђ Paywall Modal в”Ђв”Ђ */
.paywall-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 10002;
  display: none;
  align-items: center;
  justify-content: center;
}
.paywall-backdrop.is-visible {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}
.paywall-window {
  background: var(--bg-main, #fff);
  border-radius: 12px;
  padding: 28px 24px 20px;
  width: 420px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  animation: scaleIn 0.2s ease-out;
}
.paywall-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius, 8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary, #7F7F7F);
  transition: background-color 0.15s, color 0.15s;
}
.paywall-close:hover {
  background-color: var(--bg-grey, #F3F3F3);
  color: var(--text-main, #454545);
}
.paywall-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main, #454545);
  margin: 0;
}
.paywall-sub {
  font-size: 13px;
  color: var(--text-secondary, #7F7F7F);
  margin: 0;
}
.paywall-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.paywall-plan-mini {
  border: var(--border, 0.5px solid #D8D8D8);
  border-radius: var(--radius, 8px);
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.paywall-plan-name {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #7F7F7F);
}
.paywall-plan-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main, #454545);
}
.paywall-plan-price span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #7F7F7F);
}
.paywall-plan-credits {
  font-size: 12px;
  color: var(--text-secondary, #7F7F7F);
}
.paywall-cta {
  width: 100%;
  justify-content: center;
  text-decoration: none;
}
.paywall-cancel {
  width: 100%;
  justify-content: center;
}

/* в”Ђв”Ђ Export Lock в”Ђв”Ђ */
.is-export-locked {
  opacity: 0.6;
}
.is-export-locked .lock-icon {
  margin-right: 4px;
  flex-shrink: 0;
}

/* User profile dropdown */
.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  padding: 6px 0;
  z-index: 9999;
}

.user-profile-dropdown.is-open {
  display: flex;
}

/* User profile menu item */
.user-profile-menu-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
  color: var(--bg-dark);
  text-align: left;
  transition: background-color 0.2s;
  width: 100%;
}

.user-profile-menu-item:hover {
  background-color: var(--bg-grey-light);
}

.user-profile-menu-item--danger {
  color: var(--color-danger);
  margin-top: 6px;
}

.user-profile-menu-item--danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

/* Menu divider */
.user-profile-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}


.project-menu-bar {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  align-self: flex-end;
  background-color: transparent;
  border-bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 0 0 12px;
  gap: 25px;
  overflow: hidden;
}

.topbar-projects .btn-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: -12px;
  flex: 0 0 auto;
}


.content-wrapper {
  flex-grow: 1;
  /* <--- Р—Р°РЅРёРјР°РµС‚ РІСЃСЋ РѕСЃС‚Р°РІС€СѓСЋСЃСЏ РІС‹СЃРѕС‚Сѓ */

  /* Р”РѕР±Р°РІР»СЏРµРј РІРЅСѓС‚СЂРµРЅРЅРёРµ СЃС‚РёР»Рё РґР»СЏ С‚СЂРµС… РєРѕР»РѕРЅРѕРє */
  display: flex;
  height: 100%;
  /* Р—Р°РЅРёРјР°РµС‚ 100% РІС‹СЃРѕС‚С‹ СЂРѕРґРёС‚РµР»СЏ (РѕСЃС‚Р°РІС€РµРµСЃСЏ РјРµСЃС‚Рѕ) */


  /* РћРўРњР•РќРђ РЎРљР РћР›Р›Рђ: РѕСЃРЅРѕРІРЅРѕР№ РєРѕРЅС‚РµРЅС‚ СЃР°Рј РїРѕ СЃРµР±Рµ РЅРµ РїСЂРѕРєСЂСѓС‡РёРІР°РµС‚СЃСЏ */
  overflow: hidden;
}


/* --- РЎРўР РЈРљРўРЈР Рђ РљРћР›РћРќРћРљ (Р’РќРЈРўР Р content-wrapper) --- */
.block-a,
.block-b {
  width: 250px;
  /* Р¤РёРєСЃРёСЂРѕРІР°РЅРЅР°СЏ С€РёСЂРёРЅР° */
  flex-shrink: 0;
  /* РќРµ СЃР¶РёРјР°СЋС‚СЃСЏ */
  border-right: var(--border);
  height: 100%;
}

.scrollable-block {
  flex-grow: 1;
  /* Р—Р°РЅРёРјР°РµС‚ РІСЃРµ РѕСЃС‚Р°РІС€РµРµСЃСЏ РјРµСЃС‚Рѕ */
  height: 100%;

  /* <-- Р“Р”Р• РџР РћРРЎРҐРћР”РРў РџР РћРљР РЈРўРљРђ --> */
  overflow-y: auto;
  /* РўРѕР»СЊРєРѕ СЌС‚РѕС‚ Р±Р»РѕРє РїСЂРѕРєСЂСѓС‡РёРІР°РµС‚СЃСЏ РІРµСЂС‚РёРєР°Р»СЊРЅРѕ */

  padding: 0 20px;
  /* Р’РЅСѓС‚СЂРµРЅРЅРёРµ РѕС‚СЃС‚СѓРїС‹ РґР»СЏ РїСЂРѕРєСЂСѓС‡РёРІР°РµРјРѕРіРѕ РєРѕРЅС‚РµРЅС‚Р° */
}




.variant-menu-bar {
  grid-area: variant-menu-bar;
  flex-shrink: 0;
  height: 55px;
  flex-shrink: 0;
  background-color: var(--bg-main);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 25px;
}




/* РћР‘Р›РђРЎРўР¬, РљРћРўРћР РђРЇ Р—РђРќРРњРђР•Рў РћРЎРўРђРўРћРљ Р’Р«РЎРћРўР« */
/* project-main-content С‚РµРїРµСЂСЊ С‚РѕР»СЊРєРѕ РґР»СЏ РІРµСЂС…РЅРµРіРѕ РіРѕСЂРёР·РѕРЅС‚Р°Р»СЊРЅРѕРіРѕ СЂСЏРґР° */
.project-main-content {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  width: 100%;
  box-sizing: border-box;
  min-height: 0;
}

.project-current-view {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* --- 3. Р’Р•Р РҐРќРР™ Р РЇР” РЎ РљРћР›РћРќРљРђРњР (Horizontal Row) --- */
.project-top-columns {
  flex-grow: 1;
  display: flex;
  gap: 10px;
}




.templates-gallery-header,
.template-settings-zone {
  flex-shrink: 0;
  /* Р¤РёРєСЃРёСЂРѕРІР°РЅРЅР°СЏ РІС‹СЃРѕС‚Р° */
  height: 30px;
  /* РџСЂРёРјРµСЂ РІС‹СЃРѕС‚С‹ */
  /* ... СЃС‚РёР»Рё ... */

}

.templates-gallery-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* СЃРєСЂРѕР»Р» РёРјРµРЅРЅРѕ РІРЅСѓС‚СЂРё */
  padding-right: 20px;
  padding-top: 20px;
  padding-left: 20px;
}




/* --- РЎРўР РЈРљРўРЈР Рђ РљРћР›РћРќРћРљ (Template Zone Top Row) --- */

.template-zone-top-row {
  display: flex;
}


/* --- Р‘Р›РћРљР Р’РќРЈРўР Р Р“РћР РР—РћРќРўРђР›Р¬РќРћР“Рћ Р РЇР”Рђ --- */
.file-picker-zone {
  grid-area: file-picker-zone;
  width: 415px;
  /* РєР°Рє Рё Р±С‹Р»Рѕ */
  flex-shrink: 0;
  background-color: var(--bg-project);
  border-bottom: var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}





/* РЎС‚Р°С‚СѓСЃ Р±Р°СЂ РІРЅРёР·Сѓ Р·РѕРЅС‹ РІС‹Р±РѕСЂР° С„Р°Р№Р»РѕРІ */
.status-bar-container {
  height: 40px;
  border-bottom: var(--border);
  background-color: var(--bg-grey-light);
  display: flex;
  align-items: center;
  gap: 20px;

  font-size: 12px;
  flex-direction: row;
}

.active-spreads-number {
  padding-left: 60px;
  width: auto;
}

.previous-next {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-right: 20px;
}

.previous-next-label {
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--color-text-muted);
}

.previous-next .icons-square-button {
  width: 24px;
  height: 24px;
  padding-inline: 0;
}







.template-preview-zone {
  grid-area: template-preview-zone;
  flex-shrink: 0;
  background-color: var(--bg-project);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-left: var(--border);
  border-bottom: var(--border);
  height: 100%;
  box-sizing: border-box;
}




.preview-box {
  background-color: #fbff08;
  border-radius: var(--radius);
  border: var(--border);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* РџР›РђР’РќРђРЇ РЁРР РРќРђ */
  transition: width 0.25s ease;
}



/* Р±РѕР»СЊС€РѕРµ РїСЂРµРІСЊСЋ РїРѕ СѓРјРѕР»С‡Р°РЅРёСЋ */
.preview-box--large {
  width: 350px;
  aspect-ratio: 1 / 1;
}

/* РєРѕРјРїР°РєС‚РЅРѕРµ РїСЂРµРІСЊСЋ */
.preview-box--small {
  width: 232px;
  /* РїРѕРґР±РµСЂРё РїРѕРґ СЃРµР±СЏ */
  aspect-ratio: 1 / 1;
}


.preview-image-content {
  width: 100%;
  height: 100%;
  /* Р—Р°РїРѕР»РЅСЏРµС‚ РІРµСЃСЊ РєРІР°РґСЂР°С‚РЅС‹Р№ СЂРѕРґРёС‚РµР»СЊ */
  object-fit: contain;
  /* Р’РїРёСЃС‹РІР°РµС‚СЃСЏ, СЃРѕС…СЂР°РЅСЏСЏ РїСЂРѕРїРѕСЂС†РёРё (РєРІР°РґСЂР°С‚РЅР°СЏ РѕР±Р»Р°СЃС‚СЊ) */
  display: block;
  aspect-ratio: 1 / 1;
  /* РЈР±РµР¶РґР°РµРјСЃСЏ, С‡С‚Рѕ РѕР±Р»Р°СЃС‚СЊ РёР·РѕР±СЂР°Р¶РµРЅРёСЏ РєРІР°РґСЂР°С‚РЅР°СЏ */
}


/* --- РЎРўРР›Р Р”Р›РЇ РљРќРћРџРљР (РћСЃС‚Р°СЋС‚СЃСЏ С‚Р°РєРёРјРё Р¶Рµ) --- */
.top-right-button {
  position: absolute;
  top: 10px;
  right: 10px;
  /* ... РѕСЃС‚Р°Р»СЊРЅС‹Рµ СЃС‚РёР»Рё РєРЅРѕРїРєРё ... */
}


.project-zone-wrapper {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.content-area-wrapper {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  /* СЃРІРµСЂС…Сѓ РјРѕРєР°Рї, РЅРёР¶Рµ РіР°Р»РµСЂРµСЏ */
  overflow: hidden;
  min-height: 0;
  /* С‡С‚РѕР±С‹ РґРµС‚Рё РјРѕРіР»Рё СЃР¶РёРјР°С‚СЊСЃСЏ */
}






/* 1. РЎРўРР›Р¬ РўР•РљРЎРўРђ (H2 GREY) */
.zone-label-text {
  /* Р—Р°РґР°РЅРЅС‹Рµ РІР°РјРё СЃС‚РёР»Рё */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-size: 14px;
  line-height: 14px;
  letter-spacing: -0.01em;
  color: var(--bg-dark);

}

/* 2. РЎРўРР›Р¬ РџРћР—РР¦РРћРќРР РћР’РђРќРРЇ */
.zone-label {
  position: absolute;
  top: 17px;
  left: 20px;
  z-index: 10;

}

.label-secondary-text {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-size: 15px;
  line-height: 15px;
  letter-spacing: -0.01em;
  color: var(--bg-active);

}



/* РџСЂРѕРµРєС‚С‹ */

.project-tab {
  position: relative;
  /* РѕР±СЏР·Р°С‚РµР»СЊРЅРѕ! */
  height: 30px;
  padding: 0 14px;
  background: none;
  border: none;
  font-weight: 600;
  font-size: 16px;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 6px;
  /* РЅР° РІСЃСЏРєРёР№ СЃР»СѓС‡Р°Р№ СЃР±СЂР°СЃС‹РІР°РµРј */
  position: relative;

}

.project-tab:hover {
  color: var(--bg-dark);
  background-color: var(--bg-grey-light);
}

.project-tab--selected {
  color: var(--bg-dark);
  font-weight: 700;
}

.project-tab--selected::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 4px;
  background: var(--bg-dark);
  border-radius: 0;/
}

.project-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: var(--border);
  background: var(--color-surface);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.project-add-plus {
  font-size: 16px;
  font-weight: 700;
}

.project-add-label {
  font-weight: 500;
}

.project-tab+.project-tab::before,
.project-tab+.project-tab--selected::before,
.project-tab--selected+.project-tab::before {
  content: "";
  position: absolute;
  left: -10px;
  /* СЃРјРµС‰Р°РµРј Р»РёРЅРёСЋ РІРЅСѓС‚СЂСЊ РјРµР¶РґСѓ РєРЅРѕРїРєР°РјРё */
  top: 25%;
  height: 50%;
  width: 1px;
  background-color: var(--color-border);
}

/* Project tab inline input for renaming */
.project-tab-input {
  width: 120px;
  padding: 2px 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border-color, #DADADA);
  border-radius: 4px;
  outline: none;
  background: var(--color-surface);
}

.project-tab-input:focus {
  border-color: var(--bg-dark, #333333);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Project context menu (right-click) */
.project-context-menu {
  position: fixed;
  background: var(--color-surface);
  border: 1px solid var(--border-color, #DADADA);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  min-width: 160px;
  padding: 6px 0;
  overflow: hidden;
}

.project-context-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  transition: background-color 0.15s ease;
}

.project-context-menu-item:hover {
  background-color: var(--bg-grey-light, #F5F5F5);
}

.project-context-menu-item--danger {
  color: #E53935;
}

.project-context-menu-item--danger:hover {
  background-color: #FFEBEE;
}


/* Р’Р°СЂРёР°РЅС‚С‹ */

.variant-tab {
  position: relative;
  height: 30px;
  padding: 0 14px;
  background: none;
  border: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 6px;
  position: relative;
}

.variant-tab--selected {
  color: var(--bg-dark);
  font-weight: 700;
}

.variant-tab--selected::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 3px;
  background: var(--bg-dark);
  border-radius: 0;/
}

.variant-tab:hover {
  color: var(--bg-dark);
  background-color: var(--bg-grey-light);
}

.variants-actions {
  display: flex;
  gap: 4px;
}

.variant-tab+.variant-tab::before,
.variant-tab+.variant-tab--selected::before,
.variant-tab--selected+.variant-tab::before {
  content: "";
  position: absolute;
  left: -4px;
  /* СЃРјРµС‰Р°РµРј Р»РёРЅРёСЋ РІРЅСѓС‚СЂСЊ РјРµР¶РґСѓ РєРЅРѕРїРєР°РјРё */
  top: 25%;
  height: 50%;
  width: 1px;
  background-color: var(--color-border);
}




/* Р¦РІРµС‚РѕРІС‹Рµ РєРѕРЅС‚СЂРѕР»С‹ РІРЅСѓС‚СЂРё color-picker-menu - РЈР”РђР›Р•РќРћ, РёСЃРїРѕР»СЊР·СѓРµС‚СЃСЏ РѕРїСЂРµРґРµР»РµРЅРёРµ РЅРёР¶Рµ (СЃС‚СЂРѕРєР° ~1877) */

.button-small {
  /* 1. Р’РєР»СЋС‡Р°РµРј Flexbox, С‡С‚РѕР±С‹ Р·Р°СЂР°Р±РѕС‚Р°Р»Рѕ РІС‹СЂР°РІРЅРёРІР°РЅРёРµ */
  display: flex;
  width: 23px;
  height: 23px;
  padding: 0;
  background-color: transparent;
  border: none;
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  stroke-width: 1.3px;
  transition: background-color 0.2s ease-in-out, stroke 0.2s ease-in-out;
}


.button-small:hover {
  background-color: var(--border-color);
  transition: color 0.2s ease-in-out, stroke 0.2s ease-in-out;
}


/* Р°РєС‚РёРІРЅС‹Р№ СЃРІРѕС‚С‡ - РЈР”РђР›Р•РќРћ, РёСЃРїРѕР»СЊР·СѓРµРј РѕРїСЂРµРґРµР»РµРЅРёРµ РЅРёР¶Рµ РІ СЃС‚СЂРѕРєРµ ~1944 */

/* РѕРїС†РёРѕРЅР°Р»СЊРЅРѕ: Р»С‘РіРєРёР№ РѕР±РІРѕРґ РїСЂРё С…РѕРІРµСЂРµ */
.color-swatch-btn:hover {
  outline: 1px solid #b0b0b0;
}


.templates-gallery-container {
  grid-area: templates-gallery-container;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  background-color: var(--color-surface);
  padding-left: 0px;
  padding-right: 0px;
  border-left: var(--border);
  border-bottom: var(--border);
  height: 100%;
  border-right: var(--border);
}


#templates-empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary, #888);
  font-size: 14px;
}

.templates-gallery-zone {
  grid-area: templates-gallery-zone;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--min-tile-size, 250px), 1fr));
  /* С„РёРєСЃРёСЂРѕРІР°РЅРЅР°СЏ С€РёСЂРёРЅР° РїР»РёС‚РѕРє */
  justify-content: flex-start;
  gap: 20px;
  padding: 0px;
}



.template-image {
  aspect-ratio: 1 / 1;
  /* РІСЃРµРіРґР° РєРІР°РґСЂР°С‚ */
  background-color: var(--color-surface-active);
  border-radius: var(--radius);
  border: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}




.gallery-zone {
  grid-area: gallery-zone;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 200px));
  justify-content: start;
  padding: 14px 10px 14px 14px;
  align-content: start;
  overflow-y: auto;
  background: var(--bg-project);
}


.empty-gallery-message {
  /* Р¦РµРЅС‚СЂРёСЂСѓРµРј Р±Р»РѕРє */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  /* РћС„РѕСЂРјР»РµРЅРёРµ */
  color: var(--text-secondary);
  /* РР»Рё Р»СЋР±РѕР№ РґСЂСѓРіРѕР№ С†РІРµС‚ */
  font-size: 1.2em;
  text-align: center;

  /* Р’Р°Р¶РЅРѕ: С‡С‚РѕР±С‹ РЅРµ РїРµСЂРµС…РІР°С‚С‹РІР°Р» РєР»РёРєРё РїРѕРґ СЃРѕР±РѕР№ */
  pointer-events: none;
}

.gallery-image {
  width: 120px;
  aspect-ratio: 1 / 1;
  background-color: transparent;
  /* С„РѕРЅ Р·Р°РґР°С‘Рј РёР· JS */
  border-radius: var(--radius);
  border: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;

}





.preferences-tab {
  position: relative;
  height: 30px;
  padding: 0 14px;
  background-color: transparent;
  border: none;
  font-weight: 400;
  font-size: 12px;
  color: var(--bg-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 6px;
  gap: 6px;
}

.preferences-tab__icon {
  flex-shrink: 0;
}

.preferences-tab:hover,
.preferences-tab--selected {
  background-color: var(--bg-grey);
  /* #F3F3F3 вЂ“ Р±СѓРґРµС‚ Р·Р°РјРµС‚РЅРµРµ */
}

.preferences-tab--selected::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -13px;
  height: 4px;
  border-radius: 0;
}

.preferences-actions {
  display: flex;
  gap: 4px;
}

.preferences-actions .preferences-dropdown+.preferences-dropdown::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 25%;
  height: 50%;
  width: 1px;
  background-color: var(--color-border);
}

.dropdown {
  position: absolute;
  display: inline-block;
}


/* Р’С‹РїР°РґР°СЋС‰РµРµ РјРµРЅСЋ РїСЂРµРґРїРѕС‡С‚РµРЅРёР№ */

/* РћР±С‘СЂС‚РєР° РґР»СЏ РєРЅРѕРїРєРё СЃ РјРµРЅСЋ */
.preferences-dropdown {
    position: relative;       /* РЎРѕС…СЂР°РЅСЏРµРј РґР»СЏ РїРѕР·РёС†РёРѕРЅРёСЂРѕРІР°РЅРёСЏ РїРѕР»РѕСЃРѕРє Рё РјРµРЅСЋ */
    display: flex;            /* Р’РєР»СЋС‡Р°РµРј С„Р»РµРєСЃ-РєРѕРЅС‚РµР№РЅРµСЂ */
    align-items: center;      /* Р’С‹СЂР°РІРЅРёРІР°РµРј СЃРѕРґРµСЂР¶РёРјРѕРµ (РєРЅРѕРїРєСѓ) РїРѕ С†РµРЅС‚СЂСѓ РїРѕ РІРµСЂС‚РёРєР°Р»Рё */
    height: 100%;             /* Р“Р°СЂР°РЅС‚РёСЂСѓРµРј, С‡С‚Рѕ Р±Р»РѕРє Р·Р°РЅРёРјР°РµС‚ РІСЃСЋ РІС‹СЃРѕС‚Сѓ Р±Р°СЂР° */
}

/* РљРЅРѕРїРєР°-РґСЂРѕРїРґР°СѓРЅ: С‡СѓС‚СЊ Р±РѕР»СЊС€Рµ РїР°РґРґРёРЅРі СЃРїСЂР°РІР° РїРѕРґ СЃС‚СЂРµР»РєСѓ */




/* Р’С‹РїР°РґР°СЋС‰РµРµ РјРµРЅСЋ */
.preferences-menu {
  position: absolute;
  right: auto;
  top: 100%;
  margin-top: 4px;
  min-width: 160px;

  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-md);

  padding: 4px 0;
  display: none;
  z-index: 9999; /* High z-index to overlay all other content */
}

/* РџСѓРЅРєС‚С‹ РјРµРЅСЋ */
.preferences-menu-item {
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
  color: var(--bg-dark);
}

.preferences-menu-item:hover {
  background: var(--bg-grey-light);
}

/* РљРѕРіРґР° РґСЂРѕРїРґР°СѓРЅ РѕС‚РєСЂС‹С‚ */
.preferences-dropdown.open {
  z-index: 9999; /* Boost parent when open to create proper stacking context */
}

.preferences-dropdown.open .preferences-menu {
  display: block;
}

.language-switcher.preferences-dropdown {
  height: auto;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  z-index: 50;
}

.language-switcher__trigger.preferences-tab {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--bg-dark);
}

.language-switcher__trigger.preferences-tab:hover,
.language-switcher.open .language-switcher__trigger.preferences-tab {
  background: var(--bg-grey);
}

.language-switcher__icon {
  width: 22px;
  height: 22px;
  display: block;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 50%;
}

.language-switcher__menu.preferences-menu {
  min-width: 170px;
}

.language-switcher__item.preferences-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.language-switcher__item.is-active {
  font-weight: 600;
}

.language-switcher__label {
  white-space: nowrap;
}

.theme-switcher {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--bg-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
  box-sizing: border-box;
  transition: background-color 0.16s ease-in-out;
}

.theme-switcher__icon {
  width: 22px;
  height: 22px;
  display: block;
  flex: 0 0 auto;
}

.theme-switcher__icon--dark {
  display: none;
}

html[data-theme="dark"] .theme-switcher__icon--light {
  display: none;
}

html[data-theme="dark"] .theme-switcher__icon--dark {
  display: block;
}

html[data-theme="light"] .theme-switcher:hover .theme-switcher__icon--light,
html[data-theme="light"] .theme-switcher:focus-visible .theme-switcher__icon--light {
  display: none;
}

html[data-theme="light"] .theme-switcher:hover .theme-switcher__icon--dark,
html[data-theme="light"] .theme-switcher:focus-visible .theme-switcher__icon--dark {
  display: block;
}

html[data-theme="dark"] .theme-switcher:hover .theme-switcher__icon--dark,
html[data-theme="dark"] .theme-switcher:focus-visible .theme-switcher__icon--dark {
  display: none;
}

html[data-theme="dark"] .theme-switcher:hover .theme-switcher__icon--light,
html[data-theme="dark"] .theme-switcher:focus-visible .theme-switcher__icon--light {
  display: block;
}

.theme-switcher__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.theme-switcher--sidebar {
  align-self: center;
  margin: 0 0 11px;
  background: rgba(255, 255, 255, 0.16);
}

.sidebar[data-sidebar-expanded="true"] .theme-switcher--sidebar {
  align-self: flex-start;
  margin-left: 22px;
}

.theme-switcher--sidebar:hover,
.theme-switcher--sidebar:focus-visible {
  background: rgba(255, 255, 255, 0.24);
}

.theme-switcher--sidebar:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.language-switcher--sidebar {
  align-self: center;
  margin: 0 0 12px;
}

.sidebar[data-sidebar-expanded="true"] .language-switcher--sidebar {
  align-self: flex-start;
  margin-left: 22px;
}

.language-switcher--sidebar .language-switcher__trigger.preferences-tab {
  background: rgba(255, 255, 255, 0.16);
}

.language-switcher--sidebar .language-switcher__trigger.preferences-tab:hover,
.language-switcher--sidebar.open .language-switcher__trigger.preferences-tab {
  background: rgba(255, 255, 255, 0.24);
}

.language-switcher--sidebar .language-switcher__menu.preferences-menu {
  left: calc(100% + 8px);
  right: auto;
  top: auto;
  bottom: 0;
}

.language-switcher--auth .language-switcher__menu.preferences-menu {
  left: auto;
  right: 0;
}


/* ---- Shadow toggle (РўРµРЅСЊ СЂР°Р·РґРµР»СЊРЅРѕ) ---- */
.shadow-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  user-select: none;
}
.shadow-toggle:hover {
  background-color: var(--bg-grey);
}
.shadow-toggle__input {
  display: none;
}
.shadow-toggle__track {
  position: relative;
  width: 34px;
  height: 20px;
  background: var(--color-border-strong);
  border-radius: 10px;
  transition: background 0.18s;
  flex-shrink: 0;
}
.shadow-toggle__input:checked ~ .shadow-toggle__track {
  background: var(--green);
}
.shadow-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--color-surface);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s;
}
.shadow-toggle__input:checked ~ .shadow-toggle__track .shadow-toggle__thumb {
  transform: translateX(14px);
}
.shadow-toggle__label {
  font-size: 12px;
  color: var(--bg-dark);
  white-space: nowrap;
}


.preferences-tab--editable {
  display: flex;
  align-items: center;
  padding: 0 26px 0 10px;
  /* СЃР»РµРІР° С‚РµРєСЃС‚, СЃРїСЂР°РІР° СЃС‚СЂРµР»РєР° */
  cursor: pointer;
}

.preferences-input {
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 0;
  margin: 0;
  width: 70px;
  /* РёР»Рё Р±РѕР»СЊС€Рµ/РјРµРЅСЊС€Рµ РїРѕ РІРєСѓСЃСѓ */
  outline: none;
  cursor: text;
}


/* Р§С‚РѕР±С‹ Р±РµР· С„РѕРєСѓСЃРѕРІ РЅРµ Р±С‹Р»Рѕ РІРёРґРЅРѕ, С‡С‚Рѕ СЌС‚Рѕ input */
.preferences-tab--editable:not(:hover) .preferences-input {
  caret-color: transparent;
  /* РєСѓСЂСЃРѕСЂ РІРІРѕРґР° РЅРµ РІРёРґРµРЅ, РїРѕРєР° РЅРµ РЅР°РІРµР»Рё */
}

/* РџСЂРё С„РѕРєСѓСЃРµ РІСЃС‘-С‚Р°РєРё С…РѕС‚СЊ РєР°Рє-С‚Рѕ РїРѕРґСЃРІРµС‚РёС‚СЊ */
.preferences-input:focus {
  caret-color: auto;
  /* РЅРѕСЂРјР°Р»СЊРЅС‹Р№ РєР°СЂРµС‚ */
}

.upload-container {
  display: flex;
  /* РђРєС‚РёРІРёСЂСѓРµРј Flexbox */
  gap: 0px;
  /* Р”РѕР±Р°РІР»СЏРµРј РЅРµР±РѕР»СЊС€РѕР№ РѕС‚СЃС‚СѓРї РјРµР¶РґСѓ РєРѕР»РѕРЅРєР°РјРё */
  width: 100%;
  /* Р—Р°РЅРёРјР°РµРј РІСЃСЋ РґРѕСЃС‚СѓРїРЅСѓСЋ С€РёСЂРёРЅСѓ */
  height: 230px;
  /* РџСЂРёРјРµСЂ РІС‹СЃРѕС‚С‹ */
  padding-top: 20px;
}

.upload-controls {
  width: 60px;
  /* РЈР·РєР°СЏ С„РёРєСЃРёСЂРѕРІР°РЅРЅР°СЏ С€РёСЂРёРЅР° */
  height: 100%;
  flex-shrink: 0;
  /* Р’Р°Р¶РЅРѕ: РїСЂРµРґРѕС‚РІСЂР°С‰Р°РµС‚ СЃР¶Р°С‚РёРµ РєРѕР»РѕРЅРєРё */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 0px 0;


}

.upload-files {
  flex-grow: 1;
  /* РљР›Р®Р§Р•Р’РћР• РЎР’РћР™РЎРўР’Рћ: Р—Р°РЅРёРјР°РµС‚ РІСЃСЋ РґРѕСЃС‚СѓРїРЅСѓСЋ РѕСЃС‚Р°РІС€СѓСЋСЃСЏ С€РёСЂРёРЅСѓ */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  padding-right: 20px;
}


.icons-dropzone {
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--color-surface-subtle);
  padding-inline: 4px;
  stroke-width: 0.5;
}

.icons-dropzone:hover {
  background-color: var(--color-surface-hover);
}

.icons-dropzone:active {
  background-color: var(--bg-active);
  color: var(--bg-grey);
}

.icons-dropzone--selected {
  background-color: var(--bg-active);
  color: var(--bg-project);
  border-radius: var(--radius);
  width: 27px;
  height: 27px;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  padding-inline: 4px;
  stroke-width: 1;
}

.icons-dropzone--selected:hover {
  background-color: var(--bg-dark);
  color: var(--bg-project);
}

.icons-dropzone--selected:active {
  background-color: var(--bg-active);
  color: var(--bg-project);
}

.icons-square-button {
  width: 27px;
  height: 27px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-main);
  padding-inline: 4px;
  stroke-width: 0.5;
}

.icons-square-button:hover {
  background-color: var(--bg-hover-icon);
}

.icon-tooltip {
  position: fixed;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.2;
  border-radius: 4px;
  background-color: #222;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  pointer-events: none;
  /* РљР РРўРР§РќРћ: С‚СѓР»С‚РёРї РЅРµ СѓС‡Р°СЃС‚РІСѓРµС‚ РІ hover */
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.1s ease;
  z-index: 2000;
}

.icons-square-button:active {
  background-color: var(--bg-active);
  color: var(--bg-grey);
}


.icon-group,
.icon-group-bottom {
  display: flex;
  flex-direction: column;
  /* Р Р°Р·РјРµС‰Р°РµРј РёРєРѕРЅРєРё РІРµСЂС‚РёРєР°Р»СЊРЅРѕ РІРЅСѓС‚СЂРё РіСЂСѓРїРїС‹ */
  gap: 3px;
  align-items: center;
}

.dropzone {
  position: relative;
  border: 0.5px solid #888888;
  border-radius: 2px;
  display: grid;
  height: 100%;
  width: 100%;
  place-items: center;
  color: var(--color-text-subtle);
  font-size: 13px;
  text-align: center;
  background: var(--color-surface-active);
  cursor: pointer;

}

.dropzone.has-image {
  color: transparent;
  /* РїСЂСЏС‡РµС‚ С‚РµРєСЃС‚ "РќР°Р¶РјРёС‚Рµ..." РєРѕРіРґР° РµСЃС‚СЊ РєР°СЂС‚РёРЅРєР° */

}

.dropzone-clear-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
}

.red-bg {}

.red-bg:hover {
  background-color: rgb(247, 157, 157);
}

.red-bg:active {
  background-color: rgb(248, 68, 68);
}

.icon-size {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}




.template-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  /* РєРІР°РґСЂР°С‚РЅР°СЏ РїР»РёС‚РєР° */
  border-radius: var(--radius);
  border: var(--border);
  background-color: var(--color-surface-active);
  /* РїРѕС‚РѕРј РїРµСЂРµРєСЂРѕРµС‚СЃСЏ JS'РѕРј */
  overflow: hidden;
  container-type: inline-size;
  container-name: template-tile;
}


.icons-square-button {
  width: 27px;
  height: 27px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-main);
  padding-inline: 4px;
  stroke-width: 0.5;
  transition: background-color 0.2s ease-in-out;
}



.template-item:hover {
  box-shadow: 3px 5px 5px rgb(236, 236, 236);
  border: 0.5px solid #aaaaaa;
  cursor: default;
}

/* Drag handles: hand cursor on draggable tiles */
.template-item--draggable:hover {
  cursor: grab;
}

.template-item--draggable:active {
  cursor: grabbing;
}

.template-item:hover .color-lock-button {
  opacity: 1;

}

/* РљРЅРѕРїРєР° Р·Р°РјРєР° РІ РїСЂР°РІРѕРј РІРµСЂС…РЅРµРј СѓРіР»Сѓ РїР»РёС‚РєРё */
.color-lock-button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 27px;
  height: 27px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.color-pick-button {
  position: absolute;
  top: 6px;
  right: 36px;
  width: 27px;
  height: 27px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}





.color-lock-button--locked {
  opacity: 1 !important;
  background-color: var(--bg-dark);
  color: #FFFFFF;
}

/* Favorite star button - mirrors lock button positioning but on left side */
.color-favorite-button {
  position: absolute;
  top: 6px;
  left: 6px;  /* Left side instead of right */
  width: 27px;
  height: 27px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}

/* Show on hover (same pattern as lock button) */
.template-item:hover .color-favorite-button {
  opacity: 1;
}

/* Active state: always visible with yellow background */
.color-favorite-button--favorited {
  opacity: 1 !important;
  background-color: #FFD700;  /* Yellow for favorited state */
  color: #454545;  /* Dark icon on yellow background */
  transition: none !important;  /* Disable transition for favorited state - instant visibility */
}

/* Force override - highest specificity for favorited state */
.template-item .color-favorite-button.color-favorite-button--favorited {
  opacity: 1 !important;
  transition: none !important;  /* Disable transition - instant visibility */
}

/* РІСЃРµ IMG РІРЅСѓС‚СЂРё template-item вЂ” СЃР»РѕРё РјРѕРєР°РїР° */
.template-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* СЃР°Рј template-image РїСЂРµРІСЂР°С‰Р°РµРј РІ РѕР±СЉРµРєС‚РЅС‹Р№ СЃР»РѕР№: Р±РµР· СЃРІРѕРµРіРѕ С„РѕРЅР°/Р±РѕСЂРґРµСЂР° */
.template-item .template-image {
  background-color: transparent !important;
  border: none;
  transition: transform 0.3s ease;
  display: block;
  width: 100%;
  height: auto;
}

/* Р§РµРєР±РѕРєСЃ РІРЅРёР·Сѓ СЃР»РµРІР° */
.template-checkbox {
  position: absolute;
  left: 6px;
  bottom: 6px;
}

/* Hidden template during filtering */
.template-item.filtered-hidden {
  display: none;
}

.button-text-light {
  color: var(--color-ink-hover);
  width: fit-content;
  height: 27px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-main);
  padding-inline: 4px;

}

.button-text-dark {
  color: var(--bg-grey);
  width: fit-content;
  height: 27px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-dark);
  padding-inline: 8px;
  border: 0;
  gap: 6px;
  transition: background-color 0.2s ease-in-out ;
}

.button-text-dark svg {
  width: 14px;        /* РљРЅРѕРїРєР° РЅРµРІС‹СЃРѕРєР°СЏ (27px), РёРєРѕРЅРєСѓ Р±РµСЂРµРј РЅРµР±РѕР»СЊС€СѓСЋ */
  height: 14px;
  fill: currentColor; /* РРєРѕРЅРєР° РІРѕР·СЊРјРµС‚ С†РІРµС‚ С‚РµРєСЃС‚Р° (var(--bg-grey)) */
  flex-shrink: 0;     /* Р§С‚РѕР±С‹ РёРєРѕРЅРєСѓ РЅРµ СЃРїР»СЋС‰РёР»Рѕ, РµСЃР»Рё С‚РµРєСЃС‚ РґР»РёРЅРЅС‹Р№ */
}



.button-text-dark:hover {
  background-color: var(--bg-active);
  transition: background-color 0.2s ease-in-out;
}

.button-text-green {
  color: var(--color-on-brand);
  width: fit-content;
  height: 27px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--green);
  padding-inline: 8px;
  border: 0;
  gap: 6px;
  transition: background-color 0.2s ease-in-out;
}

.button-text-green svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.button-text-green:hover {
  background-color: var(--color-brand-hover); /* Darker green on hover */
  transition: background-color 0.2s ease-in-out;
}

.button-xl-text-dark {
  color: var(--bg-grey);
  width: fit-content;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-dark);
  padding-inline: 8px;
  border: 0;
  transition: background-color 0.2s ease-in-out ;
}

.button-xl-text-dark:hover {
  background-color: var(--bg-active);
  transition: background-color 0.2s ease-in-out;
}

/* Cancel-export button state */
.is-export-cancel {
  background-color: #c0392b !important;
  color: #fff !important;
  border-color: #c0392b !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

.is-export-cancel:hover {
  background-color: #e74c3c !important;
}

.button-xl-text-light {
  color: var(--bg-dark);
  width: fit-content;
  height: 36px;
  border-radius: var(--radius);
  border-color: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-main);
  padding-inline: 8px;
  transition: background-color 0.2s ease-in-out ;
}

.button-xl-text-light:hover {
  background-color: var(--bg-project);
  transition: background-color 0.2s ease-in-out;
}






/* Wrapper for both buttons */
.template-actions-wrapper {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.template-item:hover .template-actions-wrapper {
  opacity: 1;
}

/* Queue button (black) */
.template-add-btn {
  color: var(--bg-grey);
  width: fit-content;
  height: 27px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-dark);
  padding-inline: 8px;
  border: 0;
  gap: 6px;
  transition: background-color 0.2s ease-in-out;
}

.template-add-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.template-add-btn:hover {
  background-color: var(--bg-active);
}

.btn-credit-cost {
  font-size: 11px;
  opacity: 0.7;
  margin-left: 2px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Download button (green) */
.template-download-btn {
  color: #FFFFFF;
  width: fit-content;
  height: 27px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--green);
  padding-inline: 8px;
  border: 0;
  gap: 6px;
  transition: background-color 0.2s ease-in-out;
}

.template-download-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.template-download-btn:hover {
  background-color: var(--color-brand-hover);
}

/* Button text span - override sidebar .btn-text styles */
.template-add-btn .btn-text,
.template-download-btn .btn-text {
  display: inline;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  color: inherit;
  line-height: 1;
  opacity: 1 !important;
  visibility: visible !important;
}

/* ============================================
   Compact Mode for Template Buttons
   When tile width < 220px, hide button text
   ============================================ */

@container template-tile (max-width: 220px) {
  /* Make buttons square (icon-only mode) */
  .template-add-btn,
  .template-download-btn {
    width: 27px;
    padding-inline: 0;
    justify-content: center;
  }

  /* Hide text labels in compact mode */
  .template-add-btn .btn-text,
  .template-download-btn .btn-text {
    display: none;
  }
}


.dropzone-placeholder {
  pointer-events: none;
  padding: 0 8px;
}

.dropzone.has-image .dropzone-placeholder {
  display: none;

}

.template-progress-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  text-align: center;
  padding: 0 8px;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(2px);
  transition: opacity 0.15s ease;
}

.template-item.is-rendering .template-progress-overlay {
  opacity: 1;
}


.preview-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  cursor: zoom-out;
}

.preview-modal-backdrop.is-visible {
  display: flex;
}

.preview-modal {
  position: relative;
  background: #111111;
  border-radius: 12px;
  padding: 16px;
  max-width: 1000px;
  max-height: 1000px;
  box-shadow: var(--shadow-modal);
  cursor: default;
}

.preview-modal-img {
  display: block;
  max-width: 1000px;
  max-height: 1000px;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.preview-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.preview-modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.mockup-wrapper {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
}

.mockup-wrapper img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.shadow-layer {
  /* Р”РµР»Р°РµС‚ РёР·РѕР±СЂР°Р¶РµРЅРёРµ РїРѕР»РЅРѕСЃС‚СЊСЋ С‡РµСЂРЅС‹Рј, СЃРѕС…СЂР°РЅСЏСЏ РїСЂРѕР·СЂР°С‡РЅРѕСЃС‚СЊ */
  filter: brightness(0); 
  
  /* РЈРїСЂР°РІР»СЏРµРј РёРЅС‚РµРЅСЃРёРІРЅРѕСЃС‚СЊСЋ С‚РµРЅРё С‡РµСЂРµР· РїСЂРѕР·СЂР°С‡РЅРѕСЃС‚СЊ */
  opacity: 1; 
  
  /* Р”Р»СЏ С‚РµРЅРµР№ Р»СѓС‡С€Рµ РІСЃРµРіРѕ РїРѕРґС…РѕРґРёС‚ multiply (СѓРјРЅРѕР¶РµРЅРёРµ) */
  /* РћРЅРѕ Р·Р°СЃС‚Р°РІР»СЏРµС‚ С‚РµРјРЅС‹Рµ СѓС‡Р°СЃС‚РєРё Р·Р°С‚РµРјРЅСЏС‚СЊ С„РѕРЅ РїРѕРґ РЅРёРјРё */
  mix-blend-mode: multiply;
  
  /* РЈР±РµРґРёС‚РµСЃСЊ, С‡С‚Рѕ СЃР»РѕР№ РЅРµ РїРµСЂРµРєСЂС‹РІР°РµС‚ РєР»РёРєРё, РµСЃР»Рё СЌС‚Рѕ РЅСѓР¶РЅРѕ */
  pointer-events: none; 
}

.shadow-layer,
.object-layer {
  background-color: transparent !important;
}


.preview-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  cursor: zoom-out;
}

.preview-modal-backdrop.is-visible {
  display: flex;
}


.preview-modal {
  position: relative;
  background: #111111;
  border-radius: 12px;
  padding: 16px;
  max-width: 1000px;
  max-height: 1000px;
  box-shadow: var(--shadow-modal);
  cursor: default;
}


/* РЅРѕРІС‹Р№ РєР»СЋС‡РµРІРѕР№ Р±Р»РѕРє вЂ“ Р·Р°РґР°С‘Рј Р РђР—РњР•Р  СЃРѕРґРµСЂР¶РёРјРѕРјСѓ */
.preview-modal-content {
  width: min(60vw, 60vh);
  height: min(60vw, 60vh);
}

/* СЃР°Рј РєР»РѕРЅ РјРѕРєР°РїР° */
.preview-modal .preview-modal-mockup {
  width: 100%;
  height: 100%;
}

/* РІРЅСѓС‚СЂРё РјРѕРґР°Р»РєРё РјРѕРєР°Рї/С€Р°Р±Р»РѕРЅ СЂР°СЃС‚СЏРіРёРІР°РµРј РЅР° РІРµСЃСЊ РєРѕРЅС‚РµРЅС‚ */
.preview-modal .mockup-wrapper,
.preview-modal .template-item {
  position: relative;
  width: 100%;
  height: 100%;
}

/* РєРЅРѕРїРєРё Р»РёСЃС‚Р°РЅРёСЏ */
.preview-modal-prev,
.preview-modal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.preview-modal-prev:hover,
.preview-modal-next:hover {
  background: rgba(0, 0, 0, 0.85);
}

.preview-modal-prev {
  left: -40px;
}

.preview-modal-next {
  right: -40px;
}

/* РєРЅРѕРїРєР° Р·Р°РєСЂС‹С‚РёСЏ РєР°Рє Р±С‹Р»Р° */
.preview-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.preview-modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}


/* РЎС‚РёР»Рё РґР»СЏ Р»РѕР°РґРµСЂР° */
.dropzone-loader {
  display: none;
  /* РџРѕ СѓРјРѕР»С‡Р°РЅРёСЋ СЃРєСЂС‹С‚ */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
  /* Р§С‚РѕР±С‹ РєР»РёРєРё РїСЂРѕС…РѕРґРёР»Рё СЃРєРІРѕР·СЊ РЅРµРіРѕ */
}

/* РЎР°Рј РєСЂСѓС‚СЏС‰РёР№СЃСЏ Р±СѓР±Р»РёРє */
.dropzone-loader::after {
  content: " ";
  display: block;
  width: 32px;
  height: 32px;
  margin: 1px;
  border-radius: 50%;
  border: 3px solid #fff;
  /* Р¦РІРµС‚ РєРѕР»СЊС†Р° */
  border-color: #fff transparent #fff transparent;
  /* Р”РµР»Р°РµРј РїСЂРѕР±РµР»С‹ РґР»СЏ РІСЂР°С‰РµРЅРёСЏ */
  animation: dropzone-spin 1.2s linear infinite;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
  /* РќРµРјРЅРѕРіРѕ С‚РµРЅРё РґР»СЏ РєРѕРЅС‚СЂР°СЃС‚Р° РЅР° СЃРµСЂРѕРј */
}

@keyframes dropzone-spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* РљР»Р°СЃСЃ, РєРѕС‚РѕСЂС‹Р№ JS Р±СѓРґРµС‚ РІРµС€Р°С‚СЊ РЅР° РґСЂРѕРїР·РѕРЅСѓ РІРѕ РІСЂРµРјСЏ Р·Р°РіСЂСѓР·РєРё */
.dropzone.is-loading .dropzone-loader {
  display: block;
}

/* РћРїС†РёРѕРЅР°Р»СЊРЅРѕ: Р·Р°С‚РµРјРЅСЏС‚СЊ С„РѕРЅ РїСЂРё Р·Р°РіСЂСѓР·РєРµ */
.dropzone.is-loading {
  opacity: 0.8;
  cursor: wait;
}



/* --- РџР›РђР’РќРћР• РџР•Р Р•РњР•Р©Р•РќРР• (View Transitions) --- */
::view-transition-group(*) {
  animation-duration: 0.4s;
  /* Р”Р»РёС‚РµР»СЊРЅРѕСЃС‚СЊ РїРµСЂРµР»РµС‚Р° РїР»РёС‚РѕРє */
  animation-timing-function: cubic-bezier(0.2, 0, 0.2, 1);
  /* РџСЂРёСЏС‚РЅР°СЏ РёРЅРµСЂС†РёСЏ */
}








/* --- Updated Controls Layout --- */
.color-picker-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0px 0px;
  flex-wrap: nowrap; /* Don't allow wrapping - force overflow */
  flex: 1 1 auto; /* Allow the controls container to shrink */
  min-width: 0; /* Allow shrinking below content size */
  overflow: visible; /* РџРѕР·РІРѕР»СЏРµРј РїРѕР»РѕСЃРєРµ РІС‹С…РѕРґРёС‚СЊ Р·Р° РїСЂРµРґРµР»С‹ */
  position: relative; /* Р”Р»СЏ РєРѕСЂСЂРµРєС‚РЅРѕРіРѕ РїРѕР·РёС†РёРѕРЅРёСЂРѕРІР°РЅРёСЏ РїРѕР»РѕСЃРєРё */
}


.palette-separator {
  width: 1px;
  height: 24px;
  background-color: var(--border-color);
  margin: 0 4px;
}

/* --- Swatch Styles --- */
.color-swatch-btn {
  /* 1. РЎР±СЂР°СЃС‹РІР°РµРј СЃС‚Р°РЅРґР°СЂС‚РЅС‹Рµ СЃС‚РёР»Рё Р±СЂР°СѓР·РµСЂР° */
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  margin: 0;
  background: none; /* Р•СЃР»Рё С†РІРµС‚ Р·Р°РґР°РµС‚СЃСЏ С‡РµСЂРµР· inline style, СЌС‚Рѕ РЅРµ РїРѕРјРµС€Р°РµС‚ */
  
  /* 2. Р—Р°РґР°РµРј С‡РµС‚РєРёРµ СЂР°Р·РјРµСЂС‹ */
  width: 24px;
  height: 24px;
  box-sizing: border-box; /* Р§С‚РѕР±С‹ СЂР°РјРєР° РЅРµ СѓРІРµР»РёС‡РёРІР°Р»Р° СЂР°Р·РјРµСЂ */
  
  /* 3. Р”РµР»Р°РµРј РѕРґРЅСѓ Р°РєРєСѓСЂР°С‚РЅСѓСЋ РѕР±РІРѕРґРєСѓ */
  border: 1px solid rgba(0, 0, 0, 0.1); /* Р›РµРіРєР°СЏ СЃРµСЂР°СЏ СЂР°РјРєР° */
  border-radius: 4px; /* РЎРєСЂСѓРіР»РµРЅРёРµ (РїРѕ РІРєСѓСЃСѓ) */
  cursor: pointer;

  /* 4. Р’Р°Р¶РЅРѕ РґР»СЏ Р»РёРЅРёРё СЃРЅРёР·Сѓ */
  position: relative; 
  overflow: visible; /* Р РђР—Р Р•РЁРђР•Рњ СЌР»РµРјРµРЅС‚Р°Рј С‚РѕСЂС‡Р°С‚СЊ РЅР°СЂСѓР¶Сѓ (РёРЅР°С‡Рµ Р»РёРЅРёСЋ РѕР±СЂРµР¶РµС‚) */
  
  transition: border-color 0.2s;
}

/* Р­С„С„РµРєС‚ РїСЂРё РЅР°РІРµРґРµРЅРёРё - СЂР°РјРєР° СЃС‚Р°РЅРѕРІРёС‚СЃСЏ С‡СѓС‚СЊ С‚РµРјРЅРµРµ */
.color-swatch-btn:hover {
  border-color: rgba(0, 0, 0, 0.4);
}

/* РЈР±РёСЂР°РµРј СЃС‚СЂР°РЅРЅС‹Рµ СЂР°РјРєРё С„РѕРєСѓСЃР° РІ РЅРµРєРѕС‚РѕСЂС‹С… Р±СЂР°СѓР·РµСЂР°С… */
.color-swatch-btn:focus {
  outline: none;
  border-color: var(--text-main);
}

/* --- Р›РРќРРЇ Р’Р«Р‘РћР Рђ Р”Р›РЇ Р¦Р’Р•РўРћР’ --- */
.color-swatch-btn--selected::after {
  content: "";
  position: absolute;
  display: block;

  /* Р Р°СЃРїРѕР»РѕР¶РµРЅРёРµ - РЅР° РЅРёР¶РЅРµРј РєСЂР°СЋ РїР°РЅРµР»Рё РІ РѕСЃРІРѕР±РѕР¶РґС‘РЅРЅРѕРј РїСЂРѕСЃС‚СЂР°РЅСЃС‚РІРµ */
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 10px; /* РћРїСѓСЃРєР°РµРј РІ РїСЂРѕСЃС‚СЂР°РЅСЃС‚РІРѕ padding-top СЃР»РµРґСѓСЋС‰РµРіРѕ СЌР»РµРјРµРЅС‚Р° */

  /* Р’РЅРµС€РЅРёР№ РІРёРґ */
  width: 100%;
  height: 4px;
  background: var(--bg-dark); /* Р§С‘СЂРЅР°СЏ РїРѕР»РѕСЃРєР° */
  border-radius: 0;
  z-index: 1;
  pointer-events: none;
}

/* --- PALETTE OVERFLOW MENU --- */
.palette-overflow-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.palette-overflow-wrapper.is-open {
  z-index: 10020;
}

.color-swatch-overflow {
  background-color: var(--color-surface-muted);
  cursor: pointer;
  user-select: none;
}

.color-swatch-overflow:hover {
  background-color: #e0e0e0;
}

.palette-overflow-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 120px;
  max-width: 200px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 10020;
}

.palette-overflow-wrapper.is-open .palette-overflow-menu {
  display: flex;
}

/* Overflow menu swatches - hide the underline in dropdown */
.palette-overflow-menu .color-swatch-btn--selected::after {
  display: none;
}

/* Р’РµРєС‚РѕСЂРЅС‹Р№ РѕРІРµСЂР»РµР№ РєРѕСЂРµС€РєР° (CSS mask-image + multiply blend) */
.spine-vector-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* Spine swatches overflow menu */
.spine-overflow-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.spine-overflow-wrapper.is-open {
  z-index: 10020;
}

.spine-overflow-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 120px;
  max-width: 200px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 10020;
}

.spine-overflow-wrapper.is-open .spine-overflow-menu {
  display: flex;
}

.spine-overflow-menu .color-swatch-btn--selected::after {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scaleX(0.5); }
  to { opacity: 1; transform: scaleX(1); }
}


/* Checkerboard for Transparent */
.checkerboard-bg {
  width: 100%;
  height: 100%;
  background-color: var(--color-surface);
  
  /* РЎРѕР·РґР°РµРј 4 СЃРµРєС‚РѕСЂР° РїРѕ 90 РіСЂР°РґСѓСЃРѕРІ */
  background-image: conic-gradient(
    #ccc 90deg, 
    transparent 90deg 180deg, 
    #ccc 180deg 270deg, 
    transparent 270deg
  );
  
  /* Р’РђР–РќРћ: Р Р°Р·РјРµСЂ РїР°С‚С‚РµСЂРЅР° РґРѕР»Р¶РµРЅ Р±С‹С‚СЊ РІ 2 СЂР°Р·Р° Р±РѕР»СЊС€Рµ СЂР°Р·РјРµСЂР° РѕРґРЅРѕР№ РєР»РµС‚РєРё.
     Р•СЃР»Рё РІС‹ С…РѕС‚РёС‚Рµ РєР»РµС‚РєСѓ 8px, Р·РґРµСЃСЊ РїРёС€РµРј 16px */
  background-size: 8px 8px; 
}

.color-swatch-special {
  background-color: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-dark);
}

.custom-color-wrapper {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#native-picker-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

/* --- COLOR MODAL STYLES (NEW) --- */
.color-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.color-modal-backdrop.is-visible {
  display: flex;
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.color-modal-window {
  background: var(--bg-main);
  border-radius: 12px;
  width: 680px;
  max-width: 95vw;
  max-height: 90vh;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

/* Header */
.color-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  min-height: 58px;
  border-bottom: var(--border);
}

.color-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.color-modal-tabs {
  display: flex;
  align-self: stretch;
  align-items: stretch;
  gap: 24px;
}

.color-modal-tab {
  position: relative;
  display: flex;
  align-items: center;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text-secondary);
  font: 600 14px/1 var(--font-family-base);
  cursor: pointer;
}

.color-modal-tab:hover {
  color: var(--text-main);
}

.color-modal-tab.is-active {
  color: var(--text-main);
}

.color-modal-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--bg-dark);
}

.color-modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background-color 0.15s, color 0.15s;
}

.color-modal-close:hover {
  background-color: var(--bg-grey);
  color: var(--text-main);
}

/* Main content: two columns */
.color-modal-content {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  padding: 20px 0 20px 20px;
  overflow: visible;
}

/* Left column: Color Picker */
.color-picker-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 20px; /* РѕС‚СЃС‚СѓРї РґРѕ РІРµСЂС‚РёРєР°Р»СЊРЅРѕР№ Р»РёРЅРёРё */
  overflow: visible;
}

/* SV Canvas wrapper */
.sv-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1; /* РєРІР°РґСЂР°С‚ */
  border-radius: var(--radius);
  overflow: hidden;
  border: var(--border);
  cursor: crosshair;
}

#sv-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sv-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  top: 0;
  left: 100%;
}

/* Hue slider row */
.hue-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.hue-slider-wrap {
  position: relative;
  width: 254px;
  flex-shrink: 0;
  height: 14px;
  border-radius: 7px;
  cursor: pointer;
}

.hue-slider-track {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right,
    hsl(0, 100%, 50%),
    hsl(60, 100%, 50%),
    hsl(120, 100%, 50%),
    hsl(180, 100%, 50%),
    hsl(240, 100%, 50%),
    hsl(300, 100%, 50%),
    hsl(360, 100%, 50%)
  );
  border-radius: 7px;
}

.hue-slider-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 18px;
  height: 18px;
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hue-slider-thumb::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--thumb-color, hsl(0, 100%, 50%));
}

/* Saturation slider row */
.saturation-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.saturation-slider-wrap {
  position: relative;
  width: 254px;
  flex-shrink: 0;
  height: 14px;
  border-radius: 7px;
  cursor: pointer;
}

.saturation-slider-track {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #ffffff, #000000);
  border-radius: 7px;
}

.saturation-slider-thumb {
  position: absolute;
  top: 50%;
  left: 100%;
  width: 18px;
  height: 18px;
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saturation-slider-thumb::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--thumb-color, #808080);
}

/* Color mode row */
.color-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow: visible;
  position: relative;
  z-index: 10;
}

.color-mode-dropdown {
  position: relative;
}

.color-mode-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg-grey);
  border: var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
}

.color-mode-btn:hover {
  background: var(--bg-grey-light);
}

.color-mode-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 80px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  padding: 4px 0;
  display: none;
  z-index: 6000;
}

.color-mode-dropdown.is-open .color-mode-menu,
.color-mode-menu.is-visible {
  display: block;
}

.color-mode-menu-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-main);
}

.color-mode-menu-item:hover {
  background: var(--bg-grey-light);
}

/* Color inputs */
.color-inputs {
  display: flex;
  align-items: center;
  gap: 0; /* СѓР±РёСЂР°РµРј gap РґР»СЏ unified СЃС‚РёР»СЏ */
  background: var(--bg-grey);
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1; /* Р·Р°РЅРёРјР°РµС‚ РІСЃС‘ РѕСЃС‚Р°РІС€РµРµСЃСЏ РїСЂРѕСЃС‚СЂР°РЅСЃС‚РІРѕ */
}

.color-input-group {
  display: flex;
  align-items: center;
  gap: 0;
}

/* РЎРєСЂС‹РІР°РµРј Р»РµР№Р±Р»С‹ C, M, Y, K */
.color-input-label {
  display: none;
}

.color-num-input {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 0;
  font-size: 12px;
  font-weight: 400; /* РѕР±С‹С‡РЅС‹Р№, РЅРµ РїРѕР»СѓР¶РёСЂРЅС‹Р№ */
  text-align: center;
  background: transparent;
}

/* РЈР±РёСЂР°РµРј РїСЂР°РІСѓСЋ РіСЂР°РЅРёС†Сѓ Сѓ РїРѕСЃР»РµРґРЅРµРіРѕ РёРЅРїСѓС‚Р° */
.color-input-group:last-child .color-num-input,
.color-num-input:last-child {
  border-right: none;
}

.color-num-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.3);
}

/* РЈР±РёСЂР°РµРј СЃРїРёРЅРЅРµСЂС‹ (РєРЅРѕРїРєРё РІРІРµСЂС…/РІРЅРёР·) РёР· number inputs */
.color-num-input::-webkit-outer-spin-button,
.color-num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.color-num-input[type="number"] {
  -moz-appearance: textfield;
}

.color-hex-input {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  border: none;
  border-radius: 0;
  font-size: 12px;
  font-weight: 400;
  text-align: center;
  background: transparent;
  font-family: monospace;
  text-transform: uppercase;
}

.color-hex-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.3);
}

/* Preview and Add button */
.color-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.color-preview-swatch {
  width: 100px;
  height: 27px;
  border-radius: var(--radius);
  border: var(--border);
  background-color: var(--color-surface);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.color-preview-row .btn {
  margin-left: auto; /* РїСЂРёР¶РёРјР°РµРј РєРЅРѕРїРєСѓ Рє РїСЂР°РІРѕРјСѓ РєСЂР°СЋ */
}

/* Right column: Palette */
.color-palette-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding-left: 20px;
  padding-right: 20px;
  border-left: var(--border);
  margin-top: -20px; /* Р»РёРЅРёСЏ РґРѕ header */
  margin-bottom: -20px; /* Р»РёРЅРёСЏ РґРѕ РЅРёР·Р° */
  padding-top: 20px;
  padding-bottom: 20px;
}

/* Palette header */
.palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.palette-dropdown-wrap {
  position: relative;
}

.palette-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
  border-radius: var(--radius);
}

.palette-dropdown-btn:hover {
  background: var(--bg-grey-light);
}

.palette-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 180px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  padding: 4px 0;
  display: none;
  z-index: 100;
}

.palette-dropdown-wrap.is-open .palette-dropdown-menu {
  display: block;
}

.palette-dropdown-menu.is-visible {
  display: block;
}

.palette-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-main);
}

.palette-menu-item:hover {
  background: var(--bg-grey-light);
}

.palette-menu-item--danger {
  color: var(--color-danger);
}

.palette-menu-item--danger:hover {
  background: var(--color-danger-soft);
}

.palette-menu-separator {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Submenu */
.palette-menu-item--submenu {
  position: relative;
}

.palette-submenu {
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 140px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  padding: 4px 0;
  display: none;
  z-index: 101;
}

.palette-menu-item--submenu:hover .palette-submenu {
  display: block;
}

.palette-submenu.is-visible {
  display: block;
}

.palette-submenu--presets {
  min-width: 300px;
}

.palette-preset-item {
  gap: 14px;
}

.palette-preset-label {
  flex: 0 0 76px;
}

.palette-preset-preview {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.palette-preset-chip {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

/* View toggle */
.palette-view-toggle {
  display: flex;
  gap: 4px;
}

/* Palette list */
.palette-list {
  flex: 1;
  min-height: 200px;
  max-height: 320px;
  overflow-y: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: var(--bg-main); /* Р±РµР»С‹Р№ С„РѕРЅ */
}

/* Grid view */
.palette-list.view-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-content: start;
}

.palette-list.view-grid .palette-swatch {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.1s;
}

.palette-list.view-grid .palette-swatch:hover {
  /* transform removed - no scaling on hover */
}

.palette-list.view-grid .palette-swatch-delete {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: inherit;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.palette-list.view-grid .palette-swatch:hover .palette-swatch-delete {
  display: flex;
}

.palette-list.view-grid .palette-swatch-delete svg {
  width: 16px;
  height: 16px;
}

/* Rows view */
.palette-list.view-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.palette-list.view-rows .palette-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: var(--color-surface);
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
}

.palette-list.view-rows .palette-swatch:hover {
  border-color: var(--border-color);
}

.palette-list.view-rows .palette-swatch-color {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.palette-list.view-rows .palette-swatch-hex {
  flex: 1;
  font-size: 13px;
  font-family: monospace;
  color: var(--text-main);
}

.palette-list.view-rows .palette-swatch-delete {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.palette-list.view-rows .palette-swatch:hover .palette-swatch-delete {
  opacity: 1;
}

.palette-list.view-rows .palette-swatch-delete:hover {
  color: var(--color-danger);
  background: var(--color-danger-soft);
}

.palette-list.view-rows .palette-swatch-delete svg {
  width: 12px;
  height: 12px;
}

/* Edit button in rows view */
.palette-list.view-rows .palette-swatch-edit {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  padding: 0;
  transition: opacity 0.15s;
}

.palette-list.view-rows .palette-swatch:hover .palette-swatch-edit {
  opacity: 1;
}

.palette-list.view-rows .palette-swatch-edit:hover {
  color: var(--color-info);
  background: var(--color-info-soft);
}

.palette-list.view-rows .palette-swatch-edit svg {
  width: 12px;
  height: 12px;
}

/* Highlight row being edited */
.palette-list.view-rows .palette-swatch--editing {
  border-color: var(--color-info);
  background: var(--color-info-soft);
}

.palette-list.view-rows .palette-swatch--editing .palette-swatch-edit {
  opacity: 1;
  color: var(--color-info);
}

/* Footer (СЃС‚Р°СЂС‹Р№, СЃРєСЂС‹С‚) */
.color-modal-footer {
  display: none;
}

/* Footer РІРЅСѓС‚СЂРё РїСЂР°РІРѕР№ РєРѕР»РѕРЅРєРё (РїР°Р»РёС‚СЂС‹) */
.color-palette-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  margin-top: auto;
  border-top: var(--border);
  margin-left: -20px;
  margin-right: -20px;
  padding-left: 20px;
  padding-right: 20px;
}

/* Legacy support - keep old classes working */
.color-large-preview {
  width: 50px;
  height: 50px;
  border-radius: var(--radius);
  border: var(--border);
  background-color: var(--color-surface);
}

.full-width {
  width: 100%;
}

/* Apply checkerboard to templates when transparent */
.template-item.is-transparent {
  background-image: 
    conic-gradient(
      #ebebeb 90deg, 
      transparent 90deg 180deg, 
      #ebebeb 180deg 270deg, 
      transparent 270deg
    ) !important;
    
  /* Р Р°Р·РјРµСЂ РїРѕР»РЅРѕРіРѕ РїР°С‚С‚РµСЂРЅР° 16px, Р·РЅР°С‡РёС‚ РѕРґРЅР° РєР»РµС‚РєР° Р±СѓРґРµС‚ 8px */
  background-size: 50px 50px !important; 
  
  background-color: #fff !important;
  
  /* РќР° РІСЃСЏРєРёР№ СЃР»СѓС‡Р°Р№ СЃР±СЂР°СЃС‹РІР°РµРј РїРѕР·РёС†РёСЋ */
  background-position: 0 0 !important; 
}

.custom-color-group {
  display: flex;
  align-items: center;
  gap: 4px;
  /* РћС‚СЃС‚СѓРї РјРµР¶РґСѓ РїРёРїРµС‚РєРѕР№ Рё РїР»СЋСЃРёРєРѕРј */
}

/* РЎРґРµР»Р°РµРј РєРЅРѕРїРєСѓ РїР»СЋСЃР° Р·РµР»РµРЅРѕР№ РїСЂРё РЅР°РІРµРґРµРЅРёРё, С‡С‚РѕР±С‹ Р±С‹Р»Рѕ РїРѕРЅСЏС‚РЅРѕ РґРµР№СЃС‚РІРёРµ */
#btn-add-current-color:hover {
  color: var(--green);
  /* РР»Рё Р»СЋР±РѕР№ РґСЂСѓРіРѕР№ Р°РєС‚РёРІРЅС‹Р№ С†РІРµС‚ */
  background-color: #e6f7ed;
  border-radius: 4px;
}


/* РџСЂСЏС‡РµРј РєРЅРѕРїРєСѓ, РєРѕС‚РѕСЂСѓСЋ СЃРѕР·РґР°РµС‚ СЃР°Рј Pickr, С‡С‚РѕР±С‹ РёСЃРїРѕР»СЊР·РѕРІР°С‚СЊ РЅР°С€Сѓ */
.pickr {
  display: none !important;
}

/* РќР°СЃС‚СЂР°РёРІР°РµРј z-index, С‡С‚РѕР±С‹ РѕРєРЅРѕ РїРёРєРµСЂР° Р±С‹Р»Рѕ РїРѕРІРµСЂС… РІСЃРµРіРѕ */
.pcr-app {
  z-index: 9999 !important;
}

/* --- РќРђРЎРўР РћР™РљР Р РђР—РњР•Р Рђ PICKR --- */

/* 1. РЈРІРµР»РёС‡РёРІР°РµРј РјР°СЃС€С‚Р°Р± РІСЃРµРіРѕ РѕРєРЅР° */
.pcr-app {
  /* РџРѕ СѓРјРѕР»С‡Р°РЅРёСЋ С‚Р°Рј РѕРєРѕР»Рѕ 13-14px. 
       РџРѕСЃС‚Р°РІСЊС‚Рµ 18px РёР»Рё 20px, С‡С‚РѕР±С‹ СЃРґРµР»Р°С‚СЊ РµРіРѕ РєСЂСѓРїРЅС‹Рј. */
  font-size: 18px !important;

  /* РњРѕР¶РЅРѕ РґРѕР±Р°РІРёС‚СЊ С€РёСЂРёРЅСѓ, РµСЃР»Рё РєР°Р¶РµС‚СЃСЏ СѓР·РєРёРј */
  width: 22em !important;
}

/* 2. РЈРІРµР»РёС‡РёРІР°РµРј РІС‹СЃРѕС‚Сѓ РїРѕР»РѕСЃРѕРє РІС‹Р±РѕСЂР° С†РІРµС‚Р° (Hue Рё Opacity) */
.pcr-app .pcr-selection .pcr-color-chooser,
.pcr-app .pcr-selection .pcr-color-opacity {
  height: 0.8em !important;
  /* Р”РµР»Р°РµРј РїРѕР»РѕСЃРєРё РїРѕС‚РѕР»С‰Рµ, С‡С‚РѕР±С‹ СѓРґРѕР±РЅРµРµ РїРѕРїР°РґР°С‚СЊ */
}

/* РЈРјРµРЅСЊС€Р°РµРј РєРѕРЅРєСЂРµС‚РЅРѕ РєРЅРѕРїРєСѓ "Р”РѕР±Р°РІРёС‚СЊ" */
.pcr-app .pcr-interaction .pcr-save {
  font-size: 13px !important;
  /* РЎС‚Р°РІРёРј С„РёРєСЃРёСЂРѕРІР°РЅРЅС‹Р№ РЅРµР±РѕР»СЊС€РѕР№ СЂР°Р·РјРµСЂ С€СЂРёС„С‚Р° */
  padding: 6px 12px !important;
  /* Р”РµР»Р°РµРј РєРЅРѕРїРєСѓ РєРѕРјРїР°РєС‚РЅРµРµ РїРѕ РІС‹СЃРѕС‚Рµ */
  height: auto !important;
  /* РЎР±СЂР°СЃС‹РІР°РµРј Р»РёС€РЅСЋСЋ РІС‹СЃРѕС‚Сѓ */
  font-weight: 600 !important;
  /* РћСЃС‚Р°РІР»СЏРµРј Р¶РёСЂРЅРѕСЃС‚СЊ */
  margin-top: .75em !important;
  /* Р’С‹СЂР°РІРЅРёРІР°РЅРёРµ РїРѕ РІРµСЂС‚РёРєР°Р»Рё СЃ HEXA input */
}

/* РўР°РєР¶Рµ РјРѕР¶РЅРѕ С‡СѓС‚СЊ СѓРјРµРЅСЊС€РёС‚СЊ РїРѕР»СЏ РІРІРѕРґР° HEX/RGB, РµСЃР»Рё РѕРЅРё С‚РѕР¶Рµ РєР°Р¶СѓС‚СЃСЏ РіРёРіР°РЅС‚СЃРєРёРјРё */
.pcr-app .pcr-interaction input {
  font-size: 13px !important;
  padding: 6px 8px !important;
  border-radius: 4px !important;
}

/* === NEW: gallery-zone tiles (files/spreads) === */

/* one spread tile (200px) */
.gallery-spread-tile {
  width: 200px;
  border: var(--spread-border);
  border-radius: 6px;
  background: var(--bg-main);
  position: relative;
  cursor: default;

  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  
}

.gallery-spread-tile:active { 
  
 cursor: default;
}

.gallery-spread-tile.is-selected {
  background: var(--bg-dark) !important;
}

.gallery-spread-tile.is-selected .gallery-spread-inner {
  background: var(--bg-dark) !important;
}

.gallery-spread-tile.is-selected .gallery-page-thumb {
  background: transparent;
}

.gallery-spread-tile:hover {
  box-shadow: 3px 5px 5px rgb(236, 236, 236);
  border-color: #aaaaaa;
}

.gallery-spread-tile.is-drop-target {
  outline: 2px dashed var(--bg-dark);
  outline-offset: -4px;
}

/* two thumbs side-by-side */
.gallery-spread-inner {
  display: grid;
  grid-template-columns: 100px 100px;
}

.gallery-page-thumb {
  width: 100px;
  height: auto;
  object-fit: cover;
  display: block;
  background: #eee;
  border-radius: 6px;
}

/* Covers module: one thumbnail per tile */
.gallery-spread-tile.is-cover .gallery-spread-inner {
  grid-template-columns: 200px;
}

.gallery-spread-tile.is-cover .gallery-page-thumb {
  width: 200px;
  object-fit: contain;
}

.gallery-zone.is-dragover {
  outline: 2px dashed var(--bg-dark);
  outline-offset: -6px;
}


/* === Gallery View Mode Toggle Buttons === */
.gallery-view-modes {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    gap: 0;
    border: var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-main);
}

.gallery-view-modes .btn {
    border-radius: 0;
    border: none;
}

.gallery-view-modes .btn:not(:last-child) {
    border-right: var(--border);
}

.gallery-view-modes .btn.is-active {
    background-color: var(--bg-dark);
    color: #FFFFFF;
}

.gallery-view-modes .btn.is-active:hover {
    background-color: var(--bg-active);
    color: #FFFFFF;
}


/* === Gallery Expanded View Layout === */

/* Simple view: default grid with gaps */
.gallery-zone {
    gap: 20px;
}

/* Expanded view: flexible grid with card containers */
.gallery-zone.view-expanded {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 20px !important;
    padding: 20px !important;
}

.gallery-zone.view-expanded.is-module-covers {
    grid-template-columns: repeat(auto-fill, 210px) !important;
    justify-content: start;
    gap: 20px !important;
}

/* Expanded view: white card containers (outer white background) */
.gallery-zone.view-expanded .gallery-spread-tile {
    width: auto;
    min-width: 200px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

.gallery-zone.view-expanded.is-module-covers .gallery-spread-tile.is-cover {
    width: 210px;
    min-width: 210px;
    height: 261px;
    box-sizing: border-box;
}

.gallery-zone.view-expanded .gallery-spread-tile:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-strong);
    background-color: var(--bg-dark);
}

/* Expanded view: image container (white background, no rounded corners) */
.gallery-zone.view-expanded .gallery-spread-inner {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    background: var(--color-surface);
    border-radius: 0;
    padding: 0;
    min-height: 130px;
    grid-template-columns: unset; /* Override default grid for spreads */
}

/* Expanded view: images scale to fit within container (no border, no rounded corners) */
.gallery-zone.view-expanded .gallery-page-thumb {
    flex: 1;
    width: 0; /* flex basis trick — let flex grow handle width */
    min-width: 0;
    min-height: 130px;
    height: auto;
    max-height: 260px;
    object-fit: contain;
    background: transparent;
    border: none;
    border-radius: 0;
}

/* Expanded view: covers module adjustment */
.gallery-zone.view-expanded .gallery-spread-tile.is-cover .gallery-spread-inner {
    display: flex; /* Override grid for single covers */
}

.gallery-zone.view-expanded.is-module-covers .gallery-spread-tile.is-cover .gallery-spread-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 210px;
    height: 216px;
    min-height: 216px;
    background: var(--color-surface);
}

.gallery-zone.view-expanded .gallery-spread-tile.is-cover .gallery-page-thumb {
    width: auto;
    max-width: 100%;
    border: 0.5px solid #d0d0d0;
}

.gallery-zone.view-expanded.is-module-covers .gallery-spread-tile.is-cover .gallery-page-thumb {
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

/* Expanded view: adjust spine texture menu position */
.gallery-zone.view-expanded .spine-texture-menu {
    bottom: 53px; /* Move up to account for 45px metadata row + 8px gap */
}


/* === Gallery Metadata Row (Expanded View Only) === */

/* Hidden by default (simple view) */
.gallery-spread-tile-meta {
    display: none;
}

/* Visible in expanded view */
.gallery-zone.view-expanded .gallery-spread-tile-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    height: 45px;
    min-height: 45px;
    padding: 0 10px;
    border-top: 1px solid #e6e6e6;
    margin-top: 0;
    flex-shrink: 0;
}

/* Color mode tag (RGB/CMYK) */
.gallery-color-mode-tag {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    padding: 3px 6px;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    background: var(--color-surface);
    color: #444;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.gallery-spread-tile.is-selected .gallery-color-mode-tag {
    border-color: rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
}

.gallery-spread-tile.is-selected .gallery-filename {
    color: rgba(255,255,255,0.65);
}

/* Filename with ellipsis truncation */
.gallery-filename {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: #666;
}


/* === Gallery Loading Placeholder === */

/* Loading placeholder for images */
.gallery-page-thumb.is-loading {
    display: block !important;
    width: 100% !important;
    min-width: 150px !important;
    min-height: 200px !important;
    background: #e0e0e0 !important;
    position: relative;
    overflow: hidden;
}

/* Three dots animation */
.gallery-page-thumb.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 10px;
    background:
        radial-gradient(circle 4px, #999 100%, transparent 0) 0 center,
        radial-gradient(circle 4px, #999 100%, transparent 0) 20px center,
        radial-gradient(circle 4px, #999 100%, transparent 0) 40px center;
    background-size: 10px 10px;
    background-repeat: no-repeat;
    animation: gallery-loading-dots 1.4s infinite ease-in-out;
}

@keyframes gallery-loading-dots {
    0%, 100% {
        opacity: 0.3;
    }
    20% {
        opacity: 1;
    }
    40% {
        opacity: 0.3;
    }
}

/* Expanded view loading adjustments */
.gallery-zone.view-expanded .gallery-page-thumb.is-loading {
    min-width: 180px !important;
    min-height: 240px !important;
    background: #e0e0e0 !important;
}

/* === TILE-SIZED PLACEHOLDER (shown while file uploads) === */
.gallery-loading-placeholder {
    width: 100%;
    min-height: 250px;
    background: #e0e0e0;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Spinner animation for tile placeholder (same as template spinner) */
.gallery-loading-placeholder::after {
    content: '';
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid #666;
    border-color: #666 transparent #666 transparent;
    animation: dropzone-spin 1.0s linear infinite;
    display: inline-block;
}

/* Expanded view: placeholder fills the tile inner */
.gallery-zone.view-expanded .gallery-loading-placeholder {
    min-height: 300px;
    background: #f5f5f5;
    border-radius: 6px;
}

.gallery-zone.view-expanded.is-module-covers .gallery-spread-tile.is-cover .gallery-loading-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* Use lighter spinner color in expanded view */
.gallery-zone.view-expanded .gallery-loading-placeholder::after {
    border-color: #999 transparent #999 transparent;
}



.export-queue-sheet.is-hidden {
  display: none;
}

.export-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: var(--border);
}

.export-queue-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-queue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: var(--border);
  font-size: 0.8rem;
  background: #f7f7f7;
}

.export-queue-actions {
  display: flex;
  gap: 8px;
}

/* --- РЎР•Р Р•Р”РРќРђ: РЎРµС‚РєР° СЃ РєР°СЂС‚РёРЅРєР°РјРё (Р РђРЎРўРЇР“РР’РђР•РўРЎРЇ) --- */
.export-queue-grid {
  /* Р­С‚Рѕ РєР»СЋС‡РµРІРѕРµ СЃРІРѕР№СЃС‚РІРѕ: Р·Р°РЅРёРјР°Р№ РІСЃС‘ СЃРІРѕР±РѕРґРЅРѕРµ РјРµСЃС‚Рѕ! */
  flex: 1 1 auto;
    height: auto;    /* РЎР±СЂРѕСЃСЊС‚Рµ С„РёРєСЃРёСЂРѕРІР°РЅРЅСѓСЋ РІС‹СЃРѕС‚Сѓ, РµСЃР»Рё Р±С‹Р»Р° */
    min-height: 0;   /* Р’Р°Р¶РЅРѕ РґР»СЏ РїСЂРѕРєСЂСѓС‚РєРё РІРЅСѓС‚СЂРё С„Р»РµРєСЃ-СЌР»РµРјРµРЅС‚Р° */
  /* Р’РєР»СЋС‡Р°РµРј СЃРєСЂРѕР»Р», РµСЃР»Рё РєР°СЂС‚РёРЅРѕРє РјРЅРѕРіРѕ */
  overflow-y: auto;
  overflow-x: hidden;
  
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); /* РџСЂРёРјРµСЂ СЃРµС‚РєРё */
  gap: 10px;
  align-content: start; /* Р§С‚РѕР±С‹ СЂСЏРґС‹ РЅРµ "СЂР°Р·РјР°Р·С‹РІР°Р»РёСЃСЊ" РїРѕ РІС‹СЃРѕС‚Рµ РїСЂРё РјР°Р»РѕРј РєРѕР»-РІРµ */
}

.export-queue-grid .mockup-wrapper.export-queue-item {
  flex: 0 0 auto;
  width: 80px;
  height: 80px;
  border: var(--border);
  border-radius: 10px;
  background: var(--color-surface);
}

/* Р’РёР·СѓР°Р»СЊРЅС‹Р№ С…РѕРІРµСЂ РїСЂРё РїСЂРёС‘РјРµ РґСЂРѕРїР° РЅР° С€Р°Р±Р»РѕРЅ */
.template-item.is-drop-receiver {
  outline: 2px solid #3B3B3B;
  outline-offset: 2px;
}

/* Split drop zones for multi-cover tiles */
.mc-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}
.template-item.is-mc-drop-receiver .mc-drop-overlay {
  opacity: 1;
}
.mc-drop-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.58);
  transition: background 0.1s, color 0.1s;
}
.mc-drop-zone--split {
  border-bottom: 2px dashed rgba(255, 255, 255, 0.45);
}
.mc-drop-zone__icon {
  height: 22cqi;
  width: auto;
  flex-shrink: 0;
}
/* Solo zone (no split) вЂ” icon takes up more space */
.mc-drop-zone--top:not(.mc-drop-zone--split) .mc-drop-zone__icon {
  height: 38cqi;
}
.mc-drop-zone.is-active {
  background: rgba(0, 176, 88, 0.72);
  color: #fff;
}


/* === Live preview toggle in gallery-top-menu === */
.live-preview-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  user-select: none;
}

.live-preview-toggle input {
  transform: translateY(1px);
}

/* === Gallery multi-select marquee + insert marker === */
.gallery-marquee {
  position: absolute;
  border: 1px dashed rgba(0,0,0,0.35);
  background: rgba(0,0,0,0.06);
  pointer-events: none;
  z-index: 5;
}

.gallery-insert-marker {
  position: absolute;
  width: 2px;
  background: rgba(0,0,0,0.75);
  border-radius: 2px;
  pointer-events: none;
  z-index: 6;
}

/* remove confusing tile "drop target" highlight (we use marker between tiles instead) */
.gallery-spread-tile.is-drop-target {
  outline: none;
}

/* === Export queue: background render overlay === */
.export-queue-item.is-rendering .gallery-image {
  opacity: 0.35;
}

.export-queue-render-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.6);
  pointer-events: none;
}


/* --- Gallery improvements (selection + spacing) --- */
.gallery-zone {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}


.gallery-spread-tile{
  border-radius: 6px;
}

.gallery-spread-inner{
  border-radius: 6px;
}

.gallery-selection-status{
  font-size: 12px;
  opacity: 0.85;
  margin-right: 10px;
  user-select: none;
}

.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
    padding: 0 20px;
    height: 50px;
    box-sizing: border-box;
    border-bottom: var(--border);
}
.templates-filter-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
    box-sizing: border-box;
    border-bottom: var(--border);
}
.templates-actions {
    display: flex;
    gap: 10px;                 /* Р Р°СЃСЃС‚РѕСЏРЅРёРµ РјРµР¶РґСѓ СЃР°РјРёРјРё РєРЅРѕРїРєР°РјРё */
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
}

/* small count badge on template drop */
.template-drop-count{
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.preferences-bar {
  grid-area: preferences-bar;
  display: flex;
  padding-left: 20px;
  border-bottom: var(--border);
  background: var(--bg-project);
}

.color-picker-controls-panel {
  grid-area: color-picker-controls;
  border-bottom: var(--border);
  border-left: var(--border);
  border-right: var(--border);
  background: var(--bg-main);
  overflow: visible; /* РџРѕР·РІРѕР»СЏРµРј РїРѕР»РѕСЃРєРµ Р±С‹С‚СЊ РІРёРґРёРјРѕР№ */
}

.template-preview-zone { display: none !important; }

.upload-files-hidden { display: none !important; }

.export-tabs-zone {
  grid-area: export-tabs-zone;

  /* 1. Р—Р°РЅРёРјР°РµРј РІСЃСЋ РІС‹СЃРѕС‚Сѓ Grid-СЏС‡РµР№РєРё (300px РёР»Рё СЃРєРѕР»СЊРєРѕ Р·Р°РґР°РЅРѕ) */
  height: 100%;
  min-height: 0;

  /* 2. Р”РµР»Р°РµРј РµРіРѕ С„Р»РµРєСЃ-РєРѕР»РѕРЅРєРѕР№ */
  display: flex;
  flex-direction: column;

  /* 3. Р Р°Р·СЂРµС€Р°РµРј РІС‹РїР°РґР°СЋС‰РёРј РјРµРЅСЋ С‚РѕСЂС‡Р°С‚СЊ РЅР°СЂСѓР¶Сѓ (РґР»СЏ РІР°С€РµРіРѕ РїСЂРѕС€Р»РѕРіРѕ РІРѕРїСЂРѕСЃР°) */
  overflow: visible;

  background: var(--bg-main);

  position: relative;
  z-index: 10;

  /* 4. РђРґР°РїС‚РёРІРЅР°СЏ С€РёСЂРёРЅР° */
  width: var(--export-zone-width, 480px);
  min-width: 120px;
  max-width: 480px;
  transition: width 0.15s ease;
  container-type: inline-size;
  container-name: export-zone;

  /* 5. РџСЂРёР¶Р°С‚СЊ Рє РїСЂР°РІРѕРјСѓ РєСЂР°СЋ grid-СЏС‡РµР№РєРё */
  justify-self: end;
  margin-left: auto;

  /* 6. Р›РµРІР°СЏ РіСЂР°РЅРёС†Р° */
  border-left: var(--border);
}

.export-tabs-zone.is-resizing {
  transition: none; /* РѕС‚РєР»СЋС‡РёС‚СЊ Р°РЅРёРјР°С†РёСЋ РїСЂРё СЂСѓС‡РЅРѕРј РїРµСЂРµС‚Р°СЃРєРёРІР°РЅРёРё */
}

.tabs-header {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: var(--border);
  height: 50px;
  box-sizing: border-box;
}

/* РљРЅРѕРїРєР° РІРЅСѓС‚СЂРё С…РµРґРµСЂР° */
.tabs-header .header-action-btn {
    margin-left: auto; /* Р­С‚Рѕ РІРѕР»С€РµР±РЅРѕРµ СЃРІРѕР№СЃС‚РІРѕ РїСЂРёР¶РёРјР°РµС‚ СЌР»РµРјРµРЅС‚ Рє РїСЂР°РІРѕРјСѓ РєСЂР°СЋ */

  }
#export-queue-clear { margin-left: auto; }

/* РљРѕРјРїР°РєС‚РЅС‹Р№ Р±Р°СЂ СЌРєСЃРїРѕСЂС‚Р° (Р°Р»СЊС‚РµСЂРЅР°С‚РёРІР° РѕСЃРЅРѕРІРЅРѕРјСѓ РїСЂРё СѓР·РєРѕР№ РїР°РЅРµР»Рё) */
/* РџРѕ СѓРјРѕР»С‡Р°РЅРёСЋ СЃРєСЂС‹С‚ - РёСЃРїРѕР»СЊР·СѓРµРј Р±РѕР»РµРµ РІС‹СЃРѕРєСѓСЋ СЃРїРµС†РёС„РёС‡РЅРѕСЃС‚СЊ */
.export-controls-bar.export-controls-bar-compact {
  display: none !important;
  position: relative; /* Р”Р»СЏ РїРѕР·РёС†РёРѕРЅРёСЂРѕРІР°РЅРёСЏ hamburger-menu */
}

/* Hamburger button РїРѕР·РёС†РёРѕРЅРёСЂРѕРІР°РЅРёРµ Рё РІРёРґРёРјРѕСЃС‚СЊ РІ РєРѕРјРїР°РєС‚РЅРѕРј Р±Р°СЂРµ */
.export-controls-bar-compact .export-hamburger-btn {
  display: flex !important; /* РџРѕРєР°Р·С‹РІР°РµРј РІРЅСѓС‚СЂРё РєРѕРјРїР°РєС‚РЅРѕРіРѕ Р±Р°СЂР° */
  margin-left: auto;
}
.export-tabs-zone .tabs-body {
  /* Р—Р°РЅРёРјР°РµС‚ РІСЃС‘ РѕСЃС‚Р°РІС€РµРµСЃСЏ РїСЂРѕСЃС‚СЂР°РЅСЃС‚РІРѕ РїРѕ РІРµСЂС‚РёРєР°Р»Рё */
  flex: 1 1 auto;
  
  /* Р’Р°Р¶РЅРѕ: СЃРѕР·РґР°РµРј РєРѕРЅС‚РµРєСЃС‚ РґР»СЏ РІР»РѕР¶РµРЅРЅС‹С… РїР°РЅРµР»РµР№ */
  display: flex;
  flex-direction: column;
  
  /* РџСЂРµРґРѕС‚РІСЂР°С‰Р°РµРј РїРµСЂРµРїРѕР»РЅРµРЅРёРµ СЂРѕРґРёС‚РµР»СЏ */
  min-height: 0;
  overflow: visible; /* Р§С‚РѕР±С‹ РјРµРЅСЋ РёР· export-controls-bar РјРѕРіР»Рѕ С‚РѕСЂС‡Р°С‚СЊ РІРІРµСЂС… */
}

.export-tabs-zone .tab-panel {
  /* Р Р°СЃС‚СЏРіРёРІР°РµРјСЃСЏ РЅР° РІСЃСЋ РІС‹СЃРѕС‚Сѓ tabs-body */
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  
  display: flex;
  flex-direction: column;
  
  /* Р—РґРµСЃСЊ СЃРєСЂС‹РІР°РµРј Р»РёС€РЅРµРµ, С‡С‚РѕР±С‹ СЃРєСЂРѕР»Р» Р±С‹Р» С‚РѕР»СЊРєРѕ РІРЅСѓС‚СЂРё СЃРµС‚РєРё */
  overflow: hidden; 
}

/* РЎРєСЂС‹РІР°РµРј РЅРµР°РєС‚РёРІРЅС‹Рµ РІРєР»Р°РґРєРё */
.export-tabs-zone .tab-panel.is-hidden {
  display: none;
}

/* РЈР±РёСЂР°РµРј СЃС‚Р°СЂС‹Рµ С„РёРєСЃС‹ РґР»СЏ С€С‚РѕСЂРєРё, РґРµР»Р°РµРј РµС‘ С‡Р°СЃС‚СЊСЋ РїРѕС‚РѕРєР° */
.export-queue-sheet {
  position: static;
  width: 100%;
  height: 100%;
  transform: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  
  /* Р­С‚Рѕ С‚РѕР¶Рµ С„Р»РµРєСЃ-РєРѕР»РѕРЅРєР° */
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.export-queue-actions #export-queue-hide { display: none; }

/* Download list: allow absolute-centering of the empty message */
.download-list{
  position: relative;
}

/* Download list placeholder вЂ” same style/centering as gallery empty message */
.download-list .download-empty{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  color: var(--text-secondary);
  font-size: 1.2em;
  text-align: center;

  pointer-events: none;
  padding: 0;
  width: calc(100% - 40px); /* РЅРµР±РѕР»СЊС€РѕР№ РІРѕР·РґСѓС… РїРѕ РєСЂР°СЏРј */
}


/* --- Layout v2 fixes --- */
.color-picker-controls-panel{
  display:flex;
  align-items:center;
  justify-content:flex-start; /* Start from left, allow shrinking */
  gap:0px;
  flex-wrap:nowrap;
}
.color-picker-menu{
  display:flex;
  align-items:center;
  gap:5px;
  flex:0 0 auto;
  width: auto;
  padding-left: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
}



/* .color-picker-controls - РЈР”РђР›Р•РќРћ, РёСЃРїРѕР»СЊР·СѓРµС‚СЃСЏ РѕРїСЂРµРґРµР»РµРЅРёРµ РІС‹С€Рµ (СЃС‚СЂРѕРєР° ~1877) */
.color-picker-controls::-webkit-scrollbar{ height:6px; }

.varnish-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
}

.varnish-controls.is-disabled {
  opacity: 0.55;
}

.varnish-controls__file {
  display: none;
}

.varnish-controls__upload {
  min-width: 92px;
}

.varnish-controls__invert.is-active {
  background: rgba(30, 64, 175, 0.14);
  color: #1d4ed8;
}

.varnish-controls__range {
  width: 72px;
  accent-color: #111827;
}

.varnish-controls__range--angle {
  width: 64px;
}

.varnish-controls__value,
.varnish-controls__status {
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  color: var(--muted-text, #6b7280);
}

.gallery-top-row{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
}

.gallery-numbers-toggle {
  color: #828282;
}

.gallery-numbers-toggle.is-active,
.gallery-numbers-toggle[aria-pressed="true"] {
  background: #454545;
  border-color: #454545;
  color: #eaeaea;
}

.gallery-numbers-icon {
  display: block;
  width: 15px;
  height: 9px;
  background: currentColor;
  -webkit-mask: url("static/icons/icon-123.svg") center / contain no-repeat;
  mask: url("static/icons/icon-123.svg") center / contain no-repeat;
}


/* Make sure export tabs panel height obeys the grid row */
.export-tabs-zone {
  grid-area: export-tabs-zone;
  height: 100%;
  min-height: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}


.export-tabs-zone .tabs-body {
  flex:1 1 auto;
  overflow:hidden;
}
.export-tabs-zone .tab-panel{
  height:100%;
  display:flex;
  flex-direction:column;
}
.export-controls-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2500;
  padding: 0 20px;
  border-bottom: var(--border);
  height: 50px;
  box-sizing: border-box;
  flex-shrink: 0;
  position: relative; /* Р”Р»СЏ РїРѕР·РёС†РёРѕРЅРёСЂРѕРІР°РЅРёСЏ РІР»РѕР¶РµРЅРЅС‹С… СЌР»РµРјРµРЅС‚РѕРІ */
}

.export-queue-header,
.tabs-header {
  position: relative;
  z-index: 1; /* РҐРµРґРµСЂ РґРѕР»Р¶РµРЅ Р±С‹С‚СЊ РЅРёР¶Рµ Р±Р°СЂР° СЃ РєРЅРѕРїРєР°РјРё */
}
.export-controls-sep{
  width:1px;
  height:20px;
  background: #ddd;
  flex:0 0 auto;
}

.export-queue-sheet{
  position:static;
  transform:none;
  box-shadow:none;
  border:none;
  border-radius:0;
  max-height:none;
  height:100%;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.export-queue-grid{
  flex:1 1 auto;
  overflow:auto;
  padding:10px;
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
}
/* --- РќРР—: РљРЅРѕРїРєРё РґРµР№СЃС‚РІРёР№ (РџР РР–РђРўР«) --- */
.export-actions-bar {
  /* 1. РќР°СЃС‚СЂРѕР№РєР° СЂР°СЃРїРѕР»РѕР¶РµРЅРёСЏ РІРЅСѓС‚СЂРё Р±Р°СЂР° */
  display: flex;
  flex-direction: column; /* Р’С‹СЃС‚СЂР°РёРІР°РµРј РєРЅРѕРїРєРё РІ РєРѕР»РѕРЅРєСѓ (РІРµСЂС‚РёРєР°Р»СЊРЅРѕ) */
  gap: 10px;              /* Р Р°СЃСЃС‚РѕСЏРЅРёРµ РјРµР¶РґСѓ РєРЅРѕРїРєР°РјРё */
  
  /* 2. РќР°СЃС‚СЂРѕР№РєР° СЃР°РјРѕРіРѕ Р±Р°СЂР° (С‡С‚РѕР±С‹ РѕРЅ Р±С‹Р» РїСЂРёР¶Р°С‚ Рє РЅРёР·Сѓ) */
  flex-shrink: 0;         
  padding: 20px 20px;
  padding-bottom: 40px;
  border-top: var(--border);
  background: var(--bg-main);
  z-index: 5;
}

/* РћРїС†РёРѕРЅР°Р»СЊРЅРѕ: Р•СЃР»Рё С…РѕС‚РёС‚Рµ, С‡С‚РѕР±С‹ РєРЅРѕРїРєРё СЂР°СЃС‚СЏРіРёРІР°Р»РёСЃСЊ РЅР° РІСЃСЋ С€РёСЂРёРЅСѓ */
.export-actions-bar button {
    width: 100%;
}

.download-list {
  /* Р Р°СЃС‚СЏРіРёРІР°РµРј СЃРїРёСЃРѕРє */
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  /* РњРёРЅРёРјСѓРј РєРѕР»РѕРЅРєРё = СЂР°Р·РјРµСЂ РїСЂРµРІСЊСЋ + 120px РєРѕРЅС‚РµРЅС‚Р°; РєР°СЂС‚РѕС‡РєРё Р·Р°РїРѕР»РЅСЏСЋС‚ СЂСЏРґ */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(240px, calc(var(--dq-preview-size, 90px) + 120px))), 1fr));
  gap: 12px;
  align-content: start;
  min-width: 0;
}
.download-row {
  display: grid;
  grid-template-columns: var(--dq-preview-size, 90px) 1fr;
  gap: 12px;
  padding: 12px 14px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  align-items: stretch;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.3s ease;
  container-type: inline-size;
  min-width: 0;

  /* Progress bar support */
  position: relative;
  overflow: visible; /* Allow dropdowns to overflow */
  z-index: 1; /* Create base stacking context for rows */
}

/* Progress background (rows & large views) - FULL HEIGHT */
.download-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0; /* Fills 100% height of the row */
  height: 100%; /* Explicitly set full height */
  width: var(--progress-percent, 0%);
  border-radius: 10px;                        /* РЎРѕРѕС‚РІРµС‚СЃС‚РІСѓРµС‚ РєР°СЂС‚РѕС‡РєРµ */
  background: linear-gradient(90deg,
    rgba(0, 176, 88, 0.08) 0%,
    rgba(0, 176, 88, 0.12) 100%
  );
  transition: width 0.3s ease, background 0.3s ease; /* Smooth color change for error state */
  z-index: 0;
  pointer-events: none;
}

/* Error state: light red background */
.download-row.has-error::before {
  background: linear-gradient(90deg,
    rgba(255, 68, 68, 0.08) 0%,
    rgba(255, 68, 68, 0.12) 100%
  );
}

.download-row.is-delivered::before {
  background: transparent;
}

/* Ensure content is above progress background */
.download-row > * {
  position: relative;
  z-index: 1;
}

/* Ready state: mint green background */
.download-row.is-ready-to-deliver {
  background: #E9FFF4;
  border-color: #c8eed8;
}

.download-row.is-delivered {
  background: #f2f2f2;
  border-color: #d8d8d8;
}

/* Hover effect for export rows */
.download-row:hover {
  box-shadow: 3px 5px 5px rgb(236, 236, 236);
  border-color: #aaaaaa;
}
.download-row.is-ready-to-deliver:hover {
  border-color: #9ad9bc;
}
.download-row.is-delivered:hover {
  border-color: #bdbdbd;
}

/* When dropdown is open inside a row, elevate the entire row above others */
.download-row:has(.preferences-dropdown.open),
.download-row.has-open-dropdown {
  z-index: 10000; /* Much higher than other rows (z-index: 1) */
}
.download-preview {
  width: var(--dq-preview-size, 90px);
  height: var(--dq-preview-size, 90px);
  max-width: 100%;
  flex-shrink: 0;
  border-radius: 8px;
  border: var(--border);
  background: #f2f2f2;

  position: relative;
  overflow: hidden; /* РєР»СЋС‡РµРІРѕРµ: СЂРµР¶РµРј РІСЃС‘, С‡С‚Рѕ РІС‹Р»РµР·Р°РµС‚ */
}

/* Transparent checkerboard pattern for download-preview */
.download-preview.is-transparent {
  background-image:
    conic-gradient(
      #ebebeb 90deg,
      transparent 90deg 180deg,
      #ebebeb 180deg 270deg,
      transparent 270deg
    );
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  background-color: var(--color-surface);
}

.download-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;   /* РёР»Рё contain, РµСЃР»Рё С…РѕС‡РµС€СЊ вЂњРІРїРёСЃС‹РІР°С‚СЊвЂќ РєР°Рє РІ РѕС‡РµСЂРµРґРё */
  display: block;
}

/* РљРѕРЅС‚РµРЅС‚ СЃРїСЂР°РІР° РѕС‚ РїСЂРµРІСЊСЋ */
.download-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 6px;
}

/* Р’РµСЂС…РЅСЏСЏ СЃС‚СЂРѕРєР°: СЃС‚Р°С‚СѓСЃ + РїРѕР»РѕСЃРєР° СЃРЅРёР·Сѓ */
.download-top-row {
  display: flex;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

/* РќРёР¶РЅСЏСЏ С‡Р°СЃС‚СЊ: РјРµС‚Р° + РєРЅРѕРїРєРё */
.download-bottom-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.download-meta {
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  z-index: 10;
}
.download-label{ color:#777; display:inline-block; width:95px; }
.download-status{ color:#888; font-weight:600; }
.download-status.is-done{ color:#1aa36a; }
.download-status.is-delivered{ color:#6b7280; }
.download-status.is-error{ color:#e53e3e; }
.download-actions {
  margin-top: auto;
  align-self: flex-end;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.download-meta-row{
  display:flex;
  align-items:center;
  gap:8px;
  min-width: 0;
}

.download-meta{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

/* РРєРѕРЅРєР° РїРµСЂРµРґ Р»РµР№Р±Р»РѕРј РІ РґСЂРѕРїРґР°СѓРЅРµ */
.meta-icon {
  flex-shrink: 0;
  display: inline-block;
  width: 13px;
  height: 13px;
  color: #888;
  background: currentColor;
}

.meta-icon--size {
  -webkit-mask: url("static/icons/icon-size.svg") center / contain no-repeat;
  mask: url("static/icons/icon-size.svg") center / contain no-repeat;
}

.meta-icon--file {
  -webkit-mask: url("static/icons/icon-file.svg") center / contain no-repeat;
  mask: url("static/icons/icon-file.svg") center / contain no-repeat;
}

/* РЎС‚СЂРµР»РєРё РІ РґСЂРѕРїРґР°СѓРЅР°С… download-meta - Р±РµР· Р·Р°Р»РёРІРєРё */
.download-meta .btn svg {
  fill: none;
}

/* Р’ download-СЃС‚СЂРѕРєРµ .preferences-dropdown РЅРµ РґРѕР»Р¶РµРЅ РїС‹С‚Р°С‚СЊСЃСЏ "Р·Р°РЅСЏС‚СЊ РІС‹СЃРѕС‚Сѓ 100%" */
.download-meta .preferences-dropdown{
  height:auto;
  position: relative; /* Create stacking context for the menu */
  z-index: 20; /* Higher than .download-meta (z-index: 10) to allow menu overflow */
}

/* When dropdown is open, boost its z-index above other dropdowns */
.download-meta .preferences-dropdown.open{
  z-index: 9999; /* CRITICAL: Must be higher than next .download-row to prevent overlap */
}

/* РњРµРЅСЋ РјРѕР¶РЅРѕ СЃРґРµР»Р°С‚СЊ РєРѕРјРїР°РєС‚РЅРµРµ РёРјРµРЅРЅРѕ РІ download */
.download-meta .preferences-menu{
  min-width: 120px;
  z-index: 10000; /* Very high to ensure it's always on top */
}

/* =========================================================
   Download Row Status & Ready Actions
   ========================================================= */

/* Action buttons are driven by row delivery state */
.download-action-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
  padding: 4px 10px;
  border: 0.5px solid #454545;
  border-radius: 6px;
  background: transparent;
  color: #454545;
  cursor: pointer;
  font: 600 11px/13px 'Inter', sans-serif;
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.download-action-btn svg {
  width: 14px;
  height: 14px;
}

.download-action-btn--export {
  background: var(--color-surface);
  color: #454545;
  border-color: #454545;
}

.download-action-btn--export:hover {
  background: #f5f5f5;
}

.download-action-btn--ready {
  background: var(--color-surface);
  color: #454545;
  border-color: #454545;
}

.download-action-btn--ready:hover {
  background: #f5f5f5;
}

.download-row:not(.is-ready-to-deliver) .download-action-btn[data-action="export"] {
  display: inline-flex;
}

.download-row.is-ready-to-deliver .download-action-btn--ready:not(.download-action-btn--icon) {
  display: inline-flex;
}

.download-action-btn--icon {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.download-action-btn.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

.download-action-btn.is-busy:not(.download-action-btn--icon)::before,
.download-action-btn--icon.is-busy::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: drompl-ready-spin 0.75s linear infinite;
}

.download-action-btn--icon.is-busy svg {
  display: none;
}

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

/* =========================================================
   Format Badge on preview thumbnail
   ========================================================= */
.download-format-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 5px;
  border-radius: 6px;
  font: 500 11px/13px 'Inter', sans-serif;
  letter-spacing: -0.02em;
  color: #F9F9F9;
  pointer-events: none;
  z-index: 3;
}
.download-format-badge.badge-png  { background: #2B2B2B; }
.download-format-badge.badge-jpg  { background: #D01876; }
.download-format-badge.badge-webp { background: #2B54BB; }
.download-format-badge.badge-avif { background: #7B3BB2; }

/* =========================================================
   Shadow separate buttons вЂ” hidden by default, shown only in separate mode
   ========================================================= */

/* Hide separate buttons in non-separate mode (higher specificity overrides --ready rule) */
.download-row:not([data-export-shadow="separate"]) .download-action-btn--download-object,
.download-row:not([data-export-shadow="separate"]) .download-action-btn--download-shadow,
.download-row:not([data-export-shadow="separate"]) .download-action-btn--copy-object,
.download-row:not([data-export-shadow="separate"]) .download-action-btn--copy-shadow { display: none !important; }

/* In separate mode: hide generic download/copy, show object/shadow ones */
.download-row[data-export-shadow="separate"] .download-action-btn--download,
.download-row[data-export-shadow="separate"] .download-action-btn--copy { display: none !important; }

.download-row[data-export-shadow="separate"].is-ready-to-deliver .download-action-btn--download-object,
.download-row[data-export-shadow="separate"].is-ready-to-deliver .download-action-btn--download-shadow,
.download-row[data-export-shadow="separate"].is-ready-to-deliver .download-action-btn--copy-object,
.download-row[data-export-shadow="separate"].is-ready-to-deliver .download-action-btn--copy-shadow {
  display: inline-flex;
}

/* =========================================================
   Cached download button (download at old resolution)
   ========================================================= */
.download-action-btn--download-cached { display: none; }

/* Resolution changed: show Export + cached download, hide normal ready buttons */
.download-row.is-resolution-changed .download-action-btn--download,
.download-row.is-resolution-changed .download-action-btn--icon,
.download-row.is-resolution-changed .download-action-btn--copy { display: none !important; }
.download-row.is-resolution-changed .download-action-btn[data-action="export"] { display: inline-flex !important; }
.download-row.is-resolution-changed .download-action-btn--download-cached { display: inline-flex; }

/* =========================================================
   РђРґР°РїС‚РёРІРЅС‹Р№ Р»РµР№Р°СѓС‚ РєР°СЂС‚РѕС‡РєРё: РїСЂРё СѓР·РєРѕР№ РєР°СЂС‚РѕС‡РєРµ вЂ” РІРµСЂС‚РёРєР°Р»СЊРЅРѕ
   ========================================================= */
@container (max-width: 320px) {
  /* Р’РµСЂС‚РёРєР°Р»СЊРЅС‹Р№ СЂРµР¶РёРј: РѕРґРЅР° РєРѕР»РѕРЅРєР° */
  .download-row {
    grid-template-columns: 1fr;
  }
  .download-previews {
    width: 100%;
    min-width: 0;
  }
  .download-preview {
    width: min(100%, var(--dq-preview-size, 90px)) !important;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 1 / 1;
  }
}


/* =========================================================
   Layout v3: base grid for >=1300px + palette row fix
   (v2 grid lived only inside @media, causing stacking)
   ========================================================= */

/* Base grid (normal desktop) */
.global-container {
  display: grid;
  height: 100dvh;
  grid-template-columns: var(--sidebar-width) minmax(500px, 520px) minmax(565px, 1fr) minmax(120px, var(--export-zone-width, 480px));
  grid-template-rows: 65px 50px 50px minmax(0, 1fr) clamp(220px, 32vh, 400px);
  grid-template-areas:
    "sidebar     top-bar              top-bar                           top-bar   "
    "sidebar     preferences-bar      color-picker-controls             export-tabs-zone"
    "sidebar     gallery-top-menu     templates-gallery-container       export-tabs-zone"
    "sidebar     gallery-zone         templates-gallery-container       export-tabs-zone"
    "sidebar     gallery-zone    templates-gallery-container       export-tabs-zone";
  gap: 0px;
  overflow: hidden;
  transition: grid-template-columns 0.3s ease-in-out;
}

/* Ensure the left column blocks donвЂ™t create phantom whitespace */
.gallery-top-menu,
.gallery-zone,
.export-tabs-zone,
.preferences-bar {
  margin: 0;
}

.gallery-top-menu {
  grid-area: gallery-top-menu;
  flex-shrink: 0;
  background-color: var(--bg-project);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  height: 50px;
  box-sizing: border-box;
}

.gallery-zone {
  grid-area: gallery-zone;
  overflow-y: auto;
  min-height: 0;
  position: relative; 
  
}

.templates-gallery-container {
  grid-area: templates-gallery-container;
  min-width: 580px;
  min-height: 0;
  overflow: hidden;
  background-color: var(--color-surface);
  container-type: inline-size;
  container-name: templates-zone;
}

.color-picker-controls-panel {
  grid-area: color-picker-controls;
  min-width: 0;
}

/* --- Palette must be one horizontal row and never fly out of the screen --- */
.color-picker-controls-panel{
  display:flex;
  align-items:center;
  gap:0px;
  justify-content:flex-start; /* Start from left, don't force space-between */
}

.color-settings-unified {
  margin-left: auto;
  margin-right: 20px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.color-settings-unified:hover {
  color: var(--text-main);
}

.color-settings-unified__icon {
  display: block;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("static/icons/icon-settings.svg") center / contain no-repeat;
  mask: url("static/icons/icon-settings.svg") center / contain no-repeat;
}

/* .color-picker-controls - РЈР”РђР›Р•РќРћ, РёСЃРїРѕР»СЊР·СѓРµС‚СЃСЏ РѕРїСЂРµРґРµР»РµРЅРёРµ РІС‹С€Рµ (СЃС‚СЂРѕРєР° ~1877) */

.palette-row{
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 1; /* Allow shrinking */
  min-width: 32px; /* Space for at least 1 swatch */
  max-width: fit-content; /* Don't grow beyond content */
}

.spine-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 1; /* Allow shrinking */
  min-width: 32px; /* Space for at least 1 swatch */
  max-width: fit-content; /* Don't grow beyond content */
}

/* Avoid the right panel pushing outside the viewport - SCROLLBAR RULE MOVED TO LINE ~2654 */



/* Р“СЂСѓРїРїРёСЂСѓРµРј Р·Р°РіРѕР»РѕРІРѕРє Рё РєРЅРѕРїРєСѓ РїСЂРµРІСЊСЋ, С‡С‚РѕР±С‹ РѕРЅРё СЃС‚РѕСЏР»Рё СЃР»РµРІР° РІРјРµСЃС‚Рµ */
.templates-title-group {
    display: flex;
    align-items: center;
    gap: 10px; /* РћС‚СЃС‚СѓРї РјРµР¶РґСѓ Р·Р°РіРѕР»РѕРІРєРѕРј Рё СЂР°Р·РґРµР»РёС‚РµР»РµРј */
}

/* РЎС‚РёР»СЊ СЂР°Р·РґРµР»РёС‚РµР»СЏ */
.palette-separator {
    width: 1px;
    height: 20px;
    background-color: var(--border-color); /* РР»Рё #D8D8D8 */
    display: block;
}

/* РЎС‚РёР»СЊ РєРЅРѕРїРєРё-С‚РѕРіРіР»Р° */
.icon-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-secondary); /* РЎРµСЂС‹Р№ РїРѕ СѓРјРѕР»С‡Р°РЅРёСЋ */
    padding: 5px 8px 5px 8px;
    border-radius: var(--radius);
    height: 27px;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
    font-size: 13px; /* РЇРІРЅРѕ Р·Р°РґР°РµРј СЂР°Р·РјРµСЂ С€СЂРёС„С‚Р°, С‡С‚РѕР±С‹ РёР·Р±РµР¶Р°С‚СЊ РІС‹С‡РёСЃР»РµРЅРЅС‹С… 13.3333px */
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
    white-space: nowrap;
}

.icon-toggle-btn:hover {
    color: var(--text-main);
    background-color: var(--bg-grey);
}

.icon-toggle-btn:active {
    color: var(--text-main);
    background-color: var(--color-surface-active);
    transition-duration: 0.08s;
}

/* РЎРћРЎРўРћРЇРќРР• Р’РљР›Р®Р§Р•РќРћ (ACTIVE) */
.icon-toggle-btn.is-active {
    color: var(--green); /* Р—РµР»РµРЅС‹Р№ С†РІРµС‚ РїСЂРё РІРєР»СЋС‡РµРЅРёРё */
    background-color: rgba(0, 176, 88, 0.1); /* Р›РµРіРєРёР№ Р·РµР»РµРЅС‹Р№ С„РѕРЅ */
}

/* Auto-process toggle active state */
.icon-toggle-btn.is-active:hover,
#auto-process-toggle.is-active:hover {
    color: var(--color-brand-hover);
    background-color: rgba(0, 176, 88, 0.16);
}

.icon-toggle-btn.is-active:active,
#auto-process-toggle.is-active:active {
    color: var(--color-brand-active);
    background-color: rgba(0, 176, 88, 0.24);
    transition-duration: 0.08s;
}

#auto-process-toggle.is-active {
    color: var(--green);
    background-color: rgba(0, 176, 88, 0.1);
}


/* --- РЎР•Р“РњР•РќРўРР РћР’РђРќРќР«Р™ РўРћР“Р“Р› (РўРѕС‡РЅС‹Р№ СЂР°Р·РјРµСЂ icon-toggle-btn) --- */

.segmented-toggle {
  display: inline-flex;
  vertical-align: middle;
  border-radius: var(--radius);
  overflow: hidden; /* Р§С‚РѕР±С‹ РєСЂР°Р№РЅРёРµ РєРЅРѕРїРєРё СЃРєСЂСѓРіР»СЏР»РёСЃСЊ РїРѕ СЂРѕРґРёС‚РµР»СЋ */
  gap: 0;
}

.segmented-toggle .toggle-item {
  /* РџРѕР»РЅРѕРµ РєРѕРїРёСЂРѕРІР°РЅРёРµ РїР°СЂР°РјРµС‚СЂРѕРІ .icon-toggle-btn */
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 13px; /* РџРѕРґР±РµСЂРёС‚Рµ РїРѕРґ РІР°С€ РїСЂРѕРµРєС‚ */
  padding: 5px 8px; /* РўРµ Р¶Рµ РѕС‚СЃС‚СѓРїС‹, С‡С‚Рѕ Рё Сѓ РѕСЂРёРіРёРЅР°Р»Р° */
  transition: all 0.2s ease-in-out;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;

  /* РЎС‚РёР»СЊ "РІС‹РєР»СЋС‡РµРЅРЅРѕР№" РїРѕР»РѕРІРёРЅС‹ */
  color: var(--text-secondary);
  background-color: var(--bg-grey); /* РЎРµСЂС‹Р№ С„РѕРЅ РєР°Рє Сѓ hover РѕСЂРёРіРёРЅР°Р»Р° */
}

/* РЎРћРЎРўРћРЇРќРР• Р’РљР›Р®Р§Р•РќРћ (ACTIVE) */
.segmented-toggle .toggle-item.is-active {
  color: var(--green);
  /* Р§РёСЃС‚С‹Р№ Р·РµР»РµРЅС‹Р№ С„РѕРЅ Р±РµР· РїРѕРґР»РѕР¶РєРё */
  background-color: rgba(0, 176, 88, 0.1); 
}

/* РҐРѕРІРµСЂ РґР»СЏ РЅРµР°РєС‚РёРІРЅРѕР№ С‡Р°СЃС‚Рё */
.segmented-toggle .toggle-item.is-active:hover {
  color: var(--color-brand-hover);
  background-color: rgba(0, 176, 88, 0.16);
}

.segmented-toggle .toggle-item:not(.is-active):hover {
  color: var(--text-main);
  background-color: var(--border-color); /* Р§СѓС‚СЊ С‚РµРјРЅРµРµ РїСЂРё РЅР°РІРµРґРµРЅРёРё */
}

/* РќР°СЃС‚СЂРѕР№РєР° РёРєРѕРЅРѕРє РІРЅСѓС‚СЂРё */
.segmented-toggle .toggle-item:active {
  color: var(--text-main);
  background-color: var(--color-surface-active);
  transition-duration: 0.08s;
}

.segmented-toggle .toggle-item.is-active:active {
  color: var(--color-brand-active);
  background-color: rgba(0, 176, 88, 0.24);
}

.segmented-toggle .toggle-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: currentColor;
}

/* Shadow direction picker — icon-only buttons */
.shadow-dir-picker.segmented-toggle .toggle-item {
  padding: 5px 6px;
}
.shadow-dir-picker.segmented-toggle .toggle-item svg {
  width: 18px;
  height: 18px;
}

/* === Adaptive Button Text Hiding (ResizeObserver-driven) === */

/* РЎРєСЂС‹РІР°РµРј С‚РµРєСЃС‚ РєРЅРѕРїРєРё, РєРѕРіРґР° JS РѕРїСЂРµРґРµР»РёР» РїРµСЂРµРЅРѕСЃ СЃС‚СЂРѕРєРё */
.btn-icon-only-auto span,
.btn-icon-only-auto [data-i18n] {
  display: none;
}


/* ============================================
   Tile Size Control (Slider)
   ============================================ */

.tile-size-control {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--color-ink, #3B3B3B);
}

.tile-size-control::before,
.tile-size-control::after {
    width: 9px;
    color: var(--color-ink, #3B3B3B);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
}

.tile-size-control::before {
    content: "-";
}

.tile-size-control::after {
    content: "+";
}

.icon-size {
    width: 16px;
    height: 16px;
    color: var(--text-secondary, #888);
    flex-shrink: 0;
}

.tile-size-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 2px;
    background: var(--color-ink, #3B3B3B);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.tile-size-slider::-moz-range-track {
    height: 2px;
    background: var(--color-ink, #3B3B3B);
    border: 0;
    border-radius: 2px;
}

/* Slider thumb (the draggable circle) */
.tile-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--green);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tile-size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.2);
}

.tile-size-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.0);
}

/* Firefox */
.tile-size-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--accent-color, #4a9eff);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tile-size-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.2);
}

.tile-size-slider::-moz-range-thumb:active {
    cursor: grabbing;
    transform: scale(1.0);
}

/* Container query responsiveness: hide slider on small screens */
@container templates-zone (max-width: 830px) {
    .tile-size-control {
        display: none;
    }
}


/* True color toggle (switch) */
.truecolor-toggle{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 2px 6px;
  border-radius: 999px;
}

.truecolor-toggle:focus{
  outline: 2px solid rgba(0, 176, 88, 0.25);
  outline-offset: 2px;
}

.truecolor-switch{
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #d6d6d6;
  position: relative;
  transition: background-color 0.15s ease;
  flex: 0 0 auto;
}

.truecolor-knob{
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--color-surface);
  position: absolute;
  left: 2px;
  top: 2px;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.truecolor-label{
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.truecolor-toggle.is-active .truecolor-switch{
  background: var(--green);
}

.truecolor-toggle.is-active .truecolor-knob{
  transform: translateX(16px);
}

.truecolor-toggle.is-active .truecolor-label{
  color: var(--green);
}



/* Export queue now uses download rows */
.export-queue-list-wrap{
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.export-queue-list-wrap.is-drop-receiver{
  outline: 2px solid #3B3B3B;
  outline-offset: 2px;
}

.template-item--draggable{
  cursor: grab;
}

.template-item--draggable:active{
  cursor: grabbing;
}


/* Download row selection */
.download-row.is-selected {
  outline: 1px solid var(--color-brand-active);
  outline-offset: -1px;
}

/* Download list marquee selection */
.download-marquee {
  position: absolute;
  border: 1px dashed rgba(0,0,0,0.35);
  background: rgba(0,0,0,0.06);
  pointer-events: none;
  z-index: 5;
}

.download-select-check{
  position: absolute;
  z-index: 3;
  right: 6px;
  bottom: 6px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.25);
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.download-row.is-selected .download-select-check{
  background: #3B3B3B;
}

.download-row.is-selected .download-select-check::after{
  content: '';
  width: 8px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  margin-top: -1px;
}

/* Hide selection checkboxes in download list (not needed in export queue) */
#download-list .download-select-check {
  display: none;
}

/* Quick download button for compact view mode */
.download-preview-quick-btn {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background-color: var(--green);
  border: 0;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease-in-out;
  pointer-events: auto;
}

.download-preview-quick-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--color-on-brand);
  flex-shrink: 0;
}

.download-preview-quick-btn:hover {
  background-color: var(--color-brand-hover);
}

/* Show download button on hover in compact view mode */
#download-list.view-compact .download-preview:hover .download-preview-quick-btn {
  display: flex;
}

/* Internal drag cursor: keep a "grabbing" hand everywhere while dragging tiles */
body.is-internal-dragging,
body.is-internal-dragging * {
  cursor: grabbing !important;
}

/* Internal drag: show no-drop only when JS marks an explicit forbidden zone */
.gallery-zone.is-no-drop-hover,
.gallery-zone.is-no-drop-hover * {
  cursor: no-drop !important;
}

body.is-internal-dragging {
  user-select: none;
}

/* Visual drag proxy (mouse-based dragging) */
.mokup-drag-proxy {
  opacity: 0.70;
  filter: saturate(0.95);
  box-shadow: 0 12px 35px rgba(0,0,0,0.25);
  border-radius: var(--radius);
  overflow: hidden;
}


/* Ghost placeholder row while dragging a template.
   - Appears immediately on dragstart (inactive)
   - Turns green (active) when hovering the export queue */
.download-row.download-row--ghost{
  pointer-events: none;
  opacity: 0.95;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid transparent;
  outline: 2px dashed rgba(0, 0, 0, 0.22);
  outline-offset: -6px;
}
.download-row.download-row--ghost.is-active{
  background: rgba(0, 176, 88, 0.06);
  outline-color: var(--green);
}
.download-preview.download-preview--ghost{
  background: transparent;
  border: 1px dashed rgba(0, 0, 0, 0.22);
}
.download-row.download-row--ghost.is-active .download-preview.download-preview--ghost{
  border-color: rgba(0, 176, 88, 0.55);
}
.download-meta.download-meta--ghost{
  color: #2b2b2b;
  font-size: 13px;
}
.download-ghost-title{
  color: rgba(0, 0, 0, 0.6);
  font-weight: 600;
}
.download-row.download-row--ghost.is-active .download-ghost-title{
  color: var(--green);
}



/* ========== SPINE TEXTURE MENU ========== */

/* РљРѕРЅС‚РµР№РЅРµСЂ РјРµРЅСЋ (РїРѕСЏРІР»СЏРµС‚СЃСЏ РїСЂРё hover) */
.spine-texture-menu {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 10;
}

/* РџРѕРєР°Р·С‹РІР°РµРј РјРµРЅСЋ РїСЂРё hover РЅР° tile */
.gallery-spread-tile.is-cover:hover .spine-texture-menu {
  opacity: 1;
  visibility: visible;
}

/* РљРЅРѕРїРєРё РјРµРЅСЋ */
.spine-texture-add-btn,
.spine-texture-remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.spine-texture-add-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

.spine-texture-remove-btn {
  background: rgba(220, 38, 38, 0.85);
}

.spine-texture-remove-btn:hover {
  background: rgba(220, 38, 38, 1);
}

.spine-texture-add-btn svg,
.spine-texture-remove-btn svg {
  width: 12px;
  height: 12px;
}

/* ========== SPINE TEXTURE INDICATOR ========== */

/* РРЅРґРёРєР°С‚РѕСЂ РЅР°Р»РёС‡РёСЏ С‚РµРєСЃС‚СѓСЂС‹ РєРѕСЂРµС€РєР° (27x27, РєР°Рє РєРЅРѕРїРєР° Р·Р°РјРєР° РЅР° С€Р°Р±Р»РѕРЅРµ) */
.gallery-spine-indicator {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 27px;
  height: 27px;
  border-radius: var(--radius);
  border: 1px solid #7C3AED;
  background: linear-gradient(135deg, #7C3AED 0%, #2F6BFF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
}

.gallery-spine-indicator::before {
  content: "";
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5'%3E%3Crect x='3' y='2' width='18' height='20' rx='2'/%3E%3Cpath d='M7 2v20'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.template-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #fff;
  border-color: #fff transparent #fff transparent;
  animation: dropzone-spin 1.0s linear infinite;
  display: inline-block;
}


/* --- Export queue view modes (tabs header) --- */
.tabs-header { align-items: center; }
.tabs-header .btn-group { margin-left: auto; }
.tabs-header .zone-label-text { margin-left: 4px; }

.tabs-view-modes {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: 6px;
}

.icons-square-button.is-active {
  outline: 2px solid rgba(0,0,0,0.15);
  outline-offset: 1px;
}

/* --- Download list view modes --- */
.download-previews { display: block; min-width: 0; }

/* secondary (shadow) preview exists in DOM but hidden by default */
.download-preview-secondary {
  display: none;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  border: var(--border);
  background: #f2f2f2;
  position: relative;
  overflow: hidden;
}

/* Transparent checkerboard pattern for download-preview-secondary */
.download-preview-secondary.is-transparent {
  background-image:
    conic-gradient(
      #ebebeb 90deg,
      transparent 90deg 180deg,
      #ebebeb 180deg 270deg,
      transparent 270deg
    );
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  background-color: var(--color-surface);
}
.download-preview-secondary img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* === COMPACT: grid of 80x80 tiles === */
#download-list.view-compact{
  display: grid;
  grid-template-columns: repeat(auto-fill, 80px);
  gap: 20px; /* Increased from 10px to accommodate progress bar */
  padding: 20px;
  align-content: start;
}
#download-list.view-compact .download-row{
  --dq-preview-size: 80px;
  width: 80px;
  padding: 0;
  border: 0;
  background: transparent;
  grid-template-columns: 80px; /* keep existing row grid, but 1 column */
  position: relative; /* needed for ::after progress bar positioning */
}
#download-list.view-compact .download-meta,
#download-list.view-compact .download-actions,
#download-list.view-compact .download-content{
  display: none;
}
#download-list.view-compact .download-row--ghost,
#download-list.view-compact .download-empty{
  grid-column: 1 / -1;
}

/* Hide background progress in compact view (use thin bar instead) */
#download-list.view-compact .download-row::before {
  display: none;
}

/* Add thin progress bar below preview */
#download-list.view-compact .download-row::after {
  content: '';
  position: absolute;
  bottom: -6px; /* Position below the 80px preview */
  left: 0;
  height: 4px;
  width: var(--progress-percent, 0%);
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  z-index: 1;
}

/* Compact view error state */
#download-list.view-compact .download-row.has-error::after {
  background: rgba(255, 68, 68, 0.8); /* More visible red for thin bar */
}

/* Selection in compact mode: apply outline to preview instead of row */
#download-list.view-compact .download-row.is-selected {
  outline: none;
}

#download-list.view-compact .download-row.is-selected .download-preview {
  outline: 1px solid var(--color-brand-active);
  outline-offset: -1px;
  z-index: 2;
}

/* view-large removed вЂ” preview size now controlled by +/- buttons via --dq-preview-size */


/* ===================================================================
   EXPORT ZONE RESIZE & RESPONSIVE BEHAVIOR
   =================================================================== */

/* === Resize Handle === */
.export-resize-handle {
  position: absolute;
  left: 1px; /* РЎРґРІРёРі РІРїСЂР°РІРѕ, С‡С‚РѕР±С‹ РЅРµ РїРµСЂРµРєСЂС‹РІР°С‚СЊ border-left */
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: linear-gradient(to right,
    transparent 0%, transparent 3px,
    rgba(0, 0, 0, 0.08) 3px, rgba(0, 0, 0, 0.08) 5px,
    transparent 5px);
}

.export-resize-handle:hover,
.export-resize-handle.is-active {
  opacity: 1;
  background: linear-gradient(to right,
    transparent 0%, transparent 2px,
    rgba(0, 176, 88, 0.25) 2px, rgba(0, 176, 88, 0.25) 6px,
    transparent 6px);
}

.export-tabs-zone:hover .export-resize-handle {
  opacity: 0.6;
}

body.is-resizing-export {
  cursor: col-resize !important;
  user-select: none !important;
}


/* === Hamburger Menu === */
.export-hamburger-btn {
  display: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-main);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  transition: background 0.2s ease;
}

.export-hamburger-btn:hover {
  background: var(--bg-grey-light);
}

.export-hamburger-btn.is-active {
  background: var(--bg-grey);
  border-color: var(--green);
}

.export-hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 14px;
}

.export-hamburger-icon span {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.export-hamburger-menu {
  position: absolute;
  right: 12px;
  top: calc(100% + 4px);
  min-width: 200px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  padding: 8px 0;
  display: none;
  z-index: 99999;
}

.export-hamburger-btn.is-active ~ .export-hamburger-menu {
  display: block;
}

.export-hamburger-header {
  padding: 12px 12px 8px 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 4px;
}

.export-hamburger-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.export-hamburger-section:last-child {
  border-bottom: none;
}

.export-hamburger-section-label {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.export-hamburger-item {
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease;
}

.export-hamburger-item:hover {
  background: var(--bg-grey-light);
}

.export-hamburger-item.is-active {
  color: var(--green);
  font-weight: 600;
}

.export-hamburger-item.is-active::after {
  content: 'вњ“';
  font-size: 16px;
  color: var(--green);
}

.export-hamburger-action {
  color: #e74c3c;
  font-weight: 600;
}

.export-hamburger-action:hover {
  background: rgba(231, 76, 60, 0.1);
  color: #c0392b;
}


/* === Adaptive Layout (Container Queries) === */

/* РџРµСЂРµРєР»СЋС‡РёС‚СЊ РЅР° РєРѕРјРїР°РєС‚РЅС‹Р№ Р±Р°СЂ Рё СЃРєСЂС‹С‚СЊ РїРµСЂРµРєР»СЋС‡Р°С‚РµР»Рё РІРёРґРѕРІ РїСЂРё <380px */
@container export-zone (max-width: 379px) {
  /* РЎРєСЂС‹С‚СЊ РѕСЃРЅРѕРІРЅРѕР№ Р±Р°СЂ (Р±РµР· РєР»Р°СЃСЃР° compact) */
  .export-controls-bar:not(.export-controls-bar-compact) {
    display: none !important;
  }

  /* РџРѕРєР°Р·Р°С‚СЊ РєРѕРјРїР°РєС‚РЅС‹Р№ Р±Р°СЂ (Р·Р°РјРµРЅСЏРµС‚ РѕСЃРЅРѕРІРЅРѕР№) */
  .export-controls-bar.export-controls-bar-compact {
    display: flex !important;
  }

  /* РЎРєСЂС‹С‚СЊ РїРµСЂРµРєР»СЋС‡Р°С‚РµР»Рё РІРёРґРѕРІ РІ tabs-header */
  .tabs-view-modes {
    display: none !important;
  }
}

/* РЎРєСЂС‹С‚СЊ РєРЅРѕРїРєСѓ "РЎРєР°С‡Р°С‚СЊ РІС‹РґРµР»РµРЅРЅС‹Рµ" РїСЂРё <280px */
@container export-zone (max-width: 279px) {
  #downloadSelectedBtn {
    display: none !important;
  }
}

/* РЈРјРµРЅСЊС€РёС‚СЊ preview РІ compact СЂРµР¶РёРјРµ РїСЂРё СѓР·РєРѕР№ РїР°РЅРµР»Рё */
@container export-zone (max-width: 359px) {
  #download-list.view-compact {
    grid-template-columns: repeat(auto-fill, 64px);
  }
  #download-list.view-compact .download-row {
    width: 64px;
  }
  #download-list.view-compact .download-preview {
    width: 64px;
    height: 64px;
  }
}

/* РЈРјРµРЅСЊС€РёС‚СЊ large preview РїСЂРё СЃСЂРµРґРЅРµР№ С€РёСЂРёРЅРµ */
@container export-zone (min-width: 420px) and (max-width: 480px) {
  #download-list.view-large .download-preview {
    width: 160px;
    height: 160px;
  }
}


/* === Fallback (ResizeObserver + data-attributes) === */

.export-tabs-zone[data-width="narrow"] .export-controls-bar:not(.export-controls-bar-compact) {
  display: none !important;
}

.export-tabs-zone[data-width="narrow"] .export-controls-bar.export-controls-bar-compact {
  display: flex !important;
}

.export-tabs-zone[data-width="narrow"] .tabs-view-modes {
  display: none !important;
}

.export-tabs-zone[data-width="extra-narrow"] #downloadSelectedBtn {
  display: none !important;
}

.export-tabs-zone[data-width="narrow"] #download-list.view-compact {
  grid-template-columns: repeat(auto-fill, 64px);
}

.export-tabs-zone[data-width="narrow"] #download-list.view-compact .download-row {
  width: 64px;
}

.export-tabs-zone[data-width="narrow"] #download-list.view-compact .download-preview {
  width: 64px;
  height: 64px;
}

/* view-large removed вЂ” preview size controlled by --dq-preview-size */


/* Size filter dropdown - СЃРєСЂС‹С‚ РґР»СЏ non-covers РјРѕРґСѓР»РµР№ */
.preferences-dropdown[data-filter="size"] {
  display: none;
}

/* ZIP Progress Overlay */
#zip-progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.zip-progress-modal {
  background: var(--bg-main);
  padding: 30px;
  border-radius: var(--radius);
  min-width: 400px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.zip-progress-modal h3 {
  margin: 0 0 20px 0;
  color: var(--text-main);
  font-size: 18px;
  font-weight: 600;
}

.zip-progress-bar {
  width: 100%;
  height: 20px;
  background: var(--bg-grey);
  border-radius: 10px;
  overflow: hidden;
  margin: 20px 0;
}

.zip-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #8BC34A);
  transition: width 0.3s ease;
  width: 0%;
}

.zip-progress-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 10px 0;
}

/* ============================================
   NOTIFICATION SYSTEM
   ============================================ */

/* ===== NOTIFICATION TOAST SYSTEM ===== */

/* Bell icon wrapper - positioned at far right of top bar */
.notification-bell-wrapper {
  position: relative;
  margin-left: 0;
}

.notification-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 400px;
}

.notification-toast {
  pointer-events: auto;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  animation: slideInRight 0.3s ease-out;
  position: relative;
}

.notification-toast.is-removing {
  animation: slideOutRight 0.3s ease-in;
  opacity: 0;
  transform: translateX(100%);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

.notification-toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.notification-toast-icon svg {
  width: 20px;
  height: 20px;
}

.notification-toast-content {
  flex-grow: 1;
  min-width: 0;
}

.notification-toast-message {
  font-size: 14px;
  line-height: 1.4;
  color: var(--bg-dark);
  margin: 0;
  word-wrap: break-word;
}

.notification-toast-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  border-radius: 4px;
  transition: all 0.2s ease-in-out;
}

.notification-toast-close:hover {
  background: var(--bg-grey-light);
  color: var(--bg-dark);
}

.notification-toast-close svg {
  width: 14px;
  height: 14px;
}

/* Toast Type Variants */
.notification-toast.toast-success { border-left: 3px solid var(--color-success); }
.notification-toast.toast-success .notification-toast-icon { color: var(--color-success); }

.notification-toast.toast-error { border-left: 3px solid var(--color-danger); }
.notification-toast.toast-error .notification-toast-icon { color: var(--color-danger); }

.notification-toast.toast-warning { border-left: 3px solid var(--color-warning); }
.notification-toast.toast-warning .notification-toast-icon { color: var(--color-warning); }

.notification-toast.toast-info { border-left: 3px solid var(--color-info); }
.notification-toast.toast-info .notification-toast-icon { color: var(--color-info); }

/* Progress bar for auto-dismiss */
.notification-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 8px 8px;
  transition: width linear;
  opacity: 0.5;
}

.toast-success .notification-toast-progress { background: var(--color-success); }
.toast-error .notification-toast-progress { background: var(--color-danger); }
.toast-warning .notification-toast-progress { background: var(--color-warning); }
.toast-info .notification-toast-progress { background: var(--color-info); }

/* ===== BELL ICON & HISTORY ===== */

#notification-bell-btn {
  position: relative;
  border: 0 !important;
  box-shadow: none !important;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
}

.notification-dropdown.is-open {
  display: flex;
}

.notification-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.notification-history-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 8px;
}

.notification-empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.notification-history-item {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  transition: all 0.2s ease-in-out;
  cursor: default;
}

.notification-history-item:last-child {
  margin-bottom: 0;
}

.notification-history-item:hover {
  background: var(--bg-grey-light);
}

.notification-history-item.unread {
  background: #f0f9ff;
  border-color: var(--color-info);
}

.notification-history-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.notification-history-icon svg {
  width: 18px;
  height: 18px;
}

.notification-history-content {
  flex-grow: 1;
  min-width: 0;
}

.notification-history-message {
  font-size: 13px;
  line-height: 1.4;
  color: var(--bg-dark);
  margin: 0 0 4px 0;
  word-wrap: break-word;
}

.notification-history-timestamp {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Color coding for history items */
.notification-history-item.item-success .notification-history-icon { color: var(--color-success); }
.notification-history-item.item-error .notification-history-icon { color: var(--color-danger); }
.notification-history-item.item-warning .notification-history-icon { color: #f59e0b; }
.notification-history-item.item-info .notification-history-icon { color: var(--color-info); }

/* ===== CONFIRM DIALOG ===== */

.notification-confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
}

.notification-confirm-backdrop.is-visible {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.notification-confirm-window {
  background: var(--bg-main);
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.notification-confirm-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fef3c7;
  color: #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-size-lg {
  width: 28px;
  height: 28px;
}

.notification-confirm-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--bg-dark);
  text-align: center;
}

.notification-confirm-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: center;
  white-space: pre-line;
}

.notification-confirm-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  padding-top: 8px;
}

.notification-confirm-actions .btn {
  flex: 1;
}

/* ============================
   Analytics Consent Banner
   ============================ */
.analytics-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: #d1f5e4;
  color: #1a3d2b;
  padding: 14px 24px;
  box-shadow: 0 -2px 12px rgba(46, 187, 119, 0.15);
}

.analytics-consent-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.analytics-consent-text {
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

.analytics-consent-text a {
  color: #1a7a4a;
  text-decoration: underline;
}

.analytics-consent-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.analytics-consent-actions .btn {
  background: var(--color-surface);
  color: #111827;
  border: 1px solid #111827;
  border-radius: 6px;
  height: 34px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.analytics-consent-actions .btn:hover {
  background: #f3f4f6;
}

@media (max-width: 640px) {
  .analytics-consent-inner {
    flex-direction: column;
    text-align: center;
  }
  .analytics-consent-actions {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Multi-cover: badge on template tiles ===== */
.mc-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: var(--control-height-sm);
  height: var(--control-height-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #454545;
  color: #fff;
  border: 0.5px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  box-sizing: border-box;
  font-size: 0;
  line-height: 0;
  pointer-events: auto;
  cursor: pointer;
  z-index: 4;
  backdrop-filter: blur(4px);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s ease;
  opacity: 0;
}
.mc-badge::before {
  content: "";
  width: 14px;
  height: 14px;
  background: #fff;
  -webkit-mask: url("static/icons/icon-layers.svg") center / contain no-repeat;
  mask: url("static/icons/icon-layers.svg") center / contain no-repeat;
}
.template-item:hover .mc-badge {
  opacity: 1;
}
.mc-badge:hover {
  background: #5C5C5C;
  border-color: rgba(255, 255, 255, 0.82);
}
.mc-badge.is-active {
  opacity: 1;
  background: #454545;
}
.mc-badge.is-active:hover {
  background: #5C5C5C;
}

/* ===== Multi-cover: floating debug panel ===== */
.mc-panel {
  position: fixed;
  z-index: 9000;
  width: 256px;
  background: #1e1e1e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  color: #e8e8e8;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.mc-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mc-panel__title {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.mc-panel__close {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}
.mc-panel__close:hover { color: #fff; }
.mc-panel__title { flex: 1; }
.mc-panel__hint {
  margin: 8px 12px 4px;
  font-size: 12px;
  color: #888;
}
.mc-panel__slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  max-height: 320px;
  overflow-y: auto;
  position: relative;
}
/* ===== Multi-cover: footer buttons ===== */
.mc-panel__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px 12px;
}
.mc-panel__apply {
  flex: 1 1 100%;
  width: 100%;
  padding: 10px 0;
  background: var(--color-brand);
  color: var(--color-on-brand);
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.mc-panel__apply:hover { background: var(--color-brand-hover); }
.mc-panel__apply-all {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  padding: 8px 0;
  background: var(--color-brand-soft);
  color: var(--color-brand-active);
  border: 1px solid var(--color-brand);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mc-panel__apply-all:hover {
  background: var(--color-brand);
  color: var(--color-on-brand);
}
.mc-panel__clear {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  padding: 8px 0;
  background: rgba(224, 70, 70, 0.18);
  color: #e05a5a;
  border: 1px solid rgba(224, 70, 70, 0.35);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mc-panel__clear:hover {
  background: rgba(224, 70, 70, 0.8);
  color: #fff;
}

/* ===== Multi-cover: individual slot ===== */
.mc-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1.5px dashed rgba(255,255,255,0.15);
  border-radius: 7px;
  padding: 6px 8px;
  transition: border-color 0.15s, background 0.15s;
  cursor: grab;
}
.mc-slot:active { cursor: grabbing; }
.mc-slot.is-drag-over {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
}
.mc-slot--dragging {
  opacity: 0.45;
  border-style: solid;
}
.mc-slot__label {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  min-width: 44px;
}
.mc-slot__thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mc-slot__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mc-slot__empty {
  font-size: 10px;
  color: #555;
  text-align: center;
}
.mc-slot__del {
  margin-left: auto;
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  transition: color 0.12s;
  flex-shrink: 0;
}
.mc-slot__del:hover { color: #e05a5a; }
.mc-slot--stack .mc-slot__label::before {
  content: 'рџ“љ ';
  font-size: 10px;
}

.mc-slot--stack .mc-slot__label::before {
  content: none;
}

.mc-slot-insert-marker {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: 999px;
  background: var(--color-brand);
  box-shadow: 0 0 0 1px rgba(43, 187, 117, 0.24), 0 0 10px rgba(43, 187, 117, 0.42);
  pointer-events: none;
  z-index: 2;
}

/* ===== Multi-cover: PATTERN visual assignment overlay ===== */
.mc-visual-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: rgba(0, 0, 0, 0.08);
  cursor: crosshair;
  pointer-events: auto;
}

.mc-visual-overlay.is-drag-over {
  background: rgba(0, 176, 88, 0.10);
}

.mc-visual-highlight {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mc-visual-region {
  position: absolute;
  width: 0;
  height: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
  box-sizing: border-box;
}

.mc-visual-region span {
  position: absolute;
  left: 50%;
  top: 50%;
  min-width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 5px;
  background: rgba(20, 20, 20, 0.78);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.mc-visual-region.is-active {
  z-index: 1;
}

.mc-visual-region.is-active span {
  background: var(--color-brand);
  box-shadow: var(--focus-ring);
}

.mc-visual-region.is-assigned span {
  background: var(--color-brand);
}

.mc-panel--visual {
  width: 280px;
}

/* ============================================================
   CREATOR MODE
   ============================================================ */

/* Grid override: creator-canvas-wrap spans columns 2+3 */
.global-container.creator-mode-active {
  grid-template-areas:
    "sidebar  top-bar             top-bar               top-bar"
    "sidebar  preferences-bar     color-picker-controls export-tabs-zone"
    "sidebar  creator-canvas-wrap creator-canvas-wrap   export-tabs-zone"
    "sidebar  creator-canvas-wrap creator-canvas-wrap   export-tabs-zone"
    "sidebar  creator-canvas-wrap creator-canvas-wrap   export-tabs-zone";
}

/* Hide standard panels in creator mode */
.global-container.creator-mode-active .gallery-top-menu,
.global-container.creator-mode-active .gallery-zone,
.global-container.creator-mode-active .templates-gallery-container {
  display: none;
}

/* Canvas wrap вЂ” hidden by default, visible when creator mode active */
.creator-canvas-wrap {
  display: none;
  grid-area: creator-canvas-wrap;
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary, #1a1a1a);
}

.global-container.creator-mode-active .creator-canvas-wrap {
  display: flex;
  flex-direction: column;
}

/* Empty state overlay */
.creator-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted, #888);
  font-size: 14px;
  pointer-events: none;
}
.creator-empty-state button { pointer-events: all; }
.creator-empty-state.hidden { display: none; }

/* Scrollable canvas of page tiles */
.creator-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 160px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-content: flex-start;
}

/* в”Ђв”Ђ Page tiles в”Ђв”Ђ */
.creator-page-tile {
  background: var(--bg-card, #262626);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  flex-shrink: 0;
}
.creator-page-tile.drag-over { border-color: var(--accent-blue, #4a9fff); }

.creator-page-tile--cover  { width: 150px; }
.creator-page-tile--spread { width: 280px; }

.creator-page-tile__img-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  position: relative;
  background: #111;
  overflow: hidden;
}
.creator-page-tile--spread .creator-page-tile__img-wrap { aspect-ratio: 3 / 2; }

.creator-page-tile__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.creator-page-tile__spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 16px;
}

.creator-page-tile__template-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 9px;
  background: rgba(0,0,0,0.62);
  color: #fff;
  border-radius: 3px;
  padding: 1px 4px;
  max-width: 80px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.creator-page-tile__footer {
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.creator-page-tile__page-num {
  font-size: 11px;
  color: var(--text-muted, #888);
  white-space: nowrap;
}
.creator-page-tile__export-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-blue, #4a9fff);
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.creator-page-tile__export-btn:hover { opacity: 0.85; }

/* в”Ђв”Ђ Floating Dock в”Ђв”Ђ */
.creator-dock {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 35, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  padding: 10px 14px;
  min-width: 320px;
  max-width: min(900px, calc(100% - 48px));
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.creator-dock-tabs {
  display: flex;
  gap: 4px;
}

.creator-dock-tab {
  padding: 4px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted, #888);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.creator-dock-tab.is-active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.creator-dock-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.creator-dock-scroll::-webkit-scrollbar { height: 4px; }
.creator-dock-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.creator-dock-list {
  display: flex;
  gap: 10px;
  padding: 2px 0;
}

.creator-dock-item {
  width: 80px;
  flex-shrink: 0;
  cursor: grab;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card, #2a2a2a);
  border: 2px solid transparent;
  transition: border-color 0.12s, transform 0.12s;
  display: inline-block;
}
.creator-dock-item:hover {
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}
.creator-dock-item:active { cursor: grabbing; }

.creator-dock-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  pointer-events: none;
  display: block;
}

.creator-dock-item__label {
  font-size: 9px;
  color: var(--text-muted, #888);
  padding: 2px 4px 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
}

/* ============================================================
   Export History Modal
   ============================================================ */

.export-history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-history-window {
  background: var(--color-surface);
  border-radius: 10px;
  width: 1140px;
  max-width: 96vw;
  height: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  overflow: hidden;
}

.export-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e8e8e8;
}

.export-history-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.export-history-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 0 4px;
}

.export-history-close:hover {
  color: #333;
}

.export-history-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.export-history-toolbar select {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  background: var(--color-surface);
  cursor: pointer;
  color: #333;
}

.export-history-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.export-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.export-history-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: #555;
  background: #fafafa;
  border-bottom: 1px solid #ebebeb;
  white-space: nowrap;
}

.export-history-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.12s;
}

.export-history-table tbody tr:hover {
  background: #f7f9ff;
}

.export-history-td-image {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-width: 200px;
  max-width: 260px;
}

.export-history-td-credit,
.export-history-td-size,
.export-history-td-format,
.export-history-td-status,
.export-history-td-dl,
.export-history-td-dimensions,
.export-history-td-date {
  padding: 10px 14px;
  white-space: nowrap;
  vertical-align: middle;
}

.export-history-thumb {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid #e8e8e8;
}

.export-history-thumb--placeholder {
  background: #e8e8e8;
}

.export-history-name {
  font-size: 12px;
  color: #444;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
  display: block;
}

.export-history-status {
  font-style: normal;
  color: #555;
}

.export-history-status--done {
  color: var(--color-success);
  font-weight: 600;
}

.export-history-status--downloaded {
  font-style: italic;
  color: #555;
}

.export-history-status--expired {
  color: #aaa;
  font-style: normal;
}

.export-history-dl-btn {
  background: none;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  padding: 5px 7px;
  cursor: pointer;
  color: #555;
  display: inline-flex;
  align-items: center;
  transition: background 0.12s, color 0.12s;
}

.export-history-dl-btn:hover:not([disabled]) {
  background: #f0f4ff;
  border-color: var(--color-info);
  color: var(--color-info);
}

.export-history-dl-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

#export-history-empty {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-size: 14px;
}

.export-history-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  font-size: 13px;
  color: #555;
}

.export-history-footer {
  padding: 10px 20px;
  font-size: 12px;
  color: #777;
  border-top: 1px solid #ebebeb;
  background: #fafafa;
}


/* ── PDF Layout Selection Modal ── */
.pdflm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 5100;
  display: none;
  align-items: center;
  justify-content: center;
}
.pdflm-backdrop.is-visible {
  display: flex;
  animation: fadeInModal 0.2s ease-out;
}
.pdflm-window {
  background: var(--bg-main, #fff);
  border-radius: 10px;
  width: max-content;
  max-width: min(1200px, 96vw);
  overflow: hidden;
  box-shadow: 0 0 27.7px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}
.pdflm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  color: var(--color-text, #454545);
  padding: 0 35px;
  height: 56px;
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--color-border, #CBCBCB);
}
.pdflm-cards {
  display: flex;
  gap: 26px;
  padding: 35px 35px 0;
}
.pdflm-card {
  flex: none;
  width: max-content;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  user-select: none;
}
.pdflm-card-label {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  line-height: 16px;
  color: var(--color-text, #454545);
  text-align: center;
  margin-bottom: 5px;
}
.pdflm-card-desc {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 16px;
  color: var(--color-text, #454545);
  text-align: center;
  margin-bottom: 19px;
}
/* Thumbnail box — height fixed, width follows content */
.pdflm-preview {
  width: max-content;
  min-width: 226px;
  height: 244px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 13px;
  padding: 29px 41px;
  background: var(--color-surface-muted, #F9F9F9);
  border: 1px solid var(--color-border, #D8D8D8);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.pdflm-card.is-selected .pdflm-preview {
  background: var(--color-brand, #2BBB75);
  border-color: #7F7F7F;
  box-shadow: 0 0 10.7px rgba(0, 0, 0, 0.25);
}
.pdflm-row {
  display: flex;
  gap: 6px;
  height: 86px;
  flex: none;
}
/* Real page thumbnail: height fixed, width natural from aspect ratio */
.pdflm-thumb {
  height: 86px;
  width: auto;
  flex: none;
  display: block;
  object-fit: fill;
  border-radius: 2px;
}
/* Empty placeholder: portrait page shape */
.pdflm-thumb--empty {
  width: 66px;
  height: 86px;
  background: #FCF8F8;
  border: 1px solid #D9D9D9;
}
/* Ghost: invisible spacer same width as a portrait page */
.pdflm-ghost {
  height: 86px;
  width: 66px;
  flex: none;
}
.pdflm-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  padding: 54px 35px 21px;
}


/* ======================================================
   PDF MODULE — upload gallery block
   ====================================================== */

.pdf-module {
  background: #ffffff;
  border: 0.5px solid #D9D9D9;
  border-radius: 13px;
  box-shadow: none;
  padding: 14px 16px 16px;
  margin-bottom: 0;
  grid-column: 1 / -1;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.pdf-module:hover {
  box-shadow: 0px 0px 12.6px rgba(0, 0, 0, 0.15);
  border-color: #aaa;
}

.pdf-module.has-selection {
  box-shadow: 0px 0px 12.6px rgba(0, 0, 0, 0.25);
  border-color: #959494;
}

.pdf-module.is-module-selected {
  box-shadow: 0px 0px 12.6px rgba(0, 0, 0, 0.25);
  border-color: #454545;
}

.pdf-module.is-collapsed {
  padding-bottom: 12px;
}

.pdf-module-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  padding-left: 16px;
  padding-right: 16px;
  margin: 0 -16px 12px;
  border-bottom: 0.5px solid #CBCBCB;
}

.pdf-module-header[draggable="true"] {
  cursor: grab;
}

.pdf-module-header[draggable="true"]:active {
  cursor: grabbing;
}

.pdf-module-header button {
  cursor: pointer;
}

.pdf-module-collapse {
  margin-right: 2px;
}

.pdf-module-collapse svg {
  transition: transform 0.15s ease;
}

.pdf-module.is-collapsed .pdf-module-collapse svg {
  transform: rotate(-90deg);
}

.pdf-module-filename {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #454545;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-module-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Icon button — matches existing gallery icon buttons */
.pdf-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid #C1C1C1;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  color: #828282;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pdf-btn:hover {
  border-color: #888;
  background: #f5f5f5;
}

.pdf-btn-danger:hover {
  background: #E5484D;
  border-color: #E5484D;
  color: #ffffff;
}

/* Dark "active" state — same as #454545 bg icons in design */
.pdf-btn.is-active,
.pdf-btn-upload.is-active {
  background: #454545;
  border-color: #454545;
  color: #eaeaea;
}

/* Icon SVG inside buttons — scale to fit */
.pdf-btn svg {
  display: block;
  max-width: 15px;
  max-height: 13px;
  flex-shrink: 0;
}

/* Progress bar — full-width row between header and grid */
.pdf-module-progress {
  display: block;
  margin-bottom: 12px;
  width: 100%;
}

.pdf-progress-dot {
  display: none;
}

.pdf-progress-track {
  width: 100%;
  height: 5px;
  background: #e0e0e0;
  position: relative;
  border-radius: 3px;
  overflow: hidden;
}

.pdf-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #2BBB75;
  border-radius: 3px;
}

/* Hide progress bar when fully loaded */
.pdf-module.is-loaded .pdf-module-progress {
  display: none;
}

.pdf-module.is-collapsed .pdf-module-progress {
  display: block;
  margin-bottom: 0;
}


/* Pages grid inside module */
.pdf-module-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.pdf-module.is-collapsed .pdf-module-pages-grid {
  display: none;
}

/* Each grid cell wraps the tile + number label */
.pdf-tile-cell {
  display: flex;
  flex-direction: column;
}

/* Tiles inside pdf-module — no border-radius, no shadow, border only */
.gallery-zone .pdf-module .gallery-spread-tile,
.gallery-zone.view-expanded .pdf-module .gallery-spread-tile {
  width: auto;
  min-width: 0;
  border: 1px solid #D9D9D9;
  border-radius: 0 !important;
  background: #ffffff;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: default;
  transition: border-color 0.15s ease;
  flex: 1;
}

.gallery-zone .pdf-module .gallery-spread-tile:hover,
.gallery-zone.view-expanded .pdf-module .gallery-spread-tile:hover {
  border-color: #aaa;
  box-shadow: none;
  background-color: #ffffff;
}

/* Selected tile: thick dark border only */
.gallery-zone .pdf-module .gallery-spread-tile.is-selected,
.gallery-zone.view-expanded .pdf-module .gallery-spread-tile.is-selected {
  border: 3px solid #454545 !important;
  box-shadow: 0px 0px 11.3px rgba(0, 0, 0, 0.25) !important;
  background: #ffffff !important;
}

.gallery-zone .pdf-module .gallery-spread-tile.is-selected .gallery-spread-inner,
.gallery-zone.view-expanded .pdf-module .gallery-spread-tile.is-selected .gallery-spread-inner {
  background: #ffffff !important;
}

/* Dark bottom bar inside tile only when numbers are shown */
.pdf-module.show-numbers .gallery-spread-tile.is-selected::after {
  content: '';
  display: block;
  height: 27px;
  background: #454545;
  flex-shrink: 0;
}

.pdf-module .gallery-spread-inner {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 130px;
  background: #ffffff;
}

.pdf-module .gallery-page-thumb {
  flex: 1;
  width: 0;
  min-width: 0;
  min-height: 130px;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  background: transparent;
  border: none;
  border-radius: 0;
}

/* Page numbers — outside tile border, below the tile box */
.pdf-module .gallery-spread-tile-numbers {
  display: none;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 16px;
  color: #7F7F7F;
  padding: 5px 0 0;
  white-space: pre; /* keep spaces between left/right page numbers */
}

.pdf-module.show-numbers .gallery-spread-tile-numbers {
  display: block;
}

/* Selected tile numbers: white text, positioned to overlap the dark ::after bar */
.pdf-module.show-numbers .pdf-tile-cell:has(.gallery-spread-tile.is-selected) .gallery-spread-tile-numbers {
  color: #F9F9F9;
  background: #454545;
  padding: 5px 0 6px;
  margin-top: -27px; /* overlap the ::after dark bar */
  position: relative;
  z-index: 1;
}

/* Metadata row (RGB/CMYK tag, filename) — always hidden inside pdf-module */
.gallery-zone .pdf-module .gallery-spread-tile-meta,
.gallery-zone.view-expanded .pdf-module .gallery-spread-tile-meta {
  display: none !important;
}

/* Loading placeholder inside pdf-module */
.pdf-module .gallery-loading-placeholder {
  min-height: 130px;
  width: 100%;
  background: #f0f0f0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Gallery view-modes strip — hidden now (no compact/large toggle for spreads) */
.gallery-view-modes {
  display: none !important;
}

/* === Spread Settings Modal === */

.ssm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.35);
}
.ssm-overlay--visible { display: block; }

.ssm-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 953px;
  height: 646px;
  background: #FFFFFF;
  box-shadow: 0px 0px 27.7px rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  overflow: hidden;
  flex-direction: row;
}
.ssm-modal--visible { display: flex; }

/* Left preview pane */
.ssm-preview-pane {
  position: relative;
  width: 646px;
  height: 646px;
  flex-shrink: 0;
  border-right: 0.5px solid #C1C1C1;
  background: #f5f5f5;
  overflow: hidden;
}
.ssm-preview-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Per-mockup background colour applied via SpreadSettingsModal.
   The custom property --mokup-bg-color is set on the host (.template-item / .mockup-wrapper). */
.template-item.has-mokup-bg,
.mockup-wrapper.has-mokup-bg {
  background-color: var(--mokup-bg-color);
}
.ssm-preview-shadow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: brightness(0);
  mix-blend-mode: multiply;
  z-index: 1;
}
.ssm-preview-img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  z-index: 2;
}

/* Nav buttons — visible only on hover */
.ssm-nav-btn {
  position: absolute;
  bottom: 20px;
  width: 30px;
  height: 30px;
  background: #FFFFFF;
  border: 1px solid #C1C1C1;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.ssm-prev { left: 265px; }
.ssm-next { left: 305px; }
.ssm-preview-pane:hover .ssm-nav-btn { opacity: 1; }
.ssm-nav-btn:hover { background: #f0f0f0; }

/* Spinner */
.ssm-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: #555;
  border-radius: 50%;
  animation: ssm-spin 0.7s linear infinite;
  z-index: 3;
}
.ssm-spinner--visible { display: block; }
@keyframes ssm-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Right panel */
.ssm-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

.ssm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 29px 16px 0 18px;
  flex-shrink: 0;
}
.ssm-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 16px;
  color: #454545;
}
.ssm-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.ssm-close-btn:hover { opacity: 1; }

.ssm-divider {
  height: 0;
  border-top: 0.5px solid #D8D8D8;
  margin: 0 0;
  flex-shrink: 0;
}
.ssm-panel-head + .ssm-divider { margin-top: 16px; }

/* Zone rows */
.ssm-zones {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}
.ssm-zone-row {
  display: flex;
  align-items: center;
  padding: 10px 16px 10px 18px;
  min-height: 43px;
  box-sizing: border-box;
}
.ssm-zone-row[data-zone="bg"] { border-bottom: 1px solid #EAEAEA; }
.ssm-zone-row.ssm-zone-hidden { display: none; }

.ssm-zone-label {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 16px;
  color: #454545;
  flex-shrink: 0;
}

.ssm-color-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 43px;
  background: #FCFCFC;
  border: 1px solid #D9D9D9;
  border-radius: 7px;
  padding: 0 10px 0 14px;
  box-sizing: border-box;
}
.ssm-color-swatch {
  width: 116px;
  height: 22px;
  border: 0.5px solid #B6B6B6;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  background: #f0f0f0;
  transition: box-shadow 0.15s;
}
.ssm-color-swatch:hover { box-shadow: 0 0 0 2px rgba(0,0,0,0.12); }

/* Footer */
.ssm-divider--bottom {
  margin-top: auto;
}
.ssm-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 16px;
  flex-shrink: 0;
}
.ssm-cancel-btn {
  width: 111px;
  height: 27px;
  background: #FFFFFF;
  border: 0.5px solid #000000;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: #7F7F7F;
  cursor: pointer;
  letter-spacing: -0.02em;
}
.ssm-save-btn {
  width: 119px;
  height: 27px;
  background: #000000;
  border: 0.5px solid #B7B7B7;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: #F9F9F9;
  cursor: pointer;
  letter-spacing: -0.02em;
}
.ssm-cancel-btn:hover { background: #f7f7f7; }
.ssm-save-btn:hover { background: #222; }

