/* TIMORA Admin — schlicht, dunkel, gut lesbar. Keine externen Schriften. */
:root {
  --bg: #111411; --surface: #1A1F1B; --surface-2: #222723; --border: #303730; --border-2: #424941;
  --text: #F2EFE8; --text-2: #D1CEC4; --muted: #A9ADA3; --accent: #E66B4E; --on-accent: #171A18;
  --ok: #8FA382; --warn: #E3B262; --danger: #F08A70;
  --radius: 14px; --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); padding-bottom: 96px; }
a { color: var(--text); text-underline-offset: 3px; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
code, pre { font-family: var(--mono); font-size: .9em; }
pre { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow: auto; white-space: pre-wrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 650; text-decoration: none; }
.strong:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Kopfzeile */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 12px clamp(16px, 4vw, 40px); background: rgba(17, 20, 17, .92); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: .08em; text-decoration: none; white-space: nowrap; }
.brand span:last-child { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 14px; letter-spacing: 0; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { padding: 7px 12px; border-radius: 999px; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }
.logout { margin: 0; }

.main { max-width: 1100px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.head + .muted { margin-top: 0; }

/* Karten & Raster */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.card.narrow { max-width: 440px; margin: 8vh auto; }
.card.empty { text-align: center; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { display: grid; gap: 2px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; }
.tile:hover { border-color: var(--border-2); }
.tile strong { font-size: 1.9rem; line-height: 1.1; }
.tile-label { color: var(--text-2); font-weight: 600; }
.cols { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
.cols .card { margin: 0; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 0 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: 1.1fr 1fr 2fr .6fr; }
.grid-short { display: grid; grid-template-columns: 1fr 2.4fr auto; gap: 0 16px; align-items: end; }
.plain { list-style: none; margin: 0 0 20px; padding: 0; }
.plain li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.plain li:last-child { border-bottom: 0; }
.activity time { color: var(--muted); font-family: var(--mono); font-size: .82rem; margin-right: 6px; }

/* Formulare */
.form .card { margin: 16px 0; }
.f { display: grid; gap: 6px; margin: 0 0 14px; min-width: 0; align-content: start; }
.f-label, legend { font-weight: 600; color: var(--text-2); font-size: .9rem; }
.f-hint { color: var(--muted); font-size: .8rem; }
.f-error { color: var(--danger); font-size: .85rem; font-weight: 600; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="password"], input:not([type]), textarea, select {
  width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--border-2); border-radius: 10px; font: inherit;
}
textarea { resize: vertical; min-height: 64px; }
input.short { max-width: 96px; }
input[type="file"] { color: var(--text-2); font: inherit; max-width: 100%; }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0 16px 10px 0; cursor: pointer; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.checks { align-content: end; }
fieldset.bi { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
fieldset.bi legend { padding: 0; margin-bottom: 6px; }
.bi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bi-row label { position: relative; display: block; }
.bi-row .lang { position: absolute; top: 9px; right: 10px; font: 600 .7rem var(--mono); color: var(--muted); pointer-events: none; }
.bi-row input, .bi-row textarea { padding-right: 38px; }
.pre { position: relative; display: block; }
.prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); line-height: 1; color: var(--muted); pointer-events: none; }
.pre input { padding-left: 22px; }
.row-inline { display: flex; align-items: end; gap: 16px; flex-wrap: wrap; }
.ro { display: block; padding: 10px 12px; border: 1px dashed var(--border-2); border-radius: 10px; color: var(--text-2); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 0 12px; }
.danger-zone { margin: 32px 0 0; padding-top: 20px; border-top: 1px solid var(--border); }
details.add > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 8px 0; }
details.add[open] > summary { margin-bottom: 12px; }
.card.add { padding: 14px 20px; }
.link-row { padding: 16px 0; border-top: 1px solid var(--border); }
.link-row.is-new { border-top: 0; padding-top: 0; }
.sec-head { padding-bottom: 6px; }
.img-row { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.img-row:first-of-type { border-top: 0; }
.img-fields { min-width: 0; }
.thumb { display: block; width: 120px; height: 80px; object-fit: cover; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.thumb-empty { background: repeating-linear-gradient(45deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); }

/* Tabelle */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-thumb { width: 80px; }
.cell-thumb .thumb { width: 64px; height: 44px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2); white-space: nowrap; }
.pill-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.pill-off { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font: 600 .95rem var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--text-2); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.btn.wide { width: 100%; margin-top: 6px; }

/* Hinweise */
.notice { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; border: 1px solid; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice-ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.notice-warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.notice-error { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.log { max-height: 320px; font-size: .8rem; color: var(--text-2); }

/* Leiste: Veröffentlichen */
.publish { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 14px; width: min(860px, calc(100% - 24px)); margin: 0; padding: 10px 10px 10px 18px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 999px; box-shadow: 0 16px 50px rgba(0, 0, 0, .45); }
.publish-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.publish-text strong { color: var(--text); margin-right: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.publish[data-state="building"] .dot { background: var(--warn); animation: pulse 1s ease-in-out infinite alternate; }
.publish[data-state="error"] .dot { background: var(--danger); }
.publish[data-state="never"] .dot { background: var(--muted); }
.publish[data-state="ok"][data-dirty] .dot { background: var(--warn); }
@keyframes pulse { to { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .publish[data-state="building"] .dot { animation: none; } }

/* Schmal */
@media (max-width: 860px) {
  .top { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; flex-basis: 100%; }
  .logout { margin-left: auto; }
  .cols, .grid-2, .grid-3, .grid-4, .bi-row { grid-template-columns: minmax(0, 1fr); }
  .grid-short { grid-template-columns: 1fr; }
  .img-row { grid-template-columns: 1fr; }
  .publish { border-radius: 18px; }
}
