/* Verwaltung kuh-signale.ch */
:root {
  --adm-bg: #f0f2f5;
  --adm-card: #fff;
  --adm-border: #dce0e6;
  --adm-text: #1c1e21;
  --adm-muted: #65676b;
  --adm-green: #3d4f3a;
  --adm-green-hi: #5a6e56;
  --adm-danger: #c0392b;
  --adm-focus: #1877f2;
}

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

.adm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--adm-text);
  background: var(--adm-bg);
  min-height: 100vh;
}

.adm-login {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--adm-card);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--adm-border);
}

.adm-login h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  color: var(--adm-green);
}

.adm-login p {
  margin: 0 0 1.25rem;
  color: var(--adm-muted);
  font-size: 0.9rem;
}

.adm-app {
  display: none;
  min-height: 100vh;
}

.adm-app.is-visible {
  display: block;
}

/* Eine Kopfzeile: Marke + Bereiche + Abmelden (früher zwei getrennte Balken) */
.adm-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 1.25rem 0.65rem;
  background: var(--adm-green);
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.adm-header__brand {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  flex: 0 0 auto;
  max-width: 12rem;
  opacity: 0.98;
}

.adm-header__brand strong {
  font-weight: 700;
}

.adm-header__actions {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.adm-btn--header {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.38) !important;
  color: #fff !important;
  font-size: 0.88rem;
  padding: 0.4rem 0.75rem;
}

.adm-btn--header:hover {
  background: rgba(255, 255, 255, 0.22) !important;
}

.adm-tabs {
  flex: 1 1 220px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.25rem;
  padding: 0;
  margin: 0;
  min-width: 0;
  background: transparent;
  border: none;
}

.adm-tab-group {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  align-self: flex-start;
}

.adm-tab-group__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-align: left;
}

.adm-tab-group__caret {
  font-size: 0.65em;
  opacity: 0.85;
  margin-top: 0.1em;
}

.adm-tab-group__menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1100;
  min-width: 12.5rem;
  margin-top: 2px;
  padding: 0.28rem;
  flex-direction: column;
  gap: 2px;
  background: #143d24;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.adm-tab-group:hover .adm-tab-group__menu,
.adm-tab-group.is-open .adm-tab-group__menu,
.adm-tab-group:focus-within .adm-tab-group__menu {
  display: flex;
}

.adm-tab-group.is-active-group .adm-tab-group__trigger.adm-tab {
  color: #fff;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
  border-left-color: rgba(255, 255, 255, 0.95);
}

.adm-tab--sub {
  width: 100%;
  border-radius: 6px;
  border-left: 3px solid transparent;
  text-align: left;
  justify-content: flex-start;
}

.adm-tab {
  padding: 0.45rem 0.65rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 6px;
  border-left: 3px solid transparent;
  line-height: 1.25;
}

.adm-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.adm-tab.is-active {
  color: #fff;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
  border-left-color: rgba(255, 255, 255, 0.95);
}

.adm-panel {
  display: none;
  max-width: min(100%, 90rem);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 2.5vw, 2.25rem);
  box-sizing: border-box;
}

.adm-panel.is-active {
  display: block;
}

/* Volle Fensterbreite: Startseite 7 Bereiche, Navigation (Tabellen) */
.adm-panel--startseite,
.adm-panel--wide {
  max-width: none;
  width: 100%;
}

.adm-startseite-block {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--adm-border);
}

.adm-startseite-block:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.adm-startseite-block h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--adm-green);
}

.adm-startseite-block__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.adm-startseite-block__intro {
  flex: 1 1 18rem;
  min-width: 0;
}

.adm-startseite-block__intro .adm-checkbox {
  margin-bottom: 0.5rem;
}

.adm-startseite-block__head .adm-startseite-save-one {
  flex: 0 0 auto;
  align-self: flex-start;
  white-space: nowrap;
}

.adm-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.adm-card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--adm-green);
}

label.adm-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--adm-text);
}

input.adm-input,
textarea.adm-input,
select.adm-input {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--adm-border);
  border-radius: 6px;
  font: inherit;
  margin-bottom: 1rem;
}

textarea.adm-input {
  min-height: 200px;
  resize: vertical;
}

textarea.adm-input--sm {
  min-height: 80px;
}

.adm-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 700px) {
  .adm-row {
    grid-template-columns: 1fr;
  }
}

.adm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.adm-btn--primary {
  background: var(--adm-green);
  color: #fff;
}

.adm-btn--primary:hover {
  background: var(--adm-green-hi);
}

.adm-btn--secondary {
  background: #fff;
  border-color: var(--adm-border);
  color: var(--adm-text);
}

.adm-btn--secondary:hover {
  background: var(--adm-bg);
}

.adm-btn--danger {
  background: #fff;
  border-color: var(--adm-danger);
  color: var(--adm-danger);
}

.adm-btn--fb {
  background: #1877f2;
  color: #fff;
}

.adm-btn--fb:hover {
  filter: brightness(1.05);
}

.adm-btn--icon {
  padding: 0.45rem;
  min-width: 2.35rem;
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.adm-btn--icon svg {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.adm-row-actions {
  white-space: normal;
  vertical-align: middle;
}

.adm-table-wrap {
  overflow-x: auto;
}

table.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.adm-table th,
.adm-table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--adm-border);
}

.adm-table th {
  color: var(--adm-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.adm-table tr:hover td {
  background: #fafbfc;
}

.adm-course-actions {
  white-space: normal;
  vertical-align: middle;
}

.adm-course-actions .adm-btn--icon {
  margin: 0 0.2rem 0.25rem 0;
}

.adm-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.adm-badge--ok {
  background: #e7f5e8;
  color: #1e4620;
}

.adm-badge--draft {
  background: #fff3cd;
  color: #856404;
}

.adm-hint {
  font-size: 0.85rem;
  color: var(--adm-muted);
  margin: -0.5rem 0 1rem;
  line-height: 1.45;
}

.adm-callout {
  background: #e7f3ff;
  border: 1px solid #b3d7ff;
  border-radius: 8px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.adm-callout strong {
  color: #0a4d8c;
}

.adm-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.adm-checkbox input {
  margin-top: 0.25rem;
}

.adm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.adm-empty {
  color: var(--adm-muted);
  padding: 2rem;
  text-align: center;
}

.adm-empty--error {
  color: var(--adm-danger);
  text-align: left;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.adm-error {
  color: var(--adm-danger);
  font-size: 0.85rem;
  margin-top: -0.5rem;
  margin-bottom: 0.75rem;
}

/* Quill (Kursdaten Text 1 / Text 2) */
.adm-quill-shell {
  margin-bottom: 1.35rem;
  max-width: 100%;
}

.adm-quill-shell .ql-toolbar.ql-snow {
  border-radius: 6px 6px 0 0;
  border-color: var(--adm-border);
  background: #f6f7f9;
  flex-wrap: wrap;
}

.adm-quill-shell .ql-container.ql-snow {
  border-radius: 0 0 6px 6px;
  border-color: var(--adm-border);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
}

.adm-quill-shell .ql-editor {
  min-height: 120px;
}

/*
 * Alle Quill-Editoren (Startseite s1–s7, Kursdaten, Angebot): nur Vorschau.
 * Volle Auflösung wird nicht geladen – es ist dieselbe URL, nur verkleinert per CSS.
 */
.adm-app .ql-editor img {
  max-width: min(100%, 220px) !important;
  max-height: 150px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  border-radius: 6px;
  border: 1px solid var(--adm-border);
  background: #eef1f4;
  box-sizing: border-box;
}

.adm-app .ql-editor figure {
  margin: 0.4rem 0;
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.adm-app .ql-editor figure img {
  display: block;
  margin: 0;
}

.adm-app .ql-editor figure figcaption {
  font-size: 0.78rem;
  color: var(--adm-muted);
  margin-top: 0.3rem;
  line-height: 1.3;
  max-width: 220px;
}

/* figure-row im Editor: nebeneinander als kleine Vorschau */
.adm-app .ql-editor .figure-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-start;
  margin: 0.5rem 0;
}

.adm-app .ql-editor .figure-row figure {
  flex: 0 1 auto;
  margin: 0;
  max-width: 180px;
}

.adm-app .ql-editor .figure-row figure img {
  max-width: 180px !important;
  max-height: 120px !important;
}

.adm-app .ql-editor .figure-row figure figcaption {
  max-width: 180px;
}

.adm-quill-shell--tall .ql-editor {
  min-height: 220px;
}

.adm-quill-shell .ql-picker.ql-expanded .ql-picker-options {
  z-index: 200;
}

.adm-quill-shell .ql-snow .ql-tooltip {
  z-index: 210;
}

.adm-subh {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
}

.adm-homepage-guide {
  margin: 0.75rem 0 1.25rem;
  padding: 0.65rem 1rem 0.85rem;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--adm-border);
  border-radius: 8px;
}

.adm-homepage-guide__summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--adm-text, #222);
}

.adm-homepage-guide__list {
  margin: 0.5rem 0 0.75rem 1.1rem;
  padding: 0;
  line-height: 1.45;
}

.adm-homepage-guide__list li {
  margin-bottom: 0.35rem;
}

.adm-th-quiet {
  font-weight: 400;
  color: #666;
  font-size: 0.88em;
}

.adm-monospace {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: #444;
  word-break: break-all;
}

.adm-homepage-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
  vertical-align: middle;
}

.adm-btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  min-width: 0;
  flex-shrink: 0;
}

.adm-btn--icon svg {
  display: block;
  pointer-events: none;
}

tr.adm-homepage-row--focus {
  outline: 2px solid var(--adm-focus);
  outline-offset: 2px;
}

.adm-btn--compact {
  padding: 0.25rem 0.45rem;
  font-size: 0.8rem;
  line-height: 1.25;
  white-space: nowrap;
}

.adm-homepage-items-table {
  table-layout: auto;
}

.adm-homepage-items-table .adm-input {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.adm-homepage-items-table .hp-in-title {
  min-width: 22rem;
  width: 22%;
}

.adm-homepage-items-table .hp-in-href {
  min-width: 12rem;
  max-width: none;
  width: 11%;
}

.adm-homepage-items-table .hp-preview {
  min-width: 14rem;
  max-width: none;
  font-size: 0.88rem;
}

.adm-pa-items-table .pa-in-label {
  min-width: 14rem;
}

.adm-pa-items-table .pa-in-url {
  min-width: 18rem;
  max-width: 36rem;
}

.adm-homepage-items-table td:nth-child(8) {
  min-width: 12rem;
  width: 18%;
  max-width: 32rem;
}

/* Ebene: nur 1–3 → schmale Spalte */
.adm-homepage-items-table td:nth-child(3) {
  width: 0.01%;
  white-space: nowrap;
  vertical-align: middle;
  padding-inline: 0.35rem;
}

.adm-homepage-items-table select.hp-in-level {
  width: 4ch;
  min-width: 0;
  max-width: 4.25rem;
  box-sizing: content-box;
  padding: 0.38rem 1.35rem 0.38rem 0.25rem;
  text-align: center;
  margin-bottom: 0;
}

.adm-homepage-items-table .hp-in-parent {
  min-width: 12rem;
  max-width: 22rem;
  width: 14%;
}

.adm-homepage-row--l2 td {
  background: rgba(255, 255, 255, 0.75);
}

.adm-homepage-row--l3 td {
  background: rgba(248, 249, 251, 0.9);
}

.adm-homepage-items-table input.hp-in-excerpt {
  display: block;
  min-width: 10rem;
  width: 100%;
  max-width: 100%;
  line-height: 1.35;
  padding: 0.4rem 0.55rem;
}

.adm-angebote-fig {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.adm-angebote-prev {
  max-width: 220px;
  max-height: 150px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  background: #e8eaed;
  display: none;
}

/* Bereich 6: Slider-Einträge als Cards im Raster */
#home-s6-slider-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

.adm-s6-card.home-s6-slide-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem;
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  min-width: 0;
}

.adm-s6-drag-handle {
  flex-shrink: 0;
  margin: -0.2rem -0.1rem 0.15rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px dashed var(--adm-border);
  background: linear-gradient(180deg, #f3f5f8 0%, #e8eaf0 100%);
  color: var(--adm-muted);
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-align: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.adm-s6-drag-handle:hover {
  border-color: var(--adm-green-hi);
  color: var(--adm-green);
}

.adm-s6-drag-handle:active {
  cursor: grabbing;
}

.adm-s6-card--dragging {
  opacity: 0.55;
}

.adm-s6-card--drop-hover {
  outline: 2px dashed var(--adm-green);
  outline-offset: 2px;
}

.adm-s6-thumb-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #e8eaed;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.adm-s6-thumb-wrap .adm-s6-thumb-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--adm-muted);
  text-align: center;
  padding: 0.35rem;
}

.adm-s6-thumb-wrap .adm-s6-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.adm-s6-card__fields {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
}

.adm-s6-card__fields .adm-input {
  width: 100%;
  margin: 0;
}

.adm-s6-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.15rem;
}

.adm-s6-card__reorder {
  display: flex;
  gap: 0.25rem;
  margin-right: auto;
}

.adm-s6-card__reorder .adm-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.adm-s6-card__actions .adm-s6-remove {
  width: 2.4rem;
  padding-left: 0;
  padding-right: 0;
}

/* Statistik-Panel */
.adm-stat-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.adm-stat-card {
  border-radius: 10px;
  padding: 1rem 1.1rem;
  border: 1px solid var(--adm-border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.adm-stat-card strong {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--adm-text);
}

.adm-stat-card span {
  font-size: 0.82rem;
  color: var(--adm-muted);
}

.adm-stat-card--blue {
  background: linear-gradient(135deg, #e8f2fc 0%, #ddeaf8 100%);
}

.adm-stat-card--amber {
  background: linear-gradient(135deg, #fdf2e5 0%, #fae6d4 100%);
}

.adm-stat-card--green {
  background: linear-gradient(135deg, #e9f2eb 0%, #dce9df 100%);
}

.adm-stat-section-title {
  margin: 1.25rem 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--adm-text);
}

.adm-stat-chart-hint {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--adm-muted);
  line-height: 1.45;
}

.adm-stat-bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
}

.adm-stat-bar-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, 22%) 1fr auto;
  gap: 0.5rem 0.65rem;
  align-items: center;
}

.adm-stat-bar-label {
  font-size: 0.82rem;
  color: var(--adm-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-stat-bar-track {
  height: 1.15rem;
  background: #e8eaed;
  border-radius: 6px;
  overflow: hidden;
  min-width: 0;
}

.adm-stat-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #5b8fc7 0%, #7eb89a 100%);
  min-width: 3px;
  transition: width 0.35s ease;
}

.adm-stat-bar-val {
  font-size: 0.78rem;
  color: var(--adm-muted);
  white-space: nowrap;
  text-align: right;
}

.adm-stat-tips {
  margin: 0.25rem 0 0;
  padding-left: 1.15rem;
  color: var(--adm-text);
  line-height: 1.5;
}

.adm-stat-tips li {
  margin-bottom: 0.45rem;
}

.adm-muted {
  color: var(--adm-muted);
}
