:root {
  --bg: #f6f7f9;
  --card-bg: #ffffff;
  --text: #1c1e21;
  --muted: #5c6370;
  --border: #dde1e6;
  --primary: #2457c5;
  --primary-hover: #1c439c;
  --danger: #b3261e;
  --success: #1a7f37;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card-bg: #1e2126;
    --text: #e8eaed;
    --muted: #9aa0a8;
    --border: #33373f;
    --primary: #6fa1ff;
    --primary-hover: #8fb4ff;
    --success: #4caf50;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app { max-width: 960px; margin: 0 auto; padding: 24px 16px 80px; }
.login-card { max-width: 360px; margin: 80px auto; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

h1 { font-size: 1.4rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 16px 0 8px; color: var(--primary); }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.topbar button { font-size: 0.85rem; padding: 8px 14px; }

.field { margin-bottom: 16px; }
.field label.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"], .field input[type="password"], .field input[type="email"] {
  width: 100%; padding: 10px; font-size: 1rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--text);
}

button {
  font-size: 0.95rem; padding: 10px 18px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600;
}
button.primary { background: var(--primary); color: white; }
button.primary:hover { background: var(--primary-hover); }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--danger); color: white; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.error-text { color: var(--danger); font-size: 0.85rem; }

table.patient-list { width: 100%; border-collapse: collapse; }
table.patient-list th, table.patient-list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.patient-list tr.clickable { cursor: pointer; }
table.patient-list tr.clickable:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge.pending { background: #fde9c8; color: #8a5300; }
.badge.submitted { background: #d6e6ff; color: #1c439c; }
.badge.approved { background: #d3f2d8; color: var(--success); }
.badge.expired { background: #fddede; color: var(--danger); }

.journal-draft {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  max-height: 480px;
  overflow-y: auto;
}

.copy-row { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.disclaimer { font-size: 0.8rem; color: var(--muted); border-left: 3px solid var(--primary); padding-left: 10px; margin-top: 16px; }

.hidden { display: none; }
.mfa-qr-wrap { text-align: center; margin: 16px 0; }
.mfa-qr-image { max-width: 220px; }
.mfa-secret-hint { color: inherit; }
.hint { color: var(--muted); font-size: 0.85rem; }

.option-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; }
.option-row input { width: 18px; height: 18px; }

.recovery-codes-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin: 14px 0;
}
.recovery-codes-list span { padding: 2px 0; }
