/* CapyMed visual foundation v2 — scoped to the authenticated application. */
body.capy-shell-active {
  --bg-app: var(--bg);
  --bg-surface: var(--surface);
  --bg-elevated: var(--surface-2);
  --bg-input: var(--surface-2);
  --border-default: var(--sep);
  --border-strong: var(--sep-2);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-2);
  --text-muted: var(--ink-3);
  --primary: var(--accent);
  --primary-hover: var(--accent-2);
  --primary-lt: var(--accent-soft);
  --success: var(--accent);
  --success-lt: var(--accent-soft);
  --info: var(--calm);
  --info-lt: var(--calm-soft);
  --warning: var(--warn);
  --warning-lt: var(--warn-soft);
  --danger: var(--crit);
  --danger-lt: var(--crit-soft);
  --critical: var(--plum);
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
  color: var(--ink);
  font-family: var(--ds-font);
}

body.capy-shell-active #root,
body.capy-shell-active button,
body.capy-shell-active input,
body.capy-shell-active select,
body.capy-shell-active textarea { font-family: var(--ds-font); }

@media (min-width: 768px) {
  body.capy-shell-active #root .mobile-content { background: var(--bg) !important; }
  body.capy-shell-active #root .mobile-content > :where(div,main):not(.fixed) { max-width: none; }
}

body.capy-shell-active #root :where(h1,h2,h3,h4) {
  color: var(--ink);
  letter-spacing: -.025em;
}

body.capy-shell-active #root :where(.font-black,.font-extrabold) { font-weight: 650 !important; }
body.capy-shell-active #root :where(.bg-white) { background-color: var(--surface) !important; }
body.capy-shell-active #root :where(.bg-gray-50,.bg-slate-50,.bg-gray-100,.bg-slate-100) { background-color: var(--surface-2) !important; }
body.capy-shell-active #root :where(.border-gray-100,.border-gray-200,.border-slate-100,.border-slate-200) { border-color: var(--sep) !important; }
body.capy-shell-active #root :where(.text-gray-900,.text-gray-800,.text-slate-900,.text-slate-800,.text-slate-950) { color: var(--ink) !important; }
body.capy-shell-active #root :where(.text-gray-700,.text-gray-600,.text-slate-700,.text-slate-600) { color: var(--ink-2) !important; }
body.capy-shell-active #root :where(.text-gray-500,.text-gray-400,.text-slate-500,.text-slate-400) { color: var(--ink-3) !important; }

body.capy-shell-active #root :where(.rounded-xl,.rounded-2xl,[class~="rounded-[10px]"]) { border-radius: 16px !important; }
body.capy-shell-active #root :where(.shadow-sm) { box-shadow: var(--sh-1) !important; }

body.capy-shell-active #root :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea) {
  border-color: var(--sep-2) !important;
  border-radius: 11px !important;
  background: var(--surface-2) !important;
  color: var(--ink) !important;
  min-height: 42px;
  font-size: 14px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

body.capy-shell-active #root :where(input,select,textarea):focus {
  border-color: var(--accent) !important;
  background: var(--surface) !important;
  outline: none !important;
  box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 14%,transparent) !important;
}

body.capy-shell-active #root :where(button,a,input,select,textarea,[tabindex]):focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
}

body.capy-shell-active #root :where(.cg-card,.card,.metric-card) {
  border-color: var(--sep) !important;
  border-radius: 16px !important;
  background: var(--surface) !important;
  box-shadow: var(--sh-1) !important;
}

body.capy-shell-active #root table { color: var(--ink); }
body.capy-shell-active #root th {
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
body.capy-shell-active #root td { border-color: var(--sep); }
body.capy-shell-active #root tbody tr:hover { background: var(--surface-2); }

body.capy-shell-active #root :where(.fixed.inset-0) {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

@media (max-width: 767px) {
  body.capy-shell-active #root :where(button,input,select,textarea) { min-height: 44px; }
  body.capy-shell-active #root :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea) { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  body.capy-shell-active #root *,
  body.capy-shell-active #root *::before,
  body.capy-shell-active #root *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media (prefers-contrast: more) {
  body.capy-shell-active { --sep: #8b929a; --sep-2: #69717a; --ink-3: #4e555d; }
}
