/* ==========================================================================
   SMS Biga Visiting Day Tracker — styles
   Mobile-first. Palette lives in CSS custom properties for easy swapping.
   Breakpoints: phone (default), tablet (768px+), desktop (1024px+).
   ========================================================================== */

:root {
  --color-primary: #1B3A6F;
  --color-background: #FBF7EE;
  --color-accent: #C9A227;
  --color-success: #2E7D32;
  --color-warning: #E1A100;
  --color-error: #B00020;
  --color-text: #1A1A1A;
  --color-muted: #6B6B6B;

  --color-surface: #FFFFFF;
  --color-border: rgba(27, 58, 111, 0.12);

  /* Badge backgrounds */
  --color-badge-visited-bg: #2E7D32;
  --color-badge-visited-text: #FFFFFF;
  --color-badge-novisitor-bg: #E3E0D8;
  --color-badge-novisitor-text: #4A4A4A;

  /* Sign-in screen palette (matches the SMBI Admissions sign-in) */
  --color-signin-bg: #0A3AA5;
  --color-signin-heading: #114BC7;
  --color-signin-text: #2F3944;
  --color-signin-label: #3F4A5F;
  --color-signin-input-border: #D3D8E2;

  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;

  --header-height: 56px;
  --tabbar-height: 64px;
  --tap-target: 44px;

  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

h1 { font-size: 28px; line-height: 1.25; }
h2 { font-size: 24px; line-height: 1.25; }
h3 { font-size: 20px; line-height: 1.3; }

button {
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 16px;
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Screens
   -------------------------------------------------------------------------- */

.screen-hidden {
  display: none !important;
}

#screen-signin,
#screen-log-visit,
#screen-add-session {
  min-height: 100vh;
  min-height: 100dvh;
}

/* --------------------------------------------------------------------------
   Sign-in
   -------------------------------------------------------------------------- */

/* Fallback wrapper for the boot-failure message. */
.signin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-3);
}

.signin-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-2);
  background: var(--color-signin-bg);
}

.signin-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.signin-head {
  padding: 40px 28px 28px;
  text-align: center;
}

.signin-logo {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 24px;
}

.signin-org {
  color: var(--color-signin-heading);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
}

.signin-app {
  color: var(--color-signin-text);
  font-size: 18px;
  margin-top: 10px;
}

.signin-form-wrap {
  border-top: 1px solid #E6E9EF;
  padding: 28px 28px 36px;
}

.signin-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.field input,
.field textarea {
  width: 100%;
  min-height: var(--tap-target);
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(27, 58, 111, 0.15);
}

.signin-card .field label {
  color: var(--color-signin-label);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.signin-card .field input {
  min-height: 48px;
  border: 1px solid var(--color-signin-input-border);
  border-radius: 10px;
}

.signin-card .field input::placeholder {
  color: #9AA3B2;
}

.signin-card .field input:focus {
  border-color: var(--color-signin-heading);
  box-shadow: 0 0 0 3px rgba(17, 75, 199, 0.25);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-target);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: opacity 0.15s ease, transform 0.05s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}

.btn-signin {
  background: var(--color-signin-bg);
  color: #fff;
  font-weight: 700;
  min-height: 48px;
  border-radius: 10px;
}

.btn-block { width: 100%; }

.form-error {
  color: var(--color-error);
  font-size: 14px;
  min-height: 20px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Home shell: header + tab bar
   -------------------------------------------------------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-height);
  padding: 0 var(--space-2);
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border);
}

.app-header .header-logo {
  height: 32px;
  width: auto;
}

.app-header .header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
  flex: 1;
}

.header-icon-btn {
  width: var(--tap-target);
  height: var(--tap-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-primary);
  font-size: 20px;
}

/* Clears the fixed tab bar so the last list item is never hidden behind it. */
.tab-content {
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + var(--space-2));
}

/* Full-width bar pinned to the viewport bottom on every screen size.
   The inner wrapper centers the three tab items at the content max-width. */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.tab-bar-inner {
  display: flex;
  width: 100%;
  height: var(--tabbar-height);
  margin: 0 auto;
}

.tab-bar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  min-height: var(--tap-target);
  -webkit-tap-highlight-color: transparent;
}

.tab-bar button .tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tab-bar button.active {
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Search tab
   -------------------------------------------------------------------------- */

/* Not sticky: with wrapped chip rows the filter block is taller than a
   phone viewport, so it scrolls away with the content. */
.search-head {
  background: var(--color-background);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap input {
  width: 100%;
  min-height: var(--tap-target);
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  outline: none;
}

.search-input-wrap input:focus {
  border-color: var(--color-primary);
}

.search-clear {
  position: absolute;
  right: 0;
  top: 0;
  width: var(--tap-target);
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 18px;
}

.search-clear.visible { display: inline-flex; }

.filter-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-muted);
  margin-top: var(--space-1);
  margin-bottom: 8px;
}

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

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 18px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.chip.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Contextual chips: hidden when no student in the current filter set matches. */
.chip-hidden {
  display: none;
}

.result-meta {
  padding: var(--space-1) var(--space-2) 0;
  font-size: 13px;
  color: var(--color-muted);
}

.results-list {
  padding: var(--space-1) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-2);
}

.student-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  min-height: var(--tap-target);
  -webkit-tap-highlight-color: transparent;
}

.student-card:active { background: #f4efe2; }

.student-card .student-info { flex: 1; min-width: 0; }

.student-card .student-name {
  font-weight: 700;
  color: var(--color-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-card .student-sub {
  font-size: 14px;
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-visited {
  background: var(--color-badge-visited-bg);
  color: var(--color-badge-visited-text);
}

.badge-no_visitor {
  background: var(--color-badge-novisitor-bg);
  color: var(--color-badge-novisitor-text);
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 48px var(--space-3);
}

.load-sentinel {
  height: 1px;
}

/* --------------------------------------------------------------------------
   Log Visit screen
   -------------------------------------------------------------------------- */

.subscreen-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--header-height);
  padding: 0 var(--space-1);
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border);
}

.subscreen-header .back-btn {
  width: var(--tap-target);
  height: var(--tap-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--color-primary);
  border-radius: 50%;
}

.subscreen-header .subscreen-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subscreen-body {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: 120px;
}

.student-header-card .sh-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
}

.student-header-card .sh-line {
  font-size: 14px;
  color: var(--color-muted);
  margin-top: 2px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}

.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-item + .session-item {
  margin-top: var(--space-1);
}

.session-item .session-info { flex: 1; min-width: 0; }

.session-item .session-total {
  font-weight: 700;
  color: var(--color-text);
}

.session-item .session-sub {
  font-size: 13px;
  color: var(--color-muted);
}

.session-item .edit-btn {
  flex: 0 0 auto;
  min-width: var(--tap-target);
  min-height: var(--tap-target);
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 14px;
}

.no-visitor-note {
  font-size: 14px;
  color: var(--color-muted);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Add/Edit Session screen
   -------------------------------------------------------------------------- */

.rel-list {
  display: flex;
  flex-direction: column;
}

.rel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}

.rel-row:last-child { border-bottom: none; }

.rel-label {
  font-weight: 600;
  flex: 1;
}

.rel-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stepper {
  display: none;
  align-items: center;
  gap: 4px;
}

.rel-row.on .stepper { display: inline-flex; }

.stepper button {
  width: var(--tap-target);
  height: var(--tap-target);
  border-radius: 50%;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  font-size: 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  -webkit-tap-highlight-color: transparent;
}

.stepper button:disabled {
  opacity: 0.35;
}

.stepper .count {
  min-width: 32px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 32px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  z-index: 2;
  cursor: pointer;
  margin: 0;
}

.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: #d5d0c3;
  transition: background 0.15s ease;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.switch input:checked + .track {
  background: var(--color-primary);
}

.switch input:checked + .track::after {
  transform: translateX(20px);
}

.notes-counter {
  font-size: 12px;
  color: var(--color-muted);
  text-align: right;
  margin-top: 4px;
}

.notes-counter.over { color: var(--color-error); }

/* Delete Session: tertiary destructive action, edit mode only. */
.btn-delete-session {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: center;
  min-height: var(--tap-target);
  min-width: var(--tap-target);
  padding: 10px 18px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-error);
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.btn-delete-session:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-delete-session svg {
  flex: 0 0 auto;
}

.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px var(--space-2);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.sticky-footer .footer-total {
  flex: 1;
  font-weight: 700;
  color: var(--color-primary);
}

.sticky-footer .btn { min-width: 120px; }

/* --------------------------------------------------------------------------
   Report tab
   -------------------------------------------------------------------------- */

.report-body {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.report-updated {
  font-size: 13px;
  color: var(--color-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-2);
  text-align: center;
}

.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
}

.kpi-card.kpi-success .kpi-value { color: var(--color-success); }
.kpi-card.kpi-muted .kpi-value { color: var(--color-muted); }
.kpi-card.kpi-accent .kpi-value { color: var(--color-accent); }

.kpi-card .kpi-label {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: 2px;
}

.collapse-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.collapse-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  min-height: 52px;
  padding: 12px var(--space-2);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.collapse-header .chev {
  transition: transform 0.15s ease;
  font-size: 14px;
  color: var(--color-muted);
}

.collapse-section.open .collapse-header .chev {
  transform: rotate(180deg);
}

.collapse-content {
  display: none;
  padding: 0 var(--space-2) var(--space-2);
}

.collapse-section.open .collapse-content { display: block; }

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th {
  text-align: right;
  color: var(--color-muted);
  font-weight: 600;
  padding: 6px 4px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.report-table th:first-child,
.report-table td:first-child {
  text-align: left;
}

.report-table td {
  text-align: right;
  padding: 8px 4px;
  border-bottom: 1px solid var(--color-border);
}

.report-table tr:last-child td { border-bottom: none; }

.report-table td:first-child {
  font-weight: 600;
  color: var(--color-text);
}

.td-visited { color: var(--color-success); font-weight: 700; }
.td-novis { color: var(--color-muted); font-weight: 700; }

/* --------------------------------------------------------------------------
   Menu tab
   -------------------------------------------------------------------------- */

.menu-body {
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.menu-logo {
  width: 80px;
  height: auto;
  margin-bottom: 16px;
}

.menu-user-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
}

.menu-user-role {
  font-size: 14px;
  color: var(--color-muted);
  text-transform: capitalize;
}

.menu-version {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: var(--space-3);
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

#toast-container {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + var(--space-2));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  width: calc(100% - 32px);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  width: 100%;
  padding: 12px var(--space-2);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  animation: toast-in 0.2s ease;
}

.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-error); }

.toast.hiding {
  opacity: 0;
  transition: opacity 0.25s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Confirm dialog
   -------------------------------------------------------------------------- */

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}

.dialog {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: var(--space-3);
  width: 100%;
  max-width: 340px;
}

.dialog .dialog-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}

.dialog .dialog-message {
  font-size: 15px;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.dialog .dialog-actions {
  display: flex;
  gap: var(--space-1);
  justify-content: flex-end;
}

.dialog .dialog-actions .btn {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Offline banner
   -------------------------------------------------------------------------- */

#offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--color-error);
  color: #fff;
  padding: 10px var(--space-2);
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

#offline-banner.visible { display: block; }

#offline-banner .retry-btn {
  margin-left: var(--space-1);
  padding: 4px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 700;
  min-height: 32px;
}

body.offline-shift .app-header,
body.offline-shift .subscreen-header {
  top: 44px;
}

/* --------------------------------------------------------------------------
   Spinners & pull-to-refresh
   -------------------------------------------------------------------------- */

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(27, 58, 111, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-block {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ptr-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  transition: height 0.15s ease;
  color: var(--color-muted);
  font-size: 13px;
}

.ptr-indicator.active { height: 48px; }

/* --------------------------------------------------------------------------
   Tablet: 768px to 1023px
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {
  /* Sign-in stays full-bleed: its blue background fills the viewport
     while .signin-card caps its own width. */
  #screen-home,
  #screen-log-visit,
  #screen-add-session {
    max-width: 720px;
    margin: 0 auto;
  }

  /* The tab bar itself spans the viewport; only its items are centered. */
  .tab-bar-inner {
    max-width: 720px;
  }

  .sticky-footer {
    max-width: 720px;
    left: 50%;
    right: auto;
    width: 100%;
    transform: translateX(-50%);
  }

  .results-list {
    padding-left: 24px;
    padding-right: 24px;
  }

  .result-meta {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* --------------------------------------------------------------------------
   Desktop: 1024px and up
   -------------------------------------------------------------------------- */

@media (min-width: 1024px) {
  body { font-size: 17px; }

  h1 { font-size: 32px; }
  h2 { font-size: 26px; }
  h3 { font-size: 22px; }

  #screen-home,
  #screen-log-visit,
  #screen-add-session {
    max-width: 960px;
  }

  .tab-bar-inner {
    max-width: 960px;
  }

  .sticky-footer {
    max-width: 960px;
  }

  /* All eleven relationship rows fit above the fold in two columns. */
  .rel-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 32px;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
