/* Healthcare CRM — minimal, clean styling */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f8; color: #1c2430; }
a { color: #1a5fb4; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

.nav { background: #1c2430; color: #fff; padding: 12px 24px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav a { color: #d9e3f2; }
.nav-brand a { font-weight: 600; font-size: 18px; color: #fff; }
.nav-links { display: flex; gap: 14px; flex-grow: 1; margin-left: 24px; }
.nav-user { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.nav-user span { color: #a8b3c5; }
.btn-logout { background: #c0392b; padding: 6px 10px; border-radius: 4px; color: #fff !important; }

.footer { text-align: center; padding: 18px; color: #7a8599; }

h1 { margin-top: 0; }
.muted { color: #7a8599; }
.err { color: #c0392b; display: block; margin-top: 4px; font-size: 13px; }

.flash { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; }
.flash-success { background: #d4edda; color: #155724; }
.flash-error   { background: #f8d7da; color: #721c24; }
.flash-info    { background: #d1ecf1; color: #0c5460; }

/* Buttons */
.btn { display: inline-block; padding: 8px 14px; border: 1px solid #c7d0dc; background: #fff;
  border-radius: 4px; font-size: 14px; cursor: pointer; color: #1c2430; }
.btn:hover { background: #f0f3f8; text-decoration: none; }
.btn-primary { background: #1a5fb4; color: #fff; border-color: #1a5fb4; }
.btn-primary:hover { background: #154d92; }
.btn-danger { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-danger:hover { background: #9c2f22; }
.btn-link { border: none; background: transparent; color: #1a5fb4; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 8px; font-size: 13px; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 500; color: #3a4559; }
.input, .select, .textarea, input[type=text], input[type=password], input[type=email],
input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c7d0dc; border-radius: 4px; font-size: 14px;
  font-family: inherit; background: #fff;
}
.textarea, textarea { min-height: 80px; }
.input:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: #1a5fb4; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

fieldset { border: 1px solid #dde3ec; border-radius: 6px; padding: 16px; margin-bottom: 20px; background: #fff; }
legend { font-weight: 600; padding: 0 8px; color: #1c2430; }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }

/* Auth card */
.auth-card { max-width: 400px; margin: 80px auto; padding: 32px; background: #fff;
  border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.08); text-align: center; }
.auth-card h1 { margin: 0 0 8px; }
.auth-card form { text-align: left; margin-top: 20px; }

/* Dashboard cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin: 20px 0 30px; }
.card { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-number { font-size: 36px; font-weight: 600; color: #1a5fb4; }
.card-label { color: #7a8599; margin-top: 4px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); border-radius: 6px; overflow: hidden; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef1f5; font-size: 14px; }
.data-table th { background: #f4f6f8; font-weight: 600; color: #3a4559; }
.data-table tr:hover { background: #fafbfd; }
.data-table .actions a { margin-right: 10px; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar .input { flex-grow: 1; }

.pagination { display: flex; gap: 12px; justify-content: center; align-items: center; margin: 20px 0; }

/* Patient detail view */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px; }
.detail-grid section { background: #fff; padding: 16px; border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.detail-grid h3 { margin: 0 0 12px; font-size: 15px; color: #1a5fb4;
  border-bottom: 1px solid #eef1f5; padding-bottom: 6px; }
.dt-row { display: flex; padding: 6px 0; font-size: 14px; }
.dt-label { width: 45%; color: #7a8599; }
.dt-value { width: 55%; word-break: break-word; }

/* Audit tags */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.tag-create { background: #d4edda; color: #155724; }
.tag-update { background: #d1ecf1; color: #0c5460; }
.tag-delete { background: #f8d7da; color: #721c24; }
.tag-view   { background: #e2e3e5; color: #383d41; }
.tag-login  { background: #fff3cd; color: #856404; }
.tag-logout { background: #fff3cd; color: #856404; }
.tag-login_fail { background: #f8d7da; color: #721c24; }

/* Attendance filter bar */
.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  background: #fff; padding: 14px; border-radius: 6px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.filter-bar label { display: flex; flex-direction: column; font-size: 13px;
  color: #3a4559; font-weight: 500; min-width: 120px; }
.filter-bar .select, .filter-bar .input { margin-top: 4px; }

/* Table footer (totals) */
.data-table tfoot td { background: #f4f6f8; font-weight: 600; }
