/* Mi Collar — minimal, mobile-first styles. */

* { box-sizing: border-box; }

:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #111111;
  --primary-fg: #ffffff;
  --accent: #2563eb;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --ok: #047857;
  --warn: #b45309;
  --card-bg: #f9fafb;
  --radius: 12px;
}

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

body { padding: env(safe-area-inset-top) env(safe-area-inset-right)
  env(safe-area-inset-bottom) env(safe-area-inset-left); max-width: 720px; margin: 0 auto; }

h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.5rem; margin: 1rem 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 1rem 0 0.5rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

main { padding: 1rem; }

.page-header { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.nav { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.nav-link { color: var(--fg); padding: 0.25rem 0.5rem; border-radius: 6px; }
.nav-link.active { background: var(--card-bg); }
.nav-admin { font-size: 0.95rem; }
.nav-logout { margin-left: auto; color: var(--error); }

.card { background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.card-header { font-size: 1.05rem; margin-bottom: 0.5rem; }
.card-body { display: flex; flex-direction: column; gap: 0.5rem; }
.card-footer { margin-top: 0.75rem; }

.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field input, .field textarea, .field select {
  font: inherit; padding: 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--fg); width: 100%;
}
.field input[type="range"] { padding: 0; }
.q-label { font-weight: 600; }
.required-marker { color: var(--error); }
.help-text { color: var(--muted); font-size: 0.9rem; }
.field-error { color: var(--error); font-size: 0.9rem; }

.radio-group { display: flex; gap: 1.5rem; }
.radio-label { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }

.btn { font: inherit; cursor: pointer; padding: 0.85rem 1.25rem; border-radius: 10px;
  border: 1px solid var(--primary); background: var(--primary); color: var(--primary-fg);
  min-height: 48px; }
.btn-secondary { background: var(--bg); color: var(--fg); }
.btn-danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin: 0.75rem 0; }
.alert-info { background: #eff6ff; color: #1e3a8a; }
.alert-success { background: #ecfdf5; color: var(--ok); }
.alert-warning { background: #fffbeb; color: var(--warn); }
.alert-error { background: var(--error-bg); color: var(--error); }

.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.8rem; background: var(--border); color: var(--fg); }
.status-submitted { background: #d1fae5; color: var(--ok); }
.status-late { background: #fef3c7; color: var(--warn); }
.status-incomplete, .status-missed { background: var(--error-bg); color: var(--error); }

.dl { display: flex; flex-direction: column; gap: 0.25rem; }
.dl-row { display: flex; justify-content: space-between; gap: 1rem;
  border-bottom: 1px dashed var(--border); padding: 0.25rem 0; }
.dl-row strong { color: var(--muted); font-weight: 500; }

.empty-state { color: var(--muted); font-style: italic; }

table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); }

.consent-text { white-space: pre-line; background: var(--card-bg); padding: 1rem;
  border-radius: var(--radius); border: 1px solid var(--border); }

.checkin-cards { display: grid; gap: 1rem; }
@media (min-width: 600px) { .checkin-cards { grid-template-columns: 1fr 1fr; } }

.message-title { font-weight: 600; margin: 0; }
.message-body { white-space: pre-line; margin: 0; }

.container, .login-page { padding: 1rem; }

/* Camera preview: cap the height on small screens (CO-3july26 §13.4) so the
   countdown, errors, Retake and Submit controls stay visible; keep scrollable. */
.camera-video, .camera-preview { width: 100%; max-width: 100%;
  max-height: 55vh; object-fit: cover;
  display: block; border-radius: var(--radius); margin: 0.5rem 0; background: #000; }
.camera-status { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0; }
.camera-help { margin: 0.5rem 0; padding: 0.75rem; border-radius: var(--radius);
  background: #fffbeb; border: 1px solid #fbbf24; color: #664d03;
  font-size: 0.95rem; white-space: pre-line; }

/* Browser enrollment gateway (CO-3july26 §2). Small, vertically scrollable. */
.gateway-page { padding: 1rem; }
.welcome-text { white-space: pre-wrap; word-wrap: break-word; font-family: inherit;
  font-size: 1rem; line-height: 1.5; margin: 0.5rem 0; }

/* Keep bottom controls clear of the Home indicator / Safari toolbar
   (CO-3july26 §13.3). */
.form, .container, .consent-page, .gateway-page {
  padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }

.push-panel { padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card-bg); display: flex; flex-direction: column; gap: 0.6rem; }
.push-status { font-size: 1.1rem; font-weight: 600; margin: 0; }
.push-instructions { color: var(--muted); font-size: 0.95rem; margin: 0;
  white-space: pre-line; }
.push-panel[data-state="enabled"] { background: #ecfdf5; border-color: #34d399; }
.push-panel[data-state="enabled"] .push-status { color: var(--ok); }
.push-panel[data-state="denied"],
.push-panel[data-state="needs-install"],
.push-panel[data-state="unsupported"] { background: #fffbeb; border-color: #fbbf24; }
.push-panel[data-state="denied"] .push-status,
.push-panel[data-state="needs-install"] .push-status,
.push-panel[data-state="unsupported"] .push-status { color: var(--warn); }
.push-panel[data-state="disabled"] { background: #eff6ff; border-color: #93c5fd; }

.notification-list { max-height: 50vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.notification-item { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
.notification-item:last-child { border-bottom: none; }
.notification-when { color: var(--muted); font-size: 0.8rem; }
.notification-title { font-weight: 600; margin: 0.1rem 0; }
.notification-body { white-space: pre-line; }

.health-row { display: grid;
  grid-template-columns: 1.5rem minmax(8rem, max-content) 1fr auto auto;
  align-items: baseline; gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.75rem; border-radius: 8px; margin: 0.35rem 0;
  border: 1px solid var(--border); background: var(--bg); }
.health-row .health-icon { font-weight: 700; text-align: center;
  width: 1.5rem; }
.health-row .health-label { font-weight: 600; }
.health-row .health-evidence { color: var(--fg); }
.health-row .health-observed { color: var(--muted); font-size: 0.85rem;
  white-space: nowrap; }
.health-row form { margin: 0; }
.health-row-ok { background: #ecfdf5; border-color: #6ee7b7; }
.health-row-ok .health-icon { color: var(--ok); }
.health-row-needs_attention { background: var(--error-bg); border-color: #fca5a5; }
.health-row-needs_attention .health-icon { color: var(--error); }
.health-row-unknown { background: #fffbeb; border-color: #fcd34d; }
.health-row-unknown .health-icon { color: var(--warn); }
@media (max-width: 600px) {
  .health-row { grid-template-columns: 1.5rem 1fr;
    grid-template-areas: "icon label" ". evidence" ". observed" ". action"; }
  .health-row .health-icon { grid-area: icon; }
  .health-row .health-label { grid-area: label; }
  .health-row .health-evidence { grid-area: evidence; }
  .health-row .health-observed { grid-area: observed; }
  .health-row form, .health-row .health-action { grid-area: action; }
}

.onboarding-steps { margin-top: 0.75rem; }
.onboarding-steps > p { font-weight: 600; margin: 0 0 0.35rem; }
.health-row.onboarding-row {
  grid-template-columns: 1.5rem minmax(8rem, max-content) 1fr; }
.onboarding-ok { background: #ecfdf5; border-color: #6ee7b7; }
.onboarding-ok .health-icon { color: var(--ok); }
.onboarding-unknown { background: var(--bg); }
.onboarding-unknown .health-icon { color: var(--muted); }
@media (max-width: 600px) {
  .health-row.onboarding-row { grid-template-columns: 1.5rem 1fr;
    grid-template-areas: "icon label" ". observed"; }
}

.badge.issues-ok { background: #d1fae5; color: var(--ok); }
.badge.issues-bad { background: var(--error-bg); color: var(--error);
  font-weight: 600; }

.sprint-form { gap: 1.25rem; }
.sprint-day { padding: 0.75rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--card-bg); margin: 0.5rem 0; }
.sprint-day-heading { margin: 0 0 0.5rem; font-size: 1.05rem; color: var(--muted); }
.sprint-day-cells { display: grid; gap: 0.75rem; }
@media (min-width: 700px) {
  .sprint-day-cells { grid-template-columns: 1fr 1fr; }
}
.sprint-cell { padding: 0.6rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg);
  display: flex; flex-direction: column; gap: 0.4rem; }
.sprint-cell-heading { margin: 0; font-size: 0.95rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; }
.sprint-cell textarea { font-family: inherit; }

