/* =============================================================================
   HiveEditor — Design System
   Modern dark UI, amber/honey accent, award-winning 2026
   ============================================================================= */

/* --- Custom Properties (Design Tokens) -------------------------------------- */
:root {
  /* Color palette */
  --bg-base:          #0B0B0B;
  --bg-surface:       #141414;
  --bg-surface2:      #1C1C1C;
  --bg-surface3:      #242424;
  --bg-hover:         #2A2A2A;
  --bg-active:        #303030;

  /* Borders */
  --border-subtle:    #1F1F1F;
  --border-default:   #2C2C2C;
  --border-strong:    #404040;
  --border-accent:    rgba(245, 166, 35, 0.4);

  /* Accent — honey/amber */
  --accent-primary:   #F5A623;
  --accent-bright:    #FFD060;
  --accent-deep:      #C47D0E;
  --accent-glow:      rgba(245, 166, 35, 0.12);
  --accent-glow-strong: rgba(245, 166, 35, 0.25);

  /* Text */
  --text-primary:     #F2F2F2;
  --text-secondary:   #A0A0A0;
  --text-tertiary:    #606060;
  --text-accent:      #F5A623;
  --text-link:        #FFD060;

  /* Status */
  --status-success:   #43A047;
  --status-warning:   #FB8C00;
  --status-error:     #E53935;
  --status-info:      #1E88E5;

  /* Hive component colors */
  --hive-stand:       #3E2723;
  --hive-bottom:      #5D4037;
  --hive-deep:        #6D4C41;
  --hive-medium:      #795548;
  --hive-shallow:     #8D6E63;
  --hive-excluder:    #546E7A;
  --hive-inner-cover: #546E7A;
  --hive-cover:       #37474F;

  /* Frame zone colors */
  --zone-empty:       #EDD9A3;
  --zone-comb:        #DEB887;
  --zone-brood:       #8B4513;
  --zone-pollen:      #DAA520;
  --zone-honey:       #E8A000;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;

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

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.7);
  --shadow-accent: 0 0 20px rgba(245, 166, 35, 0.2);
  --shadow-glow:   0 0 40px rgba(245, 166, 35, 0.15);

  /* Transitions */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-display: 'Inter', sans-serif;

  /* Layout */
  --sidebar-width:    260px;
  --right-panel-width: 280px;
  --toolbar-height:    56px;
}

/* --- Reset & Base ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden;
}

body.page {
  overflow: auto;
}

/* --- Typography ------------------------------------------------------------- */
h1, h2, h3, h4, h5 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--accent-bright); }

/* --- Scrollbar ------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* =============================================================================
   SHARED COMPONENTS
   ============================================================================= */

/* --- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  line-height: 1;
  height: 34px;
}

.btn-primary {
  background: var(--accent-primary);
  color: #000;
  border-color: var(--accent-primary);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  box-shadow: var(--shadow-accent);
  color: #000;
}

.btn-secondary {
  background: var(--bg-surface3);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: transparent;
  color: var(--status-error);
  border-color: var(--border-default);
}
.btn-danger:hover {
  background: rgba(229, 57, 53, 0.12);
  border-color: var(--status-error);
}

.btn-icon {
  padding: var(--space-2);
  width: 34px;
  height: 34px;
  justify-content: center;
}

.btn-sm {
  height: 28px;
  padding: var(--space-1) var(--space-3);
  font-size: 0.8125rem;
}

.btn-lg {
  height: 42px;
  padding: var(--space-3) var(--space-6);
  font-size: 1rem;
}

/* --- Form Controls --------------------------------------------------------- */
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-surface2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--transition-fast);
  outline: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder { color: var(--text-tertiary); }

.textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23A0A0A0'%3E%3Cpath d='M8 10.5L3 5.5h10L8 10.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
}

.form-group { display: flex; flex-direction: column; gap: var(--space-1); }
.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Range slider */
input[type="range"] {
  width: 100%;
  height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  outline: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(245, 166, 35, 0.5);
}

/* --- Badge ----------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-glow);
  color: var(--accent-primary);
  border: 1px solid var(--border-accent);
}

/* --- Card ------------------------------------------------------------------ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.card-body { padding: var(--space-6); }

/* --- Divider --------------------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-4) 0;
}

/* --- Toast notification ---------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface3);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  min-width: 240px;
  max-width: 360px;
  animation: slideInUp 0.3s ease;
  pointer-events: auto;
}

.toast.success { border-color: var(--status-success); }
.toast.success .toast-icon { color: var(--status-success); }
.toast.error   { border-color: var(--status-error); }
.toast.error   .toast-icon { color: var(--status-error); }
.toast.info    { border-color: var(--accent-primary); }
.toast.info    .toast-icon { color: var(--accent-primary); }

@keyframes slideInUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* --- Modal ----------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.2s ease;
}

.modal-lg { max-width: 760px; }

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

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

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* =============================================================================
   LOGIN PAGE
   ============================================================================= */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(245,166,35,0.08) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: var(--space-10) var(--space-8);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  position: relative;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  text-align: center;
  flex-direction: column;
}

.login-logo .bee-icon {
  width: 52px;
  height: 52px;
}

.login-logo h1 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.login-form { display: flex; flex-direction: column; gap: var(--space-4); }

/* =============================================================================
   DASHBOARD (index.asp)
   ============================================================================= */
.dashboard {
  min-height: 100vh;
  background: var(--bg-base);
  overflow: auto;
}

.dash-header {
  height: var(--toolbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  gap: var(--space-4);
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.dash-logo .logo-accent { color: var(--accent-primary); }

.dash-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.dash-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-8);
}

.dash-hero {
  text-align: center;
  margin-bottom: var(--space-12);
}

.dash-hero h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dash-hero p { color: var(--text-secondary); font-size: 1.1rem; }

.pres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.pres-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.pres-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-deep));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.pres-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.pres-card:hover::before { opacity: 1; }

.pres-card-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-glow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  font-size: 1.5rem;
}

.pres-card-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: var(--space-1);
}

.pres-card-meta {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.pres-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.pres-card-new {
  border: 2px dashed var(--border-strong);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 160px;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.pres-card-new:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-glow);
}

.pres-card-new svg { width: 32px; height: 32px; }

/* =============================================================================
   EDITOR LAYOUT
   ============================================================================= */
.editor-layout {
  display: grid;
  grid-template-rows: var(--toolbar-height) 1fr;
  grid-template-columns: var(--sidebar-width) 1fr var(--right-panel-width);
  height: 100vh;
  overflow: hidden;
}

/* --- Toolbar --------------------------------------------------------------- */
.editor-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  z-index: 400;
}

.toolbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
  text-decoration: none;
  margin-right: var(--space-2);
}

/* --- Editor toolbar: desktop-only / mobile-only visibility ----------------- */
/* By default (desktop) show desktop items, hide mobile items */
.editor-desk-only { display: flex; align-items: center; }
.editor-mob-only  { display: none !important; }
.editor-mob-back  { display: none !important; }
.editor-desk-logo { display: flex; }

/* Mobile ⋮ dropdown */
.editor-mob-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-surface2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 500;
  overflow: hidden;
}
.editor-mob-dropdown a,
.editor-mob-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  font-size: 0.9rem;
  color: var(--text-primary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.editor-mob-dropdown a:hover,
.editor-mob-dropdown button:hover {
  background: var(--bg-surface3);
}
.editor-mob-dropdown .mob-sep {
  height: 1px;
  background: var(--border-default);
  margin: 4px 0;
}

.toolbar-logo .logo-bee { color: var(--accent-primary); }

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border-default);
  flex-shrink: 0;
}

.pres-name-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  width: 220px;
  transition: all var(--transition-fast);
}

.pres-name-input:focus {
  border-color: var(--border-accent);
  background: var(--bg-surface2);
  outline: none;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Lang toggle */
.lang-toggle {
  display: flex;
  background: var(--bg-surface2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lang-btn {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.lang-btn.active {
  background: var(--accent-primary);
  color: #000;
}

/* Dirty indicator */
.dirty-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.dirty-indicator.visible { opacity: 1; }

/* Mobile nav hidden on desktop, shown via media query */
.editor-mobile-nav { display: none !important; }

/* --- Left Sidebar (Palette) ------------------------------------------------ */
.editor-palette {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.palette-search {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 10;
}

.palette-category {
  padding: var(--space-1) var(--space-3);
}

.palette-cat-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0 var(--space-1);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
}

.palette-cat-header .chevron {
  margin-left: auto;
  transition: transform var(--transition-fast);
}

.palette-cat-header.collapsed .chevron { transform: rotate(-90deg); }

.palette-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: var(--space-2);
}

.palette-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
}

.palette-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
}

.palette-item:active { transform: scale(0.97); }

.palette-item-swatch {
  width: 32px;
  height: 20px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.08);
}

.palette-item-name {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.palette-item-sub {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

/* --- Canvas Area ----------------------------------------------------------- */
.editor-canvas-area {
  background: var(--bg-base);
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  position: relative;
}

/* Canvas background pattern */
.editor-canvas-area::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, var(--border-subtle) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

.editor-canvas {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  min-width: 500px;
}

/* --- Hive Container -------------------------------------------------------- */
.hive-container {
  width: 320px;
  display: flex;
  flex-direction: column;
  position: relative;
  /* allow layer-controls pill to float above the topmost layer */
  overflow: visible;
  padding-top: 34px;
}

.hive-drop-zone {
  height: 40px;
  border: 2px dashed transparent;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  margin: 2px 0;
}

.hive-drop-zone.active {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
  color: var(--accent-primary);
}

/* --- Hive Layer ------------------------------------------------------------ */
.hive-layer {
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin: 1px 0;
}

.hive-layer-inner {
  border-radius: var(--radius-sm);
  border-width: 2px;
  border-style: solid;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.hive-layer:hover .hive-layer-inner {
  filter: brightness(1.15);
}

.hive-layer.selected .hive-layer-inner {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  filter: brightness(1.15);
}

.hive-layer-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* Layer controls (show on hover/select) */
.hive-layer-controls {
  position: absolute;
  right: -44px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 10;
}

.hive-layer:hover .hive-layer-controls,
.hive-layer.selected .hive-layer-controls {
  opacity: 1;
}

.layer-ctrl-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.layer-ctrl-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.layer-ctrl-btn.del:hover { background: rgba(229,57,53,0.15); border-color: var(--status-error); color: var(--status-error); }

/* --- Super with frames ----------------------------------------------------- */
.hive-layer.has-frames .hive-layer-inner {
  flex-direction: column;
  padding: 6px;
  align-items: stretch;
  gap: 4px;
  cursor: default;
}

.frames-row {
  display: flex;
  gap: 3px;
  align-items: stretch;
  flex: 1;
}

.frame-slot {
  flex: 1;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  min-height: 60px;
  overflow: hidden;
  transition: all var(--transition-fast);
  border: 1px solid rgba(0,0,0,0.2);
}

.frame-slot:hover {
  transform: scaleY(1.04);
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.frame-slot.selected {
  outline: 2px solid var(--accent-primary);
  z-index: 5;
}

.frame-zone {
  width: 100%;
  transition: height 0.3s ease;
}

/* Queen excluder pattern */
.hive-layer.excluder .hive-layer-inner {
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 4px,
    rgba(0,0,0,0.3) 4px,
    rgba(0,0,0,0.3) 5px
  );
}

/* --- Add component hint ---------------------------------------------------- */
.canvas-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-tertiary);
  padding: var(--space-10);
  text-align: center;
}

.canvas-hint svg { width: 48px; height: 48px; opacity: 0.4; }
.canvas-hint p { font-size: 0.875rem; }

/* --- Right Panel ----------------------------------------------------------- */
.editor-right-panel {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.panel-section {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-default);
}

.panel-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,.07));
}

/* Slide nav */
.slide-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.slide-counter {
  flex: 1;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.slide-thumbnails {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 200px;
  overflow-y: auto;
}

.slide-thumb {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  font-size: 0.8125rem;
}

.slide-thumb:hover { background: var(--bg-hover); border-color: var(--border-default); }
.slide-thumb.active { background: var(--accent-glow); border-color: var(--border-accent); color: var(--accent-primary); }

.slide-thumb-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.slide-thumb.active .slide-thumb-num {
  background: var(--accent-primary);
  color: #000;
}

/* Frame editor (inside right panel when super selected) */
.frame-editor {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-default);
}

.frame-editor-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.frame-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.frame-type-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface2);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.frame-type-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.frame-type-btn.active {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
  color: var(--accent-primary);
}

.frame-type-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Zone sliders */
.zone-sliders { display: flex; flex-direction: column; gap: var(--space-3); }

.zone-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.zone-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zone-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  width: 50px;
  flex-shrink: 0;
}

.zone-slider { flex: 1; }

.zone-pct {
  font-size: 0.8rem;
  color: var(--text-secondary);
  width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* =============================================================================
   FRAME MINI-SELECTOR (grid of frames in super)
   ============================================================================= */
.frame-mini-grid {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-3);
}

.frame-mini-slot {
  flex: 1;
  height: 30px;
  border-radius: 2px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
  background: var(--bg-surface3);
}

.frame-mini-slot:hover { border-color: var(--accent-primary); }
.frame-mini-slot.selected { border-color: var(--accent-primary); box-shadow: 0 0 6px rgba(245,166,35,0.4); }

/* =============================================================================
   VIEWER PAGE
   ============================================================================= */
.viewer-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-base);
  overflow: hidden;
}

.viewer-toolbar {
  height: var(--toolbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.viewer-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  overflow: hidden;
}

.viewer-canvas {
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-8);
  background: var(--bg-base);
  position: relative;
}

.viewer-canvas::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--border-subtle) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
}

.viewer-info {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.viewer-slide-title {
  font-size: 1.44rem; /* = 1.8rem base × 80% — matches JS default index 1 */
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.viewer-description {
  color: var(--text-secondary);
  font-size: 0.92rem; /* = 1.15rem base × 80% — matches JS default index 1 */
  line-height: 1.7;
  white-space: pre-wrap;
}

.viewer-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.viewer-progress {
  flex: 1;
  height: 3px;
  background: var(--border-default);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.viewer-progress-bar {
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.4s ease;
}

/* Slide transition */
.slide-transition-enter {
  animation: slideEnter 0.35s ease;
}

@keyframes slideEnter {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* =============================================================================
   ADMIN PAGE
   ============================================================================= */
.admin-layout {
  min-height: 100vh;
  background: var(--bg-base);
  overflow: auto;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

/* ── 1100px: tighten sidebar widths ────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root {
    --sidebar-width: 220px;
    --right-panel-width: 240px;
  }
}

/* ── 900px: further tighten ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 190px;
    --right-panel-width: 210px;
  }
  .pres-name-input { width: 160px; }
  .viewer-main { grid-template-columns: 1fr 300px; }
}

/* ── 768px: full mobile layout ──────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Toolbar desktop/mobile visibility */
  .editor-desk-only { display: none !important; }
  .editor-mob-only  { display: flex !important; align-items: center; }
  .editor-mob-back  { display: flex !important; align-items: center; justify-content: center; }
  .editor-desk-logo { display: none !important; }

  /* ─── Editor: fixed 3-row app shell ──────────────────────────────────────── */
  body.editor-page {
    overflow: hidden; /* keep fixed app shell, no body scroll */
  }

  .editor-layout {
    grid-template-rows: var(--toolbar-height) 1fr 60px;
    grid-template-columns: 1fr;
    height: 100svh;
    height: 100dvh;
  }

  .editor-toolbar {
    grid-column: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .editor-toolbar::-webkit-scrollbar { display: none; }

  /* Side panels become full-screen slide-in drawers */
  .editor-palette {
    position: fixed;
    inset: var(--toolbar-height) 0 60px 0;
    z-index: 300;
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border-default);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }
  .editor-palette.mob-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
  }

  .editor-right-panel {
    position: fixed;
    inset: var(--toolbar-height) 0 60px 0;
    z-index: 300;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-default);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }
  .editor-right-panel.mob-open {
    transform: translateX(0);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.6);
  }

  .editor-canvas-area {
    grid-column: 1;
    grid-row: 2;
    padding: var(--space-4) var(--space-3) var(--space-3);
    align-items: flex-start;
    overflow: auto;
  }

  .editor-canvas { min-width: unset; width: 100%; align-items: center; }

  .hive-container { width: min(320px, 90vw); padding-top: 40px; }

  /* Mobile bottom nav bar */
  .editor-mobile-nav {
    grid-column: 1;
    grid-row: 3;
    display: flex !important;
    height: 60px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-default);
    z-index: 200;
    flex-shrink: 0;
  }

  .mob-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    transition: color 0.15s, border-color 0.15s;
    font-family: var(--font-sans);
    padding: 0;
    border-top: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-nav-btn.active {
    color: var(--accent-primary);
    border-top-color: var(--accent-primary);
  }
  .mob-nav-btn svg { width: 20px; height: 20px; }

  /* Toolbar adjustments on mobile */
  .pres-name-input { width: 110px; font-size: 0.82rem; }
  .toolbar-sep { display: none; }

  /* ─── Viewer: scrollable stacked layout ───────────────────────────────────── */
  /* viewer.asp uses body.page so body scrolls; viewer-layout grows naturally */
  .viewer-layout {
    height: auto;
    min-height: 100svh;
    min-height: 100dvh;
    overflow: visible;
  }

  .viewer-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 var(--space-3);
    gap: var(--space-2);
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .viewer-toolbar::-webkit-scrollbar { display: none; }

  .viewer-main {
    display: block;
    height: auto;
    overflow: visible;
  }

  .viewer-canvas {
    min-height: 45svh;
    min-height: 45dvh;
    padding: var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--border-default);
    overflow: visible;
    position: relative;
  }

  /* viewer-info visibility controlled by .mob-collapsed toggle (in viewer.asp) */
  .viewer-info {
    border-left: none;
    padding: var(--space-4) var(--space-4) var(--space-8);
    overflow: visible;
    max-height: none;
  }

  /* ─── Admin: single-column stacked ───────────────────────────────────────── */
  .admin-main {
    grid-template-columns: 1fr !important;
    padding: var(--space-4) !important;
    gap: var(--space-4) !important;
  }

  .admin-header {
    padding: 0 var(--space-3) !important;
    gap: var(--space-2) !important;
    flex-wrap: wrap;
    height: auto !important;
    min-height: var(--toolbar-height);
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  /* Collapse inline-styled multi-column form grids inside admin edit panel */
  #formContent div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* ─── Dashboard ───────────────────────────────────────────────────────────── */
  .dash-header { padding: 0 var(--space-4); }
  .dash-main { padding: var(--space-5) var(--space-4) !important; }
  .dash-hero h2 { font-size: 1.4rem !important; }

  /* ─── Modals slide up from bottom on mobile ──────────────────────────────── */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-height: 92svh;
    max-height: 92dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 100%;
  }

  /* ─── Toast: above editor bottom nav ─────────────────────────────────────── */
  #toast-container { bottom: 72px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: 100%; }
}

/* ── 480px: small phones ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  :root { font-size: 13px; }

  .pres-name-input { width: 80px; }

  /* Shrink editor toolbar buttons to icon-only */
  .editor-toolbar .btn-sm:not(.btn-icon) { padding-left: 7px; padding-right: 7px; }
  .editor-toolbar .btn-sm:not(.btn-icon) > svg { margin: 0; }
  .editor-toolbar .btn-sm .btn-label { display: none; }
  /* Hide text in "Prezentovať" and "Export XML", keep icons */
  .editor-toolbar .btn-sm span:not(.btn-label) { font-size: 0; letter-spacing: 0; }

  /* Viewer toolbar */
  .viewer-toolbar .btn-sm .btn-label { display: none; }

  .hive-container { width: 98vw; max-width: 320px; }

  .admin-main { padding: var(--space-3) !important; }

  .dash-hero p { font-size: 0.875rem; }

  /* Dashboard grid: 1 column on tiny screens */
  .pres-grid { grid-template-columns: 1fr !important; }
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: var(--space-2); }
.gap-3       { gap: var(--space-3); }
.gap-4       { gap: var(--space-4); }
.ml-auto     { margin-left: auto; }
.mt-2        { margin-top: var(--space-2); }
.mt-4        { margin-top: var(--space-4); }
.mb-2        { margin-bottom: var(--space-2); }
.mb-4        { margin-bottom: var(--space-4); }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.text-muted  { color: var(--text-secondary); }
.text-accent { color: var(--accent-primary); }
.hidden      { display: none !important; }
.w-full      { width: 100%; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Accent highlight pulse animation */
@keyframes pulse-accent {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50%       { box-shadow: 0 0 0 6px transparent; }
}

.pulse { animation: pulse-accent 2s infinite; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface2) 25%, var(--bg-surface3) 50%, var(--bg-surface2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
