/* ============================================================
   App layer — turns the static mockup CSS (assurdent.css) into a
   real, scrollable, responsive web app. Loaded after assurdent.css.
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body { background: var(--c-cream); color: var(--c-ink); font-family: var(--font-body); }

/* The mockup locked `.wf` to a fixed frame; real pages must flow & scroll. */
.wf { height: auto; min-height: 100vh; overflow: visible; }
.wf-split { height: auto; min-height: calc(100vh - 60px); align-items: stretch; }
.wf-main { min-width: 0; }
.wf-sidebar { min-height: calc(100vh - 60px); }

a { color: inherit; }
.link { color: var(--c-coral-d); cursor: pointer; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.page-narrow { max-width: 980px; margin: 0 auto; width: 100%; }
.page-pad { padding: 32px 40px; }

/* Real form controls inherit the mockup's .wf-input look. */
.wf-input input, .wf-input select, .wf-input textarea { all: unset; width: 100%; }
input.wf-input, select.wf-input, textarea.wf-input {
  font-family: var(--font-body); font-size: 14px; color: var(--c-ink);
  width: 100%; appearance: auto;
}
textarea.wf-input { min-height: 84px; }
.wf-input.error, input.wf-input.error, select.wf-input.error { border-color: var(--c-coral); }
.field-error { color: var(--c-coral-d); font-size: 12px; margin-top: 4px; }

/* Toast notifications — floating, auto-dismissing.
   Positioned in the top-right so they overlay the page chrome without
   shifting content. Driven by app/javascript/controllers/toast_controller.js. */
.toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md, 12px);
  font-size: 14px; font-weight: 500;
  background: var(--c-paper, #fff); color: var(--c-ink, #1c1810);
  border: 1px solid var(--c-line, #E8DFC9);
  box-shadow: 0 10px 32px rgba(28,24,16,0.10), 0 2px 6px rgba(28,24,16,0.05);
  animation: toast-enter 220ms ease-out;
}
.toast.is-leaving { animation: toast-exit 220ms ease-in forwards; }
.toast-body { flex: 1; min-width: 0; }
.toast-close {
  border: 0; background: transparent; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 4px 6px;
  color: inherit; opacity: 0.55;
}
.toast-close:hover { opacity: 1; }

.toast-notice,
.toast-success { background: var(--c-sage-s, #E6EFE6); color: var(--c-sage-d, #4F7D5B); border-color: rgba(127,166,136,0.35); }
.toast-alert,
.toast-error   { background: #FAD9D2; color: #9F3527; border-color: rgba(159,53,39,0.25); }
.toast-warning { background: var(--c-amber-s, #FCEBC9); color: #8B5E0F; border-color: rgba(196,138,30,0.35); }
.toast-info    { background: var(--c-blush, #FFE5D4); color: var(--c-coral-d, #E8482A); border-color: rgba(232,72,42,0.25); }

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

/* Dev sign-in panel */
.dev-panel {
  background: var(--c-amber-s); border: 1px dashed var(--c-amber);
  border-radius: var(--r-md); padding: 14px; margin-top: 16px;
}
.dev-panel .mono { color: #8B5E0F; }

/* Empty state */
.wf-empty {
  text-align: center; padding: 48px 24px; color: var(--c-ink-3);
}

/* X-ray / document thumbnails actually showing an image */
.wf-xbox img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wf-xbox.has-file { border-style: solid; background: linear-gradient(135deg, var(--c-blush) 0%, var(--c-cream-2) 100%); }
/* Uploaded x-ray tile: green (not blush) and openable. */
.wf-xbox.xray-filled { border-style: solid; border-color: var(--c-sage);
  background: linear-gradient(135deg, var(--c-sage-s) 0%, var(--c-cream-2) 100%); }
.wf-xbox.xray-filled .lbl { color: var(--c-sage-d); }
.wf-xbox.clickable.xray-filled:hover { border-color: var(--c-sage-d); background: var(--c-sage-s); }
.wf-xbox.clickable.xray-filled:hover .lbl { color: var(--c-sage-d); }

/* Clickable upload tile (FileFieldComponent) */
.wf-xbox.clickable { cursor: pointer; display: block; margin: 0;
  transition: border-color 150ms, background 150ms, color 150ms; }
.wf-xbox.clickable:hover { border-color: var(--c-coral); background: var(--c-cream-2); }
.wf-xbox.clickable:hover .lbl { color: var(--c-coral-d); }
.wf-xbox.clickable:focus-within { border-color: var(--c-coral); outline: none;
  box-shadow: 0 0 0 3px rgba(255,95,60,0.16); }
.wf-xbox .lbl small { display: block; margin-top: 4px; color: var(--c-ink-4);
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; }
.wf-xbox .filename {
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  color: var(--c-coral-d); letter-spacing: 0; text-transform: none;
}

/* Accessibility helper — hide visually but keep in the AT/keyboard tree */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Signature pad */
.signature-pad {
  border: 1.5px dashed var(--c-line); background: var(--c-paper);
  border-radius: var(--r-sm); width: 100%; height: 140px; touch-action: none;
  display: block;
}

/* Simple bar chart sizing already in assurdent.css (.wf-bars) */

/* ---- Responsive (mobile + tablet) ------------------------------------ */
@media (max-width: 960px) {
  .wf-row { flex-direction: column; }
  .wf-row > * { width: 100% !important; }
  .page-pad, .wf-pad-section { padding: 20px 16px; }
  .wf-main { padding: 16px; }
  .wf h1 { font-size: 30px; }
  .wf-topbar { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 12px; }
  .wf-topbar .nav { order: 3; width: 100%; overflow-x: auto; }
  .wf-topbar .right { margin-left: auto; }
}

@media (max-width: 760px) {
  .wf-sidebar { display: none; }
  .wf-split { flex-direction: column; }
  .wf-table-wrap { overflow-x: auto; }
  .wf-grid-2, .wf-grid-3, .wf-grid-4 { grid-template-columns: 1fr !important; }
  .wf-phone { width: 100%; max-width: 360px; }
}

/* Public (onboarding-flow) topbar: keep the header a clean single row on
   phones — brand · sign-in. */
@media (max-width: 600px) {
  .wf-topbar--public { flex-wrap: nowrap; gap: 10px; }
  .wf-topbar--public .right { gap: 10px; }
}

/* Responsive grids used across screens */
.wf-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.wf-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.wf-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
/* Auto-fit so a 5-stat row (e.g. the practice dashboard) wraps cleanly from
   five-across on desktop down to two-up on a phone without overflowing. */
.wf-grid-5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.wf-table-wrap { width: 100%; }

/* Resend-signing disclosure: the summary is styled as a button, so drop the
   default disclosure triangle. */
.wf-resend > summary { list-style: none; }
.wf-resend > summary::-webkit-details-marker { display: none; }

/* The disclosure lives inside the header's flex row of action buttons. Float
   the expanded panel as a dropdown anchored to the button so it doesn't wedge
   itself in-flow between the other buttons and shove the row around. */
.wf-resend { position: relative; }
.wf-resend[open] > form {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  margin-top: 0 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
@media (max-width: 760px) {
  /* On phones the button row wraps and there's no room to float; keep it
     in-flow, aligned to the viewport rather than overflowing right. */
  .wf-resend[open] > form { position: static; box-shadow: none; }
}

/* Pagy pagination nav — styled to match the wf- pill/button system. */
.pagy.nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagy.nav a, .pagy.nav span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--c-line, #e4ded3); border-radius: 8px;
  background: var(--c-cream); color: var(--c-ink);
  font-size: 13px; text-decoration: none;
}
.pagy.nav a:hover { border-color: var(--c-ink); }
.pagy.nav a.current, .pagy.nav span.current {
  background: var(--c-ink); color: var(--c-cream); border-color: var(--c-ink);
}
.pagy.nav a.gap,
.pagy.nav a[aria-disabled="true"] {
  background: transparent; border-color: transparent; color: var(--c-ink-3); cursor: default;
}

/* ============================================================= *
 * Agreement signature panel — admin practice review (ASSURDENT-60)
 * A status-driven focal block: it changes colour and call-to-action
 * with the agreement's state so reviewers can't miss the signing gate.
 * ============================================================= */
.sign-panel {
  position: relative; overflow: hidden;
  border: 1.5px solid var(--c-line); border-radius: 14px;
  background: var(--c-paper);
  padding: 22px 24px 20px; margin-bottom: 16px;
}
.sign-panel::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--c-ink-4);
}
.sign-panel.is-action {
  border-color: var(--c-coral);
  background: linear-gradient(180deg, var(--c-blush) 0%, var(--c-paper) 55%);
  box-shadow: 0 6px 22px -14px rgba(232, 72, 42, 0.55);
}
.sign-panel.is-action::before { background: var(--c-coral); }
.sign-panel.is-done   { border-color: #BFD6C4; background: var(--c-sage-s); }
.sign-panel.is-done::before   { background: var(--c-sage-d); }
.sign-panel.is-waiting::before { background: var(--c-amber); }

.sign-panel__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.sign-panel__eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.09em;
  color: var(--c-ink-3); text-transform: uppercase;
}
.sign-panel__title {
  font-family: var(--font-display); font-weight: 500;
  font-size: 22px; line-height: 1.18; margin: 8px 0 0; max-width: 34ch;
}
.sign-panel__lead { color: var(--c-ink-2); font-size: 14px; line-height: 1.5; margin: 9px 0 0; max-width: 64ch; }

.sign-status {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
}
.sign-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sign-status.action { background: var(--c-coral);  color: #fff; }
.sign-status.done   { background: var(--c-sage-d); color: #fff; }
.sign-status.wait   { background: var(--c-cream-2); color: var(--c-ink-2); }

/* Two-step signer progress */
.sign-steps { display: flex; align-items: center; gap: 4px; margin: 20px 0 18px; flex-wrap: wrap; }
.sign-step { display: flex; align-items: center; gap: 12px; }
.sign-step__dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
  border: 1.5px solid var(--c-line); background: var(--c-paper); color: var(--c-ink-4);
}
.sign-step.done .sign-step__dot { background: var(--c-sage-d); border-color: var(--c-sage-d); color: #fff; }
.sign-step.now  .sign-step__dot { background: var(--c-coral);  border-color: var(--c-coral);  color: #fff;
  box-shadow: 0 0 0 4px rgba(255, 95, 60, 0.18); }
.sign-step__meta strong { display: block; font-size: 13.5px; line-height: 1.3; }
.sign-step__meta small  { color: var(--c-ink-3); font-size: 12px; }
.sign-step__meta small.now { color: var(--c-coral-d); font-weight: 600; }
.sign-step__rail { flex: 1 1 30px; min-width: 24px; height: 2px; background: var(--c-line); margin: 0 10px; border-radius: 2px; }
.sign-step__rail.done { background: var(--c-sage-d); }

.sign-panel__action { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.wf-btn.lg { padding: 13px 26px; min-height: 46px; font-size: 15px; }

/* Locked activation panel (until the agreement is executed) */
.activate-lock {
  border: 1.5px dashed var(--c-line); border-radius: 14px;
  background: var(--c-cream-2); padding: 22px; text-align: center;
}
.activate-lock__icon {
  width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; background: var(--c-blush);
  color: var(--c-coral-d); font-size: 19px;
}
.activate-lock h3 { font-family: var(--font-display); font-weight: 500; font-size: 18px; margin: 0 0 6px; }
.activate-lock p  { color: var(--c-ink-3); font-size: 13px; line-height: 1.5; margin: 0; }

/* ============================================================= *
 * Filter bar (admin list filters) — mobile-first, responsive.
 * Base = everything stacks full width; widens into a row at >=720px.
 * ============================================================= */
.wf-filterbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
/* Top-align variant: use when a field carries an extra sub-row (e.g. quick-range
   preset buttons under a date range) that would otherwise push the shorter
   sibling fields down off the input line. Labels + primary inputs line up; the
   extra sub-row hangs below its own field. */
.wf-filterbar--align-top { align-items: flex-start; }
.wf-filterbar > .wf-field { flex: 1 1 100%; min-width: 0; }
.wf-filterbar .filter-input-row { display: flex; gap: 6px; min-width: 0; }
.wf-filterbar .filter-input-row > .wf-input { flex: 1 1 auto; min-width: 0; }
.wf-filterbar .filter-input-row > select.wf-input { flex: 0 0 auto; width: auto; min-width: 116px; }
.wf-filterbar .filter-actions { display: flex; gap: 8px; flex: 1 1 100%; }
.wf-filterbar .filter-actions > .wf-btn { flex: 1 1 auto; justify-content: center; }

@media (min-width: 720px) {
  .wf-filterbar > .wf-field { flex: 1 1 260px; }
  .wf-filterbar .filter-actions { flex: 0 0 auto; }
  .wf-filterbar .filter-actions > .wf-btn { flex: 0 0 auto; }
}

/* =============================================================
 * Practice-focus sliders (dentist onboarding / questionnaire).
 * One 10%-step slider per procedure category, a meter showing how
 * much of the 100% budget is used, and a Reset All control. The
 * "practice-focus" Stimulus controller drives the values; this is
 * purely presentation. Mobile-first: the label sits above the
 * slider on narrow screens and beside it from 560px up.
 * ============================================================= */
.pf-meter { margin: 10px 0 16px; }
.pf-meter-track {
  height: 10px; border-radius: 999px; background: var(--c-line);
  overflow: hidden;
}
.pf-meter-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--c-coral); transition: width .15s ease, background .15s ease;
}
.pf-meter-fill.is-complete { background: var(--c-sage-d, #3F6549); }
.pf-meter-caption {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 8px;
}

.pf-list { display: flex; flex-direction: column; gap: 12px; }
.pf-row {
  display: grid; gap: 4px 12px; align-items: center;
  grid-template-columns: 1fr 48px;
  grid-template-areas: "label label" "slider value";
}
.pf-label { grid-area: label; font-weight: 600; margin: 0; }
.pf-value {
  grid-area: value; text-align: right; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Custom range styling: a soft line-coloured track (instead of the browser's
 * default, which renders an aggressively dark unfilled track) with a coral
 * thumb. Webkit paints the whole track one colour, so the track stays a
 * uniform soft grey on both engines — the thumb, the per-row %, and the meter
 * carry the value. */
.pf-slider {
  grid-area: slider; width: 100%; height: 22px; margin: 0;
  -webkit-appearance: none; appearance: none;
  background: transparent; cursor: pointer;
}
.pf-slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px; background: var(--c-line);
}
.pf-slider::-moz-range-track {
  height: 6px; border-radius: 999px; background: var(--c-line);
}
.pf-slider::-moz-range-progress {
  height: 6px; border-radius: 999px; background: var(--c-line);
}
.pf-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; margin-top: -5px;
  border-radius: 50%; background: var(--c-coral);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.pf-slider::-moz-range-thumb {
  width: 16px; height: 16px; border: none;
  border-radius: 50%; background: var(--c-coral);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.pf-slider:focus-visible { outline: none; }
.pf-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(255, 95, 60, .35); }
.pf-slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px rgba(255, 95, 60, .35); }
.pf-slider:disabled { cursor: not-allowed; opacity: .5; }
.pf-slider:disabled::-webkit-slider-thumb { background: var(--c-ink-4); }
.pf-slider:disabled::-moz-range-thumb { background: var(--c-ink-4); }

@media (min-width: 560px) {
  .pf-row {
    grid-template-columns: 220px 1fr 56px;
    grid-template-areas: "label slider value";
  }
}

/* =============================================================
 * Practice warranties index — column widths and pending-items
 * cell. Keeps the Procedure column from devouring the row on wide
 * desktops, and lets the multi-pill Status cell wrap onto two
 * lines without overflowing.
 * ============================================================= */
.wf-warranty-index .wf-table .col-procedure {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-warranty-index .wf-table .col-status { min-width: 160px; }
.wf-warranty-index .wf-table .col-actions {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}

/* =============================================================
 * ASSURDENT-143 — the onboarding flows read larger & bolder (Kyle):
 * the practice application wizard and the dentist supplementary-info
 * form. Scoped to `.onboarding-flow` so only those flows are affected,
 * not the rest of the app.
 * ============================================================= */
.onboarding-flow p { font-size: 16px; }
.onboarding-flow .wf-card > .mono { font-size: 12.5px; font-weight: 700; color: var(--c-ink); }
.onboarding-flow .wf-field > label {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--c-ink);
}
.onboarding-flow input.wf-input,
.onboarding-flow select.wf-input,
.onboarding-flow textarea.wf-input {
  font-size: 15.5px;
  min-height: 44px;
}
.onboarding-flow .wf-field > small { font-size: 13px; }
.onboarding-flow .state-chip span { font-size: 14px; }
