/* Editor Override Styles - Tailwind utilities fallback */

/* Palette progetto - Editor Elegante */
:root {
  --palette-teal: #2C5F6F;      /* 1. teal principale */
  --palette-teal-dark: #1a3d47;  /* 2. teal scuro (gradient) */
  --palette-rose: #E5B4A8;       /* 3. rosa terracotta (toolbar) */
  --palette-sky: #7CA5B8;        /* 4. blu (status bar) */
  --palette-cream: #F5F5F0;      /* 5. bianco crema */
  --palette-muted: #8FA89E;      /* 6. verde muted */
}

/* Layout */
.flex { display: flex !important; }
.flex-col { flex-direction: column !important; }
.h-screen { height: 100vh !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }

/* Colors */
.bg-gray-100 { background-color: #f3f4f6 !important; }
.bg-white { background-color: #ffffff !important; }
.bg-blue-800 { background-color: #1e3a8a !important; }
.bg-blue-700 { background-color: #1d4ed8 !important; }
.text-white { color: #ffffff !important; }

/* Typography */
.text-sm { font-size: 0.875rem !important; line-height: 1.25rem !important; }
.font-medium { font-weight: 500 !important; }

/* Spacing */
.px-6 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-2\.5 { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; }
.py-1\.5 { padding-top: 0.375rem !important; padding-bottom: 0.375rem !important; }
.p-1\.5 { padding: 0.375rem !important; }
.py-8 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }

/* Gap */
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-1\.5 { gap: 0.375rem !important; }

/* Alignment */
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }

/* Overflow */
.overflow-y-auto { overflow-y: auto !important; }

/* Sizing */
.min-h-full { min-height: 100% !important; }
.w-4 { width: 1rem !important; }
.h-4 { height: 1rem !important; }

/* Borders */
.border-b { border-bottom-width: 1px !important; }
.border-gray-200 { border-color: #e5e7eb !important; }
.rounded { border-radius: 0.25rem !important; }

/* Shadows */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important; }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important; }

/* Transitions */
.transition { 
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
  transition-duration: 150ms !important;
}

/* Hover states */
.hover\:bg-blue-700:hover { background-color: #1d4ed8 !important; }

/* Display */
.hidden { display: none !important; }
.inline-block { display: inline-block !important; }
.block { display: block !important; }

/* Additional Tailwind classes for login and dashboard */
.min-h-screen { min-height: 100vh !important; }
.bg-gray-50 { background-color: #f9fafb !important; }
.text-gray-800 { color: #1f2937 !important; }
.text-gray-600 { color: #4b5563 !important; }
.text-gray-700 { color: #374151 !important; }
.text-red-600 { color: #dc2626 !important; }
.text-xl { font-size: 1.25rem !important; line-height: 1.75rem !important; }
.text-2xl { font-size: 1.5rem !important; line-height: 2rem !important; }
.font-bold { font-weight: 700 !important; }
.w-8 { width: 2rem !important; }
.h-8 { height: 2rem !important; }
.w-full { width: 100% !important; }
.max-w-md { max-width: 28rem !important; }
.mb-6 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mt-4 { margin-top: 1rem !important; }
.p-6 { padding: 1.5rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-12 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
.border-2 { border-width: 2px !important; }
.border { border-width: 1px !important; }
.border-gray-300 { border-color: #d1d5db !important; }
.rounded-lg { border-radius: 0.5rem !important; }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important; }
.text-center { text-align: center !important; }
.h-12 { height: 3rem !important; }
.w-12 { width: 3rem !important; }
.border-b-2 { border-bottom-width: 2px !important; }
.animate-spin { animation: spin 1s linear infinite !important; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.rounded-full { border-radius: 9999px !important; }
.border-teal-dark { border-color: #0d9488 !important; }
.text-teal-dark { color: #0d9488 !important; }
.border-teal-light { border-color: #5eead4 !important; }
.bg-teal-light { background-color: #5eead4 !important; }
.bg-saffron { background-color: #fbbf24 !important; }
.text-gray-900 { color: #111827 !important; }
.hover\:bg-yellow-400:hover { background-color: #facc15 !important; }
.hover\:bg-teal-medium:hover { background-color: #14b8a6 !important; }
.bg-teal-dark { background-color: #0d9488 !important; }
.bg-teal-medium { background-color: #14b8a6 !important; }
.hover\:underline:hover { text-decoration: underline !important; }
.focus\:outline-none:focus { outline: 2px solid transparent !important; outline-offset: 2px !important; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5) !important; }
.focus\:ring-teal-500:focus { box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.5) !important; }
.focus\:border-teal-500:focus { border-color: #14b8a6 !important; }

/* Modern Login Styles */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.login-container {
  width: 100%;
  max-width: 420px;
  animation: fadeInUp 0.5s ease-out;
}

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

.login-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.login-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.login-logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(61, 92, 92, 0.35);
}

.login-logo img {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

.login-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  letter-spacing: -0.5px;
}

.login-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 2rem 0;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  transition: all 0.2s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-input:hover {
  border-color: #d1d5db;
}

.form-input:focus {
  outline: none;
  border-color: var(--palette-teal);
  box-shadow: 0 0 0 3px rgba(61, 92, 92, 0.15);
}

.error-message {
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 500;
}

.error-message.hidden {
  display: none;
}

.login-button {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(61, 92, 92, 0.35);
  font-family: inherit;
  margin-top: 0.5rem;
}

.login-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(61, 92, 92, 0.45);
}

.login-button:active:not(:disabled) {
  transform: translateY(0);
}

.login-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.button-text {
  display: inline-block;
}

/* Responsive */
@media (max-width: 640px) {
  .login-card {
    padding: 2rem 1.5rem;
  }
  
  .login-title {
    font-size: 1.5rem;
  }
}

/* Modern Dashboard Styles */
.dashboard-page {
  min-height: 100vh;
  background: var(--palette-cream);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dashboard-header {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.dashboard-header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dashboard-logo {
  width: 40px;
  height: 40px;
  background: var(--palette-teal);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(61, 92, 92, 0.3);
}

.dashboard-logo svg {
  width: 24px;
  height: 24px;
}

.dashboard-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--palette-teal);
  margin: 0;
  letter-spacing: -0.5px;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dashboard-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
}

.dashboard-logout-btn {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.dashboard-logout-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.dashboard-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.dashboard-hero {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInUp 0.6s ease-out;
}

.dashboard-title {
  font-size: 3rem;
  font-weight: 800;
  color: var(--palette-teal);
  margin: 0 0 0.5rem 0;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dashboard-subtitle {
  font-size: 1.125rem;
  color: #6b7280;
  margin: 0;
  font-weight: 400;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.dashboard-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 2px solid transparent;
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.dashboard-card:nth-child(1) { animation-delay: 0.1s; }
.dashboard-card:nth-child(2) { animation-delay: 0.2s; }
.dashboard-card:nth-child(3) { animation-delay: 0.3s; }

.dashboard-card:hover:not(.dashboard-card-disabled) {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--palette-teal);
}

.dashboard-card-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dashboard-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.dashboard-card-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

.writer-icon {
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%);
  color: white;
  box-shadow: 0 8px 16px rgba(61, 92, 92, 0.3);
}

.writer-icon svg {
  width: 36px;
  height: 36px;
}

.dashboard-card:hover:not(.dashboard-card-disabled) .writer-icon {
  transform: scale(1.1) rotate(5deg);
}

.disabled-icon {
  background: #f3f4f6;
  font-size: 2rem;
}

.dashboard-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.5px;
}

.disabled-title {
  color: #9ca3af;
}

.dashboard-card-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 1.5rem 0;
  line-height: 1.6;
}

.disabled-description {
  color: #d1d5db;
}

.dashboard-card-button {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(61, 92, 92, 0.3);
  font-family: inherit;
}

.dashboard-card-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(61, 92, 92, 0.4);
}

.dashboard-footer {
  text-align: center;
  padding: 2rem;
  color: #9ca3af;
  font-size: 0.875rem;
  margin-top: 4rem;
}

/* Loading spinner */
#loading {
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loading .text-center {
  text-align: center;
}

#loading .animate-spin {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: white;
}

#loading .text-teal-dark {
  color: white;
  font-weight: 500;
}

/* Responsive dashboard */
@media (max-width: 768px) {
  .dashboard-title {
    font-size: 2rem;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-header-content {
    padding: 0 1rem;
  }
  
  .dashboard-main {
    padding: 2rem 1rem;
  }
}

/* Modern Editor Styles */
.modern-toolbar {
  background: white !important;
  border-bottom: 1px solid #e5e7eb !important;
  padding: 10px 16px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.modern-toolbar button,
.modern-toolbar .toolbar-btn {
  margin: 0 2px !important;
  transition: all 0.2s ease !important;
}

.modern-toolbar button:hover,
.modern-toolbar .toolbar-btn:hover {
  background: #f3f4f6 !important;
  transform: scale(1.05) !important;
}

.modern-toolbar button.ql-active,
.modern-toolbar .toolbar-btn.ql-active {
  background: #e5e7eb !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

.modern-toolbar .ql-picker-options {
  border-radius: 8px !important;
  margin-top: 4px !important;
}

/* Top bar styling */
#top-bar,
.editor-top-bar {
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%) !important;
  box-shadow: 0 2px 8px rgba(61, 92, 92, 0.2) !important;
  padding: 0.75rem 1.5rem !important;
}

#top-bar h1 {
  font-weight: 600 !important;
  letter-spacing: -0.3px !important;
}

#top-bar button {
  transition: all 0.2s ease !important;
}

#top-bar button:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-1px) !important;
}

/* Editor page styling */
#editor-main {
  background: var(--palette-cream) !important;
}

#editor-main .editor-page {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
  border-radius: 4px !important;
  overflow: hidden !important;
}


/* Modern Editor Wrapper */
.editor-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--palette-cream);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Editor Top Bar - colore da palette */
.editor-top-bar {
  color: white;
  flex-shrink: 0;
}

.editor-top-bar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.editor-top-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.editor-top-bar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-filename {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.2px;
}

.editor-top-btn {
  background: transparent;
  border: none;
  color: white;
  padding: 0.5rem;
  min-width: 36px;
  min-height: 36px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.editor-top-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.editor-top-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.editor-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 0.5rem 0.875rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.editor-action-btn svg {
  width: 16px;
  height: 16px;
}

.editor-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Editor Toolbar */
.editor-toolbar-container {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.modern-toolbar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 16px !important;
}

.modern-toolbar .ql-stroke {
  stroke: var(--palette-teal) !important;
  stroke-width: 2 !important;
}

.modern-toolbar button:hover .ql-stroke,
.modern-toolbar .toolbar-btn:hover .ql-stroke {
  stroke: var(--palette-sky) !important;
}

.modern-toolbar button.ql-active .ql-stroke,
.modern-toolbar .toolbar-btn.ql-active .ql-stroke {
  stroke: var(--palette-teal) !important;
  stroke-width: 2.5 !important;
}

.modern-toolbar .ql-fill {
  fill: var(--palette-teal) !important;
}

.modern-toolbar button:hover .ql-fill,
.modern-toolbar .toolbar-btn:hover .ql-fill {
  fill: var(--palette-sky) !important;
}

.modern-toolbar button.ql-active .ql-fill,
.modern-toolbar .toolbar-btn.ql-active .ql-fill {
  fill: var(--palette-teal) !important;
}

/* Editor Main Area */
.editor-main-area {
  flex: 1;
  overflow-y: auto;
  background: var(--palette-cream);
  padding: 2rem 1rem;
}

.editor-content-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.editor-page {
  background: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  overflow: hidden;
  width: 210mm;
  min-height: 297mm;
  padding: 20mm;
  margin: 0 auto;
}

@media screen and (max-width: 768px) {
  .editor-page {
    width: 100%;
    padding: 1rem;
  }
}

/* Custom Modal Styles */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

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

.custom-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 420px;
  width: 90%;
  padding: 2rem;
  animation: slideUp 0.3s ease-out;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

.custom-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.custom-modal-icon {
  width: 24px;
  height: 24px;
  color: #f59e0b;
  flex-shrink: 0;
}

.custom-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  letter-spacing: -0.5px;
}

.custom-modal-message {
  font-size: 0.9375rem;
  color: #6b7280;
  margin: 0 0 1.5rem 0;
  line-height: 1.6;
}

.custom-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.custom-modal-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
}

.custom-modal-btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.custom-modal-btn-secondary:hover {
  background: #e5e7eb;
  color: #111827;
}

.custom-modal-btn-primary {
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(61, 92, 92, 0.35);
}

.custom-modal-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(61, 92, 92, 0.45);
}

/* Recovery Modal (already exists but improve styling) */
.fixed.inset-0 {
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(4px) !important;
}

.fixed.inset-0 .bg-white {
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
  padding: 2rem !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.fixed.inset-0 button {
  border-radius: 8px !important;
  padding: 0.625rem 1.25rem !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  font-family: inherit !important;
}

.fixed.inset-0 #recovery-restore {
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-sky) 100%) !important;
  color: white !important;
  border: none !important;
}

.fixed.inset-0 #recovery-restore:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(61, 92, 92, 0.45) !important;
}

.fixed.inset-0 #recovery-discard {
  background: #f3f4f6 !important;
  color: #374151 !important;
  border: none !important;
}

.fixed.inset-0 #recovery-discard:hover {
  background: #e5e7eb !important;
}

/* ========== EDITOR PAGE: stili forzati solo dentro #editor-app (palette + icone) ========== */
#editor-app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Body background quando editor è attivo - layout full screen */
body.editor-active {
  background: var(--palette-cream) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: 100vh !important;
  display: block !important;
}

#editor-app {
  width: 100% !important;
  max-width: none !important;
  display: block !important;
  min-height: 100vh !important;
}

#editor-app .editor-wrapper {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh !important;
  background: var(--palette-cream) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: hidden !important;
  width: 100% !important;
}

/* Navbar full width - occupa tutto lo schermo in larghezza */
#editor-app #top-bar,
#editor-app .editor-top-bar {
  width: 100% !important;
  max-width: none !important;
  background: linear-gradient(135deg, var(--palette-teal) 0%, var(--palette-teal-dark) 100%) !important;
  color: #fff !important;
  padding: 0.75rem 1.5rem !important;
  box-shadow: 0 2px 8px rgba(44, 95, 111, 0.3) !important;
  flex-shrink: 0 !important;
}

/* Top bar: logo progetto, documento, pulsanti a sinistra - stile minimale */
#editor-app .editor-top-bar-left {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
}

#editor-app .editor-logo-link {
  display: flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: 6px;
  flex-shrink: 0;
}
#editor-app .editor-nav-logo {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

#editor-app .editor-doc-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
#editor-app .editor-doc-logo {
  width: 22px;
  height: 22px;
  color: rgba(255,255,255,0.9);
  flex-shrink: 0;
}
#editor-app .editor-doc-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
#editor-app .editor-app-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.02em;
}
#editor-app .editor-filename,
#editor-app #filename-display {
  font-size: 0.8125rem;
  font-weight: 400;
  color: rgba(255,255,255,0.85);
}

/* Pulsanti minimali: niente bordi, testo semplice */
#editor-app .editor-btn-minimal {
  background: transparent !important;
  border: none !important;
  color: rgba(255,255,255,0.95) !important;
  padding: 0.4rem 0.75rem !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: background 0.15s, color 0.15s !important;
  font-family: inherit !important;
}
#editor-app .editor-btn-minimal:hover {
  background: rgba(255,255,255,0.12) !important;
  color: #fff !important;
}

#editor-app .editor-btn-icon {
  background: transparent !important;
  border: none !important;
  color: rgba(255,255,255,0.9) !important;
  padding: 0.5rem !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.15s !important;
}
#editor-app .editor-btn-icon:hover {
  background: rgba(255,255,255,0.12) !important;
}
#editor-app .editor-btn-icon svg {
  stroke: currentColor;
  flex-shrink: 0;
}
#editor-app .editor-top-bar-right {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

/* Toolbar full width - comandi per il testo sotto la navbar */
#editor-app .editor-toolbar-container {
  width: 100% !important;
  max-width: none !important;
  background: var(--palette-rose) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
  padding: 0.75rem 1rem !important;
  flex-shrink: 0 !important;
  overflow-x: auto !important;
}

#editor-app .modern-toolbar {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  display: flex !important;
  gap: 1rem !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  min-width: 0 !important;
}
#editor-app .modern-toolbar .ql-formats {
  display: flex !important;
  gap: 0.5rem !important;
  align-items: center !important;
}
#editor-app .modern-toolbar .ql-formats + .ql-formats {
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  padding-left: 0.75rem;
  margin-left: 0.25rem;
}
#editor-app .modern-toolbar .ql-stroke {
  stroke: var(--palette-teal) !important;
}
#editor-app .modern-toolbar .ql-fill {
  fill: var(--palette-teal) !important;
}
#editor-app .modern-toolbar button,
#editor-app .modern-toolbar .toolbar-btn {
  background: rgba(255, 255, 255, 0.3) !important;
  border: none !important;
  border-radius: 6px !important;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  flex-shrink: 0 !important;
  color: var(--palette-teal) !important;
  transition: all 0.2s !important;
}

#editor-app .modern-toolbar button.toolbar-btn[title*="Nuovo"],
#editor-app .modern-toolbar button.toolbar-btn[title*="Immagine"],
#editor-app .modern-toolbar button.toolbar-btn[title*="Link"] {
  width: auto !important;
  min-width: 32px !important;
  padding: 0 0.5rem !important;
}

#editor-app .modern-toolbar .ql-picker {
  background: rgba(255, 255, 255, 0.3) !important;
  border: none !important;
  border-radius: 6px !important;
  min-width: 32px !important;
  height: 32px !important;
  flex-shrink: 0 !important;
  color: var(--palette-teal) !important;
  transition: all 0.2s !important;
}
#editor-app .modern-toolbar button:hover,
#editor-app .modern-toolbar .toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.5) !important;
  transform: translateY(-1px) !important;
}
#editor-app .modern-toolbar button:hover .ql-stroke,
#editor-app .modern-toolbar .toolbar-btn:hover .ql-stroke {
  stroke: var(--palette-teal-dark) !important;
}
#editor-app .modern-toolbar button:hover .ql-fill,
#editor-app .modern-toolbar .toolbar-btn:hover .ql-fill {
  fill: var(--palette-teal-dark) !important;
}
#editor-app .modern-toolbar button.ql-active,
#editor-app .modern-toolbar .toolbar-btn.ql-active {
  background: var(--palette-teal) !important;
  color: white !important;
}
#editor-app .modern-toolbar button.ql-active .ql-stroke,
#editor-app .modern-toolbar button.ql-active .ql-fill {
  stroke: white !important;
  fill: white !important;
}

/* Area principale: navigatore + foglio */
#editor-app #editor-main,
#editor-app .editor-main-area {
  background: var(--palette-cream) !important;
  flex: 1 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: row !important;
  min-height: 0 !important;
}

/* Colonna navigatore - indice del documento */
#editor-app .editor-outline {
  width: 220px !important;
  min-width: 220px !important;
  flex-shrink: 0 !important;
  background: white !important;
  border-right: 1px solid #e5e7eb !important;
  overflow-y: auto !important;
  padding: 1rem 0.75rem !important;
}

#editor-app .editor-outline-title {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: var(--palette-teal) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  margin-bottom: 0.75rem !important;
  padding: 0 0.25rem !important;
}

#editor-app .editor-outline-nav {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.25rem !important;
}

#editor-app .editor-outline-item {
  display: block !important;
  font-size: 0.8125rem !important;
  color: #4b5563 !important;
  text-decoration: none !important;
  padding: 0.35rem 0.5rem !important;
  border-radius: 4px !important;
  transition: background 0.15s, color 0.15s !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#editor-app .editor-outline-item:hover {
  background: #f3f4f6 !important;
  color: var(--palette-teal) !important;
}

#editor-app .editor-outline-h1 {
  font-weight: 600 !important;
  padding-left: 0.25rem !important;
}

#editor-app .editor-outline-h2 {
  font-weight: 500 !important;
  padding-left: 0.75rem !important;
  font-size: 0.75rem !important;
}

#editor-app .editor-outline-h3 {
  font-weight: 400 !important;
  padding-left: 1.25rem !important;
  font-size: 0.6875rem !important;
  color: #6b7280 !important;
}

#editor-app .editor-outline-empty {
  font-size: 0.8125rem !important;
  color: #9ca3af !important;
  font-style: italic !important;
  padding: 0.5rem !important;
}

/* Content wrapper con scroll */
#editor-app .editor-content-wrapper {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 2rem 1rem !important;
  min-width: 0 !important;
}

#editor-app .editor-page {
  background: #fff !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
  border-radius: 4px !important;
  margin: 0 auto !important;
  padding: 4rem 5rem !important;
  min-height: 297mm !important;
  width: 210mm !important;
}

/* Status bar - Editor Elegante */
#editor-app .status-bar {
  background: var(--palette-sky) !important;
  padding: 0.75rem 2rem !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  color: white !important;
  font-size: 0.85rem !important;
  flex-shrink: 0 !important;
}

#editor-app .status-item {
  display: flex !important;
  gap: 2rem !important;
}

#editor-app .status-info {
  opacity: 0.9 !important;
}

/* Scrollbar - Editor Elegante */
#editor-app ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#editor-app ::-webkit-scrollbar-track {
  background: var(--palette-cream);
}

#editor-app ::-webkit-scrollbar-thumb {
  background: var(--palette-muted);
  border-radius: 4px;
}

#editor-app ::-webkit-scrollbar-thumb:hover {
  background: var(--palette-sky);
}

@media (max-width: 768px) {
  #editor-app .editor-outline {
    display: none !important;
  }
  
  #editor-app .editor-page {
    margin: 1.5rem !important;
    padding: 2rem 1.5rem !important;
  }
  
  #editor-app .editor-toolbar-container {
    padding: 0.75rem 1rem !important;
  }
}

/* Forza override Quill/Tailwind nella pagina editor - niente bordi neri */
#editor-app .ql-toolbar.ql-snow {
  background: #fff !important;
  border: none !important;
  border-bottom: 1px solid #e5e7eb !important;
}
#editor-app .ql-toolbar.ql-snow button,
#editor-app .ql-toolbar.ql-snow .ql-picker {
  border: none !important;
  outline: none !important;
}
#editor-app .ql-toolbar.ql-snow .ql-picker-label {
  border: none !important;
}
#editor-app .ql-container.ql-snow {
  border: none !important;
}

/* Stampa: solo il foglio, niente navbar/toolbar/indice */
@media print {
  body,
  html {
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
  }
  #app,
  #loading,
  #editor-app .editor-outline,
  #editor-app #top-bar,
  #editor-app .editor-top-bar,
  #editor-app .editor-toolbar-container,
  #editor-app .status-bar {
    display: none !important;
  }
  #editor-app {
    display: block !important;
  }
  #editor-app .editor-wrapper {
    display: block !important;
    box-shadow: none !important;
    background: white !important;
  }
  #editor-app .editor-main-area {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
    background: white !important;
  }
  #editor-app .editor-content-wrapper {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
  }
  #editor-app .editor-page {
    box-shadow: none !important;
    margin: 0 auto !important;
    width: 210mm !important;
    min-height: 297mm !important;
    background: white !important;
  }
  #editor-app .ql-toolbar,
  #editor-app .ql-container.ql-snow {
    border: none !important;
  }
  #editor-app .ql-editor {
    border: none !important;
    box-shadow: none !important;
  }
}

