:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #6b7585;
  --border: #e2e6ed;
  --primary: #2d6cdf;
  --primary-dark: #1f51ad;
  --success: #2e9e5b;
  --warn: #d98324;
  --danger: #d64545;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 30, 50, 0.06);
  --maxw: 1100px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* --- Header --- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.site-header .brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.site-header nav a { margin-left: 16px; font-size: 0.95rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: #eef1f6; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #e2e7f0; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 0.85rem; }
.btn.success { background: var(--success); }

/* --- Cards / Grid --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s, box-shadow 0.12s;
}
.card.link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,30,50,0.1); }
.card .thumb {
  aspect-ratio: 4 / 3;
  background: #e9edf3 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.card .body { padding: 14px; flex: 1; }
.card .body h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card .body p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eaf0fb;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

/* --- Headings / sections --- */
h1 { font-size: 1.7rem; margin: 28px 0 4px; }
.subtitle { color: var(--muted); margin: 0 0 8px; }
.section { margin: 28px 0; }

/* --- Configurator layout --- */
.config-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
.viewer {
  width: 100%;
  height: 460px;
  background: #e9edf3;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  touch-action: none;
}
.viewer .hint {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
}
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel h2 { margin: 0 0 12px; font-size: 1.15rem; }

/* --- Forms --- */
label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}
textarea { resize: vertical; min-height: 80px; }
input[type=range] { width: 100%; }
.slider-row { display: grid; grid-template-columns: 90px 1fr 52px; align-items: center; gap: 8px; margin-bottom: 8px; }
.slider-row label { margin: 0; font-weight: 500; }
.slider-row .val { font-size: 0.8rem; color: var(--muted); text-align: right; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }
.help { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: #fbfcfe;
}
.dropzone:hover { border-color: var(--primary); color: var(--primary); }
.dropzone.has-file { border-style: solid; color: var(--text); }
.logo-preview { max-height: 60px; max-width: 100%; margin-top: 8px; }

/* --- Variant selector --- */
.variant-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.variant-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.9rem;
}
.variant-btn.active { border-color: var(--primary); background: #eaf0fb; color: var(--primary-dark); font-weight: 600; }

/* --- Messages --- */
.alert { padding: 12px 14px; border-radius: 8px; margin: 12px 0; font-size: 0.92rem; }
.alert.error { background: #fdecec; color: #99312f; border: 1px solid #f3c2c0; }
.alert.success { background: #e7f6ec; color: #1f6e3f; border: 1px solid #bfe6cc; }
.alert.info { background: #eaf0fb; color: var(--primary-dark); border: 1px solid #cbdcf7; }

/* --- Badges --- */
.badge { display:inline-block; font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.badge.neu { background: #eaf0fb; color: var(--primary-dark); }
.badge.bearbeitet { background: #e7f6ec; color: #1f6e3f; }
.badge.archiviert { background: #eef0f3; color: var(--muted); }

/* --- Tables --- */
table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.list th, table.list td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
table.list th { background: #f7f9fc; color: var(--muted); font-weight: 600; }
table.list tr:last-child td { border-bottom: none; }
table.list tr.clickable { cursor: pointer; }
table.list tr.clickable:hover { background: #f7f9fc; }

/* --- Admin layout --- */
.admin-header { background: #1c2330; color: #fff; }
.admin-header .brand, .admin-header nav a { color: #fff; }
.admin-header nav a { opacity: 0.85; }
.admin-header nav a:hover { opacity: 1; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.kv { margin: 0 0 10px; }
.kv b { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

.muted { color: var(--muted); }
.center { text-align: center; }
.spinner { text-align: center; color: var(--muted); padding: 40px 0; }

/* --- Mobile --- */
@media (max-width: 820px) {
  .config-layout { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .viewer { height: 340px; }
}
