/* ===========================================================================
   momenta · Gestaltung
   Hell-/Dunkelmodus, grosse Bedienelemente, mobil zuerst.
   =========================================================================== */

:root {
  --accent: #b8873b;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 32%, transparent);

  --bg:        #faf8f5;
  --bg-2:      #f2eee7;
  --surface:   #ffffff;
  --surface-2: #f7f4ef;
  --ink:       #1c1917;
  --ink-2:     #57534e;
  --muted:     #79716b;
  --line:      #e5dfd6;
  --line-2:    #d6cec2;

  --ok:      #15803d;
  --ok-bg:   #dcfce7;
  --warn:    #a16207;
  --warn-bg: #fef3c7;
  --err:     #b91c1c;
  --err-bg:  #fee2e2;
  --info:    #1d4ed8;
  --info-bg: #dbeafe;

  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --shadow-1: 0 1px 2px rgba(28, 25, 23, .06), 0 1px 3px rgba(28, 25, 23, .05);
  --shadow-2: 0 4px 12px rgba(28, 25, 23, .08), 0 2px 4px rgba(28, 25, 23, .04);
  --shadow-3: 0 18px 40px rgba(28, 25, 23, .16), 0 4px 10px rgba(28, 25, 23, .06);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;

  --wrap: 1180px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg:        #14120f;
  --bg-2:      #1a1714;
  --surface:   #1f1c18;
  --surface-2: #262119;
  --ink:       #f6f2ec;
  --ink-2:     #d6cfc5;
  --muted:     #a49c92;
  --line:      #332e28;
  --line-2:    #453e36;

  --ok:      #4ade80;  --ok-bg:   #14321f;
  --warn:    #fbbf24;  --warn-bg: #362a10;
  --err:     #fca5a5;  --err-bg:  #3a1717;
  --info:    #93c5fd;  --info-bg: #16243f;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, .5);
  --shadow-3: 0 18px 44px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* --- Grundlagen ---------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
h3 { font-size: 1.06rem; }
p  { margin: 0 0 1em; }
a  { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }

.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; }

img, video { max-width: 100%; height: auto; display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.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;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600;
  transition: top .15s;
}
.skip-link:focus { top: 8px; }

/* --- Layout -------------------------------------------------------------- */
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.wrap-narrow { width: min(100% - 32px, 720px); margin-inline: auto; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.center { text-align: center; }

/* --- Kopfzeile ----------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 14px; min-height: 62px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.12rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7c3aed));
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-1);
}
.brand-mark svg { width: 19px; height: 19px; }

/* --- Schaltflaechen ------------------------------------------------------ */
.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  --btn-line: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 11px 18px;
  font: inherit; font-weight: 600; font-size: .97rem;
  color: var(--btn-ink); background: var(--btn-bg);
  border: 1px solid var(--btn-line); border-radius: var(--r);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { box-shadow: var(--shadow-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary { --btn-bg: var(--accent); --btn-ink: var(--accent-ink); --btn-line: transparent; box-shadow: var(--shadow-1); }
.btn-primary:hover:not(:disabled) { --btn-bg: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-ghost { --btn-bg: transparent; --btn-line: transparent; }
.btn-ghost:hover:not(:disabled) { --btn-bg: var(--surface-2); box-shadow: none; }
.btn-danger { --btn-ink: var(--err); --btn-line: color-mix(in srgb, var(--err) 40%, transparent); }
.btn-danger:hover:not(:disabled) { --btn-bg: var(--err-bg); }
.btn-lg { min-height: 60px; font-size: 1.08rem; padding: 16px 28px; border-radius: var(--r-lg); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .87rem; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 42px; min-height: 42px; border-radius: var(--r-sm); }
.btn-icon.btn-sm { width: 34px; min-height: 34px; }

/* --- Formulare ----------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field > label, .label {
  display: block; font-weight: 600; font-size: .9rem;
  margin-bottom: 6px; color: var(--ink-2);
}
.hint { display: block; font-size: .84rem; color: var(--muted); margin-top: 5px; line-height: 1.45; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="datetime-local"],
select, textarea {
  width: 100%; font: inherit; font-size: 1rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 12px 14px; min-height: 48px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2379716b' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
  padding-right: 38px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--err); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 15%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

.field-error { display: block; color: var(--err); font-size: .86rem; font-weight: 600; margin-top: 5px; }

.check {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); cursor: pointer; margin-bottom: 10px;
}
.check:hover { border-color: var(--line-2); }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.check span { font-size: .95rem; }
.check .hint { margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* Farbwahl */
.swatches { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line-2);
  cursor: pointer; padding: 0; transition: transform .1s;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
input[type="color"] { width: 46px; height: 38px; min-height: 38px; padding: 3px; border-radius: var(--r-sm); cursor: pointer; }

/* --- Karten -------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card-pad { padding: clamp(18px, 3vw, 26px); }

.panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }

/* --- Etiketten ----------------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .78rem; font-weight: 650; letter-spacing: .01em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.tag-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag-entwurf     { background: var(--surface-2); color: var(--muted); }
.tag-aktiv       { background: var(--ok-bg);   color: var(--ok);   border-color: transparent; }
.tag-geschlossen { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag-archiviert  { background: var(--info-bg); color: var(--info); border-color: transparent; }
.tag-accent      { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

/* --- Meldungen ----------------------------------------------------------- */
.note {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r); font-size: .93rem;
  border: 1px solid transparent; line-height: 1.5;
}
.note svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.note strong { font-weight: 700; }
.note-info { background: var(--info-bg); color: var(--info); }
.note-ok   { background: var(--ok-bg);   color: var(--ok); }
.note-warn { background: var(--warn-bg); color: var(--warn); }
.note-err  { background: var(--err-bg);  color: var(--err); }

/* --- Kurzmeldungen (Toasts) ---------------------------------------------- */
#toasts {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 9px;
  width: min(100% - 28px, 460px); pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--ink); color: var(--bg);
  padding: 13px 17px; border-radius: var(--r);
  box-shadow: var(--shadow-3); font-size: .94rem; font-weight: 550;
  display: flex; gap: 10px; align-items: center;
  animation: toast-in .22s cubic-bezier(.2, .9, .3, 1.2);
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast-err { background: var(--err); color: #fff; }
.toast-ok  { background: var(--ok);  color: #fff; }
html[data-theme="dark"] .toast-ok { color: #06210f; }
html[data-theme="dark"] .toast-err { color: #2b0b0b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* --- Dialoge ------------------------------------------------------------- */
dialog {
  border: none; padding: 0; border-radius: var(--r-xl);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-3); max-width: min(100% - 24px, 640px); width: 100%;
}
dialog::backdrop { background: rgba(20, 18, 15, .55); backdrop-filter: blur(3px); }
dialog[open] { animation: dlg-in .18s ease; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.dlg-head { padding: 22px 24px 0; }
.dlg-body { padding: 14px 24px; max-height: min(66vh, 640px); overflow: auto; }
.dlg-foot {
  padding: 16px 24px 22px; display: flex; gap: 10px; justify-content: flex-end;
  flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 8px;
}
@media (max-width: 560px) {
  .dlg-foot { flex-direction: column-reverse; }
  .dlg-foot .btn { width: 100%; }
}

/* --- Ladezustand --------------------------------------------------------- */
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 54px 22px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; opacity: .45; margin-bottom: 12px; }
.empty h3 { color: var(--ink-2); }

/* --- Fortschritt --------------------------------------------------------- */
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.bar-ok   > i { background: var(--ok); }
.bar-warn > i { background: var(--warn); }
.bar-err  > i { background: var(--err); }
.bar-lg { height: 14px; }

/* --- Galerie ------------------------------------------------------------- */
.gallery {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
@media (max-width: 480px) { .gallery { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 7px; } }

.tile {
  position: relative; aspect-ratio: 1; border-radius: var(--r);
  overflow: hidden; background: var(--surface-2); border: 1px solid var(--line);
  cursor: zoom-in; padding: 0; display: block; width: 100%;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.tile:hover img { transform: scale(1.05); }
.tile-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(transparent 45%, rgba(0, 0, 0, .5));
  pointer-events: none;
}
.tile-play svg { width: 40px; height: 40px; color: #fff; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.tile-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 9px 7px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .72));
  color: #fff; font-size: .76rem; font-weight: 600; text-align: left;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6); pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-check {
  position: absolute; top: 7px; left: 7px; width: 26px; height: 26px;
  border-radius: 8px; border: 2px solid #fff; background: rgba(0, 0, 0, .35);
  display: grid; place-items: center; color: #fff; z-index: 2;
}
.tile[aria-selected="true"] { outline: 3px solid var(--accent); outline-offset: -3px; }
.tile[aria-selected="true"] .tile-check { background: var(--accent); border-color: var(--accent); }
.tile-badge {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  font-size: .7rem; font-weight: 700; padding: 3px 7px; border-radius: 7px;
  background: rgba(0, 0, 0, .62); color: #fff; backdrop-filter: blur(4px);
}

/* --- Bildbetrachter ------------------------------------------------------ */
.lightbox {
  position: fixed; inset: 0; z-index: 250; background: rgba(10, 9, 8, .96);
  display: none; flex-direction: column;
}
.lightbox[open], .lightbox.on { display: flex; }
.lb-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: #fff; }
.lb-top .btn { --btn-bg: rgba(255,255,255,.12); --btn-ink: #fff; --btn-line: rgba(255,255,255,.2); }
.lb-stage { flex: 1; display: grid; place-items: center; padding: 4px 12px; min-height: 0; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-sm); }
.lb-foot { padding: 12px 16px 22px; color: #e7e5e4; text-align: center; font-size: .92rem; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 50px; height: 50px; border-radius: 50%; border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center;
  cursor: pointer; backdrop-filter: blur(6px);
}
.lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
@media (max-width: 560px) { .lb-nav { width: 42px; height: 42px; } }

/* --- Umschalter ---------------------------------------------------------- */
.segmented {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 3px; gap: 3px;
}
.segmented button {
  font: inherit; font-size: .89rem; font-weight: 600; color: var(--ink-2);
  background: transparent; border: none; border-radius: 10px;
  padding: 8px 14px; min-height: 36px; cursor: pointer; white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* --- Tabelle ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.list { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 720px; }
table.list th, table.list td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.list th { font-weight: 650; color: var(--ink-2); font-size: .84rem; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); position: sticky; top: 0; }
table.list tbody tr:last-child td { border-bottom: none; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list th button { background: none; border: none; font: inherit; color: inherit; cursor: pointer; padding: 0; display: inline-flex; gap: 4px; align-items: center; }

/* --- Druck --------------------------------------------------------------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
