/* Components — the shared building blocks: buttons, pills, the one
   sheet system, StateBlock, toasts, offline bar, sheet menus. */

/* ---- Buttons ---- */
.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--r-full);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-caption);
  cursor: pointer;
  white-space: nowrap;
}
.ghost-btn:hover { color: var(--text-1); border-color: var(--accent); }
.ghost-btn:disabled { opacity: 0.5; cursor: default; }

.link-btn {
  background: none;
  border: none;
  color: var(--text-2);
  text-decoration: underline;
  cursor: pointer;
  font-size: var(--fs-meta);
  padding: var(--sp-2) var(--sp-1);
}
.link-btn:hover { color: var(--text-1); }

.primary-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--r-full);
  padding: 10px 22px;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
}
.primary-btn:disabled { opacity: 0.5; cursor: default; }

.danger-btn {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--r-full);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-meta);
  cursor: pointer;
}
.danger-btn.armed { background: var(--danger); color: var(--bg-0); font-weight: var(--fw-bold); }

/* Header location pill */
.hub-open {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: var(--r-full);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-meta);
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-open:hover { border-color: var(--accent); }

/* ---- Pills ----
   .pill is the generic selectable pill. It was used by composer.js
   for reach + urgency with NO rule anywhere (Phase 0 §6.4) — the
   split adds it, styled identically to .reach-pill (composer.css),
   which is plainly what the markup always intended. */
.pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--r-full);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-meta);
  cursor: pointer;
}
.pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: var(--fw-bold);
}

/* ---- Sheets: the one overlay system (Hub, Echo, composer, place,
   report, menus, static copy all consume it) ---- */
.no-scroll { overflow: hidden; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  z-index: var(--z-sheet);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop.composer-backdrop { z-index: var(--z-composer); }
.sheet {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-width: var(--content-max);
  max-height: calc(100dvh - var(--sp-4));
  overflow-y: auto;
  padding: var(--sp-5) var(--sp-5) calc(var(--sp-6) + var(--safe-bottom));
  position: relative;
  animation: sheet-up var(--t-med);
  box-shadow: var(--shadow-sheet);
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: var(--fs-body);
  cursor: pointer;
  padding: var(--sp-2);
  z-index: 1;
}
.sheet-title { font-size: var(--fs-title); font-weight: var(--fw-bold); margin: 0 var(--sp-8) var(--sp-2) 0; }
.sheet-copy { color: var(--text-2); font-size: var(--fs-body-sm); line-height: var(--lh-body); }
.sheet-copy p { margin-bottom: var(--sp-3); }
.sheet-copy b, .sheet-copy strong { color: var(--text-1); }

/* Sheet menu rows (card overflow, report reasons) */
.menu-list { display: flex; flex-direction: column; }
.menu-row {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  text-align: left;
  padding: var(--sp-3) var(--sp-1);
  font-size: var(--fs-body-sm);
  cursor: pointer;
}
.menu-row:last-child { border-bottom: none; }
.menu-row:hover { background: var(--accent-soft); }
.menu-row.danger { color: var(--danger); }
.menu-note { color: var(--text-2); font-size: var(--fs-body-sm); padding: var(--sp-3) var(--sp-1); }

/* ---- StateBlock: the shared empty/loading/error renderer (§2.9) ---- */
.state-block {
  text-align: center;
  color: var(--text-2);
  padding: var(--sp-10) var(--sp-4);
  font-size: var(--fs-body-sm);
}
.state-block .state-icon { font-size: 1.6rem; display: block; margin-bottom: var(--sp-2); }
.state-block .state-cta { margin-top: var(--sp-3); }
.state-block.error-state { color: var(--danger); }

.skeleton {
  background: var(--surface-2);
  border-radius: var(--r-lg);
  min-height: 110px;
  margin-bottom: var(--sp-3);
  animation: pulse 1.6s infinite;
  opacity: 0.7;
}
.skeleton-row { min-height: 52px; border-radius: var(--r-md); }

/* ---- Offline bar (§2.9) ---- */
.offline-bar {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-5);
  font-size: var(--fs-meta);
  color: var(--warning);
  text-align: center;
}

/* ---- Toasts (§2.0): stack above the tab bar, one action max ---- */
.toast-wrap {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-3));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(92vw, 480px);
}
.toast {
  background: var(--surface-3);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-body-sm);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.toast .toast-action {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--accent-bright);
  font-weight: var(--fw-bold);
  cursor: pointer;
  white-space: nowrap;
  padding: 0;
}

/* Sheets opened from the age gate ride above it (Phase 4). */
.sheet-backdrop.above-gate { z-index: calc(var(--z-gate) + 5); }
