/* ==========================================================================
   VetScribe — Design System  "Ruhige Klinik"
   Fraunces (display) + Hanken Grotesk (UI) · warm paper · calm petrol
   ========================================================================== */

:root {
  /* surfaces & ink */
  --paper:        oklch(0.984 0.006 80);
  --surface:      oklch(1 0 0);
  --surface-2:    oklch(0.978 0.006 80);
  --ink:          oklch(0.27 0.021 245);
  --ink-soft:     oklch(0.42 0.020 245);
  --muted:        oklch(0.555 0.018 245);
  --line:         oklch(0.912 0.008 85);
  --line-strong:  oklch(0.852 0.010 85);

  /* brand */
  --primary:      oklch(0.520 0.085 196);
  --primary-deep: oklch(0.430 0.090 200);
  --primary-ink:  oklch(0.360 0.072 200);
  --primary-soft: oklch(0.955 0.027 196);

  /* semantic */
  --accent:        oklch(0.700 0.120 65);
  --accent-ink:    oklch(0.470 0.105 62);
  --accent-soft:   oklch(0.957 0.038 75);
  --accent-line:   oklch(0.840 0.080 70);
  --approved:      oklch(0.560 0.110 150);
  --approved-ink:  oklch(0.405 0.100 150);
  --approved-soft: oklch(0.956 0.040 150);
  --approved-line: oklch(0.820 0.080 150);
  --danger:        oklch(0.555 0.170 25);
  --danger-ink:    oklch(0.470 0.160 25);
  --danger-soft:   oklch(0.960 0.035 25);
  --danger-line:   oklch(0.860 0.080 25);

  --r:     14px;
  --r-sm:  10px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px oklch(0.40 0.03 245 / 0.07), 0 1px 1px oklch(0.40 0.03 245 / 0.04);
  --shadow-md: 0 12px 32px -14px oklch(0.35 0.04 240 / 0.24), 0 2px 6px oklch(0.35 0.04 240 / 0.06);
  --shadow-lg: 0 36px 70px -28px oklch(0.30 0.05 240 / 0.34), 0 4px 12px oklch(0.30 0.05 240 / 0.08);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --maxw: 760px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.62;
  letter-spacing: -0.003em;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 100% -8%, oklch(0.62 0.06 196 / 0.10), transparent 58%),
    radial-gradient(880px 480px at -8% 108%, oklch(0.72 0.08 70 / 0.07), transparent 54%),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 560;
  line-height: 1.16;
  letter-spacing: -0.012em;
  color: var(--ink);
}
h1 { font-size: clamp(1.7rem, 1.32rem + 1.6vw, 2.15rem); }
h2 { font-size: 1.2rem; }
p { margin: 0 0 0.9em; max-width: 68ch; }
a { color: var(--primary-deep); text-underline-offset: 2px; }

.muted { color: var(--muted); margin: 0; }

/* ---------- App shell ---------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px clamp(16px, 4vw, 30px);
  background: oklch(1 0 0 / 0.74);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 2px 5px oklch(0.5 0.085 196 / 0.32)); }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.22rem;
  letter-spacing: -0.015em;
}
.brand-name b { color: var(--primary-deep); font-weight: 600; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav form { margin: 0; }
.nav-link {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 550;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-link:hover { background: var(--primary-soft); color: var(--primary-deep); }

/* ---------- Content ------------------------------------------------------ */
.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(26px, 4vw, 46px) clamp(16px, 4vw, 28px) 56px;
}
.content > * { animation: rise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.content > *:nth-child(1) { animation-delay: 0.03s; }
.content > *:nth-child(2) { animation-delay: 0.09s; }
.content > *:nth-child(3) { animation-delay: 0.15s; }
.content > *:nth-child(4) { animation-delay: 0.21s; }
.content > *:nth-child(5) { animation-delay: 0.27s; }
.content > *:nth-child(n+6) { animation-delay: 0.32s; }

.content > header { margin-bottom: 30px; }
.content > header h1 { display: flex; align-items: center; gap: 12px; }
.species {
  display: inline-block;
  margin: 10px 0 0;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------- Cards & generic sections ------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: clamp(20px, 3vw, 28px);
}
.prose p { color: var(--ink-soft); }

/* ---------- Forms -------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 4px; }
label, .field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 16px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.012em;
  color: var(--ink-soft);
}
.field-label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.003em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: oklch(0.72 0.012 245); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-soft);
}
textarea { resize: vertical; min-height: 122px; line-height: 1.55; }
textarea:disabled, input:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}

/* ---------- Buttons ------------------------------------------------------ */
button, .btn {
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: -0.003em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  color: oklch(1 0 0);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-deep) 100%);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.16s ease, filter 0.16s ease, background 0.16s;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); filter: saturate(1.05); }
button:active, .btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3.5px var(--primary-soft), var(--shadow-sm); }
button:disabled, .btn:disabled {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
  filter: none;
}
.btn-block { width: 100%; }

.btn-secondary, button.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--primary-deep); border-color: var(--primary); }

/* ---------- Banners ------------------------------------------------------ */
.draft-banner, .approved-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 17px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.94rem;
  margin: 0 0 26px;
  box-shadow: var(--shadow-sm);
}
.draft-banner::before, .approved-banner::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
}
.draft-banner {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid var(--accent-line);
}
.draft-banner::before { background: var(--accent); box-shadow: 0 0 0 4px oklch(0.70 0.12 65 / 0.18); }
.approved-banner {
  background: var(--approved-soft);
  color: var(--approved-ink);
  border: 1px solid var(--approved-line);
}
.approved-banner::before { background: var(--approved); box-shadow: 0 0 0 4px oklch(0.56 0.11 150 / 0.18); }

.alert {
  margin: 4px 0 2px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger-ink);
  border: 1px solid var(--danger-line);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---------- Report export bar + editor ----------------------------------- */
.export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  margin: 0 0 28px;
}
.export a {
  font-weight: 600;
  font-size: 0.94rem;
  text-decoration: none;
  color: var(--primary-deep);
  padding: 9px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s;
}
.export a:hover { background: var(--primary-soft); border-color: var(--primary); }
.export #copy-status, #copy-status { color: var(--muted); font-size: 0.88rem; font-weight: 500; margin: 0; }

.report-edit section { margin: 0 0 18px; }
.report-edit h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 560;
  color: var(--primary-ink);
  margin: 0 0 9px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.actions button[formaction*="approve"] {
  background: linear-gradient(180deg, var(--approved) 0%, var(--approved-ink) 100%);
}

/* ---------- Recorder ----------------------------------------------------- */
#recorder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: clamp(22px, 3vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  margin: 0 0 24px;
}
#record-btn { font-size: 1rem; padding: 13px 24px; }
#record-btn.recording {
  background: linear-gradient(180deg, var(--danger) 0%, var(--danger-ink) 100%);
  animation: pulse 1.4s ease-in-out infinite;
}
#recorder-status { color: var(--muted); margin: 0; min-height: 1.3em; font-size: 0.95rem; font-weight: 500; }

/* ---------- Transcript --------------------------------------------------- */
.transcript, #transcript { display: flex; flex-direction: column; gap: 10px; }
.transcript p, #transcript p {
  margin: 0;
  max-width: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-sm);
  padding: 11px 15px;
  box-shadow: var(--shadow-sm);
}
.transcript p strong, #transcript p strong { color: var(--primary-deep); font-weight: 600; }

/* ---------- Auth (login) ------------------------------------------------- */
body.auth { display: grid; place-items: center; padding: 24px; }
body.auth .content { width: 100%; max-width: 430px; padding: 0; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--r) + 4px);
  box-shadow: var(--shadow-lg);
  padding: clamp(28px, 5vw, 40px);
  animation: rise 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.auth-title { font-size: 1.62rem; margin: 0 0 6px; }
.auth-sub { color: var(--muted); margin: 0 0 26px; font-size: 0.98rem; }

/* ---------- Footer ------------------------------------------------------- */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 28px) 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary-deep); }

/* ---------- Dashboard ---------------------------------------------------- */
.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-head h1 { margin-bottom: 4px; }
.consult-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.consult-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.12s, box-shadow 0.16s, border-color 0.16s;
}
.consult-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.consult-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.consult-name { font-family: var(--font-display); font-size: 1.18rem; font-weight: 560; color: var(--ink); }
.consult-card .species { margin: 0; }
.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip-approved { background: var(--approved-soft); color: var(--approved-ink); border: 1px solid var(--approved-line); }
.chip-draft { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); }
.chip-rec { background: var(--primary-soft); color: var(--primary-ink); border: 1px solid oklch(0.85 0.05 196); }
.chip-pending { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-strong); }
.empty-state { text-align: center; padding: 48px 28px; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state .btn { margin-top: 18px; }

/* ---------- Report actions (record page) --------------------------------- */
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 6px 0 4px;
}
#generate-status { width: 100%; color: var(--muted); font-size: 0.9rem; font-weight: 500; margin: 0; }

/* ---------- Motion ------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: 0.78; transform: scale(0.99); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; }
}

@media (max-width: 600px) {
  .site-header { padding-inline: 16px; }
  .actions button, .actions .btn { flex: 1 1 auto; }
}
