:root {
  --bg: #f4efe6;
  --surface: #fffaf3;
  --surface-strong: #ffffff;
  --text: #172126;
  --muted: #647079;
  --line: #d9cdbc;
  --accent: #0f6c63;
  --accent-soft: #d8ece8;
  --danger: #b65044;
  --shadow: 0 20px 40px rgba(44, 47, 49, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(15, 108, 99, 0.12), transparent 30%),
    linear-gradient(180deg, #f8f1e8 0%, #f4efe6 100%);
}

a { color: inherit; }

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #16343a;
  color: #f6f2eb;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand h1, .page-header h2, .card h3, .patient-banner h3 {
  margin: 0;
  font-weight: 600;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
}

.sidebar .eyebrow { color: rgba(255, 255, 255, 0.64); }

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav a, .button-link, button {
  border-radius: 14px;
  padding: 12px 16px;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.nav a { background: rgba(255, 255, 255, 0.08); }
.nav a:hover, .button-link:hover, button:hover { transform: translateY(-1px); }

.sidebar-footer { margin-top: auto; font-size: 0.95rem; }
.sidebar-footer p { margin-bottom: 8px; }
.content { padding: 28px; }
.page-header { margin-bottom: 24px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: rgba(255, 250, 243, 0.9);
  border: 1px solid rgba(217, 205, 188, 0.7);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.metric strong { font-size: 2rem; }

.section-head, .actions, .patient-banner, .search-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.button-link, button {
  background: var(--accent);
  color: white;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.button-danger {
  background: var(--danger);
}

.button-small {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bulk-action-buttons {
  display: flex;
  gap: 12px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkbox-inline input,
.patient-checkbox {
  width: auto;
}

.stack { display: grid; gap: 18px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .full { grid-column: 1 / -1; }

label { display: grid; gap: 8px; font-size: 0.95rem; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
}

textarea { resize: vertical; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.list { display: grid; }

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  align-items: center;
}

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

.alert {
  background: var(--accent-soft);
  border: 1px solid rgba(15, 108, 99, 0.15);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 16px;
}

.alert-error {
  background: rgba(182, 80, 68, 0.12);
  border-color: rgba(182, 80, 68, 0.25);
  color: var(--danger);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  background: rgba(255, 250, 243, 0.94);
  border: 1px solid rgba(217, 205, 188, 0.7);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 18px;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: 20px; }
  .content { padding: 18px; }
}

@media (max-width: 720px) {
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .section-head, .actions, .patient-banner, .search-form, .list-row, .bulk-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .bulk-action-buttons {
    flex-direction: column;
  }
}
