:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg: #f3f4f6;
  --bg-page: #f8fafc;
  --card: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --sidebar-w: 240px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --purple: #7c3aed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg-page);
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

button,
.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.btn-green {
  background: var(--green);
  color: #fff;
}

.btn-red {
  background: var(--red);
  color: #fff;
}

.btn-yellow {
  background: #ca8a04;
  color: #fff;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

input,
select,
textarea {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
  background: #fff;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

label.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.field {
  margin-bottom: 16px;
}

/* Proto radio — shared horizontal option row */
.proto-radio-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  padding-top: 4px;
}

.proto-radio-row--vertical {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.proto-radio-option {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  font-weight: 400;
  line-height: 1.25;
  cursor: pointer;
  user-select: none;
}

.proto-radio-option input[type="radio"] {
  margin: 0;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.proto-radio-label {
  font-size: 14px;
  line-height: 1.25;
  color: #374151;
}

.proto-radio-option--icon input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.proto-radio-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  line-height: 0;
  border-radius: 50%;
  box-sizing: border-box;
}

.proto-radio-img {
  width: 20px;
  height: 20px;
  display: block;
}

.proto-radio-option--icon:has(input:checked) .proto-radio-icon {
  box-shadow: 0 0 0 2px var(--primary);
}

.proto-radio-option:has(input:focus-visible) .proto-radio-icon {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Language toggle (sidebar + public pages) */
.proto-lang-toggle {
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}

.sidebar-lang-toggle {
  width: 100%;
  margin-top: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--primary);
  font-weight: 600;
}

.sidebar-lang-toggle:hover {
  background: var(--primary-light);
}

.public-lang-slot {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 50;
}

.public-lang-toggle {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.public-lang-toggle:hover {
  background: var(--primary-light);
}

.landing-lang-toggle {
  padding: 6px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-weight: 600;
}

.landing-lang-toggle:hover {
  background: #f1f5f9;
}

#app-root {
  min-height: 100vh;
}

/* Landing */
.page-landing {
  min-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #eef6ff 0%, #f8fafc 40%);
}

.landing-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 20px;
  padding: 8px 0 24px;
  min-height: 0;
  box-sizing: border-box;
}

.landing-hero {
  text-align: center;
  padding: 0 24px;
  max-width: 900px;
  margin: 0 auto;
  flex-shrink: 0;
}

.landing-role-section {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 24px;
  width: 100%;
  box-sizing: border-box;
}

.landing-hero h1 {
  font-size: 1.75rem;
  margin: 0 0 10px;
  color: #0f172a;
}

.landing-hero p {
  color: var(--text-muted);
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.5;
}

.landing-hero p:last-of-type {
  margin-bottom: 0;
}

.landing-top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 10px 48px 0;
}

.landing-login-link {
  background: #fff;
}

.landing-has-account {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  flex-shrink: 0;
}

.landing-has-account a {
  color: var(--primary);
  font-weight: 600;
}

.landing-logo {
  text-align: left;
  padding: 8px 48px 0;
  color: var(--primary);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 600;
  flex-shrink: 0;
}

.role-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
  max-width: min(1280px, 96vw);
  margin: 0 auto;
  padding: 0;
}

.role-card {
  background: var(--card);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 28px 20px 24px;
  text-align: center;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.role-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  line-height: 0;
  background: transparent;
}

.role-card-icon .proto-icon {
  width: 112px;
  height: 112px;
}

.role-card h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
}

.landing-role-btn {
  min-width: 132px;
  padding: 10px 24px !important;
  font-size: 14px;
  font-weight: 600;
}

/* Auth — login & register complete */
.auth-page {
  min-height: calc(100vh - 44px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background: linear-gradient(180deg, #eef6ff 0%, #f1f5f9 100%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.auth-lead {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 20px;
}

.auth-sub {
  font-size: 13px;
  color: #374151;
  margin: 0 0 16px;
}

.auth-back-top {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
}

.auth-role-badge {
  font-size: 13px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 20px;
}

.auth-form .field {
  margin-bottom: 14px;
}

.btn-block {
  width: 100%;
  margin-top: 8px;
}

.auth-demo-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 16px 0 0;
  line-height: 1.5;
}

.auth-switch-role {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}

.auth-switch-role a {
  color: var(--primary);
}

.auth-success {
  text-align: center;
  max-width: 520px;
}

.auth-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 28px;
  line-height: 56px;
  font-weight: 700;
}

.auth-role-picks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-role-btn {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
  text-align: center;
}

.auth-role-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}

.auth-back {
  font-size: 13px;
  color: var(--primary);
}

.landing-footer {
  margin-top: 0;
  background: #0f172a;
  color: #94a3b8;
  padding: 20px 48px 16px;
  flex-shrink: 0;
}

.landing-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid #334155;
  padding-bottom: 12px;
  margin-bottom: 10px;
}

.landing-footer nav a {
  color: #cbd5e1;
  margin-left: 20px;
  font-size: 13px;
}

.landing-footer .copy {
  text-align: center;
  width: 100%;
  font-size: 12px;
}

@media (max-height: 780px) {
  .landing-body {
    justify-content: flex-start;
    padding-top: 4px;
    gap: 14px;
  }
}

/* App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: block;
  padding: 20px 20px 12px;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
  text-decoration: none;
}

a.sidebar-brand:hover {
  color: var(--primary);
  opacity: 0.85;
}

.sidebar-brand.script {
  font-style: italic;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #374151;
  margin-bottom: 2px;
  font-size: 14px;
}

.nav-item:hover {
  background: #f3f4f6;
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-left: 3px solid var(--primary);
  padding-left: 9px;
  border-radius: 0 8px 8px 0;
}

.proto-icon {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.proto-icon-light {
  filter: brightness(0) invert(1);
}

.proto-icon-inline {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.avatar-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-top-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #93c5fd, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-box-ico {
  flex-shrink: 0;
  margin-top: 1px;
}

.btn-health-q .proto-icon-inline {
  filter: brightness(0) invert(1);
}

.btn-icon-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
}

.icon-action {
  display: inline-block;
  vertical-align: middle;
  opacity: 0.75;
}

.icon-action:hover {
  opacity: 1;
}

a.icon-btn-link,
button.icon-btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.kpi-ico,
.stat-ico {
  display: flex;
  align-items: center;
  justify-content: center;
}

.rpt-icon-img {
  margin: 0 auto;
}

.sidebar-user {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user-link {
  display: block;
  width: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.sidebar-user-link:hover {
  background: #f1f5f9;
}

.sidebar-user-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.sidebar-user-row {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 4px 2px;
  box-sizing: border-box;
}

.sidebar-logout {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
}

.sidebar-logout:hover {
  background: #f8fafc;
  color: #0f172a;
}

.sidebar-user .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #93c5fd, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-user .meta {
  font-size: 12px;
}

.sidebar-user .meta strong {
  display: block;
  font-size: 13px;
}

.sidebar-user .meta .role,
.sidebar-user .meta span:not(.role) {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.main {
  flex: 1;
  padding: 24px 28px 40px;
  overflow-x: auto;
  background: var(--bg);
}

.page-header {
  margin-bottom: 20px;
}

.page-header.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
}

.page-header .subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
}

.page-header .toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-input {
  max-width: 280px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.kpi-card .label {
  color: var(--text-muted);
  font-size: 13px;
}

.kpi-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0;
}

.kpi-card .trend {
  font-size: 12px;
}

.trend.up {
  color: var(--green);
}

.trend.down {
  color: var(--red);
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th {
  text-align: left;
  padding: 12px 10px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

table.data-table tr:hover td {
  background: #fafafa;
}

.avatar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.avatar-case {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  background: #e2e8f0;
}

.sidebar-user .sidebar-avatar.avatar-case {
  width: 40px;
  height: 40px;
}

.settings-top-avatar.avatar-case,
.privileges-user-avatar.avatar-case {
  width: 36px;
  height: 36px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-orange {
  background: #ffedd5;
  color: #c2410c;
}

.badge-red {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-gray {
  background: #f3f4f6;
  color: #4b5563;
}

.action-links a {
  margin-right: 10px;
  font-size: 13px;
  font-weight: 500;
}

.action-links .view {
  color: var(--primary);
}

.action-links .edit {
  color: var(--green);
}

.action-links .account {
  color: #ca8a04;
}

.action-links .del {
  color: var(--red);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.pagination-unified {
  width: 100%;
}

.pagination-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.pagination-summary {
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination .pages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.toolbar .btn,
.toolbar a.btn,
.page-header.row .toolbar .btn-primary,
.members-list-head .toolbar .btn,
.logs-title-tools .btn-primary,
.org-search-row .btn-primary,
.btn-nowrap {
  white-space: nowrap;
  flex-shrink: 0;
}

.pagination .page-num {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.pagination .page-num.active {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* Form pages */
.form-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.form-page .back-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.form-page .back-row h1 {
  margin: 0;
  font-size: 1.35rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  background: #fafafa;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}

.toggle {
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 999px;
  position: relative;
}

.toggle.on {
  background: var(--primary);
}

.toggle::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
}

.toggle.on::after {
  left: 23px;
}

/* Queue cards */
.date-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.date-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.date-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.queue-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.queue-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.queue-card-head-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.queue-card-avatar {
  border-radius: 10px;
}

.queue-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.queue-meta .lbl {
  color: var(--text-muted);
  font-size: 11px;
  display: block;
}

.queue-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.queue-actions-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.queue-record-bottom {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.queue-page-header-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  min-width: 0;
}

.queue-page-header-main h1 {
  margin: 0;
}

.queue-status-tabs {
  margin: 0;
  border-bottom: none;
}

.queue-status-tabs .tab {
  padding: 6px 14px;
  font-size: 13px;
}

.queue-empty-card {
  padding: 28px 20px;
  text-align: center;
}

.referral-records-toolbar-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.referral-pending-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.referral-clear-patient-filter {
  margin-left: 8px;
  font-size: 13px;
}

.queue-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.queue-card-time {
  text-align: right;
}

.queue-time-label {
  font-size: 11px;
  color: var(--text-muted);
}

.queue-seq-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: #eff6ff;
  border-radius: 999px;
  vertical-align: middle;
}

.queue-meta-extended {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 1100px) {
  .queue-meta-extended {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.queue-no {
  font-weight: 700;
  color: var(--primary);
  font-size: 14px;
}

.queue-patient-name-link {
  color: #0f172a;
  text-decoration: none;
}

.queue-patient-name-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Settings cards */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.settings-card .icon-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 18px;
}

.settings-card h3 {
  margin: 0 0 4px;
}

.settings-card .sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.settings-card p {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.settings-card .btns {
  display: flex;
  gap: 8px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 18px;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-pills .tab {
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  margin-right: 4px;
  margin-bottom: 0;
}

.tab-pills .tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.vitals-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.vital-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.star {
  color: #fbbf24;
  letter-spacing: 1px;
}

.severity-bar {
  height: 6px;
  background: #fecaca;
  border-radius: 3px;
  max-width: 80px;
}

.map-placeholder {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-radius: var(--radius);
  min-height: 220px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #065f46;
  font-weight: 600;
}

.alert-box {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}

.alert-critical {
  background: #fef2f2;
  border-left: 4px solid var(--red);
  color: #991b1b;
}

.alert-warn {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  color: #92400e;
}

.status-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.status-connected {
  background: #dcfce7;
  color: #166534;
}

.status-disconnected {
  background: #fee2e2;
  color: #b91c1c;
}

.status-intermittent {
  background: #ffedd5;
  color: #c2410c;
}

/* Add New Member (1.1) */
.member-form-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 24px;
  background: var(--bg-page);
  min-height: calc(100vh - 44px);
}

.member-form-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0 24px;
}

.member-form-header .back-link {
  position: absolute;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.member-form-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.member-form-page .section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.member-form-page .section-card > h2 {
  margin: 0 0 20px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.member-basic-layout {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 28px;
  align-items: start;
}

.member-photo-block {
  text-align: center;
}

.member-photo-circle {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  margin: 0 auto 10px;
}

.member-photo-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 140px;
  margin: 0 auto;
}

.member-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.member-fields-grid .span-full {
  grid-column: 1 / -1;
}


.dob-field-wrap {
  position: relative;
}

.dob-field-wrap input {
  padding-right: 36px;
}

.dob-field-wrap .cal-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
  font-size: 14px;
}

.plan-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 56px;
  padding: 8px 0 4px;
}

.plan-option {
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
}

.plan-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 26px;
  color: #9ca3af;
  transition: border-color 0.15s, color 0.15s;
}

.plan-option .plan-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.plan-option.selected .plan-circle {
  border-color: #f97316;
  color: #f97316;
}

.plan-option.selected .plan-label {
  color: #ea580c;
}

.history-block {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #f3f4f6;
}

.history-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.history-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
}

.history-block-manual {
  margin-top: 12px;
}

.history-block-manual[hidden] {
  display: none !important;
}

.history-block-head .title {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  flex: 1;
}

.history-block .manual-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.history-block textarea {
  min-height: 72px;
  font-size: 13px;
}

.health-q-desc {
  color: #4b5563;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.btn-health-q {
  background: #22c55e;
  color: #fff;
  border: none;
  padding: 10px 20px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
}

.btn-health-q:hover {
  background: #16a34a;
  color: #fff;
}

/* Health questionnaire (PC, aligned to mobile survey UI) */
.health-questionnaire-page {
  max-width: 680px;
}

.health-questionnaire-page .member-form-header {
  padding-bottom: 16px;
}

.hq-progress-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.hq-progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
}

.hq-progress-count {
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
}

.hq-progress-track {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.hq-progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.hq-form {
  margin: 0;
}

.hq-question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.hq-question-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.hq-q-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hq-q-text {
  margin: 5px 0 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  color: #0f172a;
}

.hq-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hq-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  line-height: 1.4;
}

.hq-option:hover {
  background: #f9fafb;
}

.hq-option input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #2563eb;
}

.hq-option-letter {
  font-weight: 600;
  flex-shrink: 0;
}

.hq-option-text {
  flex: 1;
}

.hq-submit-row {
  padding: 6px 0 32px;
}

.hq-submit-btn {
  width: 100%;
  justify-content: center;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
}

/* Health questionnaire — thank you (PC) */
.hq-complete-page {
  max-width: 640px;
  padding-bottom: 40px;
}

.hq-complete-hero {
  text-align: center;
  padding: 12px 8px 28px;
}

.hq-complete-hero h1 {
  margin: 0 0 14px;
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
}

.hq-complete-lead {
  margin: 0 auto;
  max-width: 520px;
  font-size: 15px;
  line-height: 1.65;
  color: #4b5563;
}

.hq-complete-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.hq-complete-card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.hq-complete-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #4b5563;
}

.hq-complete-notice {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.hq-complete-notice h2 {
  color: #1d4ed8;
}

.hq-complete-notice p {
  color: #1e40af;
}

.hq-complete-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 16px;
}

.hq-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: filter 0.15s ease;
}

.hq-pill:hover {
  filter: brightness(0.96);
}

.hq-pill-purple {
  background: #f3e8ff;
  color: #7c3aed;
  border-color: #e9d5ff;
}

.hq-pill-blue {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.hq-pill-green {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.hq-complete-register-link {
  text-align: center;
  margin: 0 0 28px;
}

.hq-complete-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  padding: 20px 12px 8px;
  border-top: 1px solid #e5e7eb;
  margin-top: 8px;
}

.hq-complete-footer-nav a {
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
}

.hq-complete-footer-nav a:hover {
  color: var(--primary);
}

.notes-area {
  min-height: 120px;
}

.member-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 8px 0 32px;
}

.member-form-footer .btn-cancel {
  min-width: 100px;
  justify-content: center;
  background: #fff;
  border-color: #d1d5db;
}

.member-form-footer .btn-save {
  min-width: 100px;
  justify-content: center;
}

@media (max-width: 768px) {
  .member-basic-layout {
    grid-template-columns: 1fr;
  }

  .member-photo-block {
    margin-bottom: 8px;
  }

  .member-fields-grid {
    grid-template-columns: 1fr;
  }

  .plan-row {
    gap: 24px;
    flex-wrap: wrap;
  }
}

@media (max-width: 1200px) {
  .role-cards,
  .kpi-row,
  .grid-4,
  .queue-meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }

  .role-cards,
  .kpi-row,
  .grid-2,
  .grid-3,
  .grid-4,
  .queue-meta,
  .vitals-row {
    grid-template-columns: 1fr;
  }
}
