*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:         #4f46e5;
  --brand-darkest: #1e1b4b;
  --brand-dark:    #3730a3;
  --brand-mid:     #6366f1;
  --brand-light:   #eef2ff;
  --purple:        #7c3aed;
  --purple-light:#f5f3ff;
  --pink:        #ec4899;

  --green:       #10b981;
  --green-bg:    #d1fae5;
  --red:         #ef4444;
  --red-bg:      #fee2e2;
  --orange:      #f59e0b;
  --orange-bg:   #fef3c7;
  --amber:       #f59e0b;

  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-150:    #e9eef5;
  --gray-200:    #e2e8f0;
  --gray-300:    #cbd5e1;
  --gray-400:    #94a3b8;
  --gray-500:    #64748b;
  --gray-600:    #475569;
  --gray-700:    #334155;
  --gray-800:    #1e293b;
  --gray-900:    #0f172a;
  --white:       #ffffff;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-pill: 9999px;

  --shadow-xs:   0 1px 2px rgba(0,0,0,.05);
  --shadow:      0 1px 4px rgba(0,0,0,.06), 0 2px 8px rgba(79,70,229,.05);
  --shadow-md:   0 4px 12px rgba(79,70,229,.10), 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 8px 24px rgba(79,70,229,.12), 0 2px 8px rgba(0,0,0,.06);
  --shadow-xl:   0 16px 48px rgba(79,70,229,.16), 0 4px 16px rgba(0,0,0,.08);
  --shadow-brand: 0 4px 16px rgba(79,70,229,.40);
  --shadow-brand-lg: 0 8px 28px rgba(79,70,229,.50);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Inter font from CDN */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-900);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-color: var(--page-bg, #f4f2ff);
  background-image:
    radial-gradient(ellipse at 15% 0%,  rgba(79,70,229,.08) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(124,58,237,.06) 0%, transparent 55%);
  min-height: 100vh;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  letter-spacing: -.01em;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,.15), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity .15s;
}
.btn:hover::after { opacity: 1; }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--btn-order-bg, linear-gradient(135deg, var(--brand) 0%, var(--purple) 100%));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-brand-lg);
  transform: translateY(-2px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: rgba(255,255,255,.8);
  color: var(--gray-700);
  border-color: var(--gray-200);
  backdrop-filter: blur(4px);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--white);
  border-color: var(--gray-300);
  box-shadow: var(--shadow-xs);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(239,68,68,.30);
}
.btn-danger:hover:not(:disabled) { background: #dc2626; transform: translateY(-1px); }

.btn-success {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,.30);
}

.btn-outline {
  background: transparent;
  color: var(--brand);
  border-color: var(--brand);
}
.btn-outline:hover:not(:disabled) {
  background: var(--brand-light);
}

.btn-sm   { padding: 5px 14px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-icon {
  padding: 7px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  transition: background .15s, color .15s;
  line-height: 1;
  font-size: 16px;
}
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-weight: 600; font-size: 13px; color: var(--gray-700); }

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], select, textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--white);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,.14);
}
input::placeholder, textarea::placeholder { color: var(--gray-300); }
textarea { resize: vertical; min-height: 80px; }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-400);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-150);
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #faf8ff; }
.table-wrap {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge-neu::before              { background: var(--brand); }
.badge-bearbeitung::before      { background: var(--orange); }
.badge-im-druck::before         { background: #2563eb; }
.badge-weiterverarbeitung::before{ background: #0d9488; }
.badge-versandt::before         { background: #0ea5e9; }
.badge-abgeschlossen::before    { background: var(--green); }
.badge-storniert::before        { background: var(--red); }
.badge-neu               { background: #ede9fe; color: #5b21b6; }
.badge-bearbeitung       { background: var(--orange-bg); color: #92400e; }
.badge-im-druck          { background: #dbeafe; color: #1e40af; }
.badge-weiterverarbeitung{ background: #ccfbf1; color: #0f766e; }
.badge-versandt          { background: #e0f2fe; color: #0369a1; }
.badge-abgeschlossen     { background: var(--green-bg);  color: #065f46; }
.badge-storniert         { background: var(--red-bg);    color: #991b1b; }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border: 1px solid rgba(79,70,229,.10);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-body { padding: 24px; }
.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-100);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}
.alert-error   { background: var(--red-bg);     color: #991b1b;  border-color: #fca5a5; }
.alert-success { background: var(--green-bg);   color: #065f46;  border-color: #6ee7b7; }
.alert-info    { background: #ede9fe;            color: #5b21b6;  border-color: #c4b5fd; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.6);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: min(600px, 96vw);
  max-height: 90vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  animation: modal-in .22s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid rgba(79,70,229,.08);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 17px;
  position: sticky; top: 0;
  background: var(--white);
  z-index: 1;
  letter-spacing: -.02em;
}
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.modal-close {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: var(--gray-400); line-height: 1;
  padding: 5px 8px; border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--gray-900);
  background-image:
    radial-gradient(ellipse at 20% 20%,  rgba(79,70,229,.5)   0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%,  rgba(124,58,237,.4)  0%, transparent 50%),
    radial-gradient(ellipse at 60% 10%,  rgba(236,72,153,.20) 0%, transparent 40%),
    radial-gradient(ellipse at 10% 90%,  rgba(99,102,241,.30) 0%, transparent 40%);
  position: relative;
  overflow: hidden;
}
/* Dot grid overlay */
.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0,0,0,.40), 0 4px 16px rgba(79,70,229,.20);
  padding: 48px 44px;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255,255,255,.5);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 16px;
}
.login-logo-icon {
  width: 54px; height: 54px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--purple) 100%);
  border-radius: 16px;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(79,70,229,.45);
}
.login-title { font-size: 22px; font-weight: 900; color: var(--gray-900); letter-spacing: -.03em; }
.login-subtitle { font-size: 13px; color: var(--gray-400); margin-top: 2px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.demo-hint {
  font-size: 12px;
  color: var(--gray-500);
  background: linear-gradient(135deg, #faf9ff, #f5f3ff);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius);
  padding: 12px 16px;
  line-height: 2;
}
.demo-hint code {
  background: #ede9fe;
  color: #5b21b6;
  padding: 1px 7px;
  border-radius: 5px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  font-weight: 600;
}

/* ===== PORTAL LAYOUT ===== */
.portal-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.portal-header {
  background: var(--header-bg, linear-gradient(135deg, var(--brand-darkest) 0%, var(--brand-dark) 40%, var(--brand) 100%));
  color: #fff;
  padding: 0 32px;
  height: var(--header-height, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 20px rgba(30,27,75,.40);
}
/* Subtle noise on header */
.portal-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: .5;
}
.portal-header-brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 900; font-size: 17px; letter-spacing: -.03em;
  z-index: 1;
}
.portal-header-brand-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.20);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px;
}
.portal-header-user {
  display: flex; align-items: center; gap: 16px;
  font-size: 13px;
  z-index: 1;
}
.portal-header-company  { font-weight: 700; }
.portal-header-username { opacity: .6; font-size: 12px; }

/* ===== TABS ===== */
.tabs {
  display: flex; gap: 2px;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(8px);
  padding: 4px;
  border-radius: var(--radius-pill);
  width: fit-content;
  border: 1px solid var(--gray-200);
}
.tab-btn {
  padding: 7px 22px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-500);
  cursor: pointer;
  transition: all .18s;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--purple) 100%);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.tab-btn:hover:not(.active) { color: var(--gray-800); background: rgba(79,70,229,.06); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== PRODUCT CARDS ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 700px) { .products-grid { grid-template-columns: 1fr; } }
/* Last card spans full width when 3 items (2+1 grid) */
.products-grid .product-card:last-child:nth-child(odd) {
  grid-column: span 2;
}
@media (max-width: 700px) {
  .products-grid .product-card:last-child:nth-child(odd) { grid-column: span 1; }
}

.product-card {
  background: var(--white);
  border: 1px solid rgba(79,70,229,.10);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow .22s, transform .22s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Gradient accent bar at top */
.product-card::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--purple) 60%, var(--pink) 100%);
  flex-shrink: 0;
}

.product-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--gray-100);
  background: linear-gradient(180deg, #faf8ff 0%, var(--white) 100%);
}
.product-card-number {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-light);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(79,70,229,.15);
  margin-bottom: 8px;
}
.product-card-name {
  font-size: 18px;
  font-weight: 900;
  color: var(--gray-900);
  letter-spacing: -.03em;
  line-height: 1.2;
}
.product-card-desc {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 4px;
}
.product-card-price {
  text-align: right;
  flex-shrink: 0;
}
.product-card-price-value {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--brand) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.product-card-price-unit {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 3px;
}

.product-card-body {
  padding: 0 24px 22px;
  flex: 1;
}

/* ===== MOTIF ROWS ===== */
.motif-list { display: flex; flex-direction: column; }

.motif-row {
  display: grid;
  grid-template-columns: auto 1fr 190px 90px 36px;
  gap: 10px;
  align-items: end;
  padding: 14px 0;
  border-bottom: 1px dashed var(--gray-150);
}
.motif-row:last-child { border-bottom: none; }

.motif-number-badge {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-light) 0%, #ede9fe 100%);
  border: 1.5px solid rgba(79,70,229,.20);
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.motif-col-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-400);
  margin-bottom: 5px;
}

.motif-remove {
  background: none;
  border: none;
  color: var(--gray-300);
  cursor: pointer;
  font-size: 15px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  margin-bottom: 8px;
}
.motif-remove:hover { color: var(--red); background: var(--red-bg); }

@media (max-width: 640px) {
  .motif-row { grid-template-columns: auto 1fr 90px 36px; }
  .motif-upload-col { grid-column: 2 / span 3; }
}

.add-motif-btn {
  margin-top: 14px;
  background: none;
  border: 2px dashed rgba(79,70,229,.25);
  border-radius: var(--radius);
  color: var(--brand);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  width: 100%;
  text-align: center;
  letter-spacing: -.01em;
}
.add-motif-btn:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  transform: none;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone-wrap { display: flex; flex-direction: column; gap: 4px; }

.upload-zone {
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius);
  background: var(--gray-50);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.upload-zone:hover, .upload-zone--hover {
  border-color: var(--brand);
  background: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(79,70,229,.10);
}
.upload-zone--dragover {
  border-color: var(--brand);
  border-style: solid;
  background: var(--brand-light);
  box-shadow: 0 0 0 4px rgba(79,70,229,.15);
}
.upload-zone-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-400);
  font-size: 12px;
  font-weight: 600;
}
.upload-zone-icon { font-size: 17px; flex-shrink: 0; }
.upload-zone-text { line-height: 1.4; }
.upload-zone-browse {
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1.5px solid rgba(79,70,229,.40);
  padding-bottom: 1px;
  transition: border-color .15s;
}
.upload-zone-browse:hover { border-color: var(--brand); }
.upload-zone-formats {
  font-size: 10px;
  color: var(--gray-400);
  display: block;
  margin-top: 2px;
  font-weight: 500;
}

/* uploading */
.upload-zone--uploading {
  border-style: solid;
  border-color: var(--brand-mid);
  background: var(--brand-light);
}
.upload-spinner {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--brand); font-weight: 600;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(79,70,229,.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
  display: inline-block;
}

/* done */
.upload-zone--done {
  border-style: solid;
  border-color: rgba(16,185,129,.35);
  background: rgba(16,185,129,.04);
  cursor: default;
  padding: 8px 10px;
}
.upload-preview { display: flex; align-items: center; gap: 10px; }
.upload-thumb {
  width: 38px; height: 46px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
  cursor: pointer;
  background: var(--gray-50);
  transition: opacity .15s;
}
.upload-thumb:hover { opacity: .85; }
.upload-thumb-canvas {
  width: 38px; height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
  cursor: pointer;
  background: var(--white);
  transition: opacity .15s;
}
.upload-thumb-canvas:hover { opacity: .85; }
.upload-preview-info { flex: 1; min-width: 0; }
.upload-preview-name {
  font-size: 11px; font-weight: 700;
  color: var(--gray-800);
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-preview-size {
  font-size: 10px; color: var(--gray-400); display: block; margin-top: 1px;
}
.upload-preview-remove {
  background: none; border: none; color: var(--gray-300); cursor: pointer;
  font-size: 14px; padding: 3px; border-radius: var(--radius-sm); flex-shrink: 0;
  transition: color .15s;
}
.upload-preview-remove:hover { color: var(--red); }
.upload-error-msg {
  font-size: 11px; color: var(--red); font-weight: 600;
}

/* ===== ORDER BAR ===== */
.order-bar {
  position: sticky; bottom: 0;
  background: linear-gradient(135deg, #1e1b4b 0%, var(--brand-dark) 50%, var(--brand) 100%);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  z-index: 50;
  box-shadow: 0 -8px 32px rgba(30,27,75,.35);
}
.order-bar-label {
  font-size: 10px;
  color: rgba(255,255,255,.5);
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
}
.order-bar-total {
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -.04em;
  margin-top: 2px;
}
.order-bar-positions {
  color: rgba(255,255,255,.6);
  font-size: 13px;
  font-weight: 500;
}
/* Clear button in order bar */
.order-bar .btn-ghost {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.20);
  color: rgba(255,255,255,.8);
  backdrop-filter: none;
}
.order-bar .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,.20);
  border-color: rgba(255,255,255,.35);
}
/* Submit button in order bar — white */
.order-bar .btn-primary {
  background: rgba(255,255,255,.95);
  color: var(--brand-dark);
  box-shadow: 0 4px 16px rgba(0,0,0,.20);
}
.order-bar .btn-primary:hover:not(:disabled) {
  background: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.30);
}

/* ===== ADMIN LAYOUT ===== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 232px;
  background: #0f0d1e;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,.05);
}
.admin-sidebar-brand {
  padding: 22px 20px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.admin-sidebar-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--purple) 100%);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px;
  box-shadow: 0 4px 14px rgba(79,70,229,.50);
}
.admin-sidebar-title { font-weight: 900; font-size: 15px; letter-spacing: -.02em; }
.admin-sidebar-sub   { font-size: 11px; opacity: .35; margin-top: 1px; font-weight: 500; }
.admin-nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.admin-nav-item {
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,.45);
  display: flex; align-items: center; gap: 10px;
  transition: all .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.admin-nav-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); }
.admin-nav-item.active {
  background: linear-gradient(135deg, rgba(79,70,229,.3) 0%, rgba(124,58,237,.3) 100%);
  color: #fff;
  border: 1px solid rgba(79,70,229,.30);
}
.admin-nav-icon { font-size: 16px; width: 20px; text-align: center; }
.admin-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.05);
  font-size: 12px;
  color: rgba(255,255,255,.25);
}
.admin-main { margin-left: 232px; flex: 1; display: flex; flex-direction: column; }
.admin-topbar {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(79,70,229,.08);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.admin-topbar-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--gray-900);
  letter-spacing: -.03em;
}
.admin-content { padding: 28px; flex: 1; display: flex; flex-direction: column; gap: 22px; }
.section { display: none; flex-direction: column; gap: 20px; }
.section.active { display: flex; }

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--white);
  border: 1px solid rgba(79,70,229,.10);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--stat-accent, linear-gradient(90deg, var(--brand), var(--purple)));
}
.stat-card-total   { --stat-accent: linear-gradient(90deg, var(--brand), var(--purple)); }
.stat-card-neu     { --stat-accent: linear-gradient(90deg, #6366f1, #818cf8); }
.stat-card-bearb   { --stat-accent: linear-gradient(90deg, var(--orange), #fbbf24); }
.stat-label {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.stat-value {
  font-size: 36px;
  font-weight: 900;
  color: var(--gray-900);
  margin-top: 8px;
  letter-spacing: -.05em;
}

/* ===== MISC ===== */
.text-muted  { color: var(--gray-500); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.fw-bold     { font-weight: 700; }
.fw-800      { font-weight: 800; }
.fw-900      { font-weight: 900; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flex-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.search-input {
  padding: 9px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  min-width: 220px;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(4px);
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
  background: var(--white);
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-300);
}
.empty-state-icon { font-size: 44px; margin-bottom: 14px; display: block; }
.empty-state-text { font-size: 14px; font-weight: 600; color: var(--gray-400); }

.tag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; }
.tag-inactive { background: var(--gray-100); color: var(--gray-400); }
.tag-active   { background: var(--green-bg); color: #065f46; }

/* Preview modal */
.preview-modal-img    { max-width: 100%; max-height: 72vh; border-radius: var(--radius); display: block; margin: 0 auto; }
.preview-modal-canvas { max-width: 100%; display: block; margin: 0 auto; border-radius: var(--radius-sm); }

/* ===== ORDER CONFIRMATION ===== */
.confirmation-card {
  background: var(--white);
  border: 1px solid rgba(79,70,229,.12);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.confirmation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
  background: linear-gradient(135deg, #1e1b4b 0%, var(--brand-dark) 50%, var(--brand) 100%);
  color: #fff;
}
.opero-logo {
  display: flex; align-items: center; gap: 11px;
}
.opero-logo-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.30);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 21px; letter-spacing: -.03em;
}
.opero-logo-name {
  font-size: 20px; font-weight: 900; letter-spacing: -.05em;
}
.opero-logo-tagline {
  font-size: 11px; opacity: .55; font-weight: 500; margin-top: 1px;
}
.confirmation-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; opacity: .65;
}

.confirmation-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 26px 32px;
  border-bottom: 1px solid var(--gray-100);
}
.confirmation-check {
  width: 52px; height: 52px;
  background: var(--green-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0; font-weight: 700;
  border: 2px solid rgba(16,185,129,.25);
}
.confirmation-title {
  font-size: 20px; font-weight: 900;
  color: var(--gray-900); letter-spacing: -.03em;
}
.confirmation-subtitle {
  font-size: 14px; color: var(--gray-400); margin-top: 3px;
}

.confirmation-meta {
  display: flex;
  border-bottom: 1px solid var(--gray-100);
}
.confirmation-meta-item {
  flex: 1;
  padding: 18px 24px;
  border-right: 1px solid var(--gray-100);
  display: flex; flex-direction: column; gap: 5px;
}
.confirmation-meta-item:last-child { border-right: none; }
.confirmation-meta-item.highlight {
  background: linear-gradient(135deg, #faf8ff 0%, var(--brand-light) 100%);
}
.conf-label {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400);
}
.conf-value {
  font-size: 15px; font-weight: 800;
  color: var(--gray-900); letter-spacing: -.02em;
}
.confirmation-meta-item.highlight .conf-value { color: var(--brand); }

.confirmation-parties {
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 24px 0;
  margin: 0 32px;
  border-bottom: 1px solid var(--gray-100);
  gap: 32px;
}
.party-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--gray-400); margin-bottom: 10px;
}
.party-name { font-size: 16px; font-weight: 900; color: var(--gray-900); letter-spacing: -.02em; }
.party-sub  { font-size: 13px; color: var(--gray-400); margin-top: 3px; }

.opero-supplier {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
.opero-supplier-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--purple) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #fff;
  box-shadow: 0 3px 10px rgba(79,70,229,.35);
  flex-shrink: 0;
}
.opero-supplier-name {
  font-size: 18px; font-weight: 900; letter-spacing: -.05em;
  background: linear-gradient(135deg, var(--brand) 0%, var(--purple) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.confirmation-items {
  padding: 24px 32px;
}
.confirmation-items-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: var(--gray-400); margin-bottom: 14px;
}

.confirmation-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: linear-gradient(135deg, #faf8ff 0%, var(--brand-light) 100%);
  border-top: 2px solid rgba(79,70,229,.12);
}
.conf-total-label { font-size: 14px; font-weight: 700; color: var(--gray-600); }
.conf-total-amount { font-size: 24px; font-weight: 900; color: var(--brand); letter-spacing: -.04em; }

.confirmation-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 32px;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap;
}
.confirmation-footer-note {
  font-size: 12px; color: var(--gray-400); line-height: 1.6; max-width: 400px;
}

/* ===== PRINT ===== */
@media print {
  .portal-header, .portal-topbar, .tabs, #catalogView,
  #tab-bestellungen, .order-bar, .no-print { display: none !important; }
  .portal-content { padding: 0 !important; max-width: 100% !important; }
  body { background: #fff !important; }
  .confirmation-card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; border-radius: 0 !important; }
  .confirmation-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .confirmation-meta-item.highlight { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .confirmation-total { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
   PRODUCT IMAGE (portal card)
   ============================================================ */
.product-card-img {
  height: 160px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  margin: -1px -1px 0 -1px;
}
.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================
   TIER PRICING TABLE (portal card)
   ============================================================ */
.tier-price-table {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
  min-width: 130px;
}
.tier-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-500);
  padding: 3px 8px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.tier-price-row.tier-active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 700;
}
.tier-from {
  opacity: .7;
}
.tier-price-val {
  font-weight: 600;
}
.tier-price-row.tier-active .tier-price-val {
  font-size: 14px;
}

/* ============================================================
   ADMIN: PRODUCT THUMBNAIL + IMAGE UPLOAD BUTTON
   ============================================================ */
.product-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid var(--gray-200);
  transition: border-color .15s;
}
.product-thumb:hover { border-color: var(--brand); }

.btn-img-upload {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 2px dashed var(--gray-300);
  background: var(--gray-50);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, background .15s;
}
.btn-img-upload:hover { border-color: var(--brand); background: var(--brand-light); }

/* ============================================================
   ADMIN: TIER EDITOR (inside catalog modal)
   ============================================================ */
.tier-expand-row td { background: var(--gray-50) !important; }

.tier-editor {
  padding: 16px 20px 20px;
  border-top: 2px solid var(--brand-light);
}
.tier-editor-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 2px;
}
.tier-editor-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 12px;
}
.tier-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.tier-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}
.tier-from  { color: var(--gray-600); min-width: 90px; }
.tier-price { font-weight: 700; color: var(--gray-800); flex: 1; }
.tier-delete {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.tier-delete:hover { color: var(--red); background: var(--red-bg); }

.tier-add-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #fff;
  border: 1px dashed var(--gray-300);
  border-radius: 8px;
  font-size: 13px;
}

/* ── Kataloge section ──────────────────────────────────── */
.catalog-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.catalog-toolbar label {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
}
.catalog-select {
  flex: 1;
  max-width: 360px;
  min-width: 200px;
  padding: 9px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-800);
  background: #fff;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color .15s;
}
.catalog-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.catalog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.catalog-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.catalog-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.catalog-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.catalog-prod-row td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  color: var(--gray-700);
  background: #fff;
  transition: background .1s;
}
.catalog-prod-row:hover td { background: var(--gray-50); }
.catalog-prod-row.is-assigned td { background: var(--brand-light); }
.catalog-prod-row.is-assigned:hover td { background: #e0e7ff; }

/* toggle switch */
.catalog-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.catalog-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.catalog-toggle-knob {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s;
}
.catalog-toggle-knob::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: var(--shadow-xs);
}
.catalog-toggle input:checked + .catalog-toggle-knob { background: var(--brand); }
.catalog-toggle input:checked + .catalog-toggle-knob::after { transform: translateX(18px); }

/* form-hint helper text under inputs */
.form-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
  line-height: 1.4;
}

/* catalog price input */
.catalog-prod-row input[type="number"] {
  width: 110px;
  padding: 6px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.catalog-prod-row input[type="number"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.catalog-prod-row input[type="number"]:disabled {
  background: var(--gray-50);
  color: var(--gray-400);
  cursor: not-allowed;
}

/* tier expand row */
.tier-expand-row td {
  padding: 0 14px 14px 14px !important;
  background: var(--brand-light) !important;
  border-bottom: 1px solid var(--gray-200) !important;
}
.catalog-prod-row.is-assigned .tier-expand-row td { background: #e0e7ff !important; }

.btn-tier-toggle {
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.btn-tier-toggle:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}
