/* ===== Admin-Bereich (ergänzt css/style.css) ===== */
.admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.admin-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.admin-brand .dot {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-right: 6px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

.admin-nav a,
.link-btn {
  color: var(--muted);
  font: inherit;
  font-size: .95rem;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.admin-nav a:hover,
.link-btn:hover { color: var(--blue); }

.admin-nav form { margin: 0; }

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.admin h1 { margin: 0; font-size: 1.6rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty { padding: 24px; color: var(--muted); }

/* --- Hinweise --- */
.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .95rem;
}

.notice--ok    { background: #e8f7ee; color: #17703d; }
.notice--error { background: #fdecec; color: #b42328; }

/* --- Buttons --- */
.btn { display: inline-block; text-decoration: none; }

.btn--ghost {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 9px 18px;
}

.btn--ghost:hover { border-color: var(--blue); color: var(--blue); box-shadow: none; }

.btn--danger {
  color: #b42328;
  background: var(--surface);
  border: 1px solid #f1c4c6;
  padding: 9px 18px;
}

.btn--danger:hover { background: #fdecec; box-shadow: none; }

/* --- App-Liste --- */
.app-list { overflow: hidden; }

.app-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.app-row:last-child { border-bottom: 0; }
.app-row--hidden { opacity: .55; }

.tile-icon--sm {
  flex: none;
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 11px;
}

.tile-icon--sm svg { width: 22px; height: 22px; }

.app-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}

.app-url {
  flex-basis: 100%;
  color: var(--muted);
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.app-order { color: var(--muted); font-variant-numeric: tabular-nums; }

.app-actions { display: flex; gap: 8px; }
.app-actions form { margin: 0; }

/* --- Formulare --- */
.admin-form,
.login-card {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.admin-form--narrow { max-width: 480px; }

.login-card {
  max-width: 400px;
  margin: 48px auto 0;
}

.login-card .btn { justify-self: stretch; }

.field small { color: var(--muted); font-weight: 400; }

fieldset.field { margin: 0; padding: 0; border: 0; }
fieldset.field legend { margin-bottom: 8px; font-weight: 500; }

.checks { display: grid; gap: 10px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.check input { width: 18px; height: 18px; accent-color: var(--blue); }

/* --- Screenshots --- */
.admin-section { margin-top: 48px; }
.admin h2 { margin: 0; font-size: 1.3rem; }

.upload-box {
  display: grid;
  gap: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.drop-zone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 32px 16px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.drop-zone:hover,
.drop-zone.is-over { border-color: var(--blue); background: rgba(30, 111, 240, .05); }

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone strong { color: var(--blue); }
.drop-zone small { color: var(--muted); }
.drop-files { color: var(--text); font-size: .9rem; word-break: break-all; }

.shot-admin { display: grid; gap: 20px; padding: 24px; }

.shot-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.shot-admin-item {
  display: grid;
  gap: 12px;
  align-content: start;
}

.shot-thumb {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.shot-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;          /* ganzes Bild sichtbar, proportional verkleinert */
  object-position: center;
  background: var(--bg);
}

.shot-admin-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.field--order { flex: 1; }

/* --- Benutzer --- */
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-weight: 600;
}

.badge--admin {
  color: var(--blue);
  border-color: rgba(30, 111, 240, .35);
  background: rgba(30, 111, 240, .07);
}

.hint { margin: -8px 0 0; color: var(--muted); font-size: .9rem; }

/* Konto wartet auf Freigabe: grau */
.user-row--pending { background: #f7f7f8; }
.user-row--pending .app-info strong,
.user-row--pending .app-url { color: #9a9ea8; }
.user-row--pending .avatar { background: #c4c7ce; }

.badge--pending {
  color: #8a6400;
  border-color: #f0d9a0;
  background: #fff6db;
}

.notice--pending { background: #fff6db; color: #7a5a00; }
.field-row--3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 760px) {
  .field-row--3 { grid-template-columns: 1fr; }
}

.custom-icon {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.custom-icon-controls { display: grid; gap: 10px; min-width: 0; }
.custom-icon-controls input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; }

.tile-icon--md { flex: none; width: 64px; height: 64px; margin: 0; border-radius: 16px; }
.tile-icon--md svg { width: 30px; height: 30px; }

legend small { color: var(--muted); font-weight: 400; }

.format-help { color: var(--muted); font-weight: 400; font-size: .85rem; }

.admin-form code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: .85em;
}

.char-count {
  justify-self: end;
  margin-top: -2px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.char-count.is-full { color: #b42328; }

.gate-help {
  margin-top: -6px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: .9rem;
  color: var(--muted);
}

.gate-help p { margin: 0 0 8px; }

/* Code im dunklen Block: ohne den hellen Hintergrund von .admin-form code */
.gate-help pre code {
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font-size: inherit;
}

.gate-help pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: 8px;
  background: #111521;
  color: #e8eaf0;
  font-size: .85rem;
  line-height: 1.5;
}

.tile-badge { justify-self: start; align-self: flex-start; margin: -8px 22px 22px; }
.checks .hint { margin: 0 0 0 28px; }

.perm-list { display: grid; gap: 10px; }
.perm-list .hint { margin: 0 0 4px; }
.check--muted { color: var(--muted); cursor: default; }

.admin .back-link { margin-bottom: 16px; }

/* --- Statistik --- */
.range-switch {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.range-switch a {
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
}

.range-switch a:hover { color: var(--blue); }
.range-switch a.is-active { background: var(--blue); color: #fff; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi { display: grid; gap: 4px; padding: 18px 20px; }
.kpi-label { color: var(--muted); font-size: .85rem; }
.kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }

.chart-card { padding: 24px; margin-bottom: 20px; }
.chart-card h2 { margin: 0 0 20px; font-size: 1.1rem; }

.chart { padding-left: 36px; }

.chart-plot {
  position: relative;
  height: 240px;
}

.chart-gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #eceef2;
}

.chart-gridline:last-child,
.chart-gridline[style*="bottom: 0%"] { border-top-color: #c9ccd3; }

.chart-gridline span {
  position: absolute;
  right: calc(100% + 8px);
  top: -.6em;
  color: var(--muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}

.chart-bars,
.chart-x {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
}

.chart-bars {
  position: absolute;
  inset: 0;
  gap: 2px;                      /* Abstand zwischen den Säulen */
}

.chart-col {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100%;
  outline: none;
  cursor: default;
}

.chart-col:hover,
.chart-col:focus-visible { background: rgba(30, 111, 240, .06); }

.chart-bar {
  width: 100%;
  max-width: 28px;
  margin: 0 auto;
  min-height: 0;
  background: var(--blue);
  border-radius: 4px 4px 0 0;
}

.chart-col.is-today .chart-bar { background: var(--indigo); }

.chart-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 2;
  display: none;
  width: max-content;
  max-width: 220px;
  padding: 8px 10px;
  transform: translateX(-50%);
  background: #111521;
  color: #e8eaf0;
  font-size: .8rem;
  line-height: 1.4;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(17, 21, 33, .25);
  pointer-events: none;
}

.chart-tip strong { display: block; color: #fff; }

.chart-col:hover .chart-tip,
.chart-col:focus-visible .chart-tip { display: block; }

/* Tooltip am Rand nicht abschneiden */
.chart-col:nth-child(-n+3) .chart-tip { left: 0; transform: none; }
.chart-col:nth-last-child(-n+3) .chart-tip { left: auto; right: 0; transform: none; }

.chart-x { margin-top: 8px; }

.chart-x span {
  overflow: visible;
  white-space: nowrap;
  text-align: center;
  color: var(--muted);
  font-size: .75rem;
}

.chart-table { margin-top: 18px; font-size: .9rem; }
.chart-table summary { cursor: pointer; color: var(--blue); }

.chart-table table,
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}

.chart-table table { margin-top: 12px; max-width: 420px; }

.chart-table th,
.chart-table td,
.stats-table th,
.stats-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.chart-table th,
.stats-table th { color: var(--muted); font-weight: 500; font-size: .85rem; }

.num { text-align: right !important; font-variant-numeric: tabular-nums; }

.page-kind { color: var(--muted); }

.privacy-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.privacy-note svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .chart-plot { height: 180px; }
}

/* --- Mobil --- */
@media (max-width: 640px) {
  .app-row { flex-wrap: wrap; }
  .app-order { display: none; }
  .app-actions { width: 100%; }
  .app-actions .btn, .app-actions form { flex: 1; }
  .app-actions form .btn { width: 100%; }
  .admin-form, .login-card { padding: 20px; }
}
