/* SBHIS Clinics — mobile-first. The agent view is the primary target: it must be usable
   one-handed, in a clinic lobby, in under two minutes. */

:root {
  --bg: #0b1220;
  --panel: #111a2e;
  --border: #22304d;
  --text: #e6edf7;
  --muted: #9fb0cf;
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body.centered {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 1rem;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 1rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

/* ---- Top navigation (shared partial) ---- */
.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  margin-right: 0.75rem;
  white-space: nowrap;
}
.nav-link {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.is-active { background: var(--blue-2); color: #fff; }
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.card-login { max-width: 26rem; text-align: center; }

.h1 { font-size: 1.25rem; margin: 0 0 0.5rem; }
.h2 { font-size: 1rem; margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.bad { color: var(--red); }
.req { color: var(--red); }
.link { color: var(--blue); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

.label { display: block; font-weight: 600; margin: 1rem 0 0.35rem; }

.input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.btn {
  display: inline-block;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--blue-2); border-color: var(--blue-2); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue); }

/* Full-width, thumb-sized: the two actions that matter on a phone. */
.btn-lg { display: block; width: 100%; padding: 1rem; margin-top: 1rem; font-size: 1.05rem; }

/* 44px minimum — these get tapped repeatedly during a shift. */
.btn-round {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
}

.counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.counter:last-child { border-bottom: 0; }
.counter-controls { display: flex; align-items: center; gap: 0.75rem; }
.counter-controls output {
  min-width: 2.5ch;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fieldset { border: 0; padding: 0; margin: 1rem 0 0; }

.stars { display: flex; gap: 0.25rem; }
.star input { position: absolute; opacity: 0; width: 0; height: 0; }
.star span {
  display: inline-block;
  font-size: 2rem;
  line-height: 1;
  padding: 0.25rem;
  color: var(--border);
  cursor: pointer;
}
/* Light up the chosen star and every one before it. */
.stars:not(:hover) .star:has(~ .star input:checked) span,
.star:has(input:checked) span { color: var(--amber); }
.star input:focus-visible + span { outline: 2px solid var(--blue); border-radius: 4px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0;
  cursor: pointer;
}
.check input { margin-top: 0.25rem; width: 18px; height: 18px; flex: none; }

.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill.ok   { color: var(--green); border-color: var(--green); }
.pill.warn { color: var(--amber); border-color: var(--amber); }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table th, .table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
  z-index: 100;
}
.toast.ok  { border-color: var(--green); }
.toast.bad { border-color: var(--red); }

/* ---- Admin pages: modal dialog + form helpers ---- */
.dialog {
  width: min(560px, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 1.25rem;
}
.dialog::backdrop { background: rgb(0 0 0 / 0.55); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

.row-end {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.row-muted { opacity: 0.55; }

.btn.small { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

.scope-box {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.85em;
}
