:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #1e293b;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --danger: #b91c1c;

  --status-young-bg: #f3e8ff;
  --status-young-fg: #6b21a8;

  --status-small-bg: #ffedd5;
  --status-small-fg: #9a3412;

  --status-ready-bg: #fef9c3;
  --status-ready-fg: #854d0e;

  --status-pregnant-bg: #dbeafe;
  --status-pregnant-fg: #1d4ed8;
}

/* Ortsverwaltung, Gruppierung und kompakte Filter */
.animal-filters{display:flex;flex-wrap:wrap;gap:4px;padding:6px;margin-bottom:6px;background:#fff;border:1px solid var(--line);border-radius:9px}
.animal-filters>*{width:auto;min-width:72px;padding:4px 6px;font-size:11px}.animal-filters input[name=q]{flex:1;min-width:130px}.filter-reset{align-self:center;padding:4px 6px;font-size:11px}
.animal-filters.has-active-filters{border-color:var(--blue);box-shadow:0 0 0 1px var(--blue-soft)}
.location-group{margin:0 0 7px}.location-group>summary{display:flex;align-items:center;gap:8px;padding:5px 7px;background:#eef4ff;border:1px solid var(--line);border-radius:8px 8px 0 0}
.location-pill{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;padding:2px 7px;border-radius:999px;background:var(--location-color);color:#1e293b;font-size:10px;font-weight:800;white-space:nowrap;border:1px solid #cbd5e1}
.location-form{display:grid;grid-template-columns:1fr 48px 70px;gap:6px}.location-list{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.row-menu{display:inline-grid;place-items:center;width:28px;height:23px;border-radius:6px;background:var(--blue);color:#fff;text-decoration:none;font-weight:900}
.animal-table{width:max-content;min-width:100%;table-layout:fixed}.animal-table col[data-column=name]{width:180px}.animal-table col[data-column=status]{width:82px}.animal-table col[data-column=location]{width:94px}.animal-table col[data-column=age]{width:50px}.animal-table col[data-column=breeding]{width:70px}.animal-table col[data-column=last-event],.animal-table col[data-column=next-task]{width:90px}.animal-table col[data-column=actions]{width:45px}
.animal-table th[data-column]{position:sticky;user-select:none}.column-resizer{position:absolute;top:0;right:-4px;bottom:0;z-index:30;width:9px!important;min-width:9px!important;padding:0;border:0;background:transparent;cursor:col-resize;touch-action:none}.is-resizing-column,.is-resizing-column *{cursor:col-resize!important;user-select:none!important}
.sort-link{display:block;color:var(--muted);text-decoration:none;font-weight:800}.sort-link.active{color:var(--blue)}
.mobile-filter-panel>summary{display:none}.quick-location{position:relative}.quick-location>summary{list-style:none}.quick-location>summary::-webkit-details-marker{display:none}.quick-location form{position:absolute;z-index:60;display:flex;gap:3px;min-width:170px;padding:5px;background:#fff;border:1px solid var(--line-strong);border-radius:8px;box-shadow:0 8px 20px rgba(15,23,42,.18)}.quick-location select{min-width:120px;padding:4px}.quick-location button{width:38px;padding:4px}
.location-admin-list{display:grid;gap:5px;margin-top:8px}.location-admin-row{display:grid;grid-template-columns:minmax(130px,1fr) 48px 80px;gap:5px;padding:6px;background:#fff;border:1px solid var(--line);border-radius:8px}.location-admin-row.inactive{opacity:.55}.deactivate-location{margin:-3px 6px 5px}.deactivate-location button{width:auto;padding:3px 7px;background:#64748b;font-size:10px}
.activate-location{margin:-3px 6px 5px}.activate-location button{width:auto;padding:3px 7px;background:var(--blue);font-size:10px}
.animal-detail-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}.animal-detail-head>div:first-child{display:flex;align-items:center;gap:7px}.animal-detail-head h1{margin:0}.detail-actions{display:flex;gap:5px}.detail-actions .button{width:auto;padding:6px 9px}.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:6px}.detail-grid .panel{padding:8px}.detail-grid .panel h2{margin-bottom:2px}.detail-list{margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 12px}.detail-list div{display:grid;grid-template-columns:auto 1fr;justify-content:start;gap:5px;padding:3px 0;border-bottom:1px solid var(--line)}.detail-list dt{color:var(--muted);white-space:nowrap}.detail-list dd{margin:0;font-weight:700;min-width:0}.empty-state{color:var(--muted)}
@media(max-width:520px){.mobile-filter-panel>summary{display:block;padding:6px 8px;background:#fff;border:1px solid var(--line);border-radius:8px}.animal-filters{margin-top:4px}.animal-filters>*{flex:1 1 95px}.animal-filters input[name=q]{flex-basis:100%}.detail-grid{grid-template-columns:1fr}.animal-detail-head{align-items:flex-start;flex-direction:column}.location-admin-row{grid-template-columns:1fr 44px 72px}}
.quick-events{display:flex;gap:4px;overflow-x:auto;margin-bottom:8px;padding-bottom:2px}.quick-events a{flex:0 0 auto;padding:5px 8px;border:1px solid var(--line);border-radius:7px;background:#fff;text-decoration:none;font-size:11px;font-weight:800}.event-form{display:grid;gap:9px}.event-form label{display:grid;gap:4px;font-weight:800}.detail-task,.history-entry{display:flex;align-items:center;justify-content:space-between;gap:7px;padding:6px 0;border-bottom:1px solid var(--line)}.detail-task div,.history-entry div{display:grid}.detail-task span,.history-entry span,.history-entry small{color:var(--muted);font-size:11px}.task-list{display:grid;gap:6px}.task-card{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px;background:#fff;border:1px solid var(--line);border-radius:9px}.task-card.overdue{border-left:4px solid #dc2626}.task-card>div{display:grid;gap:2px}.task-card .button{width:auto;padding:5px 8px}
.event-form .checkbox-label{display:flex;align-items:center;gap:7px}.event-form .checkbox-label input{width:auto}
.return-animal-data{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;padding:7px;background:var(--blue-soft);border:1px solid var(--line);border-radius:8px}.return-animal-data div{display:grid;gap:1px}.return-animal-data span{color:var(--muted);font-size:10px}.return-animal-data strong{overflow-wrap:anywhere}.action-menu[open]{position:relative;z-index:1000}.action-menu .menu{z-index:2000!important;min-width:170px}
@media(max-width:520px){.detail-list{grid-template-columns:1fr}.action-menu .menu{position:fixed;right:8px;top:auto;bottom:58px;max-height:70vh;overflow:auto}}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  padding-bottom: 54px;
}

a {
  color: var(--blue);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  backdrop-filter: blur(8px);
}

.topbar strong {
  display: block;
  font-size: 14px;
}

.topbar span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.mainnav {
  display: none;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px;
}

.page-head {
  margin: 2px 0 8px;
}

.page-head.compact {
  margin-bottom: 6px;
}

.page-head h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.page-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel,
.toolbar,
.table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.toolbar {
  position: sticky;
  top: 49px;
  z-index: 20;
  padding: 6px;
  margin-bottom: 6px;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 104px 42px;
  gap: 5px;
}

input,
select,
textarea,
button,
.button {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 6px 7px;
  font: inherit;
  background: white;
  color: var(--text);
}

button,
.button {
  background: var(--blue);
  color: white;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--blue-dark);
}

button:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.secondary {
  background: #e2e8f0;
  color: var(--text);
}

.quick-filters {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-top: 5px;
}

.quick-filters a {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  background: white;
}

.quick-filters a.active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.new-animal {
  padding: 6px 8px;
  margin-bottom: 6px;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

.new-animal-form {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr 52px 106px 126px 70px;
  gap: 5px;
}

.table-shell {
  overflow: auto;
  max-height: calc(100vh - 205px);
}

.animal-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.animal-table th,
.animal-table td {
  border-bottom: 1px solid var(--line);
  padding: 4px 5px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.animal-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #eef4ff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.animal-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.animal-table tbody tr:hover {
  background: var(--blue-soft);
}

.col-name {
  width: 190px;
}

.col-actions {
  width: 42px;
}

.animal-name-cell {
  position: sticky;
  left: 0;
  z-index: 5;
  background: inherit;
  min-width: 170px;
  max-width: 190px;
}

.animal-table th.col-name {
  position: sticky;
  left: 0;
  z-index: 15;
}

.animal-main {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.animal-main a {
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.animal-sub {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.05;
  margin-top: 1px;
}

.owner-badge {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 900;
  color: white;
  flex: 0 0 auto;
}

.owner-s {
  background: #2563eb;
}

.owner-l {
  background: #0891b2;
}

.image-icon {
  position: relative;
  display: inline-block;
  font-size: 13px;
  line-height: 1;
  flex: 0 0 auto;
}

.image-icon.no-images {
  opacity: 0.22;
  filter: grayscale(1);
}

.image-icon.has-images {
  opacity: 1;
}

.image-icon sup {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--blue);
  color: white;
  border-radius: 999px;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  font-size: 8px;
  line-height: 13px;
  text-align: center;
}

.status-pill {
  display: inline-block;
  min-width: 74px;
  border-radius: 999px;
  padding: 2px 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 900;
}

.status-zu-jung {
  background: var(--status-young-bg);
  color: var(--status-young-fg);
}

.status-zu-klein {
  background: var(--status-small-bg);
  color: var(--status-small-fg);
}

.status-zu-belegen {
  background: var(--status-ready-bg);
  color: var(--status-ready-fg);
}

.status-belegt {
  background: var(--status-pregnant-bg);
  color: var(--status-pregnant-fg);
}

.num,
.date-cell {
  font-weight: 800;
  color: var(--text);
}

.two-line strong {
  display: block;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.two-line span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.actions-cell {
  position: sticky;
  right: 0;
  background: inherit;
  text-align: right;
  z-index: 5;
}

.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu summary {
  list-style: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border-radius: 7px;
  background: var(--blue);
  color: white;
  font-weight: 900;
  line-height: 1;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu .menu {
  position: absolute;
  right: 0;
  top: 28px;
  z-index: 50;
  display: grid;
  gap: 2px;
  min-width: 152px;
  padding: 5px;
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.action-menu .menu button,
.action-menu .menu a {
  display: block;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: white;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.action-menu .menu button:hover,
.action-menu .menu a:hover {
  background: var(--blue-soft);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.stats div {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
}

.stats strong {
  display: block;
  font-size: 22px;
}

.stats span {
  color: var(--muted);
  font-size: 11px;
}

.panel {
  padding: 10px;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.edit-form {
  display: grid;
  gap: 9px;
}

.edit-form label {
  display: grid;
  gap: 4px;
  font-weight: 800;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.danger-zone {
  margin-top: 8px;
}

.danger-zone button {
  background: var(--danger);
}

.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: white;
  border-top: 1px solid var(--line);
  z-index: 40;
}

.bottomnav a {
  color: var(--text);
  text-decoration: none;
  text-align: center;
  padding: 9px 2px;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 520px) {
  .page {
    padding: 5px;
  }

  .toolbar {
    top: 45px;
  }

  .table-shell {
    max-height: calc(100vh - 195px);
  }

  .animal-table {
    min-width: 710px;
    font-size: 11px;
  }

  .animal-table th,
  .animal-table td {
    padding: 3px 4px;
  }

  .col-name {
    width: 162px;
  }

  .animal-name-cell {
    min-width: 154px;
    max-width: 162px;
  }

  .animal-main a {
    max-width: 72px;
  }

  .status-pill {
    min-width: 66px;
    font-size: 9px;
    padding: 2px 5px;
  }

  .two-line strong {
    max-width: 76px;
  }

  .new-animal-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 860px) {
  body {
    padding-bottom: 0;
  }

  .topbar {
    padding-left: 16px;
  }

  .mainnav {
    display: flex;
    gap: 6px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 6px 8px;
  }

  .mainnav a {
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 13px;
  }

  .mainnav a:hover {
    background: var(--blue-soft);
  }

  .bottomnav {
    display: none;
  }

  .toolbar {
    top: 0;
  }

  .table-shell {
    max-height: calc(100vh - 190px);
  }
}

/* Inhaltsabhängige, möglichst kompakte Tabellenspalten */
.animal-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.animal-table th,
.animal-table td {
  width: auto;
  max-width: none;
}

.col-name,
.animal-name-cell {
  width: 1%;
  min-width: 145px;
  max-width: 210px;
}

.animal-table th:nth-child(2),
.animal-table td:nth-child(2),
.animal-table th:nth-child(3),
.animal-table td:nth-child(3),
.animal-table th:nth-child(4),
.animal-table td:nth-child(4),
.col-actions,
.actions-cell {
  width: 1%;
}

.col-actions,
.actions-cell {
  min-width: 36px;
}

.two-line strong {
  max-width: 110px;
}

@media (max-width: 520px) {
  .animal-table {
    min-width: max-content;
  }

  .col-name,
  .animal-name-cell {
    min-width: 135px;
    max-width: 175px;
  }

  .two-line strong {
    max-width: 92px;
  }
}

/* ---------------------------------------------------------
   Dynamische und manuell verstellbare Tabellenspalten
   --------------------------------------------------------- */

.table-shell {
  overflow: auto;
}

.animal-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.animal-table col[data-column="name"] {
  width: auto;
}

.animal-table col[data-column="status"] {
  width: 84px;
}

.animal-table col[data-column="age"] {
  width: 52px;
}

.animal-table col[data-column="breeding"] {
  width: 72px;
}

.animal-table col[data-column="last-event"] {
  width: auto;
}

.animal-table col[data-column="next-task"] {
  width: auto;
}

.animal-table col[data-column="actions"] {
  width: 40px;
}

.animal-table th {
  position: sticky;
  top: 0;
}

.animal-table th[data-column] {
  position: sticky;
  user-select: none;
}

.animal-table th[data-column] > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  z-index: 30;
  width: 7px;
  min-width: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  content: "";
  position: absolute;
  top: 20%;
  right: 3px;
  width: 1px;
  height: 60%;
  background: transparent;
}

.column-resizer:hover::after,
.column-resizer.active::after {
  background: var(--blue);
}

body.is-resizing-column,
body.is-resizing-column * {
  cursor: col-resize !important;
  user-select: none !important;
}

.animal-name-cell {
  width: auto;
  min-width: 0;
  max-width: none;
}

.animal-main {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.animal-main a {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animal-separator,
.ear-tag-short,
.image-icon,
.owner-badge {
  flex: 0 0 auto;
}

.ear-tag-short {
  color: var(--muted);
  font-weight: 700;
}

.two-line {
  min-width: 0;
  overflow: hidden;
}

.two-line strong,
.two-line span {
  display: block;
  width: 100%;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reset-columns-button {
  width: auto;
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.reset-columns-button:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

@media (max-width: 520px) {
  .animal-table {
    width: max-content;
    min-width: 100%;
  }

  .animal-table col[data-column="name"] {
    width: 150px;
  }

  .animal-table col[data-column="last-event"] {
    width: 90px;
  }

  .animal-table col[data-column="next-task"] {
    width: 90px;
  }

  .column-resizer {
    width: 11px;
    min-width: 11px;
    right: -5px;
  }
}

/* Besitzer-Badge vor dem Tiernamen */
.animal-main {
  gap: 4px;
}

.animal-main .owner-badge {
  order: 0;
}

.animal-main a {
  order: 1;
}

.animal-main .animal-separator {
  order: 2;
}

.animal-main .ear-tag-short {
  order: 3;
}

.animal-main .image-icon {
  order: 4;
}

/* Auch die Aktionsspalte ist vollständig verstellbar */
.animal-table th[data-column="actions"] {
  min-width: 38px;
}

.animal-table col[data-column="actions"] {
  width: 48px;
}

.col-actions > span {
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ruhigeres, feineres Schriftbild */
body{font-weight:400;letter-spacing:-.005em}
h1,h2,h3,.page-head h1,.panel h2{font-weight:600}
button,.button,.mainnav a,.bottomnav a,summary,.animal-main a,.status-pill,.location-pill,.sort-link{font-weight:600}
.owner-badge{font-weight:700}
.animals-title{display:flex;align-items:center;justify-content:space-between;gap:8px}.new-animal-button{width:auto;padding:5px 8px;font-size:11px}
.status-hint{display:grid;grid-template-columns:1fr auto;gap:4px 10px;padding:7px;background:var(--blue-soft);border:1px solid var(--line);border-radius:8px}.entry-actions{display:flex;align-items:center;gap:6px}.entry-actions form{margin:0}.delete-link{width:auto;padding:2px 4px;border:0;background:transparent;color:#b91c1c;font-size:10px;font-weight:500}.delete-link:hover{background:#fee2e2;color:#991b1b}
.animal-images-section{margin-bottom:6px}.image-upload-form{display:flex;gap:5px;margin-bottom:7px}.image-upload-form input{min-width:0}.image-upload-form button{width:auto}.animal-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(105px,1fr));gap:6px}.animal-gallery figure{margin:0;min-width:0;border:1px solid var(--line);border-radius:7px;overflow:hidden;background:#fff}.animal-gallery img{display:block;width:100%;height:90px;object-fit:cover}.animal-gallery figcaption{display:flex;align-items:center;justify-content:space-between;gap:3px;padding:3px}.animal-gallery figcaption span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:9px}
.floating-action-menu{position:fixed!important;z-index:99999!important;display:grid;gap:2px;min-width:170px;max-height:70vh;overflow:auto;padding:5px;background:#fff;border:1px solid var(--line-strong);border-radius:9px;box-shadow:0 14px 36px rgba(15,23,42,.28)}
.floating-action-menu a{display:block;padding:6px 8px;border-radius:6px;background:#fff;color:var(--text);text-align:left;text-decoration:none;font-size:12px;font-weight:500}.floating-action-menu a:hover{background:var(--blue-soft)}
.animal-main .image-link{flex:0 0 auto;overflow:visible;text-decoration:none}
.inline-edit{margin:0}.inline-edit select,.inline-edit input{width:auto;max-width:150px;padding:2px 4px;border-radius:5px;font-size:11px}
.quick-field{position:relative}.quick-field>summary{list-style:none;font-weight:400}.quick-field>summary::-webkit-details-marker{display:none}.quick-field form{position:absolute;z-index:500;display:flex;gap:3px;min-width:165px;padding:5px;background:#fff;border:1px solid var(--line-strong);border-radius:8px;box-shadow:0 8px 20px rgba(15,23,42,.18)}.quick-field input,.quick-field select{min-width:115px;padding:4px}.quick-field button{width:38px;padding:4px}
.edit-form{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 10px}.edit-form label{font-weight:400;font-size:11px}.edit-form label input,.edit-form label select,.edit-form label textarea{margin-top:2px}.edit-form label:has(textarea),.edit-form .form-actions,.edit-form .status-hint{grid-column:1/-1}
@media(max-width:520px){.edit-form{grid-template-columns:1fr}.edit-form label:has(textarea),.edit-form .form-actions,.edit-form .status-hint{grid-column:auto}.inline-edit select,.inline-edit input{max-width:125px}}
.event-form label,.edit-form label{font-weight:400!important}.event-form,.edit-form{gap:6px}.event-form input,.event-form select,.event-form textarea,.edit-form input,.edit-form select,.edit-form textarea{padding:6px 7px;font-weight:400}
.status-select{border:0!important;font-weight:600!important}.status-select.status-zu-jung{background:var(--status-young-bg);color:var(--status-young-fg)}.status-select.status-zu-klein{background:var(--status-small-bg);color:var(--status-small-fg)}.status-select.status-zu-belegen{background:var(--status-ready-bg);color:var(--status-ready-fg)}.status-select.status-belegt{background:var(--status-pregnant-bg);color:var(--status-pregnant-fg)}.location-select{background:var(--location-color)!important;border-color:#cbd5e1!important;font-weight:600!important}
.gallery-open{display:block;width:100%;padding:0;border:0;border-radius:0;background:transparent}.gallery-open:hover{background:transparent}.image-modal{width:min(96vw,1100px);height:min(92vh,850px);padding:0;border:0;border-radius:10px;background:#111827;color:#fff;box-shadow:0 24px 70px rgba(0,0,0,.5)}.image-modal::backdrop{background:rgba(15,23,42,.78)}.image-modal-toolbar{display:flex;justify-content:flex-end;gap:5px;padding:7px;background:#0f172a}.image-modal-toolbar button{width:auto;padding:5px 9px;background:#334155}.image-modal-stage{height:calc(100% - 47px);overflow:auto;display:grid;place-items:center}.image-modal-stage img{max-width:100%;max-height:100%;transform-origin:center;transition:transform .12s ease}
.mobile-filter-panel>summary{display:inline-block!important;margin-bottom:5px;padding:5px 8px;border:1px solid var(--line);border-radius:7px;background:#fff;color:var(--blue);font-size:11px;cursor:pointer}.mobile-filter-panel[open]>summary{background:var(--blue-soft)}
.animal-table col[data-column="name"]{width:145px}.animal-name-cell{min-width:130px!important;max-width:155px!important}.animal-main a:not(.image-link){max-width:62px!important}
.actions-mobile{display:none}.detail-list div{grid-template-columns:auto 1fr!important;gap:12px!important}.detail-list dd{padding-left:2px}
@media(max-width:520px){.animal-table col[data-column="name"]{width:130px}.animal-name-cell{min-width:122px!important;max-width:135px!important}.animal-main a:not(.image-link){max-width:50px!important}.actions-desktop{display:none}.actions-mobile{display:inline}.animal-table col[data-column="actions"]{width:68px}.action-menu summary{width:auto;min-width:61px;padding:0 7px;font-size:10px}}
.detail-action-menu{position:relative;display:inline-block;margin-bottom:6px}.detail-action-menu>summary{list-style:none;display:inline-grid;place-items:center;padding:6px 10px;border-radius:7px;background:var(--blue);color:#fff;cursor:pointer}.detail-action-menu>summary::-webkit-details-marker{display:none}.detail-action-options{position:absolute;left:0;top:34px;z-index:500;display:grid;gap:2px;min-width:170px;padding:5px;background:#fff;border:1px solid var(--line-strong);border-radius:9px;box-shadow:0 12px 28px rgba(15,23,42,.22)}.detail-action-options a{padding:6px 8px;border-radius:6px;color:var(--text);text-decoration:none;font-size:11px}.detail-action-options a:hover{background:var(--blue-soft)}
.detail-list{display:grid!important;grid-template-columns:max-content minmax(0,1fr)!important;column-gap:16px!important;row-gap:0!important}.detail-list div{display:contents!important}.detail-list dt,.detail-list dd{padding:4px 0!important;border-bottom:1px solid var(--line)}.detail-list dd{padding-left:0!important}
.tasks-head{display:flex;align-items:center;justify-content:space-between}.tasks-head .button{width:auto;padding:5px 8px}.task-filter-panel{margin-bottom:6px}.task-filter-panel>summary{display:inline-block;padding:5px 8px;border:1px solid var(--line);border-radius:7px;background:#fff;color:var(--blue);font-size:11px}.task-filters{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px;padding:6px;background:#fff;border:1px solid var(--line);border-radius:8px}.task-filters>*{width:auto;min-width:85px;padding:5px;font-size:11px}.task-filters input{flex:1;min-width:130px}.task-card.status-done,.task-card.status-discarded{opacity:.68}.task-main small{max-width:440px;color:var(--muted)}.secondary-task-button{width:auto;padding:5px 7px;background:#e2e8f0;color:var(--text);font-size:10px}.entry-actions>form>button{width:auto}.task-card .entry-actions{flex-wrap:wrap;justify-content:flex-end}
.dashboard-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:7px;margin-bottom:7px}.dashboard-task,.dashboard-event{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;padding:5px 0;border-bottom:1px solid var(--line)}.dashboard-task>div{display:grid}.dashboard-task.overdue{padding-left:6px;border-left:3px solid #dc2626}.dashboard-task span,.dashboard-event span{color:var(--muted);font-size:10px}.dashboard-event{grid-template-columns:minmax(90px,1fr) minmax(100px,1fr) auto}.event-filters{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px;padding:6px;background:#fff;border:1px solid var(--line);border-radius:8px}.event-filters>*{width:auto;min-width:95px;padding:5px;font-size:11px}.event-filters input[name=q]{flex:1}.event-list{display:grid;gap:5px}.event-card{display:grid;grid-template-columns:minmax(190px,1fr) 2fr auto;gap:8px;align-items:center;padding:7px;background:#fff;border:1px solid var(--line);border-radius:8px}.event-card-main{display:grid;grid-template-columns:1fr 1fr auto;gap:6px}.event-card-details{display:flex;gap:8px;min-width:0;color:var(--muted);font-size:11px}.event-card-details small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.image-modal-toolbar [data-image-counter]{align-self:center;min-width:45px;text-align:center;font-size:11px}.stats{grid-template-columns:repeat(4,1fr)}
@media(max-width:600px){.dashboard-grid{grid-template-columns:1fr}.event-card{grid-template-columns:1fr auto}.event-card-details{grid-column:1/-1}.event-card-main{grid-template-columns:1fr 1fr auto}.stats{grid-template-columns:repeat(2,1fr)}}
.more-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:7px}.more-grid>a{display:grid;gap:3px;padding:10px;background:#fff;border:1px solid var(--line);border-radius:9px;color:var(--text);text-decoration:none}.more-grid>a:hover{border-color:var(--blue);background:var(--blue-soft)}.more-grid span{color:var(--muted);font-size:11px}.system-message{padding:7px 9px;border:1px solid #93c5fd;border-radius:8px;background:var(--blue-soft)}.backup-create button{width:auto}.backup-list>div{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 0;border-bottom:1px solid var(--line)}.backup-list>div>div:first-child{display:grid}.backup-list span{color:var(--muted);font-size:10px}.restore-panel{margin-top:7px}.restore-form{display:grid;gap:6px;margin-top:7px}.restore-form label{display:grid;gap:3px;font-weight:400}.restore-form button{width:auto}

/* Lokale Anmeldung */
.topbar{display:flex;align-items:center;justify-content:space-between}.logout-form{margin:0}.logout-form button{width:auto;padding:4px 7px;background:#e2e8f0;color:var(--text);font-size:10px}.login-page{display:grid;min-height:100vh;place-items:center;padding:16px;background:var(--bg)}.login-card{width:min(100%,360px);padding:18px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 16px 38px rgba(15,23,42,.12)}.login-brand{display:grid;color:var(--blue)}.login-brand span{color:var(--muted);font-size:11px}.login-card h1{margin:18px 0 10px;font-size:20px}.login-form{display:grid;gap:10px}.login-form label{display:grid;gap:4px;font-size:12px;font-weight:400}.login-form input{padding:9px}.login-error{padding:8px;border:1px solid #fecaca;border-radius:7px;background:#fef2f2;color:#991b1b;font-size:12px}
