:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --primary: #1a7f5a;
  --primary-dark: #14654a;
  --text: #1e2a32;
  --muted: #6b7a85;
  --border: #dde3e8;
  --new: #e8630a;
}
* { box-sizing: border-box; }
.ti { vertical-align: -0.12em; line-height: 1; }
button .ti, .btn-like .ti { margin-right: .1rem; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9em; }
.error { color: #c0392b; }

/* Login */
#login-view {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--panel); padding: 2.5rem; border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 340px; text-align: center;
}
.login-box h1 { margin: 0 0 .25rem; }
.login-box input {
  width: 100%; margin-top: .75rem; padding: .7rem .9rem;
  border: 1px solid var(--border); border-radius: 8px; font-size: 1rem;
}
.login-box button { width: 100%; margin-top: 1rem; }

/* Header */
header {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--panel); padding: .6rem 1.2rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 1.2rem; margin: 0; }
nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.tab-btn {
  background: none; border: none; padding: .55rem .9rem; cursor: pointer;
  border-radius: 8px; font-size: .95rem; color: var(--text);
}
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-btn:hover:not(.active) { background: var(--bg); }

/* Buttons & Inputs */
button {
  background: var(--primary); color: #fff; border: none;
  padding: .6rem 1.1rem; border-radius: 8px; cursor: pointer; font-size: .95rem;
}
button:hover { background: var(--primary-dark); }
button.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
button.ghost:hover { background: #eaf5f0; }
button.big { margin-top: 1rem; padding: .8rem 2rem; font-size: 1.05rem; }
button:disabled { opacity: .5; cursor: wait; }
input[type=text], input[type=number], input[type=password],
input[type=date], input[type=time], input[type=email], input[type=url] {
  padding: .55rem .8rem; border: 1px solid var(--border); border-radius: 8px;
  font-size: .95rem; background: var(--panel); color: inherit; font-family: inherit;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary);
}
/* Moderne Selects: eigener Chevron statt Browser-Default */
select {
  appearance: none; -webkit-appearance: none;
  padding: .55rem 2rem .55rem .8rem; border: 1px solid var(--border); border-radius: 8px;
  font-size: .95rem; background-color: var(--panel); color: inherit; font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7a85' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center;
  cursor: pointer;
}
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 1.05rem; height: 1.05rem; }

/* Icon-only-Button (Toolbar) */
.icon-btn { padding: .5rem .6rem; line-height: 1; }
.icon-btn .ti { margin-right: 0; font-size: 1.1rem; }

/* Chip-Toggle (Filter-Pills) */
.chip-toggle {
  background: var(--panel); color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: .4rem .85rem; font-size: .88rem; white-space: nowrap;
}
.chip-toggle:hover { background: var(--bg); color: var(--text); }
.chip-toggle.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Suchfeld mit Icon */
.search-wrap { position: relative; display: flex; flex: 1; min-width: 180px; }
.search-wrap > .ti {
  position: absolute; left: .65rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.search-wrap input { width: 100%; padding-left: 2rem; }

/* Gefährliche Aktionen */
button.danger, button.ghost.danger { color: #c0392b; border-color: #e2a9a4; }
button.ghost.danger:hover { background: #fdecea; }

/* Layout */
.tab { padding: 1.2rem; max-width: 1200px; margin: 0 auto; }
.panel { background: var(--panel); border-radius: 12px; padding: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.panel h2 { margin-top: 0; }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
#cal-title { margin: 0; min-width: 220px; text-align: center; }
.toolbar input[type=text] { flex: 1; min-width: 180px; }
.form-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.form-row input { flex: 1; min-width: 200px; }
.chk { display: flex; align-items: center; gap: .3rem; font-size: .9rem; white-space: nowrap; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; margin-top: 1rem; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem; cursor: pointer; transition: box-shadow .15s;
}
.card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.1); }
.card h3 { margin: 0 0 .3rem; font-size: 1.02rem; }
.card p { margin: .15rem 0; font-size: .88rem; }
.badge {
  display: inline-block; font-size: .72rem; padding: .15rem .5rem;
  border-radius: 20px; background: var(--primary); color: #fff; margin-left: .4rem;
  vertical-align: middle;
}
.badge.new { background: var(--new); }
.badge.flag { background: #eaf5f0; color: var(--primary-dark); margin-left: 0; margin-right: .3rem; }
.badge.flag.off { background: #fdecea; color: #c0392b; }
.badge.archived { background: #eef2f5; color: #5a6b76; border: 1px solid var(--border); }
.do-not-visit-dot {
  display: inline-block; width: .62rem; height: .62rem; margin-left: .4rem;
  border-radius: 50%; background: #c0392b; vertical-align: middle;
  box-shadow: 0 0 0 2px #fdecea;
}
.vet-flags { margin: .2rem 0 .6rem; }
.rating-dots { color: var(--primary-dark); letter-spacing: .15em; font-size: .8rem; vertical-align: middle; }
.potential-dots { color: #b8860b; letter-spacing: .12em; font-size: .75rem; vertical-align: middle; }
.contacts-block { margin-top: 1rem; }
.contact-item { font-size: .9rem; margin: .25rem 0; }
.contact-row { display: flex; gap: .4rem; margin-bottom: .4rem; align-items: center; }
.contact-row input { flex: 1; min-width: 0; }
.phone-row { display: grid; grid-template-columns: auto minmax(8rem, 1fr) minmax(11rem, 1.4fr) auto; gap: .4rem; margin-bottom: .4rem; align-items: center; }
.phone-row input { min-width: 0; }
.phone-row input[type="radio"] { width: auto; }
.multi-value-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; margin-bottom: .4rem; align-items: center; }
.multi-value-row input { min-width: 0; }
@media (max-width: 600px) {
  .phone-row { grid-template-columns: auto 1fr auto; }
  .phone-row .vp-number { grid-column: 2 / 3; }
}
.appt-visited { margin: .5rem 0; cursor: pointer; font-weight: 600; }
.appt-visited input:checked + i { color: var(--ok, #2da44e); }
.visit-note-label { display: block; margin: .6rem 0; }
.visit-note-label textarea { width: 100%; margin-top: .3rem; }
.visit-note-preview {
  font-size: .85rem; background: #fdf8e8; border-left: 3px solid #e0c341;
  padding: .3rem .5rem; margin-top: .3rem; border-radius: 0 4px 4px 0;
}
button.mini { padding: 0 .35rem; font-size: .8rem; }
.species-tag {
  display: inline-block; font-size: .75rem; background: #eaf5f0; color: var(--primary-dark);
  padding: .12rem .5rem; border-radius: 20px; margin: .1rem .2rem 0 0;
}

/* Status */
.status {
  margin: 1rem 0; padding: .8rem 1rem; border-radius: 8px;
  background: #eaf3fb; border: 1px solid #b7d6ef;
}
.status.err { background: #fdecea; border-color: #f2b8b5; }
.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid #999;
  border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -2px; margin-right: .5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Select list (route) */
.select-list {
  max-height: 320px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: .5rem;
}
.select-item {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .8rem;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: .9rem;
}
.select-item:last-child { border-bottom: none; }
.select-item:hover { background: var(--bg); }
.select-item.selected { background: #eaf5f0; }
.route-config { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.route-config label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.route-config input { min-width: 140px; }

/* Route result */
.day-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.2rem; margin-top: 1rem;
}
.day-card h3 { margin: 0 0 .5rem; }
.day-meta { font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }
.stop {
  display: flex; gap: .8rem; padding: .45rem 0; border-bottom: 1px dashed var(--border);
  font-size: .9rem; align-items: baseline;
}
.stop:last-child { border-bottom: none; }
.stop .num {
  background: var(--primary); color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; flex-shrink: 0;
}
.stop .dist { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.stop .oh-warn { color: #d9534f; font-size: .8rem; }
.stop .oh-ok { color: #3a9d5d; font-size: .8rem; }
.stop .stop-appt { min-height: 0 !important; padding: .25rem .6rem; font-size: .8rem; white-space: nowrap; align-self: center; }
.select-item .appt-status { font-size: .75rem; white-space: nowrap; margin: 0; }

/* Kalender-Aktionen: Desktop inline, Mobil als ⋯-Popover */
.cal-actions { display: contents; }
#cal-more { display: none; }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-content {
  background: var(--panel); border-radius: 12px; padding: 1.8rem;
  max-width: 640px; width: 92%; max-height: 85vh; overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; top: .7rem; right: .7rem; background: transparent;
  color: var(--muted); font-size: 1.1rem; padding: .3rem .6rem;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

/* Mobile: Modals als Bottom-Sheet */
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .modal { align-items: flex-end; z-index: 300; }
  .modal-content {
    max-width: none !important; width: 100%; max-height: 92dvh;
    border-radius: 16px 16px 0 0; padding: 1.2rem 1rem calc(1rem + env(safe-area-inset-bottom));
    animation: sheetUp .22s ease-out;
  }
  .modal-actions { position: sticky; bottom: 0; background: var(--panel); padding-top: .6rem; margin-top: .8rem; }
  .modal-actions button { flex: 1; min-height: 46px; }
  .appt-form label { flex: 1 1 45%; }
  .appt-form label:first-child { flex-basis: 100%; }
}
@keyframes sheetUp { from { transform: translateY(30%); opacity: .6; } to { transform: none; opacity: 1; } }

/* Todo-Modal: Schnell-Fälligkeit */
.due-quick { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .35rem; }
.due-quick button { padding: .3rem .65rem; font-size: .82rem; min-height: 36px !important; border-radius: 999px; }
.due-quick button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: .4rem .8rem; font-size: .92rem; margin: 1rem 0; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; word-break: break-word; }
.modal-actions { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }

/* Routes archive */
.route-archive-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: .8rem;
}
.route-archive-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.route-archive-head > span:first-child { cursor: pointer; }
.route-archive-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.route-archive-actions button { min-height: 36px; padding: .35rem .6rem; }
.route-archive-map { height: 420px; min-height: 280px; margin-top: .8rem; border-radius: 8px; }

@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .route-archive-head { align-items: flex-start; flex-direction: column; }
  .route-archive-actions { width: 100%; }
  .route-archive-actions button { flex: 1; }
  .route-archive-map { height: 55dvh; }
}

@media (max-width: 700px) {
  header { flex-wrap: wrap; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* Notizen */
.note-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: .6rem .8rem; margin-top: .5rem; font-size: .92rem;
}
.note-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.note-item.compact { padding: .45rem .7rem; font-size: .88rem; }
.note-item.compact .muted { font-size: .78rem; }
.vet-modal-history { margin-top: .8rem; }
.vet-modal-history h3 { margin: .8rem 0 .3rem; font-size: .95rem; }
.oh-freetext { font-size: .9rem; line-height: 1.5; }
.note-del { background: none; color: var(--muted); padding: 0 .3rem; font-size: .85rem; }
.note-del:hover { background: none; color: #c0392b; }

/* Todos */
button.small { padding: .25rem .55rem; font-size: .8rem; }
.appt-todos { margin: .6rem 0; border: 1px solid var(--border); border-radius: 8px; padding: .55rem .7rem; }
.appt-todos-head { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; flex-wrap: wrap; }
.todo-list { display: flex; flex-direction: column; gap: .3rem; }
.todo-item { display: flex; align-items: center; gap: .4rem; font-size: .9rem; min-width: 0; }
.todo-item .chk { display: flex; align-items: center; cursor: pointer; flex-shrink: 0; padding: .2rem 0; }
.todo-item .todo-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-title-row { display: flex; align-items: center; gap: .3rem; min-width: 0; }
.todo-title-row > .ti { color: var(--primary); flex: 0 0 auto; }
.todo-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-title.is-truncated { cursor: pointer; }
.todo-title.is-truncated:hover { color: var(--primary-dark); text-decoration: underline; }
.todo-context { display: block; padding-left: 1.25rem; margin-top: .12rem; font-size: .78rem; line-height: 1.25; }
.todo-full-title { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.todo-title-editor { width: 100%; min-height: 7rem; margin-top: .35rem; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-item.done .todo-title-row > .ti { color: var(--muted); }
.todo-recur { color: var(--muted) !important; font-size: .8rem; }
.todo-item .note-del { margin-left: auto; flex-shrink: 0; }
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .todo-item { flex-wrap: wrap; }
  .todo-item .todo-text { flex-basis: calc(100% - 2.2rem); }
  .todo-item .todo-due, .todo-item .todo-link, .todo-item .todo-due-btn { margin-left: 2.2rem; }
  .todo-item .note-del { margin-left: auto; }
}
.todo-due {
  display: inline-flex; align-items: center; gap: .2rem; white-space: nowrap;
  font-size: .78rem; color: var(--muted); cursor: pointer;
  border: 1px solid var(--border); border-radius: 20px; padding: .1rem .5rem;
}
.todo-due-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; cursor: pointer; }
.todo-due-wrap .todo-badge { margin-left: 0; }
.todo-due.overdue { color: #b03a2e; border-color: #e6b0aa; background: #fdedec; }
.todo-badge {
  font-size: .7rem; font-weight: 700; border-radius: 20px; padding: .05rem .45rem;
  margin-left: .15rem; white-space: nowrap;
}
.todo-badge.due-today { background: #fdedec; color: #b03a2e; }
.todo-badge.due-soon { background: #fef5e7; color: #b9770e; }
.todo-link, .todo-due-btn { padding: .15rem .4rem; min-height: 0 !important; font-size: .85rem; }
.todo-item.fu-todo { cursor: pointer; padding: .2rem .3rem; border-radius: 8px; flex-wrap: wrap; }
.todo-item.fu-todo:hover { background: #eaf5f0; }
.todo-item.fu-todo > .ti { color: var(--primary); }
.todo-item.fu-todo.overdue > .ti-repeat { color: #b03a2e; }
.dash-todos h3 { display: flex; align-items: center; gap: .4rem; }
@media (min-width: 900px) {
  .dash-todos .todo-list {
    max-height: min(62vh, 38rem); overflow-y: auto; overscroll-behavior: contain;
    gap: 0; padding-right: .35rem; scrollbar-gutter: stable;
  }
  .dash-todos .todo-item {
    display: grid; grid-template-columns: auto minmax(8rem, 1fr) 2rem 7rem 1.5rem;
    align-items: center; gap: .45rem; min-height: 2.7rem; padding: .55rem .25rem .7rem;
    border-bottom: 1px solid var(--border);
  }
  .dash-todos .todo-item:last-child { border-bottom: 0; }
  .dash-todos .todo-item:hover { background: var(--bg); }
  .dash-todos .todo-item .todo-text { grid-column: 2; line-height: 1.3; }
  .dash-todos .todo-item .todo-link { grid-column: 3; justify-self: center; }
  .dash-todos .todo-item .todo-due-btn { grid-column: 4; justify-self: end; }
  .dash-todos .todo-item > .todo-due,
  .dash-todos .todo-item .todo-due-wrap { grid-column: 4; justify-self: end; }
  .dash-todos .todo-item .todo-due-wrap { align-self: stretch; justify-content: center; }
  .dash-todos .todo-item .note-del { grid-column: 5; margin-left: 0; justify-self: end; }
  .dash-todos .todo-item.fu-todo {
    grid-template-columns: auto minmax(8rem, 1fr) 2rem 7rem;
    padding: .45rem .25rem; border-radius: 0; flex-wrap: nowrap;
  }
  .dash-todos .todo-item.fu-todo > .ti { grid-column: 1; }
  .dash-todos .todo-item.fu-todo > a { grid-column: 3; justify-self: center; }
  .dash-todos .todo-item.fu-todo > .todo-due { grid-column: 4; }
}
textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem;
  font-family: inherit; font-size: .95rem; resize: vertical;
}

/* Telefonliste */
.plan-move-row { margin-bottom: 1rem; align-items: end; }
.plan-move-row label { display: flex; flex-direction: column; gap: .3rem; color: var(--muted); font-size: .85rem; }
.plan-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: .8rem 1rem; margin-top: .7rem;
}
.plan-item-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.plan-item .pi-call { display: none; }
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .plan-move-row label { width: 100%; }
  .plan-move-row input { width: 100%; }
  .plan-item .pi-call {
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 1.15rem; text-decoration: none;
  }
  .plan-item .pi-call:hover { background: var(--primary-dark); }
}
.plan-item-actions {
  display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; align-items: center;
}
.plan-item-actions select, .plan-item-actions input {
  padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem;
}
.plan-logs { margin-top: .6rem; border-top: 1px dashed var(--border); padding-top: .4rem; }
.status-badge {
  padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--bg); color: var(--muted);
}
.st-offen { background: #eef2f5; color: #5a6b76; }
.st-nicht_erreicht { background: #fdecea; color: #c0392b; }
.st-wiedervorlage { background: #fef5e7; color: #b9770e; }
.st-termin { background: #e8f8f1; color: var(--primary-dark); }
.st-erledigt { background: #eafaf1; color: #1e8449; }
.st-absage { background: #f4ecf7; color: #7d3c98; }

/* Termin-Formular */
.appt-form { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .8rem; }
.appt-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
.appt-form input {
  padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
}
.slot-grid { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.slot-btn { font-size: .85rem; padding: .35rem .6rem; }
.slot-btn.outside { color: var(--muted); border-color: var(--border); border-style: dashed; }
.slot-btn.outside:hover { background: var(--bg); }
.slot-btn.outside .ti { color: #b9770e; }

/* Kundenauswahl im Termin-Modal */
.appt-vet-picker { display: block; margin-top: .8rem; font-size: .85rem; color: var(--muted); position: relative; }
.appt-vet-picker .search-wrap { margin-top: .3rem; }
.vet-suggest {
  position: absolute; left: 0; right: 0; z-index: 50;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.14); max-height: 260px; overflow-y: auto; margin-top: .2rem;
}
.vet-suggest-item { padding: .55rem .8rem; cursor: pointer; font-size: .9rem; color: var(--text); }
.vet-suggest-item:hover { background: #eaf5f0; }

/* Diktat-Button */
.mic-btn { padding: .2rem .5rem; min-height: 0 !important; font-size: .85rem; vertical-align: middle; }
.mic-btn.recording { background: #c0392b; color: #fff; border-color: #c0392b; animation: pulse 1.2s ease-in-out infinite; }
.mic-status { font-size: .78rem; color: var(--muted); margin-left: .4rem; font-weight: normal; }
.mic-status.error { color: #c0392b; }

/* Segmented-Toggles im Formular (Hund/Anrede/Einstufung) */
.visit-toggles { display: flex; flex-direction: column; gap: .55rem; }
.toggle-group { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.toggle-label { font-size: .85rem; color: var(--muted); min-width: 110px; display: inline-flex; align-items: center; gap: .3rem; }
.seg-btn {
  background: var(--panel); color: var(--muted); border: 1px solid var(--border);
  border-radius: 8px; padding: .4rem .75rem; font-size: .88rem;
}
.seg-btn:hover { background: var(--bg); color: var(--text); }
.seg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.rating-toggle .seg-btn { padding: .4rem .65rem; min-width: 2.3rem; }
#vf-revenues { display: flex; flex-direction: column; gap: .5rem; }

/* Tierarzt-Formular */
.vet-form { display: flex; flex-direction: column; gap: .7rem; margin-top: .8rem; max-height: 65vh; overflow-y: auto; padding-right: .3rem; }
.vet-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
.vet-form label.chk { flex-direction: row; align-items: center; gap: .4rem; }
.vet-form input, .vet-form select, .vet-form textarea {
  padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
  font-family: inherit; background: var(--panel); color: inherit;
}
.vet-form .form-row { display: flex; gap: .8rem; }
.vf-fieldset { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; display: flex; flex-direction: column; gap: .5rem; }
.vf-fieldset legend { font-size: .82rem; color: var(--muted); padding: 0 .3rem; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .3rem .6rem; }
.chk-grid .chk { display: flex; flex-direction: row; align-items: center; gap: .35rem; font-size: .85rem; }

/* Umsatz-Block */
.revenue-block { margin: .8rem 0; }
.revenue-block h3, .oh-block h3 { margin: 0 0 .5rem; font-size: 1rem; }
.revenue-grid { display: flex; gap: .8rem; flex-wrap: wrap; }
.revenue-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: .5rem .9rem; display: flex; flex-direction: column; align-items: center; min-width: 100px;
}
.revenue-year { font-size: .8rem; color: var(--muted); }
.revenue-val { font-weight: 700; font-size: 1.05rem; color: var(--primary-dark); }
.oh-block { margin-top: .8rem; }

/* Öffnungszeiten-Editor */
.oh-editor { display: flex; flex-direction: column; gap: .35rem; }
.oh-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.oh-day-label { width: 80px; font-size: .88rem; font-weight: 600; }
.oh-closed-lbl { display: flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); }
.oh-win { display: flex; align-items: center; gap: .25rem; font-size: .85rem; color: var(--muted); }
.oh-win input[type="time"] { padding: .25rem .4rem; font-size: .85rem; width: 6.2em; min-height: 0 !important; }
.oh-row:has(.oh-closed:checked) .oh-win { opacity: .35; pointer-events: none; }
.oh-hint { margin: 0; font-size: .78rem; }

/* Kalender */
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 1rem;
}
.cal-head { text-align: center; font-weight: 600; color: var(--muted); padding: .3rem; font-size: .85rem; }
.cal-cell {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  min-height: 90px; padding: .3rem; cursor: pointer; font-size: .8rem;
  overflow: hidden;
}
.cal-cell:hover { border-color: var(--primary); }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell.today { border-color: var(--primary); border-width: 2px; }
.cal-cell.holiday, .cal-day-col.holiday, .cal-agenda-day.holiday { background: #fdf6ec; }
.cal-holiday {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; color: #b07d2b; background: #f7e9d2;
  border-radius: 999px; padding: .1rem .45rem; margin-bottom: .2rem;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-daynum { font-weight: 600; margin-bottom: .2rem; }
.cal-event {
  background: var(--primary); color: #fff; border-radius: 5px;
  padding: .12rem .35rem; margin-top: .15rem; font-size: .72rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.cal-event:hover { background: var(--primary-dark); }
.cal-event.ext { background: #6c757d; cursor: default; }
.cal-event.ext:hover { background: #6c757d; }
.cal-event.neutral { background: #5b7ca8; }
.cal-event.neutral:hover { background: #4a6a95; }
.cal-event.absence { background: #d9822b; }
.cal-event.absence:hover { background: #c3701d; }

/* Tages-/Wochenansicht */
.cal-view-switch { display: inline-flex; gap: 0; margin-left: .5rem; }
.cal-view-switch button { border-radius: 0; min-height: 0 !important; padding: .35rem .7rem; }
.cal-view-switch button:first-child { border-radius: 8px 0 0 8px; }
.cal-view-switch button:last-child { border-radius: 0 8px 8px 0; }
.cal-view-switch button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.cal-agenda { display: grid; gap: 6px; margin-top: 1rem; }
.cal-agenda.cols-1 { grid-template-columns: 1fr; }
.cal-agenda.cols-7 { grid-template-columns: repeat(7, 1fr); }
.cal-day-col {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  min-height: 320px; padding: .35rem; cursor: pointer;
  min-width: 0; overflow: hidden;
}
.cal-day-col:hover { border-color: var(--primary); }
.cal-day-col.today { border-color: var(--primary); border-width: 2px; }
.cal-day-head { font-weight: 600; font-size: .85rem; color: var(--muted); padding: .2rem .1rem .35rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; display: flex; align-items: center; gap: .35rem; }
.cal-day-count {
  background: var(--primary); color: #fff; border-radius: 999px;
  font-size: .68rem; padding: .05rem .4rem; margin-left: auto;
}
.cal-agenda.cols-1 .cal-event { font-size: .9rem; padding: .35rem .6rem; }
.cal-more {
  font-size: .7rem; color: var(--primary-dark); cursor: pointer;
  margin-top: .15rem; padding: .1rem .35rem; font-weight: 600;
}
.cal-more:hover { text-decoration: underline; }
.cal-travel {
  display: flex; align-items: center; gap: .3rem;
  font-size: .72rem; color: var(--muted);
  padding: .1rem .35rem; margin: .1rem 0;
}
.cal-travel i { font-size: .85rem; }
.appt-travel {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: .5rem .7rem; margin-top: .6rem; font-size: .85rem; line-height: 1.6;
}
.appt-travel i { color: var(--primary); }
.appt-conflict {
  background: #fdecea; border: 1px solid #f5b7b1; border-radius: 8px;
  padding: .5rem .7rem; margin-top: .6rem; font-size: .85rem; line-height: 1.6;
  color: #c0392b;
}
.appt-conflict i { color: #c0392b; }

/* Timeline-Tagesansicht */
.cal-timeline-wrap { display: block; }
.cal-tl-allday { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .5rem; }
.cal-timeline {
  position: relative; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px;
  margin-left: 3.2rem; cursor: pointer;
}
.cal-tl-hour {
  position: absolute; left: 0; right: 0; border-top: 1px solid var(--border);
  pointer-events: none;
}
.cal-tl-hour span {
  position: absolute; left: -3.2rem; top: -.55em;
  font-size: .72rem; color: var(--muted); width: 2.8rem; text-align: right;
}
.cal-tl-events { position: absolute; inset: 0 6px 0 6px; }
.cal-tl-event {
  position: absolute; overflow: hidden; cursor: pointer;
  background: #eaf5f0; border: 1px solid var(--primary); border-left-width: 4px;
  border-radius: 6px; padding: .2rem .45rem; font-size: .82rem; line-height: 1.3;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.cal-tl-event:hover { background: #dff0e8; z-index: 3; }
.cal-tl-main { display: flex; align-items: baseline; gap: .3rem; min-width: 0; }
.cal-tl-event .cal-tl-time { flex: 0 0 auto; font-weight: 600; font-size: .74rem; color: var(--primary-dark); }
.cal-tl-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-tl-address {
  display: block; margin-top: .1rem; color: var(--muted); font-size: .72rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-tl-event.ext { background: #eef1f4; border-color: var(--muted); cursor: default; }
.cal-tl-event.ext .cal-tl-time { color: var(--muted); }
.cal-tl-event.conflict {
  background: #fdecea; border-color: #c0392b;
}
.cal-tl-event.conflict .cal-tl-time { color: #c0392b; }
.cal-tl-event.conflict-travel {
  background: #fdf3e7; border-color: var(--new);
}
.cal-tl-event.conflict-travel .cal-tl-time { color: var(--new); }
.cal-tl-travel {
  position: absolute; left: 8px; right: 8px; z-index: 1; pointer-events: auto;
  display: flex; align-items: center; justify-content: center; gap: .3rem;
  font-size: .72rem; color: var(--muted);
  background: repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(107,122,133,.08) 5px, rgba(107,122,133,.08) 10px);
  border-left: 2px dashed var(--muted); border-radius: 4px;
}
.cal-tl-travel.late {
  color: #c0392b; border-left-color: #c0392b; font-weight: 600;
  background: repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(192,57,43,.1) 5px, rgba(192,57,43,.1) 10px);
}
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .cal-agenda.cols-7 { grid-template-columns: 1fr; }
  .cal-day-col { min-height: 0; }
  .cal-day-col.cal-empty-day { opacity: .55; }
  .cal-day-col.cal-empty-day .muted { display: none; }
}

/* Mobile Monats-Agenda */
.cal-month-agenda { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.cal-agenda-day {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: .5rem .7rem;
}
.cal-agenda-day.today { border-color: var(--primary); border-width: 2px; }
.cal-agenda-date { font-weight: 600; font-size: .9rem; margin-bottom: .3rem; cursor: pointer; }
.cal-agenda-events .cal-event { font-size: .85rem; padding: .3rem .55rem; white-space: normal; }
code { background: var(--bg); padding: .15rem .4rem; border-radius: 5px; font-size: .85em; word-break: break-all; }

/* Import */
input[type="file"] { font-size: .9rem; }

/* Dropdown-Untermenü (Tierärzte) */
.nav-group { position: relative; display: inline-flex; }
.nav-group .caret {
  font-size: .8em; opacity: .7;
  margin: -.5rem -.6rem -.5rem 0; padding: .5rem .6rem .5rem .35rem; /* großes Touch-Ziel */
  border-left: 1px solid rgba(255,255,255,.25);
}
.nav-group .tab-btn:not(.active) .caret { border-left-color: var(--border); }
.tab-btn { display: inline-flex; align-items: center; gap: .35rem; line-height: 1.2; }
.tab-btn .ti { font-size: 1.05em; }
.nav-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 150;
  min-width: 220px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.16); padding: .35rem; gap: .1rem;
}
.subtab-btn {
  background: none; border: none; padding: .55rem .9rem; cursor: pointer;
  border-radius: 8px; font-size: .9rem; color: var(--text); text-align: left;
}
.subtab-btn:hover { background: #eaf5f0; color: var(--primary-dark); }

/* Termin-Status auf Karten */
.appt-status { font-weight: 600; }
.appt-status.upcoming { color: var(--primary-dark); }
.appt-status.past { color: var(--muted); font-weight: 500; }
.appt-status.none { color: #b9770e; font-weight: 500; }

/* Detailseite */
#app-view { padding-bottom: 5.5rem; }
.detail-layout { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) {
  .detail-layout { grid-template-columns: 1.2fr 1fr; }
  .detail-layout .panel:first-child { grid-row: span 2; }
}
.btn-like {
  display: inline-block; padding: .6rem 1.1rem; border-radius: 8px;
  font-size: .95rem; text-decoration: none;
}
.btn-like.ghost { color: var(--primary); border: 1px solid var(--primary); }
.btn-like.ghost:hover { background: #eaf5f0; }
.vet-appt {
  position: relative; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: .55rem 2rem .55rem .8rem; margin-top: .5rem; font-size: .9rem;
}
.vet-appt.upcoming { border-left: 4px solid var(--primary); }
.vet-appt.past { border-left: 4px solid var(--border); color: var(--muted); }
.vet-appt .note-del { position: absolute; top: .4rem; right: .4rem; }
#vet-appts h4 { margin: .9rem 0 .2rem; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
#vet-appts h4:first-child { margin-top: 0; }
.vet-file-upload { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.vet-file-upload input { flex: 1 1 15rem; min-width: 0; }
.vet-file-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: .55rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--border);
}
.vet-file-row:last-child { border-bottom: 0; }
.vet-file-row a { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .vet-file-upload button { width: 100%; }
  .vet-file-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .vet-file-row .muted { grid-column: 2; font-size: .78rem; }
  .vet-file-row .note-del { grid-column: 3; grid-row: 1 / span 2; }
}

/* Assistent-Chat (Drawer rechts) */
.chat-fab {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 200;
  width: 60px; height: 60px; border-radius: 50%; font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); padding: 0;
}
.chat-backdrop {
  position: fixed; inset: 0; z-index: 210;
  background: rgba(0,0,0,.25); opacity: 1; transition: opacity .25s;
}
.chat-backdrop.hidden { display: block; opacity: 0; pointer-events: none; }
.chat-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 220;
  width: 520px; max-width: 100vw;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,.18);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(105%); transition: transform .28s ease;
}
.chat-drawer.open { transform: translateX(0); }
.chat-header {
  display: flex; align-items: center; gap: .3rem;
  padding: .6rem .9rem; background: var(--primary); color: #fff; font-weight: 600;
}
.chat-header .ghost { color: #fff; border: none; padding: .3rem .55rem; font-size: 1.05rem; }
.chat-header .ghost:hover { background: rgba(255,255,255,.15); }
.chat-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.chat-body { flex: 1; display: flex; min-height: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-sessions {
  width: 230px; flex-shrink: 0; border-right: 1px solid var(--border);
  overflow-y: auto; background: var(--bg); padding: .5rem;
}
.chat-session-item {
  display: flex; align-items: center; gap: .3rem;
  padding: .5rem .6rem; border-radius: 8px; cursor: pointer; font-size: .86rem;
}
.chat-session-item:hover { background: #eaf5f0; }
.chat-session-item.active { background: #dceee5; font-weight: 600; }
.chat-session-item .cs-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-session-item .cs-del { border: none; background: none; color: var(--muted); padding: .1rem .25rem; cursor: pointer; }
.chat-session-item .cs-del:hover { color: #c0392b; }
.chat-messages { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.chat-msg {
  max-width: 88%; padding: .55rem .8rem; border-radius: 12px; font-size: .92rem;
  line-height: 1.45; word-break: break-word;
}
.chat-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-msg.assistant { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.pending { color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
.chat-msg.error { background: #fdecea; border-color: #f2b8b5; color: #c0392b; }
@keyframes pulse { 50% { opacity: .4; } }
/* Markdown im Chat */
.chat-msg.assistant p { margin: .3rem 0; }
.chat-msg.assistant p:first-child { margin-top: 0; }
.chat-msg.assistant p:last-child { margin-bottom: 0; }
.chat-msg.assistant ul, .chat-msg.assistant ol { margin: .3rem 0 .3rem 1.2rem; padding: 0; }
.chat-msg.assistant li { margin: .15rem 0; }
.chat-msg.assistant code {
  background: rgba(0,0,0,.07); padding: .05rem .3rem; border-radius: 4px; font-size: .85em;
}
.chat-msg.assistant pre {
  background: #2d3436; color: #f1f2f6; padding: .6rem .8rem; border-radius: 8px;
  overflow-x: auto; font-size: .82rem; margin: .4rem 0;
}
.chat-msg.assistant pre code { background: none; padding: 0; color: inherit; }
.chat-msg.assistant table { border-collapse: collapse; margin: .4rem 0; font-size: .85rem; }
.chat-msg.assistant th, .chat-msg.assistant td { border: 1px solid var(--border); padding: .25rem .5rem; }
.chat-msg.assistant th { background: #eaf5f0; }
.chat-msg.assistant h1, .chat-msg.assistant h2, .chat-msg.assistant h3,
.chat-msg.assistant h4 { margin: .5rem 0 .2rem; font-size: 1rem; }
.chat-msg.assistant a { color: var(--primary); }
.chat-msg.assistant blockquote { margin: .3rem 0; padding-left: .6rem; border-left: 3px solid var(--border); color: var(--muted); }
/* Tool-Badges */
.chat-tools { align-self: flex-start; display: flex; flex-wrap: wrap; gap: .3rem; }
.chat-tool-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .74rem; color: var(--muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px; padding: .12rem .55rem;
}
.chat-tool-badge.running .ti { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Datei-Chips */
.chat-files { display: flex; flex-wrap: wrap; gap: .4rem; padding: .4rem .8rem 0; }
.chat-file-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .8rem; background: #eaf5f0; border: 1px solid var(--primary);
  border-radius: 999px; padding: .2rem .6rem; color: var(--primary);
}
.chat-msg .msg-file { font-size: .78rem; opacity: .85; margin-top: .2rem; }
.chat-drawer.dragover .chat-messages { outline: 3px dashed var(--primary); outline-offset: -8px; }
/* Eingabe */
.chat-input { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input textarea {
  flex: 1; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px;
  font-size: .95rem; resize: none; max-height: 130px; font-family: inherit; line-height: 1.4;
}
.chat-input button { padding: .55rem .8rem; border-radius: 10px; }
.chat-input .ghost { border: 1px solid var(--border); }

/* Tablet / Touch-Optimierung */
@media (pointer: coarse) {
  button, .tab-btn, .subtab-btn, .btn-like { min-height: 44px; }
  input[type=text], input[type=number], input[type=password], select, textarea { min-height: 44px; font-size: 1rem; }
  .card { padding: 1.1rem; }
  .select-item { padding: .75rem .8rem; }
  .cal-cell { min-height: 72px; }
}
@media (max-width: 1024px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .tab { padding: .9rem; }
}
@media (max-width: 700px) {
  .chat-drawer { width: 100vw; }
  .chat-sessions { position: absolute; top: 0; bottom: 0; left: 0; z-index: 5; box-shadow: 4px 0 16px rgba(0,0,0,.15); }
}
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .filter-select { max-width: none; flex: 1 1 40%; }
  #vet-count { flex-basis: 100%; margin-left: 0; }
  .toggle-label { min-width: 90px; }
}

/* Leaflet-Panes (z-index 400+) in eigenem Stacking-Context halten,
   damit sie Overlays wie die Bottom-Nav nicht überdecken */
.leaflet-container { z-index: 0; isolation: isolate; }

/* ---------- Mobile Bottom-Navigation ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 205;
  display: none;
  background: var(--panel); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  padding: .25rem .3rem calc(.25rem + env(safe-area-inset-bottom));
}
.bnav-btn {
  position: relative; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  background: none; border: none; border-radius: 10px;
  padding: .35rem .2rem; min-height: 52px;
  color: var(--muted); font-size: .68rem; cursor: pointer;
}
.bnav-btn .ti { font-size: 1.45rem; margin: 0; }
.bnav-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bnav-btn.active { color: var(--primary); font-weight: 600; }
.bnav-btn:hover { background: var(--bg); }
.bnav-badge { position: absolute; top: .1rem; right: 18%; margin-left: 0; }

/* Mehr-Sheet */
.more-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 240;
  background: var(--panel); border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.25);
  padding: .5rem .8rem calc(.9rem + env(safe-area-inset-bottom));
  animation: sheetUp .22s ease-out;
  max-height: 80dvh; overflow-y: auto;
}
.more-grabber { width: 42px; height: 4px; border-radius: 4px; background: var(--border); margin: .2rem auto .7rem; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.more-grid button {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: .8rem .3rem; min-height: 76px; font-size: .78rem; line-height: 1.2;
}
.more-grid button .ti { font-size: 1.5rem; margin: 0; color: var(--primary); }
.more-grid button:hover { background: #eaf5f0; }
.more-grid button.more-danger .ti { color: #c0392b; }
.more-grid button .inbox-badge { position: absolute; top: .35rem; right: .5rem; margin: 0; }

/* Mobile: schlanker Header, Navigation unten */
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  header { gap: .4rem; padding: .5rem .8rem; }
  header h1 { flex: 1; font-size: 1.1rem; }
  header nav, #logout-btn { display: none; }
  .bottom-nav { display: flex; }
  /* Inhalt & schwebende Elemente über der Bottom-Nav */
  #app-view { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .chat-fab { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .voice-fab { bottom: calc(150px + env(safe-area-inset-bottom)) !important; }
  .chat-drawer { z-index: 260; }
  .chat-backdrop { z-index: 250; }
  .dash-stats { gap: .5rem; }
  .stat-card { min-width: 100px; padding: .6rem .5rem; }
  .dash-today { order: 1; }
  .dash-note { order: 2; }
  .dash-upcoming { order: 3; }
  .dash-todos { order: 4; }
  .dash-calls { order: 5; }
  .dash-grid > .dash-side { display: contents; }
  .dash-todos .todo-list {
    max-height: min(48dvh, 25rem); overflow-y: auto; overscroll-behavior: contain;
    gap: .45rem; padding-right: .25rem; scrollbar-gutter: stable;
  }
  .dash-todos .todo-item {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .35rem .5rem;
    align-items: center; padding: .65rem .55rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px;
  }
  .dash-todos .todo-item .todo-text { grid-column: 2; flex-basis: auto; line-height: 1.35; }
  .dash-todos .todo-item .todo-link,
  .dash-todos .todo-item .todo-due,
  .dash-todos .todo-item .todo-due-btn,
  .dash-todos .todo-item .todo-due-wrap { grid-column: 2; justify-self: start; margin-left: 0; }
  .dash-todos .todo-item .todo-due-wrap { align-items: flex-start; }
  .dash-todos .todo-item .note-del { grid-column: 3; grid-row: 1; margin-left: 0; }
  .dash-todos .todo-item.fu-todo { grid-template-columns: auto minmax(0, 1fr) auto; }
  .dash-todos .todo-item.fu-todo .todo-due { grid-column: 2; }
  .dash-todos .todo-item.fu-todo > a { grid-column: 3; grid-row: 1; }

  /* Kalender-Toolbar: kompakt, Nebenfunktionen im ⋯-Popover */
  #tab-calendar .panel { padding: .9rem .8rem; }
  #tab-calendar .toolbar { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: .4rem; margin-bottom: .7rem; align-items: center; position: relative; }
  #cal-prev { grid-column: 1; grid-row: 1; }
  #cal-title { grid-column: 2 / 4; grid-row: 1; font-size: 1rem; min-width: 0; text-align: center; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #cal-next { grid-column: 4; grid-row: 1; }
  #cal-prev, #cal-next { padding: .3rem .6rem; min-height: 40px !important; }
  #tab-calendar .toolbar > span[style] { display: none; }
  #cal-today { grid-column: 1; grid-row: 2; }
  .cal-view-switch { grid-column: 2 / 4; grid-row: 2; margin-left: 0; justify-self: stretch; display: flex; }
  .cal-view-switch button { flex: 1; }
  #cal-more { display: inline-flex; grid-column: 4; grid-row: 2; min-height: 40px !important; }
  #cal-today, .cal-view-switch button { padding: .3rem .6rem; font-size: .85rem; min-height: 40px !important; }
  #cal-new-appt { grid-column: 1 / 5; grid-row: 3; min-height: 44px !important; }
  .cal-actions {
    display: none; position: absolute; right: 0; top: calc(100% - 46px); z-index: 60;
    flex-direction: column; gap: .4rem; background: var(--panel);
    border: 1px solid var(--border); border-radius: 12px; padding: .6rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.18); min-width: 220px;
  }
  .cal-actions.open { display: flex; }
  .cal-actions button { justify-content: flex-start; min-height: 44px !important; }
}

/* Slot-Empfehlung */
.slot-btn.best { border-color: var(--primary); background: #e8f5ef; font-weight: 600; }
.slot-travel { font-size: .72rem; color: var(--muted); margin-left: .3rem; white-space: nowrap; }
.slot-travel .ti { font-size: .8rem; }
.slot-best {
  display: flex; align-items: center; gap: .7rem; cursor: pointer;
  background: #e8f5ef; border: 1px solid var(--primary); border-radius: 10px;
  padding: .6rem .8rem; margin: .6rem 0; font-size: .9rem;
}
.slot-best > .ti { color: var(--primary); font-size: 1.3rem; flex-shrink: 0; }
.slot-best > div { flex: 1; min-width: 0; }
.slot-best button { flex-shrink: 0; }

/* Inbox */
.inbox-badge {
  display: inline-block; min-width: 1.3em; text-align: center;
  background: var(--new); color: #fff; border-radius: 20px;
  font-size: .72rem; padding: .1rem .35rem; margin-left: .3rem;
}
.inbox-item {
  display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 10px;
  padding: .9rem 1rem; margin-bottom: .7rem; background: var(--panel);
}
.inbox-item p { margin: .2rem 0; font-size: .88rem; }
.inbox-dup {
  background: #fdf3ec; border: 1px solid #f0c9a8; border-radius: 8px;
  padding: .35rem .6rem; font-size: .85rem !important;
}
.inbox-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Wiedervorlage-Schnellbuttons */
.fu-quick { padding: .25rem .55rem; font-size: .8rem; min-height: 0 !important; }

/* Wiedervorlage-Datum (Telefonliste) */
.fu-date { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); }

/* Dashboard */
.dash-search { position: relative; max-width: 640px; margin: 0 auto 1.2rem; }
.dash-search-box {
  display: flex; align-items: center; gap: .6rem;
  background: var(--panel); border: 1px solid var(--border); border-radius: 28px;
  padding: .35rem 1.1rem; box-shadow: 0 2px 10px rgba(0,0,0,.07);
}
.dash-search-box:focus-within { border-color: var(--primary); box-shadow: 0 3px 14px rgba(26,127,90,.18); }
.dash-search-box .ti { color: var(--muted); font-size: 1.15rem; }
.dash-search-box input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 1.05rem; padding: .55rem 0; min-height: 0;
}
.dash-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 120;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.16); overflow: hidden; padding: .3rem;
}
.dash-search-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border-radius: 10px; cursor: pointer;
}
.dash-search-item:hover { background: var(--bg); }
.dash-search-item .dsi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-search-item .dsi-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-search-item .dsi-call {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 1.1rem; text-decoration: none;
}
.dash-search-item .dsi-call:hover { background: var(--primary-dark); }
.dash-stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat-card {
  flex: 1; min-width: 140px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: .9rem 1.2rem; text-align: center; color: var(--muted); font-size: .88rem;
}
.stat-card:hover { border-color: var(--primary); }
.stat-num { display: block; font-size: 1.7rem; font-weight: 700; color: var(--primary-dark); }
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.dash-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (min-width: 900px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .dash-grid .dash-wide { grid-column: 1 / -1; }
}
.dash-grid .panel h3 { margin-top: 0; }
.dash-item {
  padding: .55rem .7rem; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; font-size: .92rem;
}
.dash-item:hover { background: var(--bg); border-color: var(--border); }
.dash-item.overdue { background: #fdf3ec; border-color: #f0c9a8; }
.dash-appt-done { color: var(--primary); margin-left: .3rem; font-size: 1.1rem; vertical-align: -.08em; }
.dash-note h3 { display: flex; align-items: center; gap: .35rem; }
.dash-note-status { margin-left: auto; font-size: .72rem; font-weight: 400; }
.dash-note-status.error { color: var(--danger); }
.dash-note textarea {
  display: block; width: 100%; min-height: 8rem; resize: vertical;
  line-height: 1.45; background: var(--bg); border-color: var(--border);
}
.dash-today-group + .dash-today-group { margin-top: .75rem; padding-top: .7rem; border-top: 1px solid var(--border); }
.dash-group-label {
  margin: 0 .7rem .2rem; color: var(--muted); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.dash-due-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .5rem; }
.dash-due-item > .ti { color: var(--primary); font-size: 1rem; }
.dash-due-item > span { min-width: 0; }
.dash-due-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-due-context { display: block; margin-top: .1rem; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-due-item.no-action { cursor: default; }
.dash-due-item.no-action:hover { background: transparent; border-color: transparent; }

/* Einstellungen */
.settings-tabs {
  display: flex; gap: .25rem; overflow-x: auto; padding-bottom: .7rem;
  margin-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.settings-tab {
  flex: 0 0 auto; background: transparent; color: var(--muted); border: 1px solid transparent;
  padding: .55rem .8rem; white-space: nowrap;
}
.settings-tab:hover { background: var(--bg); color: var(--text); }
.settings-tab.active { background: #eaf5f0; color: var(--primary-dark); border-color: #bddbce; }
.settings-pane { max-width: 780px; }
.settings-section {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.2rem; margin-bottom: 1rem; max-width: 720px;
}
.settings-section h3 { margin: 0 0 .6rem; font-size: 1.05rem; }
.settings-section code {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: .2rem .45rem; font-size: .82rem; word-break: break-all;
}
.settings-section input[type="text"], .settings-section input[type="email"], .settings-section input[type="url"] {
  width: 100%; max-width: 420px;
}
.settings-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .4rem 0; }
.settings-log-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.settings-log-head h3, .settings-log-head p { margin-top: 0; }
.activity-item {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .7rem;
  align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--border);
}
.activity-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  border-radius: 50%; background: #eaf5f0; color: var(--primary-dark);
}
.activity-icon.method-delete { background: #fdecea; color: #c0392b; }
.activity-content { min-width: 0; }
.activity-verb { margin-left: .35rem; color: var(--muted); font-size: .85rem; }
.activity-path { display: block; color: var(--muted); font: .75rem ui-monospace, monospace; overflow-wrap: anywhere; margin-top: .15rem; }
.activity-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.activity-meta strong { color: var(--text); }
@media (max-width: 600px) {
  .settings-tabs { margin-left: -.25rem; margin-right: -.25rem; }
  .activity-item { grid-template-columns: 2rem minmax(0, 1fr); }
  .activity-meta { grid-column: 2; align-items: flex-start; flex-direction: row; gap: .4rem; white-space: normal; }
}

/* Ansicht-Umschalter (Karten/Liste) */
.view-toggle { display: inline-flex; gap: 0; }
.view-toggle button { border-radius: 0; min-height: 0 !important; padding: .4rem .7rem; }
.view-toggle button:first-child { border-radius: 8px 0 0 8px; }
.view-toggle button:last-child { border-radius: 0 8px 8px 0; }
.view-toggle button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Vets-Toolbar (zweizeilig) */
.vets-toolbar { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1rem; }
.toolbar-row { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; }
.toolbar-row .flex-spacer { flex: 1; }
.filter-row { row-gap: .45rem; }
.filter-select { max-width: 190px; font-size: .88rem; padding-top: .45rem; padding-bottom: .45rem; }
#vet-count { margin-left: auto; white-space: nowrap; }

/* Umsatz-Spalte in der Liste */
.rev-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rev-year-select {
  font-size: .78rem; padding: .15rem 1.4rem .15rem .4rem; margin-left: .3rem;
  min-height: 0 !important; background-position: right .35rem center; border-radius: 6px;
}

/* Tierärzte-Tabellenansicht */
.vet-table-wrap, #product-list { overflow-x: auto; }
.vet-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; font-size: .9rem; }
.vet-table th {
  text-align: left; padding: .55rem .7rem; background: var(--bg);
  border-bottom: 2px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap;
}
.vet-table th:hover { color: var(--primary-dark); }
.vet-table td { padding: .5rem .7rem; border-bottom: 1px solid var(--border); }
.vet-table tbody tr { cursor: pointer; }
.vet-table tbody tr:hover { background: #eaf5f0; }
.vet-table .species-tag { margin-right: .2rem; }
.product-modal-scroll { max-height: 260px; overflow-y: auto; margin-bottom: .8rem; }
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .vet-table { font-size: .8rem; }
  .vet-table th, .vet-table td { padding: .4rem .45rem; }
}

/* Bestellhistorie im Kundendetail */
.orders-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: .4rem; }
.orders-table th { text-align: left; padding: .4rem .5rem; border-bottom: 2px solid var(--border); white-space: nowrap; }
.orders-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--border); }
.orders-toggle { display: flex; gap: .4rem; margin-top: .2rem; }
.orders-toggle button { background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: .3rem .8rem; font-size: .8rem; cursor: pointer; color: var(--muted); }
.orders-toggle button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.orders-table tr.order-group td { background: var(--bg); font-weight: 600; border-bottom: 1px solid var(--border); padding-top: .5rem; }
#vet-orders [data-orders-view] { max-height: 24rem; overflow-y: auto; }
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .orders-table { font-size: .75rem; }
  .orders-table th, .orders-table td { padding: .3rem .35rem; }
}

/* Öffnungszeiten inline (Telefonliste/Routenplaner) */
.oh-inline { font-size: .8rem; color: var(--primary-dark); }
.oh-inline.closed { color: #c0392b; }
.oh-inline.muted { color: var(--muted); }

/* Benutzerverwaltung */
.user-list { display: flex; flex-direction: column; gap: .3rem; }
.user-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .6rem; background: var(--bg); border-radius: 8px;
}
.user-item .mini { margin-left: auto; }
.user-item .mini + .mini { margin-left: 0; }

/* ================== Sprachassistent ================== */
.voice-panel { max-width: 720px; }
.voice-controls { margin: 1.2rem 0 .8rem; display: flex; justify-content: center; }
.voice-call-btn {
  font-size: 1.15rem; padding: 1rem 2.2rem; border-radius: 999px;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: .5rem;
  box-shadow: 0 4px 16px rgba(26,127,90,.35);
}
.voice-call-btn:active { transform: scale(.97); }
.voice-call-btn .ti { font-size: 1.4rem; }
.voice-hangup { background: #c0392b; box-shadow: 0 4px 16px rgba(192,57,43,.35); }
.voice-status {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  color: var(--muted); font-size: .95rem; margin-bottom: 1rem;
}
.voice-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #b8c2ca; flex: none;
}
.voice-dot.live { background: var(--primary); animation: voicePulse 1.2s infinite; }
.voice-dot.wait { background: #e8a13a; }
.voice-dot.err { background: #c0392b; }
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26,127,90,.4); }
  50% { box-shadow: 0 0 0 7px rgba(26,127,90,0); }
}
.voice-transcript {
  border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem;
  max-height: 50vh; overflow-y: auto; background: var(--bg);
  display: flex; flex-direction: column; gap: .5rem;
}
.voice-line { display: flex; gap: .6rem; align-items: baseline; }
.voice-who {
  font-weight: 600; font-size: .8rem; flex: none; width: 3.2rem;
  color: var(--muted);
}
.voice-user .voice-who { color: var(--primary-dark); }
.voice-text { font-size: .95rem; line-height: 1.45; }
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .voice-call-btn { font-size: 1.3rem; padding: 1.2rem 2.6rem; width: 100%; justify-content: center; }
  .voice-controls { margin-top: 1.6rem; }
}

/* Sprachassistent-Schnellzugriff: nur mobil sichtbar, großes Touch-Ziel über dem Chat-FAB */
.voice-fab { display: none; }
@media (max-width: 760px), ((pointer: coarse) and (max-height: 500px)) {
  .voice-fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 1.2rem; bottom: 6rem; z-index: 200;
    width: 64px; height: 64px; border-radius: 50%; font-size: 1.7rem;
    background: #1f8a4c; color: #fff; border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.3); padding: 0;
  }
  .voice-fab.hidden { display: none; }
  .voice-fab.active { background: #c0392b; animation: voicePulse 1.4s ease-in-out infinite; }
}

/* ---------- Fahrtenbuch ---------- */
.trip-day { margin: 1rem 0 .3rem; font-size: .9rem; color: var(--muted); }
.trip-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: .4rem; background: var(--card);
}
.trip-item .trip-main { flex: 1; min-width: 0; }
.trip-item .trip-main .muted { font-size: .82rem; }
.trip-km { font-weight: 600; white-space: nowrap; }
.trip-private { opacity: .65; border-style: dashed; }
.trip-suggest { background: var(--bg); border-style: dashed; }
.trip-suggest-box {
  border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem;
  margin: .6rem 0 1rem; background: var(--card);
}
.trip-suggest-box h4 { margin: 0 0 .5rem; }
.trip-suggest-day { display: flex; align-items: center; gap: .7rem; margin: .7rem 0 .3rem; }
#trips-summary { margin: .4rem 0 .2rem; }
.priv-limit {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 20px; padding: .1rem .55rem; font-size: .85rem;
}
.priv-limit.warn { color: #b9770e; border-color: #edbb99; background: #fef5e7; }
.priv-limit.over { color: #b03a2e; border-color: #e6b0aa; background: #fdedec; font-weight: 700; }
.priv-bar { width: 60px; height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; display: inline-block; }
.priv-bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.priv-limit.warn .priv-bar-fill { background: #b9770e; }
.priv-limit.over .priv-bar-fill { background: #b03a2e; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .9rem; margin: .8rem 0; }
.form-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.form-grid input { width: 100%; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: .5rem !important; }
.checkbox-label input { width: auto !important; }
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .trip-item { flex-wrap: wrap; }
  .trip-item .trip-main { flex-basis: 100%; }
  .trip-item button { min-height: 40px; }
}

/* ---------- Kundenkarte ---------- */
#vets-map {
  height: calc(100vh - 230px); min-height: 420px;
  border: 1px solid var(--border); border-radius: 12px; z-index: 0;
}
.map-legend { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; }
.legend-item {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem;
  color: var(--muted); white-space: nowrap;
}
.legend-dot {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25);
}
.vet-marker { background: transparent; border: none; }
.vet-marker .pin {
  position: relative;
  width: 26px; height: 26px;
  margin: 2px auto 0;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2.5px solid #fff;
  box-shadow: -1px 2px 6px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.15);
}
.vet-marker .pin::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%; background: rgba(255,255,255,.95);
}
.vet-marker .pin.do-not-visit::after { display: none; }
/* Kalender-Kartenansicht: nummerierte Termin-Pins */
#calendar-map { height: min(72vh, 720px); border-radius: 12px; border: 1px solid var(--border); }
#calendar-map-wrap { margin-top: .6rem; }
#cal-map-toggle.active { background: var(--primary); color: #fff; }
.cal-map-marker { background: transparent; border: none; }
.cal-map-marker .pin {
  position: relative;
  width: 28px; height: 28px;
  margin: 2px auto 0;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2.5px solid #fff;
  box-shadow: -1px 2px 6px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.15);
}
.cal-map-marker .pin span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(45deg);
  color: #fff; font-weight: 700; font-size: .78rem;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.map-popup { font-size: .9rem; min-width: 180px; }
.map-popup h4 { margin: 0 0 .3rem; font-size: 1rem; }
.map-popup-flag { margin: 0 0 .35rem; }
.map-popup p { margin: .15rem 0; color: #555; }
.map-popup-hours { margin-top: .35rem; color: #555; }
.map-popup-hours .oh-inline { display: inline; }
.map-popup .popup-link { display: inline-block; margin-top: .4rem; font-weight: 600; }
.map-popup-actions { display: flex; align-items: center; gap: .6rem; margin-top: .45rem; flex-wrap: wrap; }
.map-popup-actions button { font-size: .82rem; padding: .3rem .55rem; }
.map-popup-actions .popup-link { margin-top: 0; }
#map-geocode-wrap { display: inline-flex; align-items: center; gap: .6rem; }
.map-rules-panel {
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  padding: .8rem 1rem; margin-bottom: .8rem;
}
.map-rules-panel h4 { margin: 0 0 .6rem; }
.rule-row { display: flex; align-items: center; gap: .5rem; margin: .35rem 0; flex-wrap: wrap; }
.rule-row input[type="color"] {
  width: 34px; height: 28px; padding: 1px; border: 1px solid var(--border);
  border-radius: 6px; background: none; cursor: pointer;
}
.rule-row input[type="number"] { width: 80px; }
.rule-row .muted { font-size: .85rem; }
.map-rules-actions { display: flex; gap: .5rem; margin-top: .7rem; }
@media (max-width: 760px) {
  #vets-map { height: calc(100vh - 300px); min-height: 320px; }
}
