:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --ink: #23201b;
  --muted: #7a7266;
  --line: #e4ded3;
  --brand: #6b4f2a;        /* saddle brown */
  --brand-ink: #ffffff;
  --accent: #2f7d5b;       /* meadow green */
  --danger: #b3261e;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --maxw: 1000px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1712; --surface: #24201a; --ink: #f0ebe2; --muted: #a99f8f;
    --line: #3a342b; --brand: #c9a568; --brand-ink: #241d10; --accent: #5bc08e;
    --shadow: 0 2px 12px rgba(0,0,0,.4);
  }
}

/* ---- Skins (user-selectable colour themes) — win over the OS preference ---- */
:root[data-skin="default"] {
  --bg: #f7f5f0; --surface: #ffffff; --ink: #23201b; --muted: #7a7266;
  --line: #e4ded3; --brand: #6b4f2a; --brand-ink: #fff; --accent: #2f7d5b;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
}
:root[data-skin="dark"] {
  --bg: #1a1712; --surface: #24201a; --ink: #f0ebe2; --muted: #a99f8f;
  --line: #3a342b; --brand: #c9a568; --brand-ink: #241d10; --accent: #5bc08e;
  --shadow: 0 2px 12px rgba(0,0,0,.4);
}
:root[data-skin="midnight"] {
  --bg: #0f1620; --surface: #17202c; --ink: #e8eef5; --muted: #93a3b5;
  --line: #263241; --brand: #6aa9e0; --brand-ink: #0c1420; --accent: #58c0a8;
  --shadow: 0 2px 14px rgba(0,0,0,.5);
}
:root[data-skin="meadow"] {
  --bg: #f2f6ef; --surface: #ffffff; --ink: #1f2a1c; --muted: #6f7a68;
  --line: #dde6d6; --brand: #2f7d5b; --brand-ink: #fff; --accent: #b06b2a;
}
:root[data-skin="chestnut"] {
  --bg: #f7f0ec; --surface: #ffffff; --ink: #2a1e18; --muted: #8a7166;
  --line: #ecdcd2; --brand: #8a3b2e; --brand-ink: #fff; --accent: #b6852f;
}
:root[data-skin="ocean"] {
  --bg: #eef3f7; --surface: #ffffff; --ink: #1b2530; --muted: #6a7787;
  --line: #d7e1ea; --brand: #24567e; --brand-ink: #fff; --accent: #2f8f8f;
}
:root[data-skin="sand"] {
  --bg: #efe7d6; --surface: #fbf6ec; --ink: #2a2519; --muted: #857a63;
  --line: #ddd2ba; --brand: #7a5a1e; --brand-ink: #fff; --accent: #4f7a3a;
}
:root[data-skin="slate"] {
  --bg: #eef0f2; --surface: #ffffff; --ink: #1f2429; --muted: #6b727a;
  --line: #dbe0e5; --brand: #3a4650; --brand-ink: #fff; --accent: #2f8f6b;
}
:root[data-skin="rose"] {
  --bg: #f8f0f2; --surface: #ffffff; --ink: #2a1e22; --muted: #8a7079;
  --line: #ecd9de; --brand: #a13b5c; --brand-ink: #fff; --accent: #4f7a6a;
}

/* Skin switcher (header) */
.skin-sw { position: relative; }
.skin-sw > summary { list-style: none; cursor: pointer; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1.05rem; background: var(--surface); }
.skin-sw > summary::-webkit-details-marker { display: none; }
.skin-sw-menu { position: absolute; z-index: 60; margin-top: .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: .3rem; min-width: 168px; }
.skin-sw-item { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: 6px; color: var(--ink); font-size: .9rem; }
.skin-sw-item:hover { background: var(--bg); text-decoration: none; }
.skin-sw-item.is-sel { font-weight: 700; }
.skin-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(128,128,128,.4); display: inline-block; flex: none; }
.skin-dot-auto { background: linear-gradient(135deg, #ffffff 50%, #1a1712 50%); }
.skin-dot-default { background: #6b4f2a; }
.skin-dot-dark { background: #24201a; }
.skin-dot-midnight { background: #17202c; }
.skin-dot-meadow { background: #2f7d5b; }
.skin-dot-chestnut { background: #8a3b2e; }
.skin-dot-ocean { background: #24567e; }
.skin-dot-sand { background: #e0d3b6; }
.skin-dot-slate { background: #3a4650; }
.skin-dot-rose { background: #a13b5c; }

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1.25rem; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); }
.brand-mark { font-size: 1.4rem; }
.brand-name { font-size: 1.15rem; letter-spacing: .3px; }
.site-nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.site-nav a { color: var(--ink); }
.header-left { display: inline-flex; align-items: center; gap: 1rem; }

/* Language switcher — subtle button + self-contained overlay menu (milafy style).
   The menu is position:absolute, so opening it never pushes the header. */
.lang-sw { position: relative; display: inline-block; font-size: .82rem; line-height: 1; }
.lang-sw-btn {
  display: inline-flex; align-items: center; gap: 6px; background: transparent;
  color: var(--muted); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 8px; cursor: pointer; font: inherit; line-height: 1;
}
.lang-sw-btn:hover { border-color: var(--brand); color: var(--ink); }
.lang-sw-code { letter-spacing: .02em; }
.lang-sw-caret { opacity: .55; font-size: .7em; }
.lang-sw .flag {
  display: inline-block; width: 20px; height: 13px; border-radius: 2px;
  overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.18); flex: none; background: #fff;
}
.lang-sw .flag img { display: block; width: 100%; height: 100%; }
.lang-sw-menu {
  position: absolute; top: calc(100% + 5px); left: 0; z-index: 10000;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 4px; min-width: 158px; box-shadow: var(--shadow);
  max-height: min(60vh, 340px); overflow: auto;
}
.lang-sw-menu[hidden] { display: none; }
.lang-sw-item {
  display: flex; align-items: center; gap: 9px; width: 100%; background: transparent;
  border: 0; color: var(--ink); padding: 7px 9px; border-radius: 7px; cursor: pointer;
  font: inherit; text-align: left; white-space: nowrap;
}
.lang-sw-item:hover { background: var(--bg); text-decoration: none; }
.lang-sw-item.is-sel { background: var(--bg); font-weight: 600; }
.lang-sw-item.is-sel .flag { box-shadow: 0 0 0 2px var(--brand); }

/* Floating feedback button + modal (over the whole logged-in area). */
#fb-btn {
  position: fixed; bottom: 16px; left: 16px; z-index: 75; width: 46px; height: 46px;
  border-radius: 50%; background: var(--brand); color: var(--brand-ink); border: none;
  font-size: 1.3rem; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
#fb-btn:hover { filter: brightness(1.05); }
#fb-ov {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#fb-ov[hidden] { display: none; }
.fb-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; max-width: 420px; width: 100%; color: var(--ink); box-shadow: var(--shadow);
}
.fb-box h3 { margin: 0 0 4px; }
.fb-sub { margin: 0 0 12px; font-size: .85rem; color: var(--muted); }
.fb-field {
  width: 100%; margin-bottom: 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; color: var(--ink); font: inherit;
}
textarea.fb-field { resize: vertical; }
.fb-note { font-size: .82rem; margin: 2px 0 0; min-height: 18px; color: var(--muted); }
.fb-note.fb-ok { color: var(--brand); }
.fb-note.fb-err { color: #d33; }
.fb-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* Admin reply form (per feedback row) */
.fb-reply { margin-top: 6px; }
.fb-reply > summary { display: inline-block; }
.fb-reply form { margin-top: 6px; display: flex; flex-direction: column; gap: 5px; min-width: 240px; }
.fb-reply textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; color: var(--ink); font: inherit; resize: vertical;
}
.fb-reply-done { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }

/* Boarding-facility directory (Pensionsställe) */
.pf-filter { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.pf-filter select, .pf-filter input[type="search"] {
  padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.pf-filter input[type="search"] { flex: 1; min-width: 160px; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; margin-top: .5rem; }
.pf-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.pf-card h3 { margin: 0 0 .15rem; font-size: 1.02rem; }
.pf-op { font-size: .82rem; margin: 0 0 .4rem; }
.pf-addr { font-size: .88rem; margin: 0 0 .6rem; color: var(--ink); }
.pf-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .6rem; }
.pf-badge { font-size: .72rem; background: var(--bg); border: 1px solid var(--line); color: var(--muted); padding: .1rem .45rem; border-radius: 999px; }
.pf-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .5rem; font-size: .85rem; }
.pf-free { font-size: .72rem; padding: .1rem .5rem; border-radius: 5px; color: #fff; }
.pf-free-frei { background: #2e9e5b; }
.pf-free-warteliste, .pf-free-auf_anfrage { background: #c8871b; }
.pf-free-belegt { background: var(--muted); }
.pf-free-unbekannt { background: var(--muted); }
.pf-links { display: flex; gap: .8rem; margin: 0; font-size: .85rem; }
.pf-pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1.5rem 0; }

/* Layout */
.site-main { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.site-footer {
  max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem;
  color: var(--muted); font-size: .85rem; display: flex; justify-content: space-between; gap: 1rem;
  border-top: 1px solid var(--line);
}
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.center { text-align: center; }

/* Hero */
.hero { text-align: center; padding: 2.5rem 1rem 2rem; }
.hero h1 { font-size: 2.6rem; margin: 0 0 .25rem; color: var(--brand); }
.hero-claim { font-size: 1.25rem; font-weight: 600; margin: .25rem 0; }
.hero-identity { color: var(--muted); font-style: italic; }
.hero-sub { max-width: 620px; margin: 1rem auto 1.5rem; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-block; padding: .55rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; font-size: .95rem; font-weight: 600;
}
.btn:hover { text-decoration: none; border-color: var(--brand); }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }

/* Features */
.features { margin-top: 2rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.feature-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.feature-card h3 { margin: 0 0 .4rem; color: var(--brand); font-size: 1.05rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: .9rem; }

/* Cards & forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 420px; margin: 2rem auto; }
.form { display: flex; flex-direction: column; gap: .9rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.form input, .form select {
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font-size: .95rem;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-grid .form-actions { grid-column: 1 / -1; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.5rem; }
.form-inline input, .form-inline select { flex: 1 1 140px; }
.checkbox { flex-direction: row !important; align-items: center; }
.alert { background: rgba(179,38,30,.1); color: var(--danger); padding: .6rem .8rem; border-radius: 8px; font-weight: 600; }

/* Admin */
.admin-nav { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 1.5rem; }
.admin-nav a { padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .9rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; text-align: center; box-shadow: var(--shadow); }
.stat .num { display: block; font-size: 2rem; font-weight: 800; color: var(--brand); }
.stat .lbl { color: var(--muted); font-size: .85rem; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th, .data-table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.data-table th { background: var(--bg); color: var(--muted); }
code { background: var(--bg); padding: .1rem .35rem; border-radius: 5px; font-size: .85em; }

/* Data lists / detail */
.data-list { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 1rem 0; }
.data-list dt { color: var(--muted); font-weight: 600; }
.data-list dd { margin: 0; }
.detail-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.detail-actions { display: flex; gap: .5rem; }
.code-badge { display: inline-block; background: var(--brand); color: var(--brand-ink); padding: .15rem .55rem; border-radius: 6px; font-family: ui-monospace, monospace; font-size: .8em; letter-spacing: 1px; vertical-align: middle; }
.code-badge.big { font-size: 1.2rem; padding: .3rem .8rem; }

/* Horse grid */
.horse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-top: 1rem; }
.horse-card { display: flex; flex-direction: column; gap: .25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; color: var(--ink); box-shadow: var(--shadow); }
.horse-card:hover { border-color: var(--brand); text-decoration: none; }
.horse-card .code { font-family: ui-monospace, monospace; color: var(--brand); font-weight: 700; letter-spacing: 1px; }
.horse-card .name { font-weight: 600; }

/* EquiCard */
.equicard { max-width: 640px; margin: 1rem auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.equicard-header { display: flex; align-items: center; gap: .6rem; background: var(--brand); color: var(--brand-ink); padding: .8rem 1.2rem; font-weight: 700; font-size: 1.2rem; }
.equicard-body { display: grid; grid-template-columns: 120px 1fr auto; gap: 1rem; padding: 1.2rem; align-items: start; }
.equicard-photo img, .photo-placeholder { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.equicard-data h1 { margin: 0 0 .2rem; font-size: 1.5rem; }
.equicard-data .nickname { color: var(--muted); font-style: italic; margin: 0 0 .5rem; }
.equicard-data dl { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .8rem; margin: .6rem 0 0; font-size: .88rem; }
.equicard-data dt { color: var(--muted); }
.equicard-data dd { margin: 0; }
.equicard-qr img { width: 120px; height: 120px; }
.equicard-emergency { background: rgba(179,38,30,.08); color: var(--danger); margin: 0; padding: .7rem 1.2rem; font-size: .85rem; font-weight: 600; }

.public-horse { max-width: 560px; margin: 0 auto; text-align: center; }
.horse-photo { max-width: 100%; border-radius: var(--radius); margin-bottom: 1rem; }

.admin-card-tools { display: flex; gap: 1.5rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }
.tool-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }

/* User management */
.notice { background: rgba(47,125,91,.12); color: var(--accent); padding: .6rem .9rem; border-radius: 8px; font-weight: 600; margin: 0 0 1rem; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.user-list { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
.user-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.user-card.inactive { opacity: .6; }
.user-edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; align-items: end; }
.user-edit label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); font-weight: 600; }
.user-edit input, .user-edit select { padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font-size: .9rem; }
.user-edit .checkbox { flex-direction: row; align-items: center; gap: .4rem; }
.user-actions { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.pw-form { display: flex; gap: .4rem; align-items: center; }
.pw-form input { padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font-size: .85rem; }

/* Horse full detail */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1rem 0; align-items: start; }
.detail-photo { display: flex; flex-direction: column; gap: .8rem; align-items: center; }
.detail-photo img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.detail-grid .card { margin: 0; }
section.card { margin: 1rem 0; }
section.card h2 { margin-top: 0; font-size: 1.15rem; color: var(--brand); }
section.card h3 { font-size: .95rem; margin: .8rem 0 .4rem; }
section.card.emergency { border-color: var(--danger); }
section.card.emergency h2 { color: var(--danger); }

/* Owner record rows + collapsible edit forms */
.rec { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.rec:last-of-type { border-bottom: none; }
.rec-body { flex: 1 1 55%; }
.rec-actions { display: flex; gap: .4rem; align-items: flex-start; }
/* When an inline edit form is open, let it span the full row width. */
.rec-actions:has(details[open]) { flex-basis: 100%; width: 100%; }
.rec-actions details[open] { width: 100%; }
.rec-actions form.form-grid { width: 100%; margin-top: .6rem; }
details { margin-top: .9rem; }
details > summary { display: inline-block; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { content: ""; }
details[open] > summary { margin-bottom: .9rem; }
.horse-card .thumb { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; }
.horse-card .thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; background: var(--bg); color: var(--muted);
}

/* Photo & icon manager */
.photo-manage { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; }
.photo-current { text-align: center; }
.photo-current img, .photo-current .photo-placeholder { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.photo-tools { flex: 1; min-width: 240px; }
.photo-tools h3 { margin: .2rem 0 .5rem; font-size: .95rem; }
.icon-gallery { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.2rem; }
.icon-gallery form { margin: 0; }
.icon-pick { padding: 3px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; line-height: 0; }
.icon-pick:hover { border-color: var(--brand); }
.icon-pick.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.icon-pick img { border-radius: 9px; display: block; }

/* Month calendar grid */
.month-nav { display: flex; align-items: center; gap: 1rem; justify-content: center; margin: 1rem 0; }
.month-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.month-grid th { padding: .4rem; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.month-grid td { border: 1px solid var(--line); vertical-align: top; height: 92px; padding: 0; }
.month-cell { display: block; min-height: 92px; padding: .3rem; color: var(--ink); font-size: .72rem; }
.month-grid td.other-month { background: var(--bg); }
.month-grid td.other-month .daynum { color: var(--muted); font-weight: 400; }
.month-grid td.is-today { outline: 2px solid var(--brand); outline-offset: -2px; }
.daynum { display: block; font-weight: 700; margin-bottom: .15rem; color: var(--ink); }
.daynum:hover { text-decoration: underline; }
.mini-event:hover { filter: brightness(0.97); text-decoration: none; }
.mini-event { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface); border-left: 3px solid var(--evt-color, var(--accent)); padding: 0 .25rem; margin-bottom: .1rem; border-radius: 3px; }
/* Small color chip for list/table views — same per-theme color as the month grid. */
.evt-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; vertical-align: middle; margin-right: .35rem; background: var(--evt-color, var(--accent)); }
/* One color per theme CATEGORY (app.taxonomy), shared by mini-events and dots. */
/* 👤 Betreuung */
.cat-health        { --evt-color: #c0392b; }
.cat-care          { --evt-color: #17a2b8; }
.cat-training      { --evt-color: #e67e22; }
.cat-events        { --evt-color: #8e44ad; }
.cat-transport     { --evt-color: #795548; }
.cat-housing       { --evt-color: #6b8e23; }
.cat-documentation { --evt-color: #546e7a; }
.cat-appointments  { --evt-color: #ec407a; }
/* 🤖 Automatisierung */
.cat-access        { --evt-color: #3f51b5; }
.cat-feeding       { --evt-color: #d4a24a; }
.cat-water         { --evt-color: #039be5; }
.cat-climate       { --evt-color: #ff7043; }
.cat-lighting      { --evt-color: #fbc02d; }
.cat-security      { --evt-color: #e53935; }
.cat-sensors       { --evt-color: #00897b; }
.cat-system        { --evt-color: #757575; }
.mini-more { color: var(--muted); font-size: .7rem; }

/* Calendar domain filter */
.cal-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .6rem 0; }
.cal-filter .chip { cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.cal-filter .chip input { margin: 0; }

/* Selectable event rows (click to load into the edit mask) */
.rec.selectable { cursor: pointer; }
.rec.selectable:hover { background: var(--surface); }
.rec.selected { background: rgba(43,110,155,.14); outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 4px; }

/* Consistent calendar sub-navigation (routine · week · month · dry-run · sim) */
.cal-nav { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0 .8rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.cal-nav .btn.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Calendar view switcher + week grid */
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem; margin: .8rem 0; }
.view-switch { display: inline-flex; gap: .3rem; }
.view-switch .btn.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; }
.week-day { border: 1px solid var(--line); border-radius: 6px; min-height: 130px; display: flex; flex-direction: column; overflow: hidden; }
.week-day.is-today { outline: 2px solid var(--brand); outline-offset: -2px; }
.week-day-head { display: flex; align-items: baseline; justify-content: space-between; padding: .3rem .45rem; background: var(--bg); color: var(--ink); }
.week-day-head:hover { text-decoration: none; background: var(--surface); }
.week-day-head .wd-name { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.week-day-head .wd-num { font-weight: 700; }
.week-day-body { padding: .3rem; display: flex; flex-direction: column; gap: .15rem; }
.week-day-body .mini-event { white-space: normal; }
@media (max-width: 820px) { .week-grid { grid-template-columns: repeat(2, 1fr); } }

.badge-locked { background: var(--danger); color: #fff; }

/* Dashboard cockpit */
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; margin: .6rem 0 1.4rem; }
.dash-tile { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1rem .6rem; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-align: center; font-weight: 600; }
.dash-tile:hover { border-color: var(--brand); background: var(--surface); text-decoration: none; }
.dash-tile .dt-ic { font-size: 1.7rem; }
.horse-card-wrap { display: flex; flex-direction: column; }
.horse-links { display: flex; gap: .6rem; justify-content: center; padding: .3rem 0; font-size: 1.1rem; }

/* Device control panel (manual control, Dok 12) */
.emergency-bar { margin: .8rem 0 1rem; padding: .6rem .8rem; border-radius: 8px; border: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.emergency-bar.is-active { background: rgba(179,38,30,.14); border-color: var(--danger); }
.btn-emergency { font-size: 1.05rem; font-weight: 700; padding: .5rem 1.2rem; }
.ctrl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem; margin: 1rem 0; }
.ctrl-device { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; }
.ctrl-device.state-on { border-color: #2e9b5a; box-shadow: inset 0 0 0 2px rgba(46,155,90,.25); }
.ctrl-device.mode-emergency { border-color: var(--danger); background: rgba(179,38,30,.08); }
.ctrl-device.mode-manual { background: rgba(43,110,155,.07); }
.ctrl-head { margin-bottom: .3rem; }
.ctrl-status { font-size: .85rem; margin-bottom: .5rem; }
.ctrl-device.state-on .state-word { color: #1c7a44; }
.ctrl-actions { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .3rem; }
.mode-badge { display: inline-block; padding: 0 .4rem; border-radius: 999px; font-size: .72rem; border: 1px solid var(--line); }
.mode-badge.mode-manual { background: rgba(43,110,155,.18); border-color: #2c6e9b; }
.mode-badge.mode-maintenance { background: rgba(216,162,74,.2); border-color: #d8a24a; }
.mode-badge.mode-emergency { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.btn-ok { background: #2e9b5a; color: #fff; border-color: #2e9b5a; }

/* Live simulation dashboard */
.sim-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .8rem 0; }
.sim-speed { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); }
.sim-clock { font-family: ui-monospace, monospace; font-size: 1.5rem; font-weight: 700; padding: .1rem .5rem; border: 1px solid var(--line); border-radius: 6px; min-width: 3.5em; text-align: center; }
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin: 1rem 0; }
.sim-device { border: 1px solid var(--line); border-radius: 10px; padding: .8rem .6rem; text-align: center; transition: all .25s; background: var(--surface); }
.sim-dev-icon { font-size: 1.8rem; line-height: 1; }
.sim-dev-name { font-size: .8rem; font-weight: 600; margin: .3rem 0 .15rem; }
.sim-dev-state { font-size: .78rem; color: var(--muted); }
.sim-dev-who { font-size: .7rem; margin-top: .2rem; min-height: .9rem; }
.sim-device.off { opacity: .78; }
.sim-device.on { border-color: #2e9b5a; background: rgba(46,155,90,.16); box-shadow: 0 0 0 2px rgba(46,155,90,.35), 0 0 14px rgba(46,155,90,.35); opacity: 1; }
.sim-device.on .sim-dev-state { color: #1c7a44; font-weight: 700; }
.sim-log { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; font-size: .85rem; }
.sim-log li { padding: .2rem .3rem; border-bottom: 1px solid var(--line); }
.sim-log li.log-on { color: #1c7a44; }
.sim-log li.log-off { color: var(--muted); }
.sim-timeline { position: relative; height: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin: .6rem 0 .1rem; cursor: pointer; overflow: hidden; }
.sim-marker { position: absolute; top: 6px; width: 3px; height: 22px; border-radius: 2px; transform: translateX(-1px); pointer-events: none; }
.sim-marker.on { background: #2e9b5a; }
.sim-marker.off { background: var(--muted); opacity: .5; height: 14px; top: 10px; }
.sim-playhead { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--brand); left: 0; pointer-events: none; box-shadow: 0 0 5px var(--brand); z-index: 2; }
.sim-ticks { position: relative; height: 1.1rem; margin-bottom: 1rem; font-size: .68rem; color: var(--muted); }
.sim-tick { position: absolute; transform: translateX(-50%); white-space: nowrap; }

/* Automation dry-run */
.dry-summary { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.chip { display: inline-block; padding: .2rem .6rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .85rem; }
.chip-ok { background: rgba(46,160,67,.15); border-color: rgba(46,160,67,.4); }
.chip-bad { background: rgba(179,38,30,.15); border-color: rgba(179,38,30,.45); }
.dry-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dry-table th, .dry-table td { padding: .4rem .55rem; border-bottom: 1px solid var(--line); text-align: left; }
.dry-table th { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.dry-step.is-blocked, .dry-step.is-deferred { background: rgba(179,38,30,.08); }
.dry-step.playing { background: rgba(43,110,155,.18); transition: background .15s; }
.dry-step.done { opacity: .6; }
.step-kind { display: inline-block; padding: 0 .4rem; border-radius: 3px; font-size: .72rem; border: 1px solid var(--line); color: var(--muted); }
.step-main { color: var(--ink); border-color: var(--brand); font-weight: 600; }
.step-pre { color: #2c6e9b; }
.step-end { color: #7a4a6b; }
.step-verify { color: #5d7a3a; }

/* Calendar / stable resources */
.season-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.season-tab { padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .85rem; }
.season-tab:hover { border-color: var(--brand); text-decoration: none; }
.season-tab.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.season-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.conflict-row { background: rgba(179,38,30,.12); }
.conflict-badge { background: var(--danger) !important; }
.resource-list { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }

/* Add / remove horse */
.add-horse { margin: 1rem 0 1.5rem; }
.add-horse > summary { display: inline-block; }
.danger-zone { border-color: var(--danger); }
.danger-zone h2 { color: var(--danger); }
.life-badge { display: inline-block; font-size: .68rem; background: var(--muted); color: #fff; padding: .05rem .45rem; border-radius: 5px; vertical-align: middle; margin-left: .3rem; text-transform: uppercase; letter-spacing: .3px; }

/* Sticky/floating save button + read-only fields */
.sticky-save { position: fixed; right: 18px; bottom: 18px; z-index: 60; }
.sticky-save button { box-shadow: 0 6px 18px rgba(0,0,0,.28); padding: .7rem 1.3rem; font-size: 1rem; }
.ro-field { display: flex; flex-direction: column; gap: .3rem; }
.ro-field .ro-label { font-size: .78rem; color: var(--muted); font-weight: 600; }

/* Avatars (round) */
.nav-avatar { display: inline-flex; align-items: center; }
.nav-avatar img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.avatar-lg { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.avatar-pick, .avatar-pick img { border-radius: 50%; }

/* 2FA / security */
.twofa-qr { display: block; margin: 1rem 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: .5rem; }
.status-on { color: var(--accent); font-weight: 700; font-size: 1.1rem; }
.card h2 { margin-top: 0; }
.card form { margin-top: 1rem; }

@media (max-width: 560px) {
  .equicard-body { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .equicard-data dl { justify-content: center; }
}
