/* ============================================================
   Etikett-Verwaltung – Haupt-Stylesheet
   ============================================================ */

/* ── Variablen ─────────────────────────────────────────────── */
:root {
  --color-primary:     #c00;
  --color-primary-dk:  #900;
  --color-primary-lt:  #fee2e2;
  --color-accent:      #f97316;
  --color-bg:          #f5f6fa;
  --color-surface:     #ffffff;
  --color-border:      #e2e8f0;
  --color-text:        #1e293b;
  --color-text-muted:  #64748b;
  --color-success:     #22c55e;
  --color-warning:     #f59e0b;
  --color-danger:      #ef4444;
  --color-info:        #3b82f6;
  --color-gray:        #94a3b8;

  --sidebar-w:         240px;
  --topbar-h:          56px;
  --radius:            8px;
  --radius-lg:         12px;
  --shadow-sm:         0 1px 3px rgba(0,0,0,.1);
  --shadow-md:         0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:         0 8px 24px rgba(0,0,0,.15);

  --font-sans:         'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:         'Courier New', monospace;

  --transition:        0.2s ease;
}

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

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

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

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Layout ────────────────────────────────────────────────── */
body.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows:    var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  grid-area:  sidebar;
  background: #1a1a2e;
  color:      #e2e8f0;
  display:    flex;
  flex-direction: column;
  position:   fixed;
  top:        0; left: 0;
  width:      var(--sidebar-w);
  height:     100vh;
  z-index:    100;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar__brand {
  display:     flex;
  align-items: center;
  gap:         .6rem;
  padding:     1.25rem 1rem 1rem;
  font-size:   1.1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon { font-size: 1.4rem; }
.brand-text { white-space: nowrap; }

.sidebar__nav {
  list-style: none;
  padding:    .5rem 0;
  flex:       1;
}
.sidebar__nav li a {
  display:     flex;
  align-items: center;
  gap:         .75rem;
  padding:     .7rem 1rem;
  color:       #94a3b8;
  transition:  background var(--transition), color var(--transition);
  border-radius: 6px;
  margin:      0 .5rem;
}
.sidebar__nav li a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar__nav li.active a { background: var(--color-primary); color: #fff; }

.sidebar__footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.btn-logout {
  display:     flex;
  align-items: center;
  gap:         .5rem;
  padding:     .5rem .75rem;
  color:       #94a3b8;
  border-radius: 6px;
  width:       100%;
  transition:  background var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; text-decoration: none; }

/* ── Topbar (mobile) ───────────────────────────────────────── */
.topbar {
  grid-area:   topbar;
  background:  var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display:     none;
  align-items: center;
  gap:         1rem;
  padding:     0 1rem;
  height:      var(--topbar-h);
  position:    sticky;
  top:         0;
  z-index:     90;
}
.topbar__menu-btn {
  background: none; border: none; cursor: pointer;
  display:    flex; flex-direction: column; gap: 5px; padding: 4px;
}
.topbar__menu-btn span {
  display:    block;
  width:      22px; height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}
.topbar__title { font-weight: 600; font-size: 1rem; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 99;
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  grid-area:  main;
  padding:    1.5rem;
  min-width:  0;
  overflow-x: auto;
}

/* ── Login Page ────────────────────────────────────────────── */
body.login-page {
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      100vh;
  background:      linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width:   100%;
  max-width: 400px;
  text-align: center;
}
.login-card__logo    { font-size: 3rem; margin-bottom: .5rem; }
.login-card__title   { font-size: 1.6rem; font-weight: 800; color: var(--color-primary); }
.login-card__subtitle{ color: var(--color-text-muted); margin-bottom: 1.5rem; }

.login-form { text-align: left; margin-top: 1rem; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background:    var(--color-surface);
  border-radius: var(--radius);
  box-shadow:    var(--shadow-sm);
  border:        1px solid var(--color-border);
  overflow:      hidden;
}
.card__header {
  padding:      .875rem 1rem;
  font-weight:  600;
  border-bottom: 1px solid var(--color-border);
  display:      flex;
  align-items:  center;
  justify-content: space-between;
  gap:          .5rem;
  background:   #f8fafc;
}
.card__body { padding: 1rem; }
.card__body.p-0 { padding: 0; }
.card--danger .card__header { background: #fef2f2; color: var(--color-danger); }

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
  display:       flex;
  align-items:   center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap:           1rem;
  flex-wrap:     wrap;
}
.page-header__info {
  display:     flex;
  align-items: center;
  gap:         .75rem;
}
.page-header__logo { height: 40px; object-fit: contain; }
.page-header__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.page-title    { font-size: 1.4rem; font-weight: 700; }
.page-subtitle { color: var(--color-text-muted); font-size: .875rem; }
.section-title { font-size: 1.1rem; font-weight: 600; margin-bottom: .75rem; }

/* ── Stats Grid ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card__icon svg { width: 22px; height: 22px; }
.stat-card__icon--blue   { background: #eff6ff; color: var(--color-info); }
.stat-card__icon--green  { background: #f0fdf4; color: var(--color-success); }
.stat-card__icon--orange { background: #fff7ed; color: var(--color-accent); }
.stat-card__icon--red    { background: #fef2f2; color: var(--color-danger); }
.stat-card__icon--gray   { background: #f1f5f9; color: var(--color-gray); }
.stat-card__value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-card__label { font-size: .8rem; color: var(--color-text-muted); }

/* ── Quick Actions ─────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.quick-action-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  color: var(--color-text);
}
.quick-action-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  border-color: var(--color-primary);
}
.quick-action-card__icon  { font-size: 2rem; margin-bottom: .5rem; }
.quick-action-card__title { font-weight: 600; margin-bottom: .25rem; }
.quick-action-card__desc  { font-size: .8rem; color: var(--color-text-muted); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display:       inline-flex;
  align-items:   center;
  gap:           .4rem;
  padding:       .5rem 1rem;
  border:        1px solid transparent;
  border-radius: var(--radius);
  font-size:     .875rem;
  font-weight:   500;
  cursor:        pointer;
  transition:    background var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space:   nowrap;
  line-height:   1;
}
.btn:active { transform: scale(.97); }
.btn--primary  { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dk); }
.btn--secondary { background: #f1f5f9; color: var(--color-text); border-color: var(--color-border); }
.btn--secondary:hover { background: #e2e8f0; }
.btn--danger   { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: #dc2626; }
.btn--ghost    { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: #f1f5f9; }
.btn--sm    { padding: .3rem .65rem; font-size: .8rem; }
.btn--icon  { padding: .3rem .4rem; }
.btn--full  { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-row {
  display:   flex;
  gap:       .5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display:       block;
  font-size:     .875rem;
  font-weight:   500;
  margin-bottom: .35rem;
  color:         var(--color-text);
}
.form-control {
  width:         100%;
  padding:       .5rem .75rem;
  border:        1px solid var(--color-border);
  border-radius: var(--radius);
  font-size:     .875rem;
  font-family:   var(--font-sans);
  background:    var(--color-surface);
  color:         var(--color-text);
  transition:    border-color var(--transition), box-shadow var(--transition);
  line-height:   1.5;
}
.form-control:focus {
  outline:      none;
  border-color: var(--color-primary);
  box-shadow:   0 0 0 3px rgba(204,0,0,.15);
}
.form-control--sm { padding: .3rem .5rem; font-size: .8rem; }
.form-hint  { font-size: .8rem; color: var(--color-text-muted); margin-top: .3rem; }
.form-row   { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 150px; }
.form-group--small { max-width: 100px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.form-section-title {
  font-size: .875rem; font-weight: 600;
  margin: 1.25rem 0 .5rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.input-group { position: relative; display: flex; }
.input-group .form-control { padding-right: 2.5rem; }
.btn-eye {
  position:  absolute; right: 0; top: 0; bottom: 0;
  background: none; border: none; cursor: pointer; padding: 0 .75rem;
  color:     var(--color-text-muted);
}
.btn-eye svg { width: 18px; height: 18px; vertical-align: middle; }
.btn-eye.active { color: var(--color-primary); }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding:       .75rem 1rem;
  border-radius: var(--radius);
  font-size:     .875rem;
  margin-top:    .75rem;
}
.alert--success { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.alert--error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.alert--info    { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
.alert--warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1;
}
.badge--green  { background: #dcfce7; color: #166534; }
.badge--red    { background: #fee2e2; color: #991b1b; }
.badge--gray   { background: #f1f5f9; color: #475569; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs {
  display:        flex;
  gap:            .25rem;
  border-bottom:  1px solid var(--color-border);
  margin-bottom:  1.25rem;
  overflow-x:     auto;
  padding-bottom: 0;
}
.tab-btn {
  padding:        .6rem 1rem;
  background:     none;
  border:         1px solid transparent;
  border-bottom:  none;
  border-radius:  var(--radius) var(--radius) 0 0;
  cursor:         pointer;
  font-size:      .875rem;
  font-weight:    500;
  color:          var(--color-text-muted);
  white-space:    nowrap;
  transition:     color var(--transition), background var(--transition);
  margin-bottom:  -1px;
}
.tab-btn:hover   { color: var(--color-text); background: #f8fafc; }
.tab-btn.active  {
  color:       var(--color-text);
  border-color: var(--color-border) var(--color-border) var(--color-surface);
  background:  var(--color-surface);
}
.tab-panel       { display: none; }
.tab-panel.active{ display: block; }

/* ── Toggle Switch ─────────────────────────────────────────── */
.toggle-switch {
  position: relative; display: inline-flex; align-items: center;
  width: 44px; height: 24px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch__slider {
  position: absolute; inset: 0;
  background: #cbd5e1; border-radius: 12px;
  transition: background var(--transition);
}
.toggle-switch__slider::before {
  content: '';
  position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-switch__slider { background: var(--color-success); }
.toggle-switch input:checked + .toggle-switch__slider::before { transform: translateX(20px); }

/* ── Checkbox-Label ────────────────────────────────────────── */
.checkbox-label {
  display:     flex;
  align-items: center;
  gap:         .35rem;
  cursor:      pointer;
  font-size:   .875rem;
  user-select: none;
}
.checkbox-label input { cursor: pointer; accent-color: var(--color-primary); }

/* ── Search Bar ────────────────────────────────────────────── */
.search-bar { width: 100%; }
.search-bar__input-wrap {
  position:      relative;
  display:       flex;
  align-items:   center;
}
.search-bar__icon {
  position:    absolute; left: .875rem;
  width:       18px; height: 18px;
  color:       var(--color-text-muted);
  pointer-events: none;
}
.search-bar__input {
  width:         100%;
  padding:       .75rem .75rem .75rem 2.75rem;
  border:        2px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size:     1rem;
  transition:    border-color var(--transition), box-shadow var(--transition);
  background:    var(--color-surface);
}
.search-bar__input:focus {
  outline:      none;
  border-color: var(--color-primary);
  box-shadow:   0 0 0 4px rgba(204,0,0,.12);
}
.search-bar__source {
  position:  absolute; right: 2.5rem;
  font-size: .75rem; font-weight: 600;
  color:     var(--color-text-muted);
  background: #f1f5f9; padding: .15rem .4rem; border-radius: 4px;
}
.search-bar__clear {
  position:  absolute; right: .75rem;
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--color-text-muted); line-height: 1;
}

/* ── Search Results ────────────────────────────────────────── */
.search-results {
  background:    var(--color-surface);
  border:        1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow:    var(--shadow-md);
  margin-top:    .5rem;
  overflow:      hidden;
}

.result-row {
  display:     flex;
  align-items: center;
  gap:         1rem;
  padding:     .875rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-wrap:   wrap;
}
.result-row:last-child { border-bottom: none; }
.result-row--noresult {
  justify-content: space-between;
  color:           var(--color-text-muted);
}

.result-row__thumb {
  width:         56px; height: 56px;
  border:        1px solid var(--color-border);
  border-radius: var(--radius);
  overflow:      hidden;
  flex-shrink:   0;
  cursor:        pointer;
  display:       flex;
  align-items:   center;
  justify-content: center;
  background:    #f8fafc;
  transition:    border-color var(--transition);
}
.result-row__thumb:hover { border-color: var(--color-primary); }
.result-row__thumb img { width: 100%; height: 100%; object-fit: cover; }

.result-row__info { flex: 1; min-width: 160px; }
.result-row__name { font-weight: 600; margin-bottom: .2rem; }
.result-row__meta { font-size: .8rem; color: var(--color-text-muted); display: flex; gap: .5rem; flex-wrap: wrap; }
.result-row__price { font-size: 1.2rem; font-weight: 700; color: var(--color-primary); min-width: 80px; }
.result-row__label-select { min-width: 180px; flex: 0 0 180px; }
.result-row__flags { display: flex; flex-direction: column; gap: .3rem; }
.result-row__actions { margin-left: auto; }

/* ── Queue Table ───────────────────────────────────────────── */
.queue-table { table-layout: fixed; }
.queue-drag-handle { cursor: grab; color: var(--color-text-muted); text-align: center; }
.queue-img, .thumb-placeholder {
  width: 40px; height: 40px;
  object-fit: cover; border-radius: 4px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.thumb-placeholder {
  background: #f8fafc; font-size: .6rem; color: var(--color-text-muted);
  text-align: center; line-height: 1.2;
}
.thumb-placeholder--sm {
  width: 36px; height: 36px; font-size: .9rem; font-weight: 700;
  color: var(--color-primary); background: var(--color-primary-lt);
  border: 1px dashed var(--color-primary);
}
.queue-name   { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-actions{ display: flex; gap: .25rem; }

/* ── Data Table ────────────────────────────────────────────── */
.data-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       .875rem;
}
.data-table th {
  text-align:    left;
  padding:       .6rem .75rem;
  background:    #f8fafc;
  border-bottom: 2px solid var(--color-border);
  font-weight:   600;
  color:         var(--color-text-muted);
  white-space:   nowrap;
}
.data-table td {
  padding:       .55rem .75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }
.table-responsive { overflow-x: auto; }
.text-muted  { color: var(--color-text-muted); font-size: .8rem; }
.text-center { text-align: center; }

/* ── Logo Upload ───────────────────────────────────────────── */
.logo-upload {
  border:        2px dashed var(--color-border);
  border-radius: var(--radius);
  padding:       1.5rem;
  text-align:    center;
  cursor:        pointer;
  transition:    border-color var(--transition);
  min-height:    120px;
  display:       flex;
  align-items:   center;
  justify-content: center;
}
.logo-upload:hover { border-color: var(--color-primary); }
.logo-upload__placeholder { color: var(--color-text-muted); }
.logo-upload__placeholder span { display: block; font-weight: 500; }
.logo-preview { max-height: 80px; max-width: 200px; object-fit: contain; }

/* ── Dropzone ──────────────────────────────────────────────── */
.dropzone {
  border:        2px dashed var(--color-border);
  border-radius: var(--radius);
  padding:       2rem;
  text-align:    center;
  transition:    border-color var(--transition), background var(--transition);
  cursor:        default;
}
.dropzone--over, .dropzone:hover { border-color: var(--color-primary); background: var(--color-primary-lt); }
.dropzone--batch {
  margin-bottom: 1rem;
  background:    #f8fafc;
}
.dropzone__icon { font-size: 2.5rem; margin-bottom: .5rem; }
.dropzone__content p { font-weight: 500; margin-bottom: .25rem; }
.dropzone__content small { color: var(--color-text-muted); }
.dropzone__preview { position: relative; display: inline-block; }
.dropzone__preview img { max-height: 200px; border-radius: var(--radius); }
.dropzone__remove {
  position:  absolute; top: -8px; right: -8px;
  background: var(--color-danger); color: #fff;
  border: none; border-radius: 50%;
  width: 24px; height: 24px; font-size: .9rem;
  cursor: pointer; line-height: 24px; text-align: center;
}

/* ── Image Gallery ─────────────────────────────────────────── */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.gallery-item {
  border:        1px solid var(--color-border);
  border-radius: var(--radius);
  overflow:      hidden;
  background:    var(--color-surface);
  transition:    box-shadow var(--transition);
}
.gallery-item:hover { box-shadow: var(--shadow-md); }
.gallery-item__img-wrap { position: relative; aspect-ratio: 1; overflow: hidden; }
.gallery-item__img-wrap img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #f8fafc;
  cursor: zoom-in;
}
.gallery-item__delete {
  position:  absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.5); color: #fff;
  border: none; border-radius: 50%;
  width: 22px; height: 22px; font-size: .8rem;
  cursor: pointer; opacity: 0; transition: opacity var(--transition);
  line-height: 22px; text-align: center;
}
.gallery-item__img-wrap:hover .gallery-item__delete { opacity: 1; }
.gallery-item__info { padding: .5rem; }
.gallery-item__name { font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-item__meta { font-size: .7rem; color: var(--color-text-muted); }

/* ── Upload Progress ───────────────────────────────────────── */
.upload-progress {
  background:    #f8fafc;
  border:        1px solid var(--color-border);
  border-radius: var(--radius);
  padding:       .75rem;
  margin-bottom: 1rem;
}
.upload-progress__item {
  padding:     .25rem 0;
  font-size:   .875rem;
  border-bottom: 1px solid var(--color-border);
}
.upload-progress__item:last-child { border-bottom: none; }
.upload-progress__item--ok    { color: #166534; }
.upload-progress__item--error { color: #991b1b; }

/* ── Tags ──────────────────────────────────────────────────── */
.group-tag-list {
  display:   flex;
  flex-wrap: wrap;
  gap:       .4rem;
  min-height: 2rem;
  padding:   .4rem;
  border:    1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  background: #f8fafc;
}
.group-tag {
  display:       flex;
  align-items:   center;
  gap:           .3rem;
  background:    var(--color-primary-lt);
  color:         var(--color-primary-dk);
  border-radius: 999px;
  padding:       .2rem .55rem;
  font-size:     .8rem;
  font-weight:   500;
}
.tag-remove {
  background:  none; border: none; cursor: pointer;
  color:       inherit; font-size: .9rem; line-height: 1; padding: 0;
}
.tag-input-row { display: flex; gap: .4rem; align-items: center; }
.tag-input-row .form-control { flex: 1; }

/* ── Groups Grid ───────────────────────────────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  display:  flex; align-items: center; justify-content: center;
  z-index:  200;
}
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
}
.modal__box {
  background:    var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow:    var(--shadow-lg);
  width:         100%;
  max-width:     540px;
  max-height:    90vh;
  overflow-y:    auto;
  position:      relative;
  z-index:       1;
}
.modal__box--sm { max-width: 400px; }
.modal__box--lg { max-width: 700px; }
.modal__header {
  display:        flex;
  align-items:    center;
  justify-content: space-between;
  padding:        1rem 1.25rem;
  border-bottom:  1px solid var(--color-border);
}
.modal__header h2 { font-size: 1.1rem; font-weight: 600; }
.modal__close {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--color-text-muted);
}
.modal__body   { padding: 1.25rem; }
.modal__footer {
  display:        flex;
  justify-content: flex-end;
  gap:            .5rem;
  padding:        1rem 1.25rem;
  border-top:     1px solid var(--color-border);
  background:     #f8fafc;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align:   center;
  padding:      3rem 1rem;
  color:        var(--color-text-muted);
  font-size:    .9rem;
}

/* ── Meta Table ────────────────────────────────────────────── */
.meta-table { width: 100%; font-size: .875rem; }
.meta-table th {
  padding: .35rem .5rem;
  font-weight: 600; color: var(--color-text-muted);
  text-align: left; width: 130px;
}
.meta-table td { padding: .35rem .5rem; }

/* ── Icons (SVG inline emulation via emoji fallback) ───────── */
.icon { display: inline-block; width: 18px; height: 18px; font-style: normal; }

/* ── Utility ───────────────────────────────────────────────── */
.hidden   { display: none !important; }
.text-red { color: var(--color-danger); }

/* ── Print Layout ──────────────────────────────────────────── */
.print-page { margin-bottom: 1rem; background: #fff; display: inline-block; }

/* ── Responsive (Tablet / Mobile) ─────────────────────────── */
@media (max-width: 768px) {
  body.layout {
    grid-template-columns: 1fr;
    grid-template-rows:    var(--topbar-h) 1fr;
    grid-template-areas: "topbar" "main";
  }
  .topbar { display: flex; }
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.show { display: block; }

  .main-content { padding: 1rem; }
  .form-grid-3  { grid-template-columns: 1fr 1fr; }
  .stats-grid   { grid-template-columns: 1fr 1fr; }
  .queue-table .result-row__label-select { min-width: 130px; flex: 0 0 130px; }
}

@media (max-width: 480px) {
  .form-grid-3  { grid-template-columns: 1fr; }
  .stats-grid   { grid-template-columns: 1fr; }
  .image-gallery{ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .result-row   { flex-direction: column; align-items: flex-start; }
}

/* ── Phase 3: Admin & Erweiterungen ────────────────────────── */

/* RGB-Variablen für rgba() */
:root {
  --color-primary-rgb: 204,0,0;
  --color-success-rgb: 34,197,94;
  --color-danger-rgb:  239,68,68;
  --color-warning-rgb: 245,158,11;
  --color-surface-hover: #f8fafc;
}

/* Rollen-Badges */
.badge--primary { background: var(--color-primary-lt); color: var(--color-primary); }
.badge--info    { background: #dbeafe; color: #1d4ed8; }
.badge--success { background: #dcfce7; color: #15803d; }
.badge--error   { background: #fee2e2; color: #b91c1c; }
.badge--ghost   { background: var(--color-border); color: var(--color-text-muted); }
.badge--warning { background: #fef3c7; color: #b45309; }

/* Tabellen-Zustände */
.row--inactive { opacity: .5; }
.row--danger   { background: #fff5f5; }
.row--bold td  { font-weight: 700; }

/* Tab-Bar */
.tab-bar { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--color-border); }
.tab-bar__item {
  background: none; border: none; padding: .6rem 1.25rem; cursor: pointer;
  font-size: .9rem; font-weight: 500; color: var(--color-text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition);
}
.tab-bar__item:hover { color: var(--color-text); }
.tab-bar__item.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* Pagination */
.pagination { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; justify-content: center; }
.pagination__info { font-size: .85rem; color: var(--color-text-muted); }

/* Form-Grid 4 */
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 900px) { .form-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .form-grid-4 { grid-template-columns: 1fr; } }

/* Toggle-Switch */
.toggle-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch__track {
  width: 40px; height: 22px; background: var(--color-border);
  border-radius: 11px; transition: var(--transition); position: relative;
}
.toggle-switch__track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; background: #fff;
  border-radius: 50%; transition: var(--transition);
}
.toggle-switch input:checked + .toggle-switch__track { background: var(--color-success); }
.toggle-switch input:checked + .toggle-switch__track::after { transform: translateX(18px); }

/* Progress / Spinner-sm */
.progress-wrap { display: flex; align-items: center; gap: .75rem; }
.spinner-sm {
  width: 20px; height: 20px; border: 2px solid var(--color-border);
  border-top-color: var(--color-primary); border-radius: 50%;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal (alias für Phase-3-Seiten) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99; }
.modal-box {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--color-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 100; width: 95%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--color-text-muted); }
.modal-footer {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: 1rem 1.25rem; border-top: 1px solid var(--color-border);
}
.modal.is-open .modal-overlay,
.modal.is-open .modal-box { display: block; }
.modal .modal-overlay,
.modal .modal-box { display: none; }

/* Img Thumbnail */
.img-thumb { width: 40px; height: 40px; border-radius: 4px; overflow: hidden; background: var(--color-border); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb span { display: flex; align-items: center; justify-content: center; height: 100%; font-size: .65rem; color: var(--color-text-muted); }

/* Alert-Typen */
.alert { padding: .75rem 1rem; border-radius: var(--radius); font-size: .9rem; margin-bottom: 1rem; }
.alert--info    { background: #dbeafe; color: #1d4ed8; border-left: 4px solid #3b82f6; }
.alert--warning { background: #fef3c7; color: #b45309; border-left: 4px solid #f59e0b; }
.alert--error   { background: #fee2e2; color: #b91c1c; border-left: 4px solid #ef4444; }
.alert--success { background: #dcfce7; color: #15803d; border-left: 4px solid #22c55e; }

/* Button Sizes */
.btn--sm { padding: .3rem .7rem; font-size: .8rem; }
.btn--full { width: 100%; justify-content: center; }
.btn--danger { background: var(--color-danger); color: #fff; border: none; }
.btn--danger:hover { background: #b91c1c; }

/* Login-Page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh;
              background: linear-gradient(135deg, #c00 0%, #600 100%); }
.login-card { background: #fff; border-radius: var(--radius-lg); padding: 2.5rem;
              box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; }
.login-card__logo  { font-size: 2.5rem; text-align: center; margin-bottom: .5rem; }
.login-card__title { font-size: 1.4rem; font-weight: 700; text-align: center; color: var(--color-primary); }
.login-card__subtitle { text-align: center; font-size: .85rem; color: var(--color-text-muted); margin-bottom: 1.5rem; }
.login-form .form-group { margin-bottom: 1rem; }
.input-group { display: flex; position: relative; }
.input-group .form-control { flex: 1; border-radius: var(--radius) 0 0 var(--radius); }
.btn-eye { background: var(--color-border); border: 1px solid var(--color-border);
           border-left: none; border-radius: 0 var(--radius) var(--radius) 0;
           padding: 0 .75rem; cursor: pointer; display: flex; align-items: center; }
.btn-eye svg { width: 18px; height: 18px; color: var(--color-text-muted); }
.btn-eye.active svg { color: var(--color-primary); }

/* P-0 Utility */
.p-0 { padding: 0; }

/* form-grid-2 */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .form-grid-2 { grid-template-columns: 1fr; } }

