*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --primary: #1e40af;
  --primary-hover: #1e3a8a;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #d1d5db;
  --radius: 8px;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --gray: #6b7280;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
header {
  background: var(--primary);
  color: white;
  padding: 16px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}
main {
  flex: 1;
  padding: 16px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.card + .card { margin-top: 12px; }
label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30,64,175,.2);
}
.field + .field { margin-top: 12px; }
button, .btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--primary-hover); }
button:disabled, .btn:disabled { opacity: .65; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm {
  padding: 8px 16px;
  width: auto;
  font-size: .875rem;
}
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
  vertical-align: middle;
  line-height: 1.3;
}
.badge-admitted { background: #dbeafe; color: #1d4ed8; }
.badge-discharged { background: #dcfce7; color: #15803d; }
.badge-transferred { background: #fef3c7; color: #92400e; }
.badge-deceased { background: #fee2e2; color: #991b1b; }
.badge-released { background: #f3e8ff; color: #6b21a8; }
.text-muted { color: var(--text-muted); font-size: .875rem; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.gap-4 { gap: 16px; }
.error { color: var(--danger); font-size: .875rem; margin-top: 4px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state h2 { font-size: 1.25rem; margin-bottom: 8px; color: var(--text); }
.nav-link { color: white; text-decoration: none; font-size: .875rem; }
.nav-link:hover { text-decoration: underline; }
.result-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.result-item:last-child { border-bottom: none; }
.result-item h3 { font-size: 1rem; }
.result-item p { font-size: .875rem; color: var(--text-muted); }
.result-meta { font-size: .8125rem; color: var(--text-muted); margin-top: 4px; }
.result-meta span + span::before { content: " \2022 "; color: var(--border); }
.note-bullets { list-style: none; padding: 0; margin: 4px 0 0; font-size: .8125rem; color: var(--text-muted); }
.note-bullets li::before { content: "\2022 "; color: var(--text-muted); }
.note-more { font-size: .75rem; color: var(--text-muted); font-style: italic; }
.note-more::before { content: "" !important; }
.pw-wrapper { position: relative; }
.pw-wrapper input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text-muted); width: auto; border-radius: 4px;
}
.pw-toggle:hover { color: var(--text); background: none; }
.hospital-suggestions { border: 1px solid var(--border); border-radius: var(--radius); max-height: 200px; overflow-y: auto; background: white; margin-top: 4px; }
.hospital-suggestion { padding: 8px 12px; cursor: pointer; font-size: .875rem; border-bottom: 1px solid var(--border); }
.hospital-suggestion:last-child { border-bottom: none; }
.hospital-suggestion:hover { background: var(--bg); }
.pw-toggle .eye-closed { display: none; }
.table-wrap { overflow-x: auto; margin: 0 -8px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .8125rem; min-width: 420px; }
.table-wrap th, .table-wrap td { text-align: left; padding: 8px 8px; white-space: nowrap; }
.table-wrap thead { border-bottom: 2px solid var(--border); }
.table-wrap th { font-weight: 600; color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
.table-wrap tbody tr { border-bottom: 1px solid var(--border); }
.table-wrap tbody tr:last-child { border-bottom: none; }
.table-wrap .cell-notes { max-width: 160px; white-space: normal; overflow: hidden; text-overflow: ellipsis; }
footer {
  background: #1f2937;
  color: #9ca3af;
  padding: 24px 16px;
  font-size: .75rem;
  line-height: 1.5;
  text-align: center;
}
footer .version {
  color: #9ca3af;
  font-size: .6875rem;
  margin-top: 12px;
}
@media print {
  header, footer, .btn, .nav-link, .pagination { display: none !important; }
  body { background: white; color: black; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .result-item { break-inside: avoid; }
  a[href]::after { content: none; }
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #374151;
}

.footer-links a {
  color: white;
  text-decoration: none;
  font-size: .8125rem;
  background: #374151;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background .15s;
}

.footer-links a:hover { background: #4b5563; }

.contact-card + .contact-card { margin-top: 8px; }

@media (max-width: 360px) {
  main { padding: 12px; }
  .card { padding: 16px; }
}