/* ============================================================
   Equine Vet Synapse — Clinical White & Gray Theme
   Medical-grade veterinary record UI
   ============================================================ */
:root {
  --bg: #f5f6f8;
  --bg2: #ffffff;
  --card: #ffffff;
  --card-hover: #fafbfc;
  --muted: #6b7280;
  --txt: #1a1d23;
  --txt-dim: #4b5563;

  --pri: #2563eb;
  --pri-light: #dbeafe;
  --pri-dim: rgba(37, 99, 235, 0.08);
  --ok: #059669;
  --ok-light: #d1fae5;
  --ok-dim: rgba(5, 150, 105, 0.08);
  --warn: #d97706;
  --warn-light: #fef3c7;
  --warn-dim: rgba(217, 119, 6, 0.08);
  --bad: #dc2626;
  --bad-light: #fee2e2;
  --bad-dim: rgba(220, 38, 38, 0.06);
  --gold: #92722a;
  --gold-dim: rgba(146, 114, 42, 0.08);
  --accent: #4f46e5;

  --bd: #e5e7eb;
  --bd-light: #d1d5db;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--txt);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--pri); text-decoration: none; transition: color var(--transition); }
a:hover { color: #1d4ed8; }

/* ---- Layout ---- */
.container {
  max-width: 1120px; margin: 0 auto; padding: 20px 24px 40px;
}

/* ---- Nav ---- */
.nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 14px 0 18px; margin-bottom: 8px;
  border-bottom: 1px solid var(--bd);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-link { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.brand-logo { height: 40px; width: auto; transition: opacity var(--transition); }
.brand-link:hover .brand-logo { opacity: 0.8; }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand .title {
  font-weight: 700; font-size: 18px; letter-spacing: -0.3px;
  color: var(--txt);
}
.brand .sub { font-size: 11px; color: var(--muted); letter-spacing: 0.3px; }
/* Nav right (desktop: inline, mobile: dropdown) */
.nav-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---- Hamburger button (hidden on desktop) ---- */
.hamburger {
  display: none; background: none; border: 1px solid var(--bd);
  border-radius: var(--radius-xs); padding: 8px 7px; cursor: pointer;
  flex-direction: column; gap: 4px; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.hamburger span {
  display: block; width: 20px; height: 2px; background: var(--txt);
  border-radius: 2px; transition: all 0.3s ease;
}
.hamburger:hover { border-color: var(--pri); }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* ---- Language Switcher ---- */
.lang-switch {
  display: inline-flex; gap: 2px; align-items: center;
  background: var(--bg); border-radius: var(--radius-xs);
  border: 1px solid var(--bd); padding: 2px; margin-right: 4px;
}
.lang-btn {
  display: inline-block; padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  color: var(--muted); text-decoration: none; cursor: pointer;
  transition: var(--transition);
}
.lang-btn:hover { color: var(--txt); background: rgba(0,0,0,0.04); }
.lang-btn.active {
  color: var(--pri); background: var(--pri-light);
  cursor: default; pointer-events: none;
}

/* ---- Badge ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase;
  color: var(--pri); background: var(--pri-light); border: 1px solid rgba(37,99,235,0.15);
}

/* ---- Card ---- */
.card {
  background: var(--card); border: 1px solid var(--bd);
  border-radius: var(--radius); padding: 24px; margin: 16px 0;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--bd-light); box-shadow: var(--shadow-md); }

/* ---- Headings ---- */
h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; color: var(--txt); }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
h3 { font-size: 15px; font-weight: 600; color: var(--txt-dim); }

/* ---- Grid ---- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

/* ---- Section titles ---- */
.section-title {
  display: flex; align-items: center; gap: 10px;
  margin: 28px 0 14px; font-size: 12px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--bd); }

/* ---- Form ---- */
label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted);
  margin: 14px 0 6px; letter-spacing: 0.3px; text-transform: uppercase;
}
input, select, textarea {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--bd); background: var(--bg2); color: var(--txt); font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--pri);
  box-shadow: 0 0 0 3px var(--pri-dim); background: #fff;
}
input::placeholder, textarea::placeholder { color: #9ca3af; }
textarea { min-height: 80px; resize: vertical; }
select { cursor: pointer; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button { opacity: 0.5; }

/* File inputs */
input[type="file"] {
  padding: 14px; border-style: dashed; border-width: 2px;
  background: #f9fafb; cursor: pointer; font-size: 13px;
  transition: all var(--transition);
}
input[type="file"]:hover { border-color: var(--pri); background: var(--pri-dim); }
input[type="file"]::file-selector-button {
  padding: 6px 16px; margin-right: 12px; border-radius: var(--radius-xs);
  border: 1px solid var(--bd); background: #fff;
  color: var(--pri); font-weight: 600; font-size: 12px; cursor: pointer;
  transition: all var(--transition);
}
input[type="file"]::file-selector-button:hover { background: var(--pri-light); }

/* Radio */
.radio { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; }
.radio label {
  display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--txt);
  padding: 8px 16px; border: 1px solid var(--bd); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition);
  text-transform: none; letter-spacing: 0; margin: 0; font-weight: 500;
}
.radio label:hover { border-color: var(--pri); background: var(--pri-dim); }
.radio input[type="radio"] { width: auto; accent-color: var(--pri); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--bd); background: #fff;
  color: var(--txt); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); text-decoration: none; white-space: nowrap;
}
.btn:hover {
  border-color: var(--bd-light); background: var(--bg);
  color: var(--txt); box-shadow: var(--shadow);
}
.nav-link.nav-active {
  background: var(--pri-dim); border-color: rgba(37,99,235,0.2);
  color: var(--pri); font-weight: 700;
}
.nav-link.nav-active:hover {
  background: rgba(37,99,235,0.12); border-color: var(--pri);
}
.btn.primary {
  background: var(--pri); border-color: var(--pri); color: #fff;
  font-size: 14px; padding: 10px 24px;
}
.btn.primary:hover {
  background: #1d4ed8; border-color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

/* ---- Growth Feedback Buttons ---- */
.growth-feedback-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 14px; padding: 10px 0;
}
.feedback-good {
  background: #d1fae5 !important; border-color: #059669 !important;
  color: #065f46 !important; font-weight: 700 !important;
}
.feedback-good:hover {
  background: #a7f3d0 !important; box-shadow: 0 2px 8px rgba(5,150,105,0.25) !important;
  transform: translateY(-1px);
}
.feedback-bad {
  background: #fee2e2 !important; border-color: #dc2626 !important;
  color: #991b1b !important; font-weight: 700 !important;
}
.feedback-bad:hover {
  background: #fecaca !important; box-shadow: 0 2px 8px rgba(220,38,38,0.25) !important;
  transform: translateY(-1px);
}
.feedback-next {
  background: #dbeafe !important; border-color: #2563eb !important;
  color: #1e40af !important; font-weight: 700 !important;
}
.feedback-next:hover {
  background: #bfdbfe !important; box-shadow: 0 2px 8px rgba(37,99,235,0.25) !important;
  transform: translateY(-1px);
}
.growth-feedback-bar .btn span {
  font-size: 16px; line-height: 1;
}
@media (max-width: 640px) {
  .growth-feedback-bar { flex-direction: column; gap: 8px; }
  .growth-feedback-bar .btn { width: 100%; justify-content: center; }
}

/* ---- KPI ---- */
.kpi { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 16px 0; }
@media (max-width: 900px) { .kpi { grid-template-columns: 1fr; } }
.kpi .box {
  padding: 18px 16px; border-radius: var(--radius);
  border: 1px solid var(--bd); background: #fff;
  text-align: center; transition: all var(--transition);
}
.kpi .box:hover { box-shadow: var(--shadow-md); border-color: var(--bd-light); }
.kpi .k { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
.kpi .v {
  font-size: 36px; font-weight: 800; letter-spacing: -1px; line-height: 1.1;
  color: var(--txt);
}

/* ---- Progress bar ---- */
.progress {
  height: 6px; background: #e5e7eb;
  border-radius: 999px; overflow: hidden; margin: 8px 0;
}
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pri), var(--ok)); transition: width 0.6s ease; }

/* ---- Score bars ---- */
.score-row {
  display: grid; grid-template-columns: 90px 50px 1fr auto;
  align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--bd);
}
.score-row:last-child { border-bottom: none; }
.score-label { font-size: 13px; font-weight: 600; color: var(--txt-dim); }
.score-value { font-size: 18px; font-weight: 800; text-align: center; }
.score-bar { height: 6px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.score-bar > div { height: 100%; border-radius: 999px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.score-words { font-size: 12px; color: var(--muted); min-width: 0; text-align: right; }
@media (max-width: 700px) {
  .score-row { grid-template-columns: 70px 40px 1fr; }
  .score-words { display: none; }
}

/* ---- Grade badge ---- */
.grade {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 12px; font-size: 28px; font-weight: 900; letter-spacing: -1px;
}
.grade-a {
  background: #fef3c7; color: #92400e; border: 2px solid #fbbf24;
}
.grade-b {
  background: var(--pri-light); color: var(--pri); border: 2px solid rgba(37,99,235,0.3);
}
.grade-c {
  background: var(--ok-light); color: var(--ok); border: 2px solid rgba(5,150,105,0.3);
}
.grade-d { background: #f3f4f6; color: var(--muted); border: 2px solid var(--bd); }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 480px; }
.table th, .table td { padding: 12px 10px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--bd); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; background: #f9fafb; }
.table tr { transition: background var(--transition); }
.table tbody tr:hover, .table tr:hover { background: #f0f4ff; }
.table td a { font-weight: 600; }

/* ---- Info panels ---- */
.info-panel {
  border: 1px solid var(--bd); border-radius: var(--radius); padding: 18px;
  background: #f9fafb; transition: all var(--transition);
}
.info-panel:hover { border-color: var(--bd-light); }
.info-panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--txt); }
.info-panel .content { font-size: 13px; line-height: 1.65; color: var(--txt-dim); }

/* ---- Explain box ---- */
.explain-box {
  background: #f0f4ff;
  border: 1px solid rgba(37,99,235,0.15); border-radius: var(--radius);
  padding: 16px 18px; line-height: 1.65; font-size: 13px; color: var(--txt-dim);
}

/* ---- Utility ---- */
.small { font-size: 12px; color: var(--muted); line-height: 1.5; }
.hr { height: 1px; background: var(--bd); margin: 20px 0; border: none; }
img.preview {
  max-width: 100%; border-radius: var(--radius); border: 1px solid var(--bd);
  transition: transform var(--transition);
}
img.preview:hover { transform: scale(1.01); }

/* ---- Flash ---- */
.flash-msg {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--warn-light); border: 1px solid rgba(217,119,6,0.2);
  color: #92400e; font-size: 13px; font-weight: 500; margin-bottom: 4px;
}

/* ---- Sticky bar ---- */
.stickybar { position: sticky; top: 10px; z-index: 50; margin: 16px 0 12px; }
.stickybar .inner {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 10px;
  padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--bd); background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px); box-shadow: var(--shadow-lg);
}
.stickybar .box {
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--bd); background: #f9fafb; text-align: center;
}
.stickybar .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stickybar .v { font-size: 24px; font-weight: 800; color: var(--txt); }
.stickybar .small { font-size: 11px; color: var(--muted); }
@media (max-width: 900px) { .stickybar .inner { grid-template-columns: 1fr; } }

/* ---- Processing ---- */
.processing-card { text-align: center; padding: 40px 24px; }
.processing-card h2 { font-size: 22px; margin-bottom: 6px; }
.loader-ring {
  display: inline-block; width: 64px; height: 64px; margin: 24px auto; position: relative;
}
.loader-ring::before, .loader-ring::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent;
}
.loader-ring::before { border-top-color: var(--pri); animation: spin 1.2s linear infinite; }
.loader-ring::after { border-bottom-color: var(--ok); animation: spin 1.8s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-main { margin: 20px auto; max-width: 400px; }
.progress-main .bar-wrap {
  height: 8px; background: #e5e7eb;
  border-radius: 999px; overflow: hidden;
}
.progress-main .bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--pri), var(--ok));
  transition: width 0.6s ease; position: relative;
}
.progress-main .bar-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s ease infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---- Auth ---- */
.auth-wrap { max-width: 420px; margin: 60px auto 0; }
.auth-wrap .card { text-align: center; padding: 36px 32px; }
.auth-logo { height: 56px; width: auto; margin-bottom: 18px; }
.auth-wrap h2 { font-size: 24px; margin-bottom: 4px; }
.auth-wrap .auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.auth-wrap label { text-align: left; }
.auth-wrap .btn-group { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ---- Pricing ---- */
.pricing-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-top: 16px;
}
.price-card {
  border: 1px solid var(--bd); border-radius: var(--radius);
  padding: 28px 20px; background: #fff; text-align: center;
  transition: all var(--transition); position: relative;
}
.price-card:hover {
  border-color: var(--bd-light);
  box-shadow: var(--shadow-lg);
}
.price-card.recommended {
  border-color: var(--pri);
  background: linear-gradient(145deg, rgba(37,99,235,0.03), #fff);
}
.price-card.recommended::before {
  content: 'RECOMMENDED'; position: absolute; top: -10px; left: 50%;
  transform: translateX(-50%); font-size: 10px; font-weight: 700; letter-spacing: 1px;
  padding: 3px 14px; border-radius: 999px; background: var(--pri); color: #fff;
}
.price-card .plan-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.price-card .plan-price { font-size: 28px; font-weight: 800; color: var(--txt); margin-bottom: 4px; }
.price-card .plan-price .plan-period { font-size: 14px; font-weight: 400; color: var(--muted); }
.price-card .plan-limit { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.price-card .small { font-size: 12px; color: var(--txt-dim); margin-bottom: 16px; }

/* ---- Details ---- */
details { margin-top: 10px; }
details summary { cursor: pointer; color: var(--pri); font-weight: 600; font-size: 13px; transition: color var(--transition); }
details summary:hover { color: #1d4ed8; }

.atmos-debug {
  margin-top: 8px; padding: 10px 12px;
  border: 1px solid var(--bd); border-radius: var(--radius-sm);
  background: #f9fafb; font-size: 12px; color: var(--txt-dim);
}

/* ---- Footer ---- */
.footer { text-align: center; padding: 24px 0 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--bd); margin-top: 40px; }
.footer a { color: var(--muted); margin: 0 8px; transition: color var(--transition); }
.footer a:hover { color: var(--pri); }
.footer .copy { margin-bottom: 8px; }

/* ============================================================
   Responsive — Tablet (<=768px)
   ============================================================ */
@media (max-width: 768px) {
  .container { padding: 16px 16px 32px; }

  /* Hamburger visible */
  .hamburger { display: flex; }

  /* Nav layout: brand + hamburger on one row, menu hidden */
  .nav { flex-wrap: wrap; position: relative; }
  .nav-right {
    display: none; flex-direction: column; align-items: stretch; gap: 6px;
    width: 100%; padding-top: 12px; margin-top: 8px;
    border-top: 1px solid var(--bd);
  }
  .nav-right.open { display: flex; }
  .nav-right .btn { width: 100%; justify-content: center; padding: 12px 16px; }
  .nav-right .badge { align-self: center; }
  .nav-right .lang-switch { align-self: center; margin: 0 0 4px; }
  .nav-right .settings-toggle { align-self: center; margin: 0 0 4px; }
  .settings-dropdown { right: auto; left: 50%; transform: translateX(-50%); }

  /* Grid to single column */
  .grid { grid-template-columns: 1fr; gap: 12px; }

  /* KPI */
  .kpi { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .kpi .v { font-size: 28px; }
  .kpi .k { font-size: 10px; }

  /* Sticky bar */
  .stickybar .inner { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; }
  .stickybar .v { font-size: 20px; }

  /* Table horizontal scroll */
  .table-wrap { margin: 0 -8px; padding: 0 8px; }

  /* Card spacing */
  .card { padding: 18px 16px; margin: 12px 0; }

  /* Pricing grid */
  .pricing-grid { grid-template-columns: 1fr; }

  /* Radar chart: stack vertically on tablet */
  .radar-grid { grid-template-columns: 1fr !important; }
}

/* ============================================================
   Responsive — Mobile (<=480px)
   ============================================================ */
@media (max-width: 480px) {
  .container { padding: 10px 12px 24px; }

  /* Brand compact */
  .brand-logo { height: 32px; }
  .brand .title { font-size: 15px; }
  .brand .sub { font-size: 9px; }
  .brand { gap: 8px; }

  /* Headings */
  h2 { font-size: 17px; }
  h3 { font-size: 14px; }

  /* Card */
  .card { padding: 14px 12px; border-radius: 10px; }

  /* KPI stacked on very small screens */
  .kpi { grid-template-columns: 1fr; gap: 8px; }
  .kpi .box { padding: 12px 10px; display: flex; align-items: center; justify-content: space-between; text-align: left; }
  .kpi .k { margin-bottom: 0; margin-right: 12px; }
  .kpi .v { font-size: 24px; }

  /* Sticky bar single column */
  .stickybar .inner { grid-template-columns: 1fr; }

  /* Buttons */
  .btn { padding: 10px 14px; font-size: 12px; }
  .btn.primary { width: 100%; justify-content: center; padding: 12px 20px; font-size: 14px; }

  /* Auth */
  .auth-wrap { margin-top: 20px; }
  .auth-wrap .card { padding: 24px 16px; }
  .auth-wrap h2 { font-size: 20px; }
  .auth-logo { height: 44px; }

  /* Form touch targets */
  input, select, textarea { padding: 13px 14px; font-size: 16px; }
  .radio label { padding: 10px 14px; }

  /* Score rows compact */
  .score-row { grid-template-columns: 60px 36px 1fr; gap: 8px; padding: 10px 0; }
  .score-label { font-size: 12px; }
  .score-value { font-size: 16px; }
  .score-words { display: none; }

  /* Grade badge */
  .grade { width: 44px; height: 44px; font-size: 24px; border-radius: 10px; }

  /* Footer */
  .footer { font-size: 11px; }
  .footer a { margin: 0 4px; }

  /* Flash message */
  .flash-msg { padding: 10px 12px; font-size: 12px; }

  /* Button groups: stack vertically */
  .btn-group { display: flex; flex-direction: column; gap: 8px; }
  .btn-group .btn { width: 100%; justify-content: center; }
}

/* ============================================================
   Touch & Accessibility
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn { min-height: 44px; }
  .lang-btn { padding: 6px 12px; min-height: 36px; display: inline-flex; align-items: center; }
  .check-item { padding: 12px 14px; }
  .check-item input[type="checkbox"] { width: 22px; height: 22px; }

  /* Disable hover transforms on touch */
  .card:hover { transform: none; box-shadow: var(--shadow); }
  .btn:hover { transform: none; }
  .price-card:hover { transform: none; }
  .kpi .box:hover { transform: none; }
  .feat-card:hover { transform: none; }
}

/* ---- Animations ---- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeInUp 0.4s ease forwards; }

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .animate-in { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---- Effects Off (user toggle) ---- */
body.no-effects .animate-in { animation: none; }
body.no-effects .btn-ripple { display: none; }
body.no-effects .btn:active,
body.no-effects .share-btn:active,
body.no-effects .summary-card:active { transform: none; }
body.no-effects .btn:not(:active) { transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition); }
body.no-effects .btn-success-flash { animation: none; }

/* ---- Settings Toggle ---- */
.settings-toggle {
  position: relative; display: inline-flex; align-items: center;
  margin-right: 4px;
}
.settings-toggle-btn {
  background: none; border: 1px solid var(--bd); border-radius: var(--radius-xs);
  padding: 5px 7px; cursor: pointer; color: var(--muted); font-size: 16px;
  line-height: 1; transition: border-color var(--transition), color var(--transition);
}
.settings-toggle-btn:hover { border-color: var(--pri); color: var(--txt); }
.settings-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: var(--card); border: 1px solid var(--bd); border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10); z-index: 100; min-width: 180px; padding: 8px 0;
}
.settings-dropdown.open { display: block; }
.settings-dropdown label {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  font-size: 13px; color: var(--txt); cursor: pointer; white-space: nowrap;
  transition: background var(--transition);
}
.settings-dropdown label:hover { background: var(--bg); }

/* ============================================================
   Debug Inspector Panel — Tabbed AI Engine Details
   ============================================================ */
.debug-panel {
  margin-top: 24px; border: 1px solid var(--bd); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); overflow: hidden;
}
.debug-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; cursor: pointer; user-select: none;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0; font-size: 13px; font-weight: 700; letter-spacing: 0.3px;
  transition: background var(--transition);
}
.debug-toggle:hover { background: linear-gradient(135deg, #1e293b 0%, #334155 100%); }
.debug-toggle .debug-icon { font-size: 16px; margin-right: 8px; }
.debug-toggle .chevron {
  display: inline-flex; transition: transform 0.3s ease; font-size: 12px;
}
.debug-panel.open .debug-toggle .chevron { transform: rotate(180deg); }
.debug-body { display: none; }
.debug-panel.open .debug-body { display: block; }

/* Debug Tabs */
.debug-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--bd);
  background: #f8fafc; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.debug-tab {
  padding: 10px 18px; font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer; border: none; background: transparent; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all var(--transition); letter-spacing: 0.2px;
}
.debug-tab:hover { color: var(--txt); background: rgba(0,0,0,0.02); }
.debug-tab.active {
  color: var(--pri); border-bottom-color: var(--pri); background: var(--card);
}
.debug-tab .tab-icon { margin-right: 6px; font-size: 14px; }
.debug-tab .tab-status {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-left: 6px; vertical-align: middle;
}
.tab-status-ok { background: var(--ok); }
.tab-status-warn { background: var(--warn); }
.tab-status-off { background: #cbd5e1; }

/* Debug Tab Content */
.debug-content { padding: 18px; display: none; }
.debug-content.active { display: block; animation: fadeInUp 0.25s ease; }

/* Debug Data Rows */
.debug-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 13px;
}
.debug-row:last-child { border-bottom: none; }
.debug-key {
  min-width: 140px; font-weight: 600; color: var(--txt-dim);
  font-size: 12px; letter-spacing: 0.2px; flex-shrink: 0;
}
.debug-val { color: var(--txt); word-break: break-all; }
.debug-val.mono { font-family: "SF Mono", "Fira Code", "Consolas", monospace; font-size: 12px; }
.debug-val .num { color: var(--pri); font-weight: 700; }
.debug-val .str { color: var(--ok); }
.debug-val .null { color: #94a3b8; font-style: italic; }

/* Debug Engine Card */
.engine-card {
  border: 1px solid var(--bd); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 10px; background: #fafbfc;
  transition: all var(--transition);
}
.engine-card:hover { border-color: var(--bd-light); box-shadow: var(--shadow); }
.engine-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.engine-status {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.engine-name { font-weight: 700; font-size: 13px; }
.engine-meta { font-size: 11px; color: var(--muted); margin-left: auto; }

/* Copy Button */
.copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-xs);
  border: 1px solid var(--bd); background: #fff;
  color: var(--muted); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.copy-btn:hover { border-color: var(--pri); color: var(--pri); }
.copy-btn.copied { border-color: var(--ok); color: var(--ok); }

/* JSON Display */
.json-pre {
  background: #0f172a; color: #e2e8f0; padding: 14px 16px;
  border-radius: var(--radius-sm); font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 11px; line-height: 1.6; overflow-x: auto; max-height: 400px;
  overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.json-pre .json-key { color: #7dd3fc; }
.json-pre .json-str { color: #86efac; }
.json-pre .json-num { color: #fbbf24; }
.json-pre .json-bool { color: #c084fc; }
.json-pre .json-null { color: #94a3b8; }

/* Debug metric grid */
.debug-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; margin-top: 8px;
}
.debug-metric {
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--bd); background: #fff; text-align: center;
}
.debug-metric .dm-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.debug-metric .dm-value { font-size: 20px; font-weight: 800; margin-top: 2px; }
.debug-metric .dm-sub { font-size: 11px; color: var(--muted); }

@media (max-width: 640px) {
  .debug-tabs { gap: 0; }
  .debug-tab { padding: 10px 12px; font-size: 11px; }
  .debug-key { min-width: 100px; }
  .debug-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Vet Report v2 — Modern Karte Design
   ============================================================ */
.karte-v2 { max-width: 900px; margin: 0 auto; }

/* Karte Header */
.karte-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e40af 100%);
  color: #fff; padding: 32px 28px; border-radius: var(--radius);
  margin-bottom: 24px; position: relative; overflow: hidden;
}
.karte-hero::before {
  content: ''; position: absolute; top: -40%; right: -10%;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.karte-hero::after {
  content: ''; position: absolute; bottom: -30%; left: -5%;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.03);
}
.karte-hero-inner { position: relative; z-index: 1; }
.karte-hero h2 { color: #fff; font-size: 24px; margin-bottom: 6px; letter-spacing: -0.3px; }
.karte-hero .sub-info { color: #93c5fd; font-size: 13px; line-height: 1.6; }
.karte-hero .report-label {
  position: absolute; top: 28px; right: 28px; z-index: 1;
  text-align: right;
}
.karte-hero .report-label div {
  font-size: 11px; color: rgba(255,255,255,0.6);
}
.karte-hero .shared-badge {
  display: inline-block; margin-top: 8px; padding: 4px 12px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  background: rgba(251,191,36,0.2); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3);
}

/* Karte Score Dashboard */
.karte-dash {
  display: grid; grid-template-columns: 200px 1fr; gap: 20px;
  margin-bottom: 24px;
}
.karte-score-ring {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px 16px;
  background: var(--card); border: 1px solid var(--bd);
  border-radius: var(--radius); text-align: center;
}
.score-circle {
  position: relative; width: 120px; height: 120px; margin-bottom: 10px;
}
.score-circle svg { transform: rotate(-90deg); }
.score-circle .track {
  fill: none; stroke: #e5e7eb; stroke-width: 8;
}
.score-circle .fill {
  fill: none; stroke-width: 8; stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}
.score-circle .score-text {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-circle .score-num {
  font-size: 32px; font-weight: 900; letter-spacing: -1px; line-height: 1;
}
.score-circle .score-label { font-size: 10px; color: var(--muted); margin-top: 4px; text-transform: uppercase; }

.karte-score-bars {
  background: var(--card); border: 1px solid var(--bd);
  border-radius: var(--radius); padding: 20px;
}
.karte-bar-row {
  display: grid; grid-template-columns: 80px 44px 1fr; align-items: center;
  gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.04);
}
.karte-bar-row:last-child { border-bottom: none; }
.karte-bar-label { font-size: 12px; font-weight: 600; color: var(--txt-dim); }
.karte-bar-val { font-size: 16px; font-weight: 800; text-align: center; }
.karte-bar-track { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.karte-bar-fill { height: 100%; border-radius: 999px; transition: width 0.8s ease; }

@media (max-width: 640px) {
  .karte-dash { grid-template-columns: 1fr; }
  .karte-score-ring { flex-direction: row; gap: 16px; padding: 16px; }
  .score-circle { width: 80px; height: 80px; margin-bottom: 0; }
  .score-circle .score-num { font-size: 22px; }
}

/* Karte Section Cards */
.karte-card {
  background: var(--card); border: 1px solid var(--bd);
  border-radius: var(--radius); margin-bottom: 20px;
  overflow: hidden; transition: all var(--transition);
}
.karte-card:hover { box-shadow: var(--shadow-md); }
.karte-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--bd);
  background: #fafbfc;
}
.karte-card-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.karte-card-icon.blue { background: var(--pri-light); color: var(--pri); }
.karte-card-icon.green { background: var(--ok-light); color: var(--ok); }
.karte-card-icon.amber { background: var(--warn-light); color: var(--warn); }
.karte-card-icon.red { background: var(--bad-light); color: var(--bad); }
.karte-card-icon.gray { background: #f3f4f6; color: #6b7280; }
.karte-card-title { font-size: 14px; font-weight: 700; }
.karte-card-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.karte-card-body { padding: 18px; }

/* Timeline v2 */
.timeline-v2 { padding-left: 24px; position: relative; }
.timeline-v2::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(180deg, var(--pri), var(--ok));
  border-radius: 1px;
}
.tl-item {
  position: relative; padding: 0 0 20px 0;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -20px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--pri);
  z-index: 1;
}
.tl-dot.green { border-color: var(--ok); }
.tl-dot.amber { border-color: var(--warn); }
.tl-dot.red { border-color: var(--bad); }
.tl-date { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.3px; }
.tl-body {
  margin-top: 6px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: #fafbfc; border: 1px solid var(--bd);
}
.tl-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tl-tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 600; border: 1px solid var(--bd);
  background: #fff;
}
.tl-diag {
  margin-top: 6px; padding: 6px 10px; font-size: 12px;
  background: #fffbeb; border-left: 3px solid #f59e0b;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

/* Karte empty state */
.karte-empty {
  text-align: center; padding: 24px 16px; color: var(--muted);
  font-size: 13px;
}
.karte-empty .empty-icon { font-size: 32px; margin-bottom: 8px; opacity: 0.4; }

/* Share Toolbar v2 */
.share-bar {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
  padding: 12px 16px; background: #fafbfc; border: 1px solid var(--bd);
  border-radius: var(--radius);
}
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: none; transition: all var(--transition);
  text-decoration: none;
}
.share-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.share-btn.pdf { background: #dc2626; color: #fff; }
.share-btn.pdf:hover { background: #b91c1c; }
.share-btn.email { background: var(--pri); color: #fff; }
.share-btn.email:hover { background: #1d4ed8; }
.share-btn.link { background: var(--ok); color: #fff; }
.share-btn.link:hover { background: #047857; }
.share-btn.print { background: #6b7280; color: #fff; }
.share-btn.print:hover { background: #4b5563; }

/* Karte Footer */
.karte-footer {
  margin-top: 32px; padding: 20px 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--bd); text-align: center;
  font-size: 11px; color: var(--muted); line-height: 1.6;
}

/* Karte Info Grid v2 */
.karte-info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px;
}
.karte-info-cell {
  padding: 14px; border-radius: var(--radius-sm);
  background: #fafbfc; border: 1px solid var(--bd);
}
.karte-info-cell .ki-label {
  font-size: 10px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.karte-info-cell .ki-value { font-size: 15px; font-weight: 700; color: var(--txt); }
.karte-info-cell.wide { grid-column: 1 / -1; }

/* Karte Print */
@media print {
  .karte-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .share-bar, .share-modal-overlay, .nav, .footer { display: none !important; }
  .karte-card { break-inside: avoid; }
  .debug-panel { display: none !important; }
}

@media (max-width: 480px) {
  .karte-hero { padding: 20px 16px; }
  .karte-hero h2 { font-size: 18px; }
  .karte-hero .report-label { position: static; text-align: left; margin-top: 12px; }
  .share-bar { flex-direction: column; }
  .share-btn { width: 100%; justify-content: center; }
  .karte-info-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   v16 — Button Satisfaction System (Oxytocin UX)
   Ripple + Bounce + Glow + Success state
   ============================================================ */

/* Ripple container — all buttons get ripple on click */
.btn, .share-btn, .summary-card, .horse-row {
  position: relative;
  overflow: hidden;
}
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
  transform: scale(0);
  animation: rippleOut 0.55s ease-out forwards;
  pointer-events: none;
  z-index: 1;
}
.btn.primary .btn-ripple { background: rgba(255,255,255,0.5); }
.summary-card .btn-ripple, .horse-row .btn-ripple {
  background: rgba(37,99,235,0.12);
}
@keyframes rippleOut {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

/* Press bounce — micro scale on active */
.btn:active, .share-btn:active, .summary-card:active {
  transform: scale(0.96);
  transition: transform 0.08s ease;
}
.btn:not(:active) { transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition); }

/* Primary button glow pulse on hover */
.btn.primary {
  transition: all var(--transition), box-shadow 0.3s ease;
}
.btn.primary:hover {
  box-shadow: 0 2px 8px rgba(37,99,235,0.25), 0 0 20px rgba(37,99,235,0.1);
}

/* Success flash — temporary green after action */
.btn.btn-success-flash {
  background: var(--ok) !important;
  border-color: var(--ok) !important;
  color: #fff !important;
  transform: scale(1.04);
  box-shadow: 0 0 16px rgba(5,150,105,0.3);
}

/* ============================================================
   v16 — Collapsible Sections
   ============================================================ */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
  transition: opacity var(--transition);
}
.collapsible-header:hover { opacity: 0.8; }
.collapse-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--bd);
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.25s ease, background var(--transition);
  flex-shrink: 0;
}
.collapsible-header:hover .collapse-chevron {
  background: var(--pri-light);
  color: var(--pri);
}
.collapsible-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  max-height: 2000px;
  opacity: 1;
}
.collapsible-body.collapsed {
  max-height: 0 !important;
  opacity: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.collapse-chevron.rotated {
  transform: rotate(-90deg);
}

/* Global page-level collapse toggle */
.page-collapse-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--bd);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  transition: all var(--transition);
}
.page-collapse-toggle:hover {
  background: var(--pri);
  color: #fff;
  border-color: var(--pri);
  transform: scale(1.1);
}
.page-collapse-toggle:active {
  transform: scale(0.95);
}

/* ============================================================
   v16 — First-time Onboarding CTA
   ============================================================ */
.onboard-hero {
  text-align: center;
  padding: 60px 24px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f4f8 50%, #f0fdf4 100%);
  border: 2px dashed var(--pri);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.onboard-icon {
  font-size: 64px;
  margin-bottom: 16px;
  line-height: 1;
}
.onboard-hero h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--txt);
}
.onboard-hero p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
.btn-onboard {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pri) 0%, #4f46e5 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
  position: relative;
  overflow: hidden;
}
.btn-onboard:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(37,99,235,0.4);
  color: #fff;
}
.btn-onboard:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

/* Confirm overlay */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.confirm-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.confirm-box h3 { margin-bottom: 8px; font-size: 16px; }
.confirm-box p { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (max-width: 480px) {
  .onboard-hero { padding: 40px 16px; }
  .onboard-icon { font-size: 48px; }
  .onboard-hero h2 { font-size: 20px; }
  .btn-onboard { padding: 14px 32px; font-size: 16px; width: 100%; justify-content: center; }
  .page-collapse-toggle { bottom: 12px; right: 12px; width: 40px; height: 40px; }
}
