﻿/*
 * SmartTierphysio Bridge CSS v3 — Clean Bootstrap 5
 * No custom modal system. Uses Bootstrap 5 native modals everywhere.
 */

/* ═══════════════════════════════════════════
   CSS VARIABLES (used in templates)
   ═══════════════════════════════════════════ */
:root, [data-bs-theme="light"] {
  --accent:        #4f7cff;
  --accent-2:      #a855f7;
  --text-primary:  #111827;
  --text-secondary:#374151;
  --text-muted:    #6b7280;
  --bg-surface:    #f3f4f6;
  --bg-elevated:   #ffffff;
  --glass-border:  rgba(0,0,0,0.1);
  --accent-dim:    rgba(79,124,255,0.15);
  --danger:        #ef4444;
  --danger-bg:     rgba(239,68,68,0.10);
  --danger-border: rgba(239,68,68,0.25);
  --success:       #22c55e;
  --warning:       #f59e0b;
  --info:          #3b82f6;
}
[data-bs-theme="dark"] {
  --accent:        #818cf8;
  --accent-2:      #c084fc;
  --text-primary:  #f1f5f9;
  --text-secondary:#cbd5e1;
  --text-muted:    #94a3b8;
  --bg-surface:    #1a2035;
  --bg-elevated:   rgba(255,255,255,0.05);
  --glass-border:  rgba(255,255,255,0.08);
  --accent-dim:    rgba(129,140,248,0.20);
  --danger:        #f87171;
  --danger-bg:     rgba(248,113,113,0.12);
  --danger-border: rgba(248,113,113,0.30);
  --success:       #4ade80;
  --warning:       #fbbf24;
  --info:          #60a5fa;
}

/* ═══════════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════════ */
/* #js-page-content is now .content-wrapper — SmartAdmin handles padding via
   .app-content .content-wrapper { padding: 1.5rem 2rem } in smartapp.css */
#js-page-content { min-height: calc(100vh - 64px); }
.subheader { display: none; }

/* ═══════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
  margin-bottom: 1.5rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}
.page-title   { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--bs-body-color); }
.page-subtitle{ font-size: 0.85rem; color: var(--text-muted); margin: 0.2rem 0 0; }
@media (max-width: 575px) { .page-header { flex-direction: column; } }

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-icon { padding: 0.35rem; width: 34px; height: 34px; justify-content: center; }
.btn-xs { padding: 0.2rem 0.45rem; font-size: 0.75rem; line-height: 1.4; border-radius: 0.25rem; }

/* ── Glow on primary buttons ── */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .1s, background .2s !important;
}
.btn-primary:hover {
  box-shadow: 0 0 16px 4px color-mix(in srgb, var(--bs-primary) 50%, transparent) !important;
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.18) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.btn-primary:hover::after { opacity: 1; }

/* ── Logo: icon-only logo sizing ── */
:root {
  --logo-width: 2rem;
  --logo-height: 2rem;
}
.app-logo {
  padding: 0 1.25rem;
}
.app-logo > svg.custom-logo,
.app-logo > img.custom-logo {
  width: 2rem !important;
  height: 2rem !important;
  min-width: 2rem !important;
  max-width: 2rem !important;
  flex-shrink: 0;
  object-fit: contain;
}

/* ── Header btn-system hover glow ── */
.app-header .btn-system {
  transition: color .15s, box-shadow .2s;
}
.app-header .btn-system:hover {
  box-shadow: 0 0 10px 2px color-mix(in srgb, var(--bs-primary) 35%, transparent);
}

/* ── Light Mode: btn-system icons must be dark, not white ── */
[data-bs-theme="light"] .app-header .btn-system .sa-icon {
  --sa-icon-color: rgba(0, 0, 0, 0.65) !important;
  --sa-icon-fill:  rgba(0, 0, 0, 0.0)  !important;
}
[data-bs-theme="light"] .app-header .btn-system:hover .sa-icon,
[data-bs-theme="light"] .app-header .btn-system.show  .sa-icon {
  --sa-icon-color: var(--bs-primary)                      !important;
  --sa-icon-fill:  rgba(var(--bs-primary-rgb), 0.12)      !important;
}
/* mobile hamburger */
[data-bs-theme="light"] .app-header .mobile-menu-icon .sa-icon {
  --sa-icon-color: rgba(0, 0, 0, 0.65) !important;
  --sa-icon-fill:  none                !important;
}
/* collapse icon (SVG polygon, not a sa-icon) */
[data-bs-theme="light"] .app-header .collapse-icon svg polygon {
  fill: rgba(0, 0, 0, 0.45) !important;
}

/* ═══════════════════════════════════════════
   GLASS CARD → Bootstrap card
   ═══════════════════════════════════════════ */
.glass-card, .glass {
  background: var(--bs-tertiary-bg) !important;
  border: 1px solid var(--bs-border-color) !important;
  border-radius: 12px !important;
  padding: 1.25rem;
}

/* ═══════════════════════════════════════════
   TYPOGRAPHY UTILITIES
   ═══════════════════════════════════════════ */
.text-xs      { font-size: 0.72rem !important; }
.text-sm      { font-size: 0.85rem !important; }
.font-semibold{ font-weight: 600 !important; }
.font-bold    { font-weight: 700 !important; }
.text-muted   { color: var(--text-muted) !important; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-800 { font-weight: 800 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-600 { font-weight: 600 !important; }

/* ═══════════════════════════════════════════
   FLEX UTILITIES (Tailwind-style used in templates)
   ═══════════════════════════════════════════ */
.flex           { display: flex !important; }
.items-center   { align-items: center !important; }
.items-start    { align-items: flex-start !important; }
.justify-between{ justify-content: space-between !important; }
.justify-end    { justify-content: flex-end !important; }
.justify-center { justify-content: center !important; }
.flex-wrap      { flex-wrap: wrap !important; }
.flex-col       { flex-direction: column !important; }
.flex-1         { flex: 1 !important; }
.flex-shrink-0  { flex-shrink: 0 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem  !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem    !important; }
.gap-6 { gap: 1.5rem  !important; }
.w-full { width: 100% !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem  !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem    !important; }
.mb-6 { margin-bottom: 1.5rem  !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem  !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem    !important; }

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */
.form-group   { margin-bottom: 1rem; }
.form-label   { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.35rem; }
.form-grid    { display: grid; gap: 1rem; }
.form-grid-2  { grid-template-columns: 1fr 1fr; }
.form-grid-3  { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 575px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════ */
.search-bar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.search-input-wrapper { position: relative; display: flex; align-items: center; }
.search-input-wrapper svg { position: absolute; left: 0.75rem; color: var(--text-muted); pointer-events: none; }
.search-input-wrapper .form-control { padding-left: 2.25rem; }

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */
.table-container { overflow-x: auto; border-radius: 12px; border: 1px solid var(--bs-border-color); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--bs-tertiary-bg); padding: 0.75rem 1rem;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--bs-secondary-color);
  border-bottom: 1px solid var(--bs-border-color); white-space: nowrap;
}
.data-table td {
  padding: 0.875rem 1rem; border-bottom: 1px solid var(--bs-border-color-translucent);
  font-size: 0.875rem; vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bs-tertiary-bg); }

/* ═══════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════ */
.badge-aktiv, .badge-active, .badge-bezahlt, .badge-paid {
  background: rgba(34,197,94,0.15); color: #16a34a;
}
.badge-inaktiv, .badge-inactive, .badge-cancelled {
  background: rgba(100,116,139,0.15); color: #64748b;
}
.badge-offen, .badge-open {
  background: rgba(59,130,246,0.15); color: #2563eb;
}
.badge-ueberfaellig, .badge-overdue {
  background: rgba(239,68,68,0.15); color: #dc2626;
}
.badge-entwurf, .badge-draft {
  background: rgba(245,158,11,0.15); color: #d97706;
}
.badge-neu { background: rgba(139,92,246,0.15); color: #7c3aed; }
.badge-admin { background: rgba(139,92,246,0.15); color: #7c3aed; }
.badge-primary { background: rgba(79,124,255,0.15); color: #3b5bdb; }
.badge-warning { background: rgba(245,158,11,0.15); color: #d97706; }

.badge-aktiv, .badge-active, .badge-bezahlt, .badge-paid,
.badge-inaktiv, .badge-inactive, .badge-cancelled,
.badge-offen, .badge-open, .badge-ueberfaellig, .badge-overdue,
.badge-entwurf, .badge-draft, .badge-neu, .badge-admin,
.badge-primary, .badge-warning {
  border-radius: 100px; padding: 0.2rem 0.65rem;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  display: inline-flex; align-items: center;
}
[data-bs-theme="dark"] .badge-aktiv,
[data-bs-theme="dark"] .badge-active,
[data-bs-theme="dark"] .badge-bezahlt,
[data-bs-theme="dark"] .badge-paid    { color: #4ade80; }
[data-bs-theme="dark"] .badge-offen,
[data-bs-theme="dark"] .badge-open    { color: #60a5fa; }
[data-bs-theme="dark"] .badge-ueberfaellig,
[data-bs-theme="dark"] .badge-overdue { color: #f87171; }
[data-bs-theme="dark"] .badge-entwurf,
[data-bs-theme="dark"] .badge-draft   { color: #fbbf24; }
[data-bs-theme="dark"] .badge-admin,
[data-bs-theme="dark"] .badge-neu     { color: #c084fc; }
[data-bs-theme="dark"] .badge-primary { color: #818cf8; }
[data-bs-theme="dark"] .badge-inaktiv,
[data-bs-theme="dark"] .badge-inactive{ color: #94a3b8; }

/* ═══════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════ */
.alert-success { background: rgba(34,197,94,0.1);  border-color: rgba(34,197,94,0.25); }
.alert-danger,
.alert-error   { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.25); }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.25); }
.alert-info    { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.25); }

/* ═══════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════ */
.avatar-placeholder {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; border-radius: 50%; flex-shrink: 0;
  text-transform: uppercase; user-select: none;
}

/* ═══════════════════════════════════════════
   PATIENT GRID & CARDS
   ═══════════════════════════════════════════ */
.patient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.patient-card {
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px; overflow: hidden;
  cursor: pointer; display: block; color: inherit;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.15s;
  position: relative;
}
.patient-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  transform: translateY(-2px); border-color: var(--accent);
}
.patient-card-image {
  position: relative; height: 120px;
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.patient-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.patient-card-image-placeholder { opacity: 0.4; color: var(--text-muted); }
.patient-card-body  { padding: 0.75rem; }
.patient-card-name  { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.2rem; }
.patient-card-species { font-size: 0.75rem; color: var(--text-muted); }
.patient-card-meta  { display: flex; align-items: center; justify-content: space-between; margin-top: 0.4rem; gap: 0.25rem; }
.patient-card-owner { display: flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; color: var(--text-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════
   STAT CARDS (Dashboard)
   ═══════════════════════════════════════════ */
.stat-card-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--bs-secondary-color);
}
.stat-card-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: color-mix(in srgb, var(--stat-color, var(--bs-primary)) 12%, transparent);
  color: var(--stat-color, var(--bs-primary));
  display: flex; align-items: center; justify-content: center;
}
.stat-card-value { font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stat-card-meta  { display: flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; color: var(--bs-secondary-color); }
.trend-up   { color: #22c55e; font-weight: 700; }
.trend-down { color: #ef4444; font-weight: 700; }
.trend-flat { color: var(--bs-secondary-color); }

/* ═══════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════ */
.pagination { display: flex; align-items: center; gap: 0.25rem; list-style: none; padding: 0; margin: 1rem 0 0; flex-wrap: wrap; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 0.5rem;
  border-radius: 8px; border: 1px solid var(--bs-border-color);
  font-size: 0.85rem; text-decoration: none; color: var(--bs-body-color); transition: all 0.15s;
}
.page-link:hover { background: var(--bs-tertiary-bg); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state-icon  { font-size: 3rem; margin-bottom: 1rem; opacity: 0.35; display: flex; align-items: center; justify-content: center; }
.empty-state-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--bs-body-color); }
.empty-state-text  { font-size: 0.875rem; }

/* ═══════════════════════════════════════════
   FILTER PILLS
   ═══════════════════════════════════════════ */
.filter-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filter-pill {
  padding: 0.3rem 0.85rem; border-radius: 100px;
  border: 1px solid var(--bs-border-color);
  font-size: 0.8rem; font-weight: 500; color: var(--text-muted);
  background: transparent; cursor: pointer; transition: all 0.15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem;
}
.filter-pill:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ═══════════════════════════════════════════
   SETTINGS TABS
   ═══════════════════════════════════════════ */
.settings-tabs {
  display: flex; gap: 0.25rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--bs-border-color); margin-bottom: 1.25rem;
}
.settings-tab {
  padding: 0.6rem 1rem; font-size: 0.875rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none; cursor: pointer;
  border: none; background: transparent;
  border-bottom: 2px solid transparent; white-space: nowrap; transition: all 0.15s;
}
.settings-tab:hover { color: var(--bs-body-color); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-tab-content { display: none; }
.settings-tab-content.active { display: block; }

/* ═══════════════════════════════════════════
   CHART / MISC
   ═══════════════════════════════════════════ */
.chart-container { position: relative; height: 260px; }
[data-confirm] { cursor: pointer; }

/* ═══════════════════════════════════════════
   MOBILE HEADER BUTTONS
   ═══════════════════════════════════════════ */
.mobile-menu-icon, .collapse-icon {
  background: transparent; border: none; cursor: pointer;
  color: var(--bs-body-color); padding: 0.35rem;
  border-radius: 8px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.mobile-menu-icon:hover, .collapse-icon:hover { background: var(--bs-tertiary-bg); }

/* ═══════════════════════════════════════════
   APP DRAWER (Settings Panel)
   ═══════════════════════════════════════════ */
.app-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 300px;
  background: var(--bs-body-bg); border-left: 1px solid var(--bs-border-color);
  z-index: 1045; transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden; display: flex; flex-direction: column;
}
.app-drawer.open { transform: translateX(0); }
.app-drawer-header {
  display: flex; align-items: center; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--bs-border-color);
  flex-shrink: 0; background: var(--bs-tertiary-bg);
}
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 1044; display: none;
}
.backdrop.open { display: block; }

/* ═══════════════════════════════════════════
   CAL-MODAL SYSTEM (calendar plugin)
   Uses .cal-modal-overlay to avoid conflict
   with Bootstrap 5's .modal { display:none }
   ═══════════════════════════════════════════ */
.cal-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1060;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.cal-modal-overlay.open {
  display: flex !important;
}
.cal-modal {
  position: relative;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: calModalIn .25s cubic-bezier(0.34,1.26,0.64,1);
}
.cal-modal.cal-modal-lg  { max-width: 740px; }
.cal-modal.cal-modal-xl  { max-width: 960px; }
.cal-modal.cal-modal-sm  { max-width: 400px; }
@keyframes calModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--bs-border-color);
}
.cal-modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--bs-body-color);
}
.cal-modal-body  { padding: 1.25rem; }
.cal-modal-footer {
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--bs-border-color);
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
}
.cal-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--bs-secondary-color);
  padding: .3rem;
  border-radius: 6px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.cal-modal-close:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }

/* ── form-grid-2 used in calendar modal ── */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .875rem;
}
@media (max-width: 560px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   STATS GRID + STAT CARDS
   ═══════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--bs-primary));
  border-radius: 12px 12px 0 0;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.15); transform: translateY(-2px); }
.stat-card-header { margin-bottom: .35rem; }
.stat-card-label  { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }
.stat-card-value  { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--stat-color, var(--bs-primary)); }
.stat-card-meta   { font-size: .75rem; color: var(--bs-secondary-color); margin-top: .25rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.trend-up   { color: #22c55e; font-weight: 700; }
.trend-down { color: #ef4444; font-weight: 700; }
.trend-flat { color: var(--bs-secondary-color); }

/* ═══════════════════════════════════════════
   RESPONSIVE TABLE / MOBILE CARD TOGGLE
   .mob-hide-table shows table on desktop,
   hides mob-card-list; on mobile reverses.
   ═══════════════════════════════════════════ */
.mob-hide-table .mob-card-list { display: none; }
@media (max-width: 640px) {
  .mob-hide-table .table-container { display: none; }
  .mob-hide-table .mob-card-list   { display: flex; flex-direction: column; gap: .75rem; }
}
.mob-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  padding: .875rem 1rem;
  cursor: pointer;
  transition: box-shadow .15s;
}
.mob-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.mob-card-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.mob-card-title  { font-size: .9rem; font-weight: 700; }
.mob-card-meta   { display: flex; flex-wrap: wrap; gap: .35rem .75rem; font-size: .8rem; color: var(--bs-secondary-color); }
.mob-card-meta-item { white-space: nowrap; }

/* ═══════════════════════════════════════════
   BOOTSTRAP MODAL CUSTOMIZATION
   Custom styles for our BS5 modals only —
   no overriding the BS5 modal mechanism.
   ═══════════════════════════════════════════ */
.modal-content {
  border-radius: 16px !important;
  border: 1px solid var(--bs-border-color) !important;
}
.modal-header {
  border-bottom: 1px solid var(--bs-border-color) !important;
  border-radius: 16px 16px 0 0 !important;
  padding: 1rem 1.25rem !important;
}
.modal-title { font-size: 1.05rem !important; font-weight: 700 !important; }
.modal-footer { border-top: 1px solid var(--bs-border-color) !important; padding: 1rem 1.25rem !important; }
.modal-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--bs-secondary-color); padding: 0.3rem;
  border-radius: 6px; line-height: 1; display: flex;
  align-items: center; justify-content: center; transition: all 0.15s;
}
.modal-close:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }

/* FS utilities */
.fs-nano { font-size: 0.7rem !important; }
.fs-xs   { font-size: 0.75rem !important; }
.fs-sm   { font-size: 0.8rem !important; }

/* ═══════════════════════════════════════════
   PATIENTEN-AKTE: Timeline
   Jeder Eintrag bekommt eine eigene Card mit
   sichtbarer Trennung (Border + Abstand).
   ═══════════════════════════════════════════ */
.timeline {
  position: relative;
  padding-left: 1.75rem;
  margin: 0;
  max-width: 100%;
  overflow: hidden;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--bs-border-color);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 1rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -1.45rem;
  top: 0.75rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bs-primary);
  border: 2px solid var(--bs-body-bg);
  box-shadow: 0 0 0 2px var(--bs-primary);
  z-index: 1;
}

.timeline-dot-note      { background: var(--bs-info);    box-shadow: 0 0 0 2px var(--bs-info); }
.timeline-dot-treatment { background: var(--bs-success);  box-shadow: 0 0 0 2px var(--bs-success); }
.timeline-dot-photo     { background: var(--bs-purple, #a855f7); box-shadow: 0 0 0 2px var(--bs-purple, #a855f7); }
.timeline-dot-document  { background: var(--bs-warning);  box-shadow: 0 0 0 2px var(--bs-warning); }
.timeline-dot-payment   { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.35); }

.timeline-item:has(.timeline-dot-payment) .timeline-card {
    border-color: rgba(34,197,94,.35);
    background: rgba(34,197,94,.04);
}

.timeline-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.timeline-card:hover {
  border-color: var(--bs-primary);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.timeline-date   { font-size: 0.75rem; color: var(--bs-secondary-color); }
.timeline-author { font-size: 0.75rem; color: var(--bs-secondary-color); }

.timeline-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin-bottom: 0.3rem;
}

.timeline-content {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════
   GLOBAL PATIENT DETAIL MODAL
   ═══════════════════════════════════════════════════════════ */

/* Modal mobile fixes */
#modal-patient-detail .modal-dialog { max-height: 92dvh; }
@media (max-width: 600px) {
    #modal-patient-detail .modal-dialog {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        align-self: flex-end !important;
    }
    #modal-patient-detail .modal-content {
        border-radius: 12px 12px 0 0 !important;
        max-height: 100dvh !important;
    }
    #modal-patient-detail.modal.show {
        align-items: flex-end !important;
        display: flex !important;
    }
    #pd-body > div:first-child { flex-direction: column !important; }
    #pd-photo-full { width: 80px !important; height: 80px !important; }
    #pd-timeline-form .form-control { min-width: 0; }
    #pd-attachment { padding: 0.6rem 0.5rem !important; font-size: 0.85rem !important; }
    .ql-toolbar.ql-snow { padding: 0.25rem !important; }
    #pd-header > div:last-child::-webkit-scrollbar { display: none; }
    #pd-name { max-width: calc(100vw - 160px) !important; }
}

/* Patient info card */
.pd-info-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--bg-elevated, rgba(255,255,255,0.04));
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    overflow: hidden;
}
.pd-info-photo {
    width: 120px;
    min-height: 140px;
    flex-shrink: 0;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.pd-info-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pd-info-divider {
    width: 1px;
    background: var(--glass-border);
    flex-shrink: 0;
    align-self: stretch;
}
.pd-info-col {
    flex: 1;
    min-width: 0;
    padding: 1rem 1.1rem;
}
.pd-info-col-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.6rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--glass-border);
}
.pd-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem 1rem;
    font-size: 0.82rem;
}
.pd-info-grid > div > span {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}
.pd-info-grid > div > div {
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 0.05rem;
    word-break: break-word;
}
@media (max-width: 600px) {
    .pd-info-card { flex-direction: column; }
    .pd-info-photo { width: 100%; height: 90px; }
    .pd-info-divider { width: 100%; height: 1px; }
    .pd-info-grid { grid-template-columns: 1fr 1fr; }
}

/* Owner block */
.pd-owner-link { display: flex; align-items: flex-start; gap: 0.65rem; text-decoration: none; color: inherit; }
.pd-owner-link:hover .pd-owner-name { color: var(--accent); }
.pd-owner-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-dim, rgba(79,124,255,0.18));
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700; color: var(--accent);
    flex-shrink: 0; letter-spacing: 0.02em;
}
.pd-owner-info { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.pd-owner-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); transition: color 0.15s; }
.pd-owner-meta { font-size: 0.75rem; color: var(--text-muted); word-break: break-all; }

/* Entry form */
.pd-entry-section {
    background: var(--bg-elevated, rgba(255,255,255,0.04));
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 1rem;
}
.pd-section-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.85rem; }
.pd-entry-form { display: flex; flex-direction: column; gap: 0.65rem; }
.pd-form-grid4 { display: grid; grid-template-columns: 1fr 1.4fr 1.2fr 1fr; gap: 0.6rem; align-items: end; }
.pd-field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.pd-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.pd-select, .pd-input {
    width: 100%; box-sizing: border-box; font-size: 0.83rem; padding: 0.42rem 0.6rem;
    border: 1px solid var(--glass-border); border-radius: 7px;
    background: var(--bg-surface); color: var(--text-primary);
    appearance: none; -webkit-appearance: none; line-height: 1.4; transition: border-color 0.15s;
}
.pd-select {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.6rem center; padding-right: 2rem;
}
.pd-select:focus, .pd-input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim, rgba(79,124,255,0.18));
}
.pd-file {
    width: 100%; box-sizing: border-box; font-size: 0.82rem; padding: 0.38rem 0.5rem;
    border: 1px solid var(--glass-border); border-radius: 7px;
    background: var(--bg-surface); color: var(--text-primary); cursor: pointer;
}
.pd-file::-webkit-file-upload-button {
    background: var(--bg-elevated); border: 1px solid var(--glass-border);
    border-radius: 5px; color: var(--text-secondary); font-size: 0.78rem;
    padding: 0.2rem 0.6rem; cursor: pointer; margin-right: 0.5rem;
}
.pd-form-footer { display: flex; align-items: flex-end; gap: 0.6rem; }
.pd-submit-btn { flex-shrink: 0; white-space: nowrap; align-self: flex-end; margin-bottom: 0; }
@media (max-width: 640px) {
    .pd-form-grid4 { grid-template-columns: 1fr 1fr; }
    .pd-form-footer { flex-direction: column; align-items: stretch; }
    .pd-submit-btn { width: 100%; justify-content: center; }
}
@media (max-width: 400px) {
    .pd-form-grid4 { grid-template-columns: 1fr; }
}

/* Quill editor theme integration */
.ql-toolbar.ql-snow {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border) !important;
    border-bottom: none !important;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 0.35rem 0.5rem;
}
.ql-toolbar.ql-snow .ql-stroke { stroke: var(--text-secondary); }
.ql-toolbar.ql-snow .ql-fill  { fill:   var(--text-secondary); }
.ql-toolbar.ql-snow .ql-picker-label { color: var(--text-secondary); }
.ql-toolbar.ql-snow button:hover .ql-stroke,
.ql-toolbar.ql-snow .ql-active .ql-stroke { stroke: var(--accent); }
.ql-toolbar.ql-snow button:hover .ql-fill,
.ql-toolbar.ql-snow .ql-active .ql-fill  { fill:   var(--accent); }
.ql-container.ql-snow {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border) !important;
    border-radius: 0 0 var(--radius) var(--radius);
    font-family: inherit; font-size: 0.83rem;
}
.ql-editor {
    min-height: 80px; max-height: 220px;
    color: var(--text-primary); padding: 0.5rem 0.75rem; line-height: 1.55;
}
.ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; }
.ql-editor p { margin: 0; }
.ql-view { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; word-break: break-word; }

/* ── custom-logo: img border-radius for uploaded logos ── */
img.custom-logo {
    border-radius: 8px;
    object-fit: contain;
}

/* ── Rechnungs-Badge Pulsanimation (Patientenakte + Modal) ── */
@keyframes badgePulse {
    0%   { transform: translate(-50%, -50%) scale(1);    opacity: 0.7; }
    70%  { transform: translate(-50%, -50%) scale(1.35); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1.35); opacity: 0; }
}
@keyframes invoiceBadgePulse {
    0%   { box-shadow: 0 0 0 0   rgba(220,53,69,0.7); }
    70%  { box-shadow: 0 0 0 7px rgba(220,53,69,0); }
    100% { box-shadow: 0 0 0 0   rgba(220,53,69,0); }
}
.invoice-badge-pulse {
    animation: invoiceBadgePulse 1.2s ease-out infinite !important;
}