/**
 * 🎨 KOMPLETT ÜBERARBEITETES ARTIKELDETAILFENSTER
 *
 * Strukturiert, kompakt und übersichtlich
 * Optimiert für bessere Benutzerfreundlichkeit
 * KOMPAKT-VERSION für kleinere Displays */

/* ===== DIALOG CONTAINER ===== */
.edit-dialog {
  max-width: 98vw;
  width: 98vw;
  max-height: 98vh;
  overflow-y: auto;
  overflow-x: visible;
  background: var(--bg-primary, #1a1a1a);
  border-radius: var(--border-radius-lg, 12px);
  box-shadow: var(--shadow-lg, 0 20px 60px rgba(0, 0, 0, 0.5));
  border: 1px solid var(--border-color, #555555);
  padding: 0;
  position: relative;
}

.edit-dialog h3 {
  background: var(--bg-elevated, #333333);
  margin: 0;
  padding: 12px 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  border-radius: var(--border-radius-lg, 12px) var(--border-radius-lg, 12px) 0 0;
  border-bottom: 2px solid var(--primary-color, #e57373);
  text-align: left;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: visible;
  position: relative;
}

.title-with-circle {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  flex: 1;
  min-width: 0;
}

.title-with-circle .abtnr-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary, #2d2d2d);
  color: var(--text-primary, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color, #555555);
}

.title-data {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

.title-data-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  align-items: flex-start;
  position: relative;
}

.title-data-field-full {
  flex: 1;
}

.title-data-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #999999);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0;
  padding-bottom: 4px;
  display: inline-block;
  width: fit-content;
  border-bottom: 1px solid var(--border-subtle, #444444);
}

.title-data-value-container {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  width: fit-content;
  min-width: 0;
}

.title-data-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.title-data-value-editable {
  cursor: pointer;
  display: inline;
  border-bottom: 2px dotted var(--primary-color, #e57373);
  padding-bottom: 2px;
  transition: all 0.2s ease;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
}

.title-data-value-editable:hover {
  border-bottom-color: var(--primary-hover, #d46666);
  color: var(--primary-hover, #d46666);
}

.title-data-field-full .title-data-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-data-input {
  padding: 4px 8px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 15px;
  font-weight: 700;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 28px;
  width: 100%;
  flex: 1;
}

.title-data-input:focus {
  outline: none;
  border-color: var(--input-focus, #4a9eff);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.title-data-input:hover {
  border-color: var(--border-color, #555555);
}

.title-data-field-full .title-data-input {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Preisverlaufs-Grafen im Header */
.price-chart-header-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-right: 8px;
  min-width: 220px;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.price-chart-timeframe-filters {
  display: flex;
  gap: 4px;
  align-items: center;
}

.price-chart-timeframe-filters .timeframe-btn {
  background: var(--bg-elevated, #333333);
  border: 1px solid var(--border-color, #555555);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary, #cccccc);
  cursor: pointer;
  transition: var(--transition-fast, 0.15s ease);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.price-chart-timeframe-filters .timeframe-btn:hover {
  background: var(--bg-hover, #404040);
  border-color: var(--primary-color, #e57373);
  color: var(--primary-color, #e57373);
}

.price-chart-timeframe-filters .timeframe-btn.active {
  background: var(--primary-color, #e57373);
  border-color: var(--primary-color, #e57373);
  color: var(--text-primary, #ffffff);
}

.price-chart-wrapper {
  width: 200px;
  height: auto; /* Automatische Höhe für Chart + Legende */
  min-height: 60px;
  background: var(--bg-secondary, #2d2d2d);
  border-radius: 4px;
  padding: 4px;
  border: 1px solid var(--border-color, #555555);
  transition:
    transform 0.3s ease,
    z-index 0.3s ease,
    box-shadow 0.3s ease;
  transform-origin: top right;
  position: relative;
  overflow: visible;
}

.price-chart-wrapper canvas {
  overflow: visible !important;
}

.price-chart-header-container:hover .price-chart-wrapper {
  transform: scale(2);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.edit-dialog h3 {
  overflow: visible;
}

.price-chart-wrapper canvas {
  width: 100% !important;
  height: 60px !important;
}

/* 🆕 Preis-Chart Legende (jetzt im Wrapper für gemeinsamen Zoom) */
.price-chart-legend {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 8px;
  color: var(--text-muted, #999999);
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px solid var(--border-subtle, #444444);
  flex-wrap: nowrap;
}

.price-chart-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.price-chart-legend .legend-color {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

.price-chart-legend .legend-dashed {
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.9) 0px,
    rgba(255, 255, 255, 0.9) 3px,
    transparent 3px,
    transparent 5px
  ) !important;
}

/* Beim Hover: Legende wird größer und besser lesbar */
.price-chart-header-container:hover .price-chart-legend {
  font-size: 10px;
  gap: 10px;
  padding-top: 4px;
  margin-top: 4px;
}

.price-chart-header-container:hover .price-chart-legend .legend-color {
  width: 14px;
  height: 3px;
}

/* 🔒 Readonly-Felder ohne Berechtigung (cursor zeigt, dass nicht bearbeitbar) */
.edit-dialog input.readonly-no-permission,
.edit-dialog textarea.readonly-no-permission,
.edit-dialog select.readonly-no-permission {
  cursor: not-allowed !important;
  pointer-events: auto; /* Ermöglicht Click-Event für Toast */
}

.edit-dialog input.readonly-no-permission:hover,
.edit-dialog textarea.readonly-no-permission:hover,
.edit-dialog select.readonly-no-permission:hover {
  cursor: not-allowed !important;
}

.edit-dialog input.readonly-no-permission:focus,
.edit-dialog textarea.readonly-no-permission:focus,
.edit-dialog select.readonly-no-permission:focus {
  outline: none !important;
  border-color: var(--border-color, #444444) !important;
  box-shadow: none !important;
}

/* 🔒 Contenteditable-Felder im A4-Schild ohne Berechtigung (cursor zeigt, dass nicht bearbeitbar) */
#sonderheit.readonly-no-permission,
#vkneu-inner.readonly-no-permission,
#hinweis-text.readonly-no-permission {
  cursor: not-allowed !important;
  pointer-events: auto; /* Ermöglicht Click-Event für Toast */
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

#sonderheit.readonly-no-permission:hover,
#vkneu-inner.readonly-no-permission:hover,
#hinweis-text.readonly-no-permission:hover {
  cursor: not-allowed !important;
}

#sonderheit.readonly-no-permission:focus,
#vkneu-inner.readonly-no-permission:focus,
#hinweis-text.readonly-no-permission:focus {
  outline: none !important;
  border-color: var(--border-color, #444444) !important;
  box-shadow: none !important;
}

/* 📄 PDF-EXPORT: VOLLSTÄNDIGE GAST-STYLE-OVERRIDE */
/* ⚡ KRITISCH: PDFs müssen bei Gästen 100% identisch aussehen wie bei Admins */
/* ================================================ */

/* ⚡ SPEZIAL: #sonderheit, #vkneu-inner, #hinweis-text */
/* Diese Elemente MÜSSEN ihren originalen Hintergrund behalten (nicht transparent!) */
/* HÖCHSTE PRIORITÄT mit mehreren Selektoren für maximale Spezifität */
body.pdf-export #sonderheit.readonly-no-permission,
body.pdf-export #vkneu-inner.readonly-no-permission,
body.pdf-export #hinweis-text.readonly-no-permission,
body.pdf-export-guest-override #sonderheit.readonly-no-permission,
body.pdf-export-guest-override #vkneu-inner.readonly-no-permission,
body.pdf-export-guest-override #hinweis-text.readonly-no-permission,
body.pdf-export-guest-override #sonderheit,
body.pdf-export-guest-override #vkneu-inner,
body.pdf-export-guest-override #hinweis-text {
  /* ✅ NUR HINTERGRUND ÄNDERN (gelb statt #2a2a2a) */
  /* ⚠️ KRITISCH: Textfarbe, Ausrichtung, Font DÜRFEN NICHT geändert werden! */
  opacity: 1 !important;
  background: unset !important;
  background-color: unset !important; /* Entfernt #2a2a2a → Original-Gelb kommt durch */
  background-image: unset !important;

  /* ⚠️ color: ENTFERNT! - Damit rot/schwarz erhalten bleibt */
  /* ⚠️ text-align: NICHT überschreiben - bleibt center */
  /* ⚠️ font-size, font-weight: NICHT überschreiben */

  cursor: default !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  pointer-events: auto !important;
  box-shadow: none !important;
  filter: none !important;
}

/* Override für alle anderen Elemente */
body.pdf-export input.readonly-no-permission,
body.pdf-export textarea.readonly-no-permission,
body.pdf-export select.readonly-no-permission,
body.pdf-export .readonly-no-permission,
body.pdf-export .no-permission,
body.pdf-export .article-locked,
body.pdf-export .locked-by-other,
body.pdf-export input[readonly],
body.pdf-export textarea[readonly],
body.pdf-export select[readonly],
body.pdf-export *[disabled],
body.pdf-export .form-row input[readonly],
body.pdf-export .form-field input[readonly],
body.pdf-export .price-field input[readonly],
body.pdf-export .stock-field input[readonly],
body.pdf-export .form-field-compact input[readonly],
body.pdf-export-guest-override .readonly-no-permission,
body.pdf-export-guest-override .no-permission,
body.pdf-export-guest-override input[readonly],
body.pdf-export-guest-override textarea[readonly] {
  /* Zurücksetzen auf normale Werte */
  opacity: 1 !important;
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  color: inherit !important;
  cursor: default !important;
  border: inherit !important;
  border-color: inherit !important;
  border-style: inherit !important;
  border-width: inherit !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  pointer-events: auto !important;
}

.edit-dialog-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  opacity: 0.6;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary, #ffffff);
  padding: 4px 8px;
  border-radius: var(--border-radius-sm, 4px);
  line-height: 1;
  min-width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.edit-dialog-close-btn:hover {
  opacity: 1;
  background: var(--bg-hover, #404040);
  transform: scale(1.1);
}

.edit-dialog-close-btn:active {
  transform: scale(0.95);
}

/* ===== FORM CONTAINER ===== */
#edit-form {
  background: var(--bg-primary, #1a1a1a);
  padding: 12px;
  border-radius: 0 0 var(--border-radius-lg, 12px) var(--border-radius-lg, 12px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 10px;
  min-height: 500px;
}

/* Layout für die Bereiche */
.article-section.section-basic {
  display: none; /* Grunddaten-Bereich wurde entfernt - Informationen sind jetzt im Titel */
}

/* Neue strukturierte Grunddaten-Anzeige */
.basic-data-container {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.basic-data-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  flex: 1;
}

.basic-data-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.basic-data-field-full {
  grid-column: 1 / -1;
}

.basic-data-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.basic-data-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
  padding: 6px 10px;
  background: var(--bg-elevated, #333333);
  border-radius: var(--border-radius-sm, 4px);
  border: 1px solid var(--border-subtle, #444444);
  min-height: 32px;
  display: flex;
  align-items: center;
}

.basic-data-input {
  padding: 6px 10px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 13px;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 32px;
  width: 100%;
}

.basic-data-input:focus {
  outline: none;
  border-color: var(--input-focus, #4a9eff);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.basic-data-input:hover {
  border-color: var(--border-color, #555555);
}

.article-section.section-prices-stock {
  grid-column: 1;
  grid-row: 1;
  padding: 14px;
  margin-top: 0;
  padding-top: 10px;
  align-self: start;
  display: flex;
  flex-direction: column;
}

/* Größere Schriftgrößen für Preise & Bestand Bereich */
.section-prices-stock .article-section-header {
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  letter-spacing: 0.8px;
}

.section-prices-stock .article-section-header::before {
  margin-right: 8px;
  font-size: 18px;
}

.section-prices-stock .prices-compact-header,
.section-prices-stock .stock-compact-header,
.section-prices-stock .lager-compact-header {
  font-size: 12px;
  margin-bottom: 8px;
  padding-bottom: 4px;
}

.section-prices-stock .price-field-compact label,
.section-prices-stock .stock-field-compact label,
.section-prices-stock .lager-field-compact label {
  font-size: 12px;
  font-weight: 700;
}

.section-prices-stock .price-field-compact input {
  padding: 8px 25px 8px 10px;
  font-size: 14px;
  min-height: 34px;
  text-align: right;
}

.section-prices-stock .price-input-wrapper .currency-symbol {
  right: 8px;
  font-size: 14px;
}

.section-prices-stock .stock-field-compact input,
.section-prices-stock .lager-field-compact input {
  padding: 8px 10px;
  font-size: 14px;
  min-height: 34px;
}

.section-prices-stock .lager-field-compact small {
  font-size: 10px;
}

.section-prices-stock .prices-compact,
.section-prices-stock .stock-compact,
.section-prices-stock .lager-compact {
  padding: 10px;
  gap: 8px;
}

.article-section.section-history {
  grid-column: 2;
  grid-row: 1;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: visible; /* Erlaubt Nummern-Badges außerhalb der Box */
  padding: 14px;
  padding-top: 10px;
  margin-top: 0;
  align-self: start;
}

/* Größere Schriftgrößen für Preishistorie Bereich (wie Preise & Bestände) */
.section-history .article-section-header {
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  letter-spacing: 0.8px;
}

.section-history .article-section-header::before {
  margin-right: 8px;
  font-size: 18px;
}

/* Preishistorie Container nutzt volle Höhe */
.article-section.section-history .price-history-compact {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Preishistorie Liste - Maximal 4 Einträge sichtbar, dann scrollbar */
.article-section.section-history .price-history-compact .price-history-list-compact {
  flex: 0 1 auto;
  max-height: 360px; /* Etwa 4 Einträge (90px pro Eintrag) */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ===== STRUKTURIERTE BEREICHE ===== */
.article-section {
  margin-bottom: 0;
  padding: 10px;
  background: var(--bg-secondary, #2d2d2d);
  border-radius: var(--border-radius-md, 8px);
  border: 1px solid var(--border-subtle, #444444);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Kompakte Bereiche für Preise und Bestand */
.article-section.section-prices,
.article-section.section-stock {
  margin-bottom: 8px;
  padding: 8px;
}

.article-section.section-prices .article-section-header,
.article-section.section-stock .article-section-header {
  margin-bottom: 8px;
  padding-bottom: 4px;
  font-size: 12px;
}

/* Kombinierter Preise & Bestand Bereich - Kompakt */
.article-section.section-prices-stock {
  margin-bottom: 0;
  margin-top: 0;
  padding: 14px;
  padding-top: 10px;
}

.prices-stock-compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prices-compact,
.stock-compact,
.lager-compact {
  background: var(--bg-elevated, #333333);
  border-radius: 5px;
  padding: 6px;
  border: 1px solid var(--border-subtle, #444444);
}

.prices-compact-header,
.stock-compact-header,
.lager-compact-header {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border-subtle, #444444);
}

.price-grid-compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.price-field-compact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.price-field-compact label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  text-align: center;
}

.price-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.price-field-compact input {
  padding: 5px 20px 5px 6px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 12px;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 26px;
  text-align: right;
  width: 100%;
}

.price-input-wrapper .currency-symbol {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary, #cccccc);
  pointer-events: none;
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
}

.stock-grid-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.stock-field-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stock-field-compact label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.1px;
  text-align: center;
}

.stock-field-compact input {
  padding: 4px 5px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 11px;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 24px;
  text-align: center;
}

.stock-field-sop {
  border-radius: 3px;
  padding: 2px;
}

.lager-grid-compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.lager-field-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.lager-field-compact label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.1px;
}

.lager-field-compact small {
  color: var(--text-muted, #999999);
  font-size: 8px;
  font-weight: 500;
  margin: -2px 0 0 0;
}

.lager-field-compact input {
  padding: 4px 5px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 11px;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 24px;
  text-align: center;
  width: 100%;
}

.article-section-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--primary-color, #e57373);
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-section-header::before {
  margin-right: 6px;
  font-size: 14px;
}

/* Alte Header-Styles für Grunddaten entfernt - neue Struktur verwendet article-section-header-basic */
.section-prices .article-section-header::before {
  content: '💰';
}
.section-stock .article-section-header::before {
  content: '📦';
}
.section-history .article-section-header::before {
  content: '📈';
}

/* ===== KOMPAKTE FORMULARZEILEN ===== */
.form-grid {
  display: grid;
  gap: 8px;
}

.form-grid-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.form-field-compact {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-field-compact.form-field-full {
  grid-column: 1 / -1;
}

.form-field-compact label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.form-field-compact input {
  padding: 6px 8px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 13px;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 28px;
}

.form-field-compact input:focus {
  outline: none;
  border-color: var(--input-focus, #4a9eff);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.form-field-compact input[readonly] {
  background: var(--bg-secondary, #2d2d2d);
  color: var(--text-muted, #999999);
  border-color: var(--border-subtle, #444444);
  cursor: not-allowed;
  opacity: 0.8;
}

/* 📄 PDF-EXPORT: Readonly-Felder normal darstellen */
body.pdf-export .form-field-compact input[readonly],
body.pdf-export .form-field-compact input.readonly-no-permission,
body.pdf-export-guest-override .form-field-compact input {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  color: inherit !important;
  border: inherit !important;
  border-color: inherit !important;
  cursor: default !important;
  opacity: 1 !important;
  box-shadow: none !important;
  filter: none !important;
  pointer-events: auto !important;
}

/* ===== WÄHRUNGSZEICHEN BEI PREISFELDERN ===== */
.price-field {
  position: relative;
}

.price-field input {
  padding-right: 25px; /* Platz für das Euro-Zeichen */
}

.price-field::after {
  content: ' €';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: inherit;
  pointer-events: none;
  font-weight: 600;
  z-index: 1;
  font-size: 14px;
  line-height: 1;
  margin-top: 12px; /* Verschiebt es zur Mitte des Input-Feldes */
}

/* Anpassung für Währungszeichen */

.form-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.form-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin-bottom: 3px;
}

.form-field input {
  padding: 10px 12px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 15px;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 36px;
}

.form-field input:focus {
  outline: none;
  border-color: var(--input-focus, #4a9eff);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.form-field input:hover {
  border-color: var(--border-color, #555555);
}

.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.price-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.price-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin-bottom: 2px;
}

.price-field input {
  padding: 8px 10px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 14px;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 32px;
}

.stock-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1.5fr;
  gap: 6px;
}

.stock-grid-structured {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stock-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.stock-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stock-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #cccccc);
  text-transform: uppercase;
  letter-spacing: 0.1px;
  margin-bottom: 2px;
  text-align: center;
}

.stock-field input {
  padding: 6px 8px;
  border: 1px solid var(--input-border, #555555);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 13px;
  background: var(--input-bg, #333333);
  color: var(--text-primary, #ffffff);
  transition: var(--transition-fast, 0.15s ease);
  min-height: 28px;
  text-align: center;
}

/* ===== ÄNDERUNGSPROTOKOLL (CHANGELOG) - KOMPAKTES LOGBUCH ===== */

/* Section Header - wie Preise & Bestände */
.section-changelog .article-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  letter-spacing: 0.8px;
}

.changelog-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Zahlen-Badge (ersetzt das 📋 Icon) */
.changelog-count-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  background: var(--primary-color, #e57373);
  color: var(--text-primary, #ffffff);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  margin-left: -14px;
  margin-top: -16px;
}

.changelog-header-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.changelog-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted, #999999);
}

.changelog-filter-toggle input[type='checkbox'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color, #e57373);
}

.changelog-filter-toggle label {
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

/* Container */
.changelog-container {
  background: var(--bg-elevated, #333333);
  border-radius: 5px;
  padding: 8px;
  padding-left: 25px; /* Platz für die Nummern-Badges */
  height: auto;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: visible; /* Damit Nummern-Badges nicht abgeschnitten werden */
  font-size: 11px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb, #555555) var(--scrollbar-track, #2d2d2d);
}

.changelog-container::-webkit-scrollbar {
  width: 6px;
}

.changelog-container::-webkit-scrollbar-track {
  background: var(--scrollbar-track, #2d2d2d);
  border-radius: 3px;
}

.changelog-container::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb, #555555);
  border-radius: 3px;
}

/* Loading & Empty States */
.changelog-loading,
.changelog-empty,
.changelog-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-muted, #999999);
  text-align: center;
  gap: 8px;
}

.changelog-empty-icon,
.changelog-error-icon {
  font-size: 28px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.changelog-error {
  color: var(--error-color, #f44336);
}

/* Animierte Ladeanimation */
.changelog-loading-animated {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  gap: 12px;
  min-height: 150px;
}

/* Spinner */
.changelog-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-elevated, #333333);
  border-top-color: var(--primary-color, #e57373);
  border-radius: 50%;
  animation: changelog-spin 0.8s linear infinite;
}

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

.changelog-loading-text {
  font-size: 13px;
  color: var(--text-muted, #999999);
  font-weight: 500;
}

/* Fortschrittsbalken */
.changelog-progress-bar {
  width: 80%;
  max-width: 200px;
  height: 6px;
  background: var(--bg-elevated, #333333);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.changelog-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color, #e57373), var(--success-color, #4caf50));
  border-radius: 3px;
  transition: width 0.2s ease-out;
}

.changelog-progress-text {
  font-size: 11px;
  color: var(--primary-color, #e57373);
  font-weight: 600;
}

/* Retry Button */
.changelog-retry-btn {
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--primary-color, #e57373);
  color: var(--text-primary, #ffffff);
  border: none;
  border-radius: var(--border-radius-sm, 4px);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast, 0.15s ease);
}

.changelog-retry-btn:hover {
  background: var(--primary-hover, #d46666);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(229, 115, 115, 0.4);
}

/* Changelog Liste */
.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Einzelner Eintrag - HINWEIS: Hauptstyles sind jetzt in .changelog-entry-wrapper/.changelog-entry-front */

/* Nummerierungs-Badge */
.changelog-number {
  position: absolute;
  top: -10px;
  left: -18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 6px;
  background: var(--bg-elevated, #333333);
  color: var(--text-primary, #ffffff);
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color, #555555);
  z-index: 1;
}

/* Entry Content Wrapper */
.changelog-entry-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* User vs System Unterscheidung - HINWEIS: Hauptstyles sind jetzt in .changelog-entry-wrapper */

/* Entry Header */
.changelog-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.changelog-category-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.changelog-field-label {
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  font-size: 16px;
  flex: 1;
}

/* Entry Body */
.changelog-entry-body {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Werte-Anzeige */
.changelog-values {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.changelog-old-value,
.changelog-new-value {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.changelog-old-value {
  background: #fee2e2;
  color: #dc2626;
  text-decoration: line-through;
  opacity: 0.8;
}

.changelog-new-value {
  background: #dcfce7;
  color: #16a34a;
}

.changelog-arrow {
  color: #9ca3af;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}

/* Entry Footer */
.changelog-entry-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle, #444444);
  margin-top: 2px;
}

/* User-Anzeige */
.changelog-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.changelog-user-icon {
  font-size: 16px;
}

.changelog-user-name {
  font-size: 14px;
  color: var(--text-secondary, #cccccc);
  font-weight: 600;
}

/* Datum */
.changelog-date {
  font-size: 11px;
  color: var(--text-muted, #999999);
  white-space: nowrap;
}

/* Footer mit Statistiken */
.changelog-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 4px;
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle, #444444);
}

.changelog-stat {
  font-size: 9px;
  color: var(--text-muted, #999999);
  display: flex;
  align-items: center;
  gap: 3px;
}

.changelog-stat.user-stat {
  color: var(--primary-color, #e57373);
}

.changelog-stat.system-stat {
  color: var(--text-muted, #999999);
}

/* ===== FLIP-CARD ANIMATION FÜR CHANGELOG ===== */

/* Wrapper für Flip-Effekt */
.changelog-entry-wrapper {
  perspective: 1000px;
  margin-bottom: 6px;
  margin-left: 18px;
  margin-top: 10px;
  position: relative;
  overflow: visible; /* Nummern-Badge darf herausragen */
}

.changelog-entry-wrapper[data-has-snapshot='true'] {
  cursor: pointer;
}

.changelog-entry-flipper {
  position: relative;
  width: 100%;
  min-height: 80px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.changelog-entry-wrapper.flipped .changelog-entry-flipper {
  transform: rotateY(180deg);
}

/* Vorder- und Rückseite */
.changelog-entry-front,
.changelog-entry-back {
  position: absolute;
  width: 100%;
  min-height: 80px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 6px;
  overflow: visible; /* Nummern-Badge darf herausragen */
}

.changelog-entry-front {
  z-index: 2;
  background: var(--bg-elevated, #333333);
  border: 1px solid var(--border-subtle, #444444);
  display: flex;
  align-items: flex-start;
  padding: 10px 12px;
  transition: var(--transition-fast, 0.15s ease);
}

.changelog-entry-wrapper.user-change .changelog-entry-front {
  border-left: 4px solid var(--primary-color, #e57373);
}

.changelog-entry-wrapper.system-change .changelog-entry-front {
  border-left: 4px solid var(--text-muted, #999999);
  opacity: 0.7;
  background: var(--bg-secondary, #2d2d2d);
}

.changelog-entry-wrapper:hover .changelog-entry-front {
  background: var(--bg-hover, #404040);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.3));
  transform: translateY(-1px);
}

.changelog-entry-back {
  transform: rotateY(180deg);
  z-index: 1;
  background: linear-gradient(
    135deg,
    var(--bg-primary, #1a1a1a) 0%,
    var(--bg-secondary, #2d2d2d) 100%
  );
  color: var(--text-primary, #ffffff);
  padding: 12px;
  border: 1px solid var(--border-color, #555555);
}

/* Flip-Hinweis-Icon */
.flip-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.changelog-entry-wrapper:hover .flip-hint {
  opacity: 1;
}

/* Nummerierungs-Badge - Position anpassen für neue Struktur */
.changelog-entry-front .changelog-number {
  position: absolute;
  top: -10px;
  left: -18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 6px;
  background: var(--bg-elevated, #333333);
  color: var(--text-primary, #ffffff);
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color, #555555);
  z-index: 100; /* Über allem anderen */
}

/* ===== KONTEXT-BADGES ===== */
.context-badges {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.context-badge {
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.context-badge-alt {
  background: rgba(244, 67, 54, 0.2);
  color: var(--error-color, #f44336);
}

.context-badge-sop {
  background: rgba(156, 39, 176, 0.2);
  color: #ab47bc;
}

.context-badge-notiz {
  background: rgba(74, 158, 255, 0.2);
  color: var(--secondary-color, #4a9eff);
  font-size: 11px;
}

.context-badge-sonderheit {
  background: rgba(255, 152, 0, 0.2);
  color: var(--warning-color, #ff9800);
  font-size: 11px;
}

/* ===== RÜCKSEITE STYLES ===== */
.changelog-backside-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 80px;
  text-align: center;
  gap: 4px;
  opacity: 0.7;
}

.changelog-backside-empty small {
  font-size: 10px;
  opacity: 0.6;
}

.changelog-backside-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
}

.backside-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.backside-title {
  font-weight: 700;
  font-size: 12px;
}

.backside-date {
  font-size: 10px;
  opacity: 0.7;
}

.backside-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.backside-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm, 4px);
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.backside-section-full {
  grid-column: 1 / -1;
}

.backside-section-title {
  display: block;
  font-weight: 600;
  font-size: 10px;
  margin-bottom: 4px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.backside-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  font-size: 10px;
}

.backside-row span {
  opacity: 0.8;
}

.backside-row strong {
  font-weight: 600;
}

.backside-row strong.vk-neu-highlight {
  color: var(--success-color, #4caf50);
}

.backside-text {
  font-size: 10px;
  line-height: 1.4;
  opacity: 0.9;
  max-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.backside-meta {
  font-size: 9px;
  opacity: 0.6;
  margin-top: 2px;
}

.backside-hint {
  text-align: center;
  font-size: 9px;
  opacity: 0.5;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

/* Flipper Höhenanpassung */
.changelog-entry-flipper {
  min-height: auto;
}

.changelog-entry-front,
.changelog-entry-back {
  position: relative;
}

.changelog-entry-wrapper.flipped .changelog-entry-front {
  position: absolute;
}

.changelog-entry-wrapper.flipped .changelog-entry-back {
  position: relative;
}

.changelog-entry-wrapper:not(.flipped) .changelog-entry-back {
  position: absolute;
  visibility: hidden;
}

/* ===== LEGACY: PREISHISTORIE (für Kompatibilität) ===== */
.price-history-compact {
  background: var(--bg-elevated, #333333);
  border-radius: 5px;
  padding: 10px;
  height: auto;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
}

.price-history-summary-compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  background: var(--bg-secondary, #2d2d2d);
  border-radius: 5px;
  border: 1px solid var(--border-subtle, #444444);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.3));
  flex-shrink: 0;
}

.summary-stat-compact {
  text-align: center;
  padding: 6px;
  background: var(--bg-elevated, #333333);
  border-radius: var(--border-radius-sm, 4px);
  border: 1px solid var(--border-subtle, #444444);
}

.summary-stat-compact .stat-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted, #999999);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.summary-stat-compact .stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
}

.summary-stat-compact .stat-value.vk-neu {
  color: var(--success-color, #4caf50);
}

.price-history-list-compact {
  flex: 0 1 auto;
  max-height: 360px; /* Maximal 4 Einträge sichtbar (90px pro Eintrag) */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  /* Scrollbar-Styling für bessere Sichtbarkeit */
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb, #555555) var(--scrollbar-track, #2d2d2d);
}

.price-history-list-compact::-webkit-scrollbar {
  width: 8px;
}

.price-history-list-compact::-webkit-scrollbar-track {
  background: var(--scrollbar-track, #2d2d2d);
  border-radius: 4px;
}

.price-history-list-compact::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb, #555555);
  border-radius: 4px;
}

.price-history-list-compact::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover, #666666);
}

.price-history-entry-compact {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  margin-bottom: 6px;
  background: var(--bg-elevated, #333333);
  border: 1px solid var(--border-subtle, #444444);
  border-radius: var(--border-radius-sm, 4px);
  font-size: 11px;
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.3));
  transition: var(--transition-fast, 0.15s ease);
}

.price-history-entry-compact:hover {
  background: var(--bg-hover, #404040);
  border-color: var(--border-color, #555555);
  box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.4));
  transform: translateY(-1px);
}

.price-history-entry-compact.current {
  border-color: var(--primary-color, #e57373);
  background: linear-gradient(135deg, var(--primary-color, #e57373), var(--primary-hover, #d46666));
  color: var(--text-primary, #ffffff);
  box-shadow: 0 4px 12px rgba(229, 115, 115, 0.4);
}

.price-history-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.price-history-date-compact {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-primary, #ffffff);
}

.price-history-source-compact {
  background: var(--bg-secondary, #2d2d2d);
  color: var(--text-secondary, #cccccc);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid var(--border-subtle, #444444);
}

.price-history-entry-compact.current .price-history-source-compact {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary, #ffffff);
  border-color: rgba(255, 255, 255, 0.3);
}

.price-history-prices-compact {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.price-item-compact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 70px;
}

.price-label-compact {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted, #999999);
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.price-history-entry-compact.current .price-label-compact {
  color: rgba(255, 255, 255, 0.9);
}

.price-value-compact {
  background: var(--bg-secondary, #2d2d2d);
  color: var(--text-primary, #ffffff);
  padding: 4px 8px;
  border-radius: var(--border-radius-sm, 4px);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-subtle, #444444);
  min-width: 65px;
  text-align: center;
}

.price-history-entry-compact.current .price-value-compact {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary, #ffffff);
  border-color: rgba(255, 255, 255, 0.3);
}

.price-item-compact.vk-neu .price-value-compact {
  background: var(--success-color, #4caf50);
  color: var(--text-primary, #ffffff);
  border-color: #388e3c;
}

.price-history-entry-compact.current .price-item-compact.vk-neu .price-value-compact {
  background: rgba(255, 255, 255, 0.25);
  color: var(--text-primary, #ffffff);
  border-color: rgba(255, 255, 255, 0.4);
}

.price-history-user-compact {
  font-size: 9px;
  color: var(--text-muted, #999999);
  font-style: italic;
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle, #444444);
}

.price-history-entry-compact.current .price-history-user-compact {
  color: rgba(255, 255, 255, 0.9);
  border-top-color: rgba(255, 255, 255, 0.2);
}

/* ===== KOMPAKTE AKTIONS-BUTTONS ===== */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 0 0;
  border-top: 2px solid var(--border-subtle, #444444);
  margin-top: 8px;
  grid-column: 1 / -1;
}

.delete-button {
  background: linear-gradient(135deg, var(--error-color, #f44336), #c62828);
  color: var(--text-primary, #ffffff);
  border: none;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm, 4px);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast, 0.15s ease);
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.delete-button:hover:not(:disabled):not(.disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(244, 67, 54, 0.4);
}

.delete-button:disabled,
.delete-button.disabled {
  background: linear-gradient(135deg, #666666, #555555);
  color: #999999;
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.delete-button:disabled:hover,
.delete-button.disabled:hover {
  transform: none;
  box-shadow: none;
}

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

.main-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: var(--border-radius-sm, 4px);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast, 0.15s ease);
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

#edit-cancel {
  background: var(--bg-hover, #404040);
  color: var(--text-primary, #ffffff);
  border: 1px solid var(--border-color, #555555);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.3));
}

#edit-cancel:hover {
  transform: translateY(-1px);
  background: var(--bg-elevated, #333333);
  box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.4));
}

#edit-save {
  background: linear-gradient(135deg, var(--primary-color, #e57373), var(--primary-hover, #d46666));
  color: var(--text-primary, #ffffff);
  box-shadow: 0 2px 6px rgba(229, 115, 115, 0.4);
}

#edit-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 115, 115, 0.5);
}

/* ===== RESPONSIVE DESIGN - KOMPAKT ===== */
@media (max-width: 768px) {
  .edit-dialog {
    width: 95vw;
    max-height: 98vh;
  }

  .edit-dialog h3 {
    font-size: 16px;
    padding: 10px 14px;
  }

  #edit-form {
    padding: 12px;
    display: block; /* Zurück zu normalem Layout auf kleinen Bildschirmen */
    min-height: auto;
    gap: 8px;
  }

  .article-section.section-basic,
  .article-section.section-prices-stock,
  .article-section.section-history {
    grid-column: 1;
    grid-row: auto;
    height: auto;
    margin-bottom: 8px;
  }

  /* Responsive für neue Grunddaten-Struktur */
  .basic-data-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .basic-data-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
  }

  .basic-data-field-full {
    grid-column: 1 / -1;
  }

  .title-with-circle {
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
  }

  .title-with-circle .abtnr-circle {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }

  .title-data {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .title-data-field {
    width: 100%;
  }

  .title-data-field-full .title-data-value {
    white-space: normal;
  }

  .article-section.section-changelog {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 300px;
  }

  .changelog-container {
    max-height: 350px;
  }

  .changelog-entry {
    padding: 8px 10px;
    gap: 8px;
  }

  .changelog-number {
    min-width: 28px;
    height: 24px;
    font-size: 10px;
    top: -8px;
    left: -14px;
  }

  .changelog-old-value,
  .changelog-new-value {
    max-width: 70px;
    font-size: 11px;
    padding: 3px 6px;
  }

  .changelog-field-label {
    font-size: 11px;
  }

  /* Legacy Preishistorie responsive */
  .article-section.section-history {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 400px;
  }

  .price-history-list-compact {
    flex: 0 1 auto;
    max-height: 360px;
    min-height: 0;
    overflow-y: auto;
  }

  .price-history-compact {
    max-height: 550px;
  }

  .price-history-entry-compact {
    padding: 10px;
    font-size: 13px;
  }

  .price-value-compact {
    font-size: 14px;
    padding: 5px 8px;
  }

  .prices-stock-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .form-grid-2,
  .form-grid-3,
  .form-grid-4,
  .form-grid-5,
  .form-grid-compact {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .price-grid,
  .price-grid-compact {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .stock-grid,
  .stock-grid-compact {
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
  }

  .lager-grid-compact {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .stock-row {
    gap: 6px;
  }

  .price-history-summary-compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .form-actions {
    flex-direction: column;
    gap: 8px;
  }

  .main-actions {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .edit-dialog {
    width: 98vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .edit-dialog h3 {
    border-radius: 0;
    font-size: 14px;
    padding: 8px 12px;
  }

  #edit-form {
    border-radius: 0;
    padding: 8px;
  }

  .article-section {
    padding: 8px;
    margin-bottom: 6px;
  }

  .basic-data-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .prices-stock-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .stock-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
  }

  .stock-row {
    flex-direction: column;
    gap: 4px;
  }

  .price-history-summary-compact {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .price-history-list-compact {
    flex: 0 1 auto;
    max-height: 360px; /* Maximal 4 Einträge sichtbar */
    min-height: 0;
    overflow-y: auto;
  }

  .price-history-compact {
    max-height: 500px; /* Auf sehr kleinen Bildschirmen noch weniger */
  }

  .price-history-entry-compact {
    padding: 10px;
    font-size: 12px;
    gap: 6px;
  }

  .price-value-compact {
    font-size: 13px;
    padding: 5px 8px;
  }

  .price-history-date-compact {
    font-size: 12px;
  }

  .price-history-source-compact {
    font-size: 10px;
    padding: 3px 6px;
  }

  .form-field input,
  .price-field input,
  .stock-field input {
    font-size: 11px;
    padding: 4px 6px;
    min-height: 24px;
  }

  .form-field label,
  .price-field label,
  .stock-field label {
    font-size: 10px;
  }
}

/* ===== SUPPORT ===== */

/* ===== ANIMATIONS ===== */
.article-section,
.form-field,
.price-field,
.stock-field {
  transition: all 0.3s ease;
}

.article-section:hover,
.form-field:hover,
.price-field:hover,
.stock-field:hover {
  transform: translateY(-1px);
}

/* ===== ACCESSIBILITY ===== */
.form-field input:focus,
.price-field input:focus,
.stock-field input:focus {
  outline: none;
}

.form-field label,
.price-field label,
.stock-field label {
  user-select: none;
  cursor: pointer;
}

/* ===== SPECIAL STYLES FOR READONLY FIELDS ===== */
.form-field input[readonly],
.price-field input[readonly],
.stock-field input[readonly] {
  background: var(--bg-secondary, #2d2d2d);
  color: var(--text-muted, #999999);
  border-color: var(--border-subtle, #444444);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-field input[readonly]:hover,
.price-field input[readonly]:hover,
.stock-field input[readonly]:hover {
  border-color: var(--border-subtle, #444444);
  box-shadow: none;
  transform: none;
}

/* 📄 PDF-EXPORT: Readonly-Felder normal darstellen */
body.pdf-export .form-field input[readonly],
body.pdf-export .price-field input[readonly],
body.pdf-export .stock-field input[readonly],
body.pdf-export .form-field input.readonly-no-permission,
body.pdf-export .price-field input.readonly-no-permission,
body.pdf-export .stock-field input.readonly-no-permission,
body.pdf-export-guest-override .form-field input,
body.pdf-export-guest-override .price-field input,
body.pdf-export-guest-override .stock-field input {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  color: inherit !important;
  border: inherit !important;
  border-color: inherit !important;
  cursor: default !important;
  opacity: 1 !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  pointer-events: auto !important;
}

/* ===== VALIDATION STYLES ===== */
.form-field input:invalid,
.price-field input:invalid,
.stock-field input:invalid {
  border-color: var(--error-color, #f44336);
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.2);
  animation: shake 0.5s ease-in-out;
}

.form-field input:invalid:focus,
.price-field input:invalid:focus,
.stock-field input:invalid:focus {
  border-color: var(--error-color, #f44336);
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.3);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

/* ===== LOADING STATES ===== */
.price-history-loading-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  color: var(--text-muted, #999999);
  font-size: 12px;
  font-weight: 500;
}

.price-history-loading-compact::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--bg-elevated, #333333);
  border-top: 2px solid var(--primary-color, #e57373);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 6px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
