/* ==========================================================================
   Smart Collar — portal styles (no build step required)
   ========================================================================== */
:root {
  --bg: #f4f6fb; --card: #fff; --text: #152033; --text-2: #334155; --muted: #6b778c; --line: #e5e9f1; --soft: #f7f9fc;
  --brand: #1d4ed8; --brand-2: #3b82f6; --brand-soft: #eaf1ff; --nav: #0f1b33; --nav-2: #18284a;
  --green: #0f9f6e; --green-soft: #e8f8f1; --amber: #d97706; --amber-soft: #fff5e1;
  --red: #dc2626; --red-soft: #fdecec; --gray: #94a3b8; --gray-soft: #f1f4f8; --purple: #7c3aed; --purple-soft: #f2edff;
  --hover: #fafbfe; --unread: #f6f9ff; --chat-bg: #f7f9fd; --pill-bg: #e9eef7; --map-bg: #e8eef7; --crit-bg: #fff8f8;
  --input-border: #d5dbe6; --topbar: rgba(244,246,251,.9); --avatar-grad: linear-gradient(135deg, #e0ebff, #eef2ff);
  --ok-text: #056947; --ok-border: #bfe9d6; --err-text: #9f1c1c; --err-border: #f6caca;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.04); --shadow-lg: 0 16px 40px rgba(16,24,40,.14);
  color-scheme: light;
}

/* ---------- Dark mode (html[data-theme="dark"]) ---------- */
:root[data-theme="dark"] {
  --bg: #0b1220; --card: #131c2e; --text: #e6ecf5; --text-2: #c3cedf; --muted: #93a1b8; --line: #243049; --soft: #182238;
  --brand: #3b82f6; --brand-2: #60a5fa; --brand-soft: rgba(59,130,246,.16); --nav: #070d1a; --nav-2: #15203a;
  --green: #34d399; --green-soft: rgba(16,185,129,.15); --amber: #fbbf24; --amber-soft: rgba(245,158,11,.15);
  --red: #f87171; --red-soft: rgba(239,68,68,.16); --gray: #7c8aa3; --gray-soft: #1d2840; --purple: #a78bfa; --purple-soft: rgba(139,92,246,.18);
  --hover: #172136; --unread: #16223b; --chat-bg: #0f1829; --pill-bg: #1f2a40; --map-bg: #182238; --crit-bg: #2a1319;
  --input-border: #2e3c5a; --topbar: rgba(11,18,32,.88); --avatar-grad: linear-gradient(135deg, #1e3a8a, #3b2f82);
  --ok-text: #6ee7b7; --ok-border: rgba(52,211,153,.35); --err-text: #fca5a5; --err-border: rgba(248,113,113,.35);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
:root[data-theme="dark"] .leaflet-popup-content-wrapper, :root[data-theme="dark"] .leaflet-popup-tip { background: var(--card); color: var(--text); }
:root[data-theme="dark"] .leaflet-control-zoom a, :root[data-theme="dark"] .leaflet-bar a { background: var(--card); color: var(--text); border-color: var(--line); }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(19,28,46,.8); color: var(--muted); }
:root[data-theme="dark"] .leaflet-control-attribution a { color: var(--brand-2); }
:root[data-theme="dark"] .pet-pin span, :root[data-theme="dark"] .clinic-pin { background: var(--card); }
:root[data-theme="dark"] .auth-form { background: var(--card); }
:root[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.8); }
:root[data-theme="dark"] .bubble-row.mine .bubble { background: #2563eb; border-color: #2563eb; }
:root[data-theme="dark"] .tabs a { color: var(--muted); }
:root[data-theme="dark"] .tabs a.active { color: var(--brand-2); border-bottom-color: var(--brand-2); }
:root[data-theme="dark"] .date-sep span, :root[data-theme="dark"] .call-log-pill { color: var(--text-2); }
body, .panel, .stat, .card, .pet-card, .vital, .topbar, .sidebar, input, select, textarea, .btn, .chip, .badge { transition: background-color .2s ease, border-color .2s ease, color .2s ease; }

/* inside the Android app */
.app-only { display: none; }
.in-app .app-only { display: block; }
.in-app #enable-notifs { display: none; }

/* theme switcher */
.theme-menu { width: 200px; }
.theme-menu button { display: flex; align-items: center; gap: 10px; }
.theme-menu button.current { font-weight: 700; color: var(--brand); }
.theme-menu button.current::after { content: "✓"; margin-left: auto; }
.theme-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-choice { border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; background: var(--card); text-align: left; font: inherit; color: var(--text); }
.theme-choice.current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.theme-choice .swatch { height: 64px; border-radius: 8px; margin-bottom: 8px; display: grid; grid-template-columns: 30% 1fr; overflow: hidden; border: 1px solid var(--line); }
.theme-choice .swatch i:first-child { background: #0f1b33; }
.theme-choice .swatch.light i:last-child { background: #f4f6fb; }
.theme-choice .swatch.dark i:last-child { background: #0b1220; }
.theme-choice .swatch.system i:last-child { background: linear-gradient(135deg, #f4f6fb 50%, #0b1220 50%); }
.theme-choice strong { display: block; font-size: 13px; }
.theme-choice small { color: var(--muted); }
.dropdown.guest-theme { position: fixed; top: 14px; right: 14px; z-index: 50; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hidden, [hidden] { display: none !important; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex: 0 0 252px; background: var(--nav); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.brand { display: flex; gap: 11px; align-items: center; padding: 22px 20px 18px; }
.brand-icon { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #3b82f6, #6366f1); display: grid; place-items: center; font-size: 20px; }
.brand strong { display: block; font-size: 15px; }
.brand small { color: #93a3bf; font-size: 11px; }
.nav-section { padding: 14px 20px 6px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #6f82a6; font-weight: 700; }
.sidebar nav { display: grid; gap: 2px; padding: 0 10px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; color: #b7c3d8; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 500; text-decoration: none; }
.sidebar nav a .ico { width: 20px; text-align: center; font-size: 15px; }
.sidebar nav a:hover { background: var(--nav-2); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar nav a .pill { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 7px; font-weight: 700; }
.sidebar-footer { margin-top: auto; padding: 16px 20px; color: #6f82a6; font-size: 11px; border-top: 1px solid #1c2c4f; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: var(--topbar); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.menu-btn { display: none; border: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }
.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }
.scrim { display: none; }

.live-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--green); background: var(--green-soft); border-radius: 999px; padding: 6px 11px; }
.live-chip i, .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; flex: 0 0 8px; }
.live-chip i { animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(15,159,110,.5); } 70% { box-shadow: 0 0 0 8px rgba(15,159,110,0); } 100% { box-shadow: 0 0 0 0 rgba(15,159,110,0); } }
.dot.off, .is-offline .dot { background: var(--gray); }

/* user + bell */
.icon-btn { position: relative; border: 1px solid var(--line); background: var(--card); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; font-size: 16px; display: grid; place-items: center; }
.icon-btn .count { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 24px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); display: none; overflow: hidden; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.dropdown-head button { border: 0; background: none; color: var(--brand); font-size: 12px; cursor: pointer; }
.bell-list { max-height: 380px; overflow-y: auto; }
.bell-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.bell-item:hover { background: var(--soft); }
.bell-item.unread { background: var(--unread); }
.bell-item > span { font-size: 18px; }
.bell-item strong { display: block; font-size: 12.5px; }
.bell-item small { display: block; color: var(--muted); font-size: 11.5px; }
.bell-item em { font-style: normal; font-size: 10.5px; color: var(--gray); }
.bell-item.sev-critical strong { color: var(--red); }
.dropdown-foot { display: block; text-align: center; padding: 10px; font-size: 12px; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 9px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-chip span { font-size: 12.5px; font-weight: 600; }
.menu-list { width: 220px; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 10px 14px; font-size: 13px; color: var(--text); background: none; border: 0; cursor: pointer; font: inherit; }
.menu-list a:hover, .menu-list button:hover { background: var(--soft); text-decoration: none; }

/* ---------- Cards, panels ---------- */
.panel, .stat, .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush .panel-head { padding: 18px 20px 0; }

.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: 0 0 44px; }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { font-size: 22px; font-weight: 700; }
.bg-blue { background: var(--brand-soft); } .bg-green { background: var(--green-soft); } .bg-amber { background: var(--amber-soft); }
.bg-red { background: var(--red-soft); } .bg-purple { background: var(--purple-soft); } .bg-gray { background: var(--gray-soft); }

/* ---------- Badges / levels ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.normal, .badge.success, .badge.online, .badge.Resolved { background: var(--green-soft); color: var(--green); }
.badge.warning, .badge.Acknowledged { background: var(--amber-soft); color: var(--amber); }
.badge.critical, .badge.danger, .badge.Open { background: var(--red-soft); color: var(--red); }
.badge.info, .badge.minor { background: var(--brand-soft); color: var(--brand); }
.badge.major { background: var(--red-soft); color: var(--red); }
.badge.unknown, .badge.offline, .badge.gray { background: var(--gray-soft); color: #5b6678; }
.lv-normal { --lv: var(--green); --lv-soft: var(--green-soft); }
.lv-warning { --lv: var(--amber); --lv-soft: var(--amber-soft); }
.lv-critical { --lv: var(--red); --lv-soft: var(--red-soft); }
.lv-unknown { --lv: var(--gray); --lv-soft: var(--gray-soft); }
.st-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--lv-soft); color: var(--lv); text-transform: uppercase; letter-spacing: .04em; }
.st-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lv); }

/* ---------- Vitals ---------- */
.vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.vital { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.vital::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--lv, var(--gray)); }
.vital .label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); font-weight: 500; }
.vital .value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.vital .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.vital .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.vital.lv-warning .value, .vital.lv-critical .value { color: var(--lv); }
.vital.lv-critical { background: var(--crit-bg); }
.heart { display: inline-block; color: var(--red); animation: beat 1s infinite; }
@keyframes beat { 0%,100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } }

/* pet cards (dashboards) */
.pet-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.pet-card-head { display: flex; gap: 13px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.pet-avatar { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 14px; background: var(--avatar-grad); display: grid; place-items: center; font-size: 25px; }
.pet-avatar.lg { width: 72px; height: 72px; flex-basis: 72px; font-size: 38px; border-radius: 20px; }
.pet-card-head h3 { font-size: 15px; }
.pet-card-head p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.pet-card-head .st-pill { margin-left: auto; }
.mini-vitals { display: grid; grid-template-columns: repeat(4, 1fr); }
.mini-vitals > div { padding: 12px 8px; text-align: center; border-right: 1px solid var(--line); }
.mini-vitals > div:last-child { border-right: 0; }
.mini-vitals span { display: block; font-size: 10.5px; color: var(--muted); }
.mini-vitals strong { font-size: 17px; }
.mini-vitals .lv-warning strong, .mini-vitals .lv-critical strong { color: var(--lv); }
.pet-card-foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 11px 18px; background: var(--soft); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); flex-wrap: wrap; margin-top: auto; }
.pet-card-foot .is-online, .pet-card-foot .is-offline { display: inline-flex; align-items: center; gap: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; background: var(--soft); border: 1px solid var(--line); padding: 3px 8px; border-radius: 7px; color: var(--text-2); }

/* profile header */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { font-size: 22px; }
.profile-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin: 0; }
dl.facts div { background: var(--soft); border-radius: 10px; padding: 10px 12px; }
dl.facts dt { font-size: 11px; color: var(--muted); }
dl.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 13px; }

/* ---------- Charts / maps ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 8px; background: var(--card); }
.chart-box h4 { font-size: 12.5px; display: flex; justify-content: space-between; color: var(--text-2); margin-bottom: 8px; }
.chart-box h4 span { color: var(--muted); font-weight: 500; }
.chart-wrap { position: relative; height: 200px; }
.map { height: 380px; border-radius: 12px; border: 1px solid var(--line); z-index: 1; background: var(--map-bg); }
.map.tall { height: calc(100vh - 210px); min-height: 440px; }
.map.short { height: 260px; }
.seg { display: inline-flex; background: var(--gray-soft); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: none; padding: 6px 11px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 8px; cursor: pointer; text-decoration: none; }
.seg .active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.pet-pin { position: relative; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; }
.pet-pin span { width: 36px; height: 36px; border-radius: 50%; background: var(--card); border: 3px solid var(--lv, var(--brand)); display: grid; place-items: center; font-size: 18px; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.pet-pin b { margin-top: 3px; background: var(--nav); color: #fff; font-size: 10.5px; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.home-pin { transform: translate(-50%, -50%); font-size: 20px; }
.leaflet-div-icon { background: none; border: 0; }
.track-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
.track-list { display: grid; gap: 10px; align-content: start; }
.track-item { display: flex; gap: 11px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; text-align: left; font: inherit; width: 100%; }
.track-item.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.track-item strong { display: block; font-size: 13px; }
.track-item small { color: var(--muted); display: block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; background: var(--soft); }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
td .cell-title { font-weight: 600; display: block; }
td .cell-sub { font-size: 11.5px; color: var(--muted); }
.val-warning { color: var(--amber); font-weight: 600; } .val-critical { color: var(--red); font-weight: 700; }

/* ---------- Lists ---------- */
.alert-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-ico { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; background: var(--amber-soft); }
.alert-row.critical .alert-ico { background: var(--red-soft); }
.alert-row.info .alert-ico { background: var(--brand-soft); }
.alert-row .body { flex: 1 1 220px; min-width: 0; }
.alert-row strong { font-size: 13px; display: block; }
.alert-row p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.alert-row .meta { font-size: 11px; color: var(--gray); margin-top: 3px; }
.alert-row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; margin-left: auto; }
.alert-row.unread strong::after { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--brand); border-radius: 50%; margin-left: 7px; vertical-align: middle; }
.note { border-left: 3px solid var(--brand-2); padding: 4px 0 4px 14px; margin-bottom: 16px; }
.note h4 { font-size: 13.5px; }
.note p { margin: 4px 0 0; font-size: 12.5px; color: var(--text-2); white-space: pre-line; }
.note .meta { font-size: 11px; color: var(--muted); }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: var(--brand); color: #fff; padding: 9px 15px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.btn.danger { background: var(--red); }
.btn.ghost.danger { background: var(--card); color: var(--red); border-color: var(--err-border); }
.btn.success { background: var(--green); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.inline { display: inline; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--input-border); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 13.5px; background: var(--card); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 90px; resize: vertical; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.error, .field .error { color: var(--red); font-size: 12px; margin-top: 4px; }
.is-invalid { border-color: var(--red) !important; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 18px; margin: 0 0 18px; }
legend { font-weight: 700; font-size: 13px; padding: 0 6px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.key-box { display: flex; gap: 8px; align-items: center; background: var(--nav); color: #d7e3ff; border-radius: 10px; padding: 10px 12px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.key-box code { flex: 1; }
pre.code { background: var(--nav); color: #d7e3ff; border-radius: 10px; padding: 14px; overflow-x: auto; font-size: 12px; }

/* flash + toasts */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 13px; font-weight: 500; border: 1px solid; }
.flash.success { background: var(--green-soft); color: var(--ok-text); border-color: var(--ok-border); }
.flash.error { background: var(--red-soft); color: var(--err-text); border-color: var(--err-border); }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 1000; width: 340px; max-width: calc(100vw - 36px); }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; animation: slidein .25s ease; color: var(--text); text-decoration: none !important; }
.toast.critical { border-left-color: var(--red); }
.toast strong { display: block; font-size: 13px; }
.toast small { color: var(--muted); }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } }

.empty { color: var(--muted); font-size: 13px; padding: 28px 16px; text-align: center; }
.empty .big { font-size: 34px; display: block; margin-bottom: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; display: grid; place-items: center; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; font-size: 12.5px; background: var(--card); color: var(--text); text-decoration: none; }
.pagination .active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled { color: var(--gray); }
.bar { height: 8px; background: var(--gray-soft); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--lv, var(--green)); border-radius: 99px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(circle at 20% 20%, #274b9f 0, transparent 50%), linear-gradient(160deg, #0f1b33, #1d3a7a); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 28px 28px; pointer-events: none; }
.auth-art h1 { font-size: 34px; max-width: 460px; margin: 18px 0 12px; }
.auth-art p { color: #b9c8e6; max-width: 440px; }
.auth-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 480px; position: relative; z-index: 1; }
.auth-feats div { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 12px; font-size: 12.5px; }
.auth-feats b { display: block; font-size: 13px; margin-bottom: 2px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--card); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; margin-bottom: 4px; }
.auth-card .field { margin-bottom: 14px; }
.demo-box { background: var(--soft); border: 1px dashed var(--input-border); border-radius: 12px; padding: 12px 14px; font-size: 12px; margin-top: 20px; color: var(--text-2); }

/* ---------- Report / print ---------- */
.report-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--text); padding-bottom: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.report h3 { font-size: 14px; margin: 20px 0 10px; }
@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --card: #fff; --text: #152033; --text-2: #334155; --muted: #6b778c; --line: #e5e9f1; --soft: #f7f9fc; color-scheme: light; }
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  body { background: var(--card); }
  .content { padding: 0; max-width: none; }
  .panel { box-shadow: none; border: 0; padding: 0; }
  .stat { box-shadow: none; }
  a { color: inherit; }
}


/* ---------- Messaging ---------- */
.chat-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - 150px); min-height: 480px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.conv-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.conv-side-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv-side-head h2 { font-size: 15px; }
.conv-list { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.conv-item:hover { background: var(--soft); }
.conv-item.active { background: var(--brand-soft); }
.conv-item .avatar-sm { width: 40px; height: 40px; flex: 0 0 40px; font-size: 13px; }
.conv-item .conv-body { flex: 1; min-width: 0; }
.conv-item .conv-top { display: flex; justify-content: space-between; gap: 6px; }
.conv-item strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-time { font-size: 10.5px; color: var(--gray); white-space: nowrap; }
.conv-item .conv-subject { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-snippet { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item.unread strong, .conv-item.unread .conv-snippet { color: var(--text); font-weight: 700; }
.unread-dot { background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.chat-head h3 { font-size: 14.5px; }
.chat-head small { color: var(--muted); display: block; }
.chat-head .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.back-link { display: none; font-size: 20px; text-decoration: none !important; }
.bubbles { flex: 1; overflow-y: auto; padding: 18px; background: var(--chat-bg); display: flex; flex-direction: column; gap: 6px; }
.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: min(560px, 78%); background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 9px 13px; font-size: 13.5px; box-shadow: 0 1px 2px rgba(0,0,0,.03); overflow-wrap: anywhere; }
.bubble-row.mine .bubble { background: var(--brand); color: #fff; border-color: var(--brand); border-radius: 16px 16px 4px 16px; }
.bubble-meta { font-size: 10.5px; color: var(--gray); margin-top: 4px; text-align: right; }
.bubble-row.mine .bubble-meta { color: #c7d6ff; }
.bubble-alert { font-size: 11.5px; font-weight: 600; padding: 5px 8px; border-radius: 8px; margin-bottom: 6px; background: var(--amber-soft); color: var(--amber); }
.bubble-alert.critical { background: var(--red-soft); color: var(--red); }
.bubble-row.mine .bubble-alert { background: rgba(255,255,255,.18); color: #fff; }
.date-sep { text-align: center; margin: 10px 0 4px; }
.date-sep span { font-size: 11px; color: var(--muted); background: var(--pill-bg); padding: 3px 10px; border-radius: 999px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--card); }
.composer textarea { min-height: 42px; max-height: 160px; resize: none; border-radius: 12px; }
.composer.sending { opacity: .6; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); }
.chat-empty .big { font-size: 40px; display: block; }
.toast.msg { border-left-color: var(--brand); }

/* ---------- Clinic finder ---------- */
.finder { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 20px; }
.finder-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.finder-controls { display: grid; gap: 10px; }
.finder-controls .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.clinic-list { display: grid; gap: 10px; max-height: calc(100vh - 360px); min-height: 200px; overflow-y: auto; padding-right: 2px; }
.clinic-item { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.clinic-item:hover { border-color: var(--input-border); }
.clinic-item.nearest { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.clinic-rank { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: var(--gray-soft); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-2); }
.clinic-item.nearest .clinic-rank { background: var(--green); color: #fff; }
.clinic-body { flex: 1; min-width: 0; }
.clinic-body small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.clinic-top { display: flex; justify-content: space-between; gap: 8px; }
.clinic-top strong { font-size: 13.5px; }
.clinic-dist { font-weight: 700; font-size: 13px; color: var(--brand); white-space: nowrap; }
.clinic-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.clinic-pin, .origin-pin { transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: var(--card); border: 2px solid #94a3b8; display: grid; place-items: center; font-size: 15px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.clinic-pin.partner { border-color: var(--brand); }
.clinic-pin.nearest { border-color: var(--green); border-width: 3px; width: 38px; height: 38px; font-size: 19px; }
.origin-pin { transform: translate(-50%, -100%); background: none; border: 0; box-shadow: none; font-size: 30px; }
.map.picking { cursor: crosshair; outline: 3px solid var(--brand-2); }
.map.finder-map { height: calc(100vh - 190px); min-height: 460px; }
.near-list .clinic-item { cursor: default; }

@media (max-width: 1150px) {
  .finder { grid-template-columns: 1fr; }
  .finder-side { order: 2; }
  .clinic-list { max-height: none; }
  .map.finder-map { height: 55vh; min-height: 320px; }
}
@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 120px); }
  .chat-layout.has-active .conv-side { display: none; }
  .chat-layout:not(.has-active) .chat-pane { display: none; }
  .back-link { display: inline-block; }
  .bubble { max-width: 88%; }
}


/* ---------- Video / voice calls ---------- */
.call-body { background: #0b1324; color: #fff; overflow: hidden; }
.call-wrap { display: flex; height: 100vh; height: 100dvh; }
.call-stage { position: relative; flex: 1; min-width: 0; background: radial-gradient(circle at 50% 35%, #1d2c4f, #0b1324 70%); overflow: hidden; }
#remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; transition: opacity .3s; }
.call-stage.remote-video-on #remote-video { opacity: 1; }
.call-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 20px; }
.call-stage.remote-video-on .call-placeholder { display: none; }
.call-placeholder h2 { font-size: 24px; }
.call-placeholder p { color: #a9b8d6; margin: 0; }
.call-avatar { width: 110px; height: 110px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #6366f1); display: grid; place-items: center; font-size: 38px; font-weight: 700; color: #fff; margin: 0 auto 8px; }
.call-stage[data-state="ringing"] .call-avatar, .call-avatar.ringing { animation: ringpulse 1.6s infinite; }
@keyframes ringpulse { 0% { box-shadow: 0 0 0 0 rgba(59,130,246,.6); } 70% { box-shadow: 0 0 0 28px rgba(59,130,246,0); } 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); } }
.call-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; background: linear-gradient(rgba(0,0,0,.55), transparent); z-index: 3; }
.call-top strong { display: block; font-size: 15px; }
.call-top small { color: #c5d2ea; }
.call-meta { display: flex; align-items: center; gap: 7px; font-size: 13px; background: rgba(0,0,0,.35); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.call-meta b { font-variant-numeric: tabular-nums; }
.call-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; }
.call-stage[data-state="connected"] .call-dot { background: #10b981; }
.call-stage[data-state="error"] .call-dot, .call-stage[data-state="ended"] .call-dot { background: #ef4444; }
.local-tile { position: absolute; right: 18px; bottom: 104px; width: 220px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; border: 2px solid rgba(255,255,255,.35); background: #1b2745; z-index: 3; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#local-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.local-off { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #c5d2ea; font-size: 12px; }
.call-stage.cam-off #local-video { display: none; }
.call-stage.cam-off .local-off { display: flex; }
.call-avatar.sm { width: 54px; height: 54px; font-size: 18px; margin: 0; }
.local-label { position: absolute; left: 8px; bottom: 6px; font-size: 11px; background: rgba(0,0,0,.45); padding: 1px 7px; border-radius: 6px; }
.local-mic, .remote-mic { display: none; }
.local-mic { position: absolute; right: 8px; bottom: 6px; font-size: 12px; background: #dc2626; border-radius: 6px; padding: 0 5px; }
.call-stage.mic-off .local-mic { display: inline-block; }
.call-stage.remote-mic-off .remote-mic { display: inline-block; font-size: 12px; background: #dc2626; border-radius: 6px; padding: 0 5px; margin-left: 4px; }
.remote-note { font-size: 13px; color: #c5d2ea !important; min-height: 1em; }
.call-controls { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 12px; z-index: 4; background: rgba(15,23,42,.6); backdrop-filter: blur(10px); padding: 10px 14px; border-radius: 22px; }
.call-controls button { min-width: 58px; padding: 0 6px; height: 58px; border-radius: 16px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 20px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-family: inherit; }
.call-controls button i { font-style: normal; }
.call-controls button span { font-size: 10px; color: #cbd5e1; white-space: nowrap; }
.call-controls button:disabled { opacity: .5; cursor: wait; }
.call-controls button:hover { background: rgba(255,255,255,.24); }
.call-controls button.off { background: #f1f5f9; color: #0f172a; }
.call-controls button[data-act="cam"].off, .call-controls button[data-act="mic"].off { background: #fee2e2; }
.call-controls button.off span { color: #991b1b; }
.call-controls .hangup { background: #dc2626; }
.call-controls .hangup:hover { background: #b91c1c; }
.call-controls .hangup { font-size: 22px; }
.call-flash, .call-insecure { position: absolute; left: 50%; transform: translateX(-50%); top: 78px; z-index: 5; background: rgba(15,23,42,.85); border: 1px solid rgba(255,255,255,.15); padding: 10px 16px; border-radius: 12px; font-size: 13px; max-width: min(560px, 92vw); text-align: center; }
.call-insecure { top: auto; bottom: 110px; background: #7c2d12; border-color: #fb923c; line-height: 1.5; }
.call-insecure code { background: rgba(0,0,0,.3); padding: 1px 5px; border-radius: 5px; }
.call-unmute { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; padding: 14px 22px; border-radius: 999px; border: 0; font: inherit; font-weight: 600; background: #fff; color: #0f172a; cursor: pointer; }
.call-ended { position: absolute; inset: 0; z-index: 10; background: rgba(11,19,36,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.call-vitals { width: 380px; flex: 0 0 380px; background: #111c33; border-left: 1px solid #22314f; padding: 18px; overflow-y: auto; display: none; }
.vitals-open .call-vitals { display: block; }
.call-vitals .panel-head p { color: #a9b8d6; }
.call-vitals .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.call-vitals .vital { background: #182543; border-color: #22314f; color: #fff; box-shadow: none; }
.call-vitals .vital .sub, .call-vitals .vital .label, .call-vitals .vital .value small { color: #a9b8d6; }
.call-vitals .vital.lv-critical { background: #3b1620; }

.incoming-call { position: fixed; inset: 0; z-index: 2000; background: rgba(11,19,36,.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; }
.incoming-card { background: #0f1b33; color: #fff; border-radius: 24px; padding: 28px 34px 20px; text-align: center; width: 340px; max-width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.45); animation: slidein .25s ease; }
.incoming-card h3 { font-size: 20px; margin-top: 6px; }
.incoming-card p { color: #a9b8d6; margin: 6px 0 20px; font-size: 13px; }
.incoming-card .call-avatar { width: 88px; height: 88px; font-size: 30px; }
.incoming-actions { display: flex; justify-content: center; gap: 46px; margin-bottom: 8px; }
.round { width: 64px; height: 64px; border-radius: 50%; border: 0; font-size: 26px; cursor: pointer; color: #fff; }
.round.accept { background: #16a34a; animation: ringpulse 1.6s infinite; }
.round.decline { background: #dc2626; transform: rotate(135deg); }
.link-btn { background: none; border: 0; color: #93c5fd; font: inherit; font-size: 12.5px; cursor: pointer; margin-top: 10px; text-decoration: underline; }
.bubble-row.call-log { justify-content: center; }
.call-log-pill { font-size: 12px; background: #e9eef7; color: #334155; padding: 5px 12px; border-radius: 999px; }

@media (max-width: 900px) {
  .call-vitals { position: absolute; inset: auto 0 0 0; width: auto; max-height: 55vh; z-index: 8; border-left: 0; border-top: 1px solid #22314f; border-radius: 18px 18px 0 0; }
  .local-tile { width: 120px; bottom: 100px; right: 12px; }
  .call-controls button { min-width: 48px; height: 50px; }
  .call-controls button span { font-size: 9px; }
  .call-controls { gap: 8px; padding: 8px 10px; bottom: 14px; }

}


/* ---------- Appointments ---------- */
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.day-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.day-chip { flex: 0 0 auto; width: 62px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 6px 0; cursor: pointer; font: inherit; color: var(--text); display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.day-chip b { font-size: 18px; }
.day-chip small { font-size: 10.5px; color: var(--muted); }
.day-chip.active { border-color: var(--brand); background: var(--brand); color: #fff; }
.day-chip.active small { color: rgba(255,255,255,.8); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.slot { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 9px 4px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.slot:hover { border-color: var(--brand-2); }
.slot.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.slot-closed { grid-column: 1 / -1; background: var(--soft); border: 1px dashed var(--input-border); border-radius: 10px; padding: 14px; color: var(--muted); font-size: 13px; }
.pet-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.pet-pick-item { cursor: pointer; }
.pet-pick-item input { position: absolute; opacity: 0; pointer-events: none; }
.pet-pick-item span { display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: 12px; padding: 8px 14px; background: var(--card); min-width: 130px; }
.pet-pick-item small { color: var(--muted); font-size: 11.5px; }
.pet-pick-item input:checked + span { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pet-pick-item input:focus-visible + span { outline: 2px solid var(--brand-2); }

.appt-list { display: grid; gap: 12px; }
.appt-card { display: flex; gap: 14px; border: 1px solid var(--line); border-left: 4px solid var(--brand-2); border-radius: 12px; padding: 12px 14px; background: var(--card); }
.appt-card.st-pending { border-left-color: var(--amber); }
.appt-card.st-checked_in { border-left-color: var(--purple); }
.appt-card.st-completed { border-left-color: var(--green); }
.appt-card.st-cancelled, .appt-card.st-declined, .appt-card.st-no_show { border-left-color: var(--gray); opacity: .8; }
.appt-date { width: 54px; flex: 0 0 54px; text-align: center; background: var(--soft); border-radius: 10px; padding: 6px 0; display: flex; flex-direction: column; line-height: 1.15; }
.appt-date span { font-size: 11px; text-transform: uppercase; color: var(--red); font-weight: 700; }
.appt-date strong { font-size: 22px; }
.appt-date small { font-size: 11px; color: var(--muted); }
.appt-body { flex: 1; min-width: 0; }
.appt-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.appt-top strong { font-size: 14px; }
.appt-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.appt-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.appt-actions:empty { display: none; }
.appt-list.compact .appt-card { padding: 10px 12px; }

.cal-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
.cal { display: grid; grid-template-columns: 64px repeat(7, minmax(120px, 1fr)); grid-template-rows: auto calc(var(--rows) * var(--row-h)); min-width: 920px; }
.cal-head { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--soft); line-height: 1.2; position: sticky; top: 0; z-index: 2; }
.cal-head span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.cal-head strong { font-size: 18px; }
.cal-head.today strong { background: var(--brand); color: #fff; border-radius: 50%; width: 32px; height: 32px; display: inline-grid; place-items: center; }
.cal-corner { border-left: 0; }
.cal-hours div { height: var(--row-h); font-size: 11px; color: var(--muted); text-align: right; padding: 2px 8px 0 0; }
.cal-day { position: relative; border-left: 1px solid var(--line); }
.cal-day.today { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.cal-day.past { background: color-mix(in srgb, var(--soft) 60%, transparent); }
.cal-slot { display: block; height: var(--row-h); border-bottom: 1px dashed var(--line); }
.cal-slot:hover { background: var(--brand-soft); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.cal-event { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 3px 7px; font-size: 11px; line-height: 1.25; overflow: hidden; text-decoration: none !important; color: var(--text);
  background: var(--brand-soft); border-left: 3px solid var(--brand-2); z-index: 2; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.cal-event b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event:hover { filter: brightness(.97); z-index: 4; }
.cal-event.st-pending { background: repeating-linear-gradient(135deg, var(--amber-soft) 0 8px, transparent 8px 14px), var(--card); border: 1px dashed var(--amber); border-left: 3px solid var(--amber); }
.cal-event.st-checked_in { background: var(--purple-soft); border-left-color: var(--purple); }
.cal-event.st-completed { background: var(--green-soft); border-left-color: var(--green); }
.cal-event.st-no_show { background: var(--red-soft); border-left-color: var(--red); }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 18px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i.cal-event { position: static; display: inline-block; width: 18px; height: 12px; padding: 0; box-shadow: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1150px) {
  .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .track-layout { grid-template-columns: 1fr; }
  .track-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15,27,51,.45); z-index: 35; }
  .menu-btn { display: grid; place-items: center; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 40px; }
  .g-2, .chart-grid, .form-grid, .form-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .user-chip span:not(.avatar-sm), .live-chip .txt { display: none; }
  .user-chip { padding: 3px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .map.tall { height: 60vh; min-height: 320px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-ico { width: 36px; height: 36px; flex-basis: 36px; font-size: 16px; }
  .stat strong { font-size: 18px; }
  .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .vital { padding: 12px; }
  .vital .value { font-size: 22px; }
  .g-auto { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 16px; }
  .topbar .title p { display: none; }
  .topbar { gap: 8px; }
  .topbar .live-chip { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .alert-row { flex-wrap: wrap; }
  .alert-row .actions { width: 100%; justify-content: flex-start; padding-left: 48px; }
}

/* ---------- Medicine reminders ---------- */
.med-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 8px; }
.med-dose, .med-schedule { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line, rgba(127,127,127,.18)); border-radius: 12px; margin-bottom: 8px; }
.med-dose.ringing { border-color: #ef4444; background: rgba(239,68,68,.08); animation: medpulse 1.2s ease-in-out infinite; }
.med-schedule.inactive { opacity: .55; }
.med-time { font-weight: 700; min-width: 76px; }
.med-body { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.med-body small { font-size: 12px; }
.med-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.med-times { display: flex; gap: 8px; flex-wrap: wrap; }
.med-times input { width: auto; min-width: 120px; }
.med-day { cursor: pointer; user-select: none; }
.med-day input { width: auto; margin-right: 4px; }
.med-card { width: 380px; }
.med-bell { font-size: 44px; animation: medshake .6s ease-in-out infinite; display: inline-block; }
.med-item { background: rgba(255,255,255,.08); border-radius: 14px; padding: 12px; margin: 10px 0; text-align: left; }
.med-item strong { display: block; font-size: 15px; }
.med-item span { display: block; color: #a9b8d6; font-size: 12.5px; margin-top: 2px; }
.med-item .med-actions { margin-top: 10px; }
.med-item .btn { flex: 1; justify-content: center; }
@keyframes medshake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@keyframes medpulse { 50% { box-shadow: 0 0 0 4px rgba(239,68,68,.18); } }
