/* The care workspace. Reuses the marketing site's tokens and components
   (../styles.css) so the app does not feel like a different product; only
   the full-height shell and the sign-in gate are new here. */

.app-body { min-height: 100vh; }

/* `display: grid` on .gate/.shell below has the same specificity as the user
   agent's `[hidden] { display: none }` and comes later, so it wins and the
   hidden element stays on screen — the sign-in card and the workspace both
   rendered at once. Anything toggled by the `hidden` attribute needs this. */
[hidden] { display: none !important; }

/* Nothing should flash before we know whether there is a session: the gate
   and the shell are both hidden until main.js decides which to show. */
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--soft);
}
.boot[hidden] { display: none; }

/* ── Sign in ─────────────────────────────────────────────────────────── */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 5vw, 48px);
}
.gate-card {
  width: min(100%, 440px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 5vw, 36px);
}
.gate-card .brand { display: inline-block; margin-bottom: 20px; }
.gate-card h1 {
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  margin-bottom: 10px;
}
.gate-text { color: var(--soft); }
.gate-card form { display: grid; gap: 12px; margin-top: 18px; }
.gate-card label { display: grid; gap: 5px; font-weight: 650; font-size: .9rem; }
.gate-card input { width: 100%; }
.gate-card .button { width: 100%; margin-top: 4px; }
.gate-switch { margin: 14px 0 0; text-align: center; }
.linkish {
  background: none; border: 0; padding: 6px;
  color: var(--forest); font-weight: 700; text-decoration: underline;
  min-height: 40px;
}
.gate-status { margin: 14px 0 0; font-size: .92rem; min-height: 1.4em; }
.gate-status.error { color: #8c2f2f; font-weight: 650; }
.gate-status.ok { color: #2f6b45; font-weight: 650; }
.gate-foot { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }

/* ── Signed-in shell ─────────────────────────────────────────────────── */

/* Mobile first. A caregiver opens this on a phone, standing in a school
   corridor — so the phone layout is the base and the desktop sidebar is the
   enhancement, rather than a 240px rail being unwound by overrides. */
.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}
.app-nav {
  display: block;
  padding: 14px;
}
.app-nav-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #cbdcc0;
}
.app-nav-foot .detail { margin: 0; overflow-wrap: anywhere; }
.app-content { padding: 16px; }

@media (min-width: 861px) {
  .shell {
    grid-template-rows: none;
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .app-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 22px 15px;
  }
  .app-nav-foot {
    display: grid;
    justify-items: start;
    margin-top: auto;
    padding-top: 18px;
    border-top: 0;
  }
  .app-content { padding: clamp(18px, 3vw, 36px); }
}

.role-badge {
  font-size: .75rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: var(--peach);
  border-radius: 999px;
  padding: 5px 11px;
}

/* ── Shared view furniture ───────────────────────────────────────────── */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin: 16px 0;
}
.toolbar label { display: grid; gap: 4px; font-weight: 650; font-size: .85rem; }

.empty {
  border: 1px dashed #a8bbaf;
  border-radius: 14px;
  padding: 22px;
  text-align: center;
  color: var(--soft);
}

.tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .07em;
  background: var(--sage);
  border-radius: 999px;
  padding: 3px 9px;
  margin-right: 6px;
}
.tag.behavior { background: var(--peach); }
.tag.medication { background: var(--lilac); }
.tag.sleep { background: #dde6f1; }
.tag.therapy { background: var(--lime); }

.meta { color: var(--soft); font-size: .84rem; }

/* A caregiver-entered observation is not a clinical finding, and Insights
   must "distinguish correlation from causation". This caveat ships with
   every report rather than living in a help page nobody opens. */
.caveat {
  background: var(--peach);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: .9rem;
}
.caveat strong { display: block; margin-bottom: 4px; }

.bars { display: grid; gap: 7px; margin: 14px 0; }
.bar-row { display: grid; gap: 10px; align-items: center; font-size: .88rem; }
.bar { background: var(--sage); border-radius: 999px; height: 18px; min-width: 2px; }
.bar-row .count { text-align: right; color: var(--soft); }

/* ── Community ───────────────────────────────────────────────────────── */

.guidelines { margin: 12px 0; padding-left: 20px; display: grid; gap: 8px; }
.guidelines strong { display: block; }
.guidelines p { margin: 2px 0 0; color: var(--soft); font-size: .9rem; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-weight: 650; }
.check input { min-height: 0; width: 20px; height: 20px; flex: none; margin-top: 2px; }

.composer { display: grid; gap: 6px; margin: 16px 0 24px; }
.composer textarea { width: 100%; resize: vertical; }
.composer .button { justify-self: start; }

.thread { margin-bottom: 18px; }
.post {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.post .meta { margin: 0 0 6px; }
.post-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.post-actions button {
  font-weight: 700; color: var(--forest); border: 0; background: none;
  padding: 0; text-decoration: underline; min-height: 40px;
}
/* A removed post stays on screen for its author and for moderators, visibly
   different, rather than vanishing with no explanation. */
.hidden-post { background: #f3f0ea; border-style: dashed; opacity: .75; }
.reply { margin: 8px 0 0 16px; padding-left: 12px; border-left: 2px solid var(--line); }

/* ── Plans ───────────────────────────────────────────────────────────── */

.plan-grid { display: grid; gap: 12px; margin: 16px 0; }
.plan {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.plan.current { border-color: #8eaa96; box-shadow: inset 0 0 0 1px #8eaa96; }
.plan > strong { display: block; font: 400 1.45rem/1.2 Georgia, serif; margin: 6px 0 2px; }
.plan-price { font-weight: 750; margin-bottom: 8px; }
.plan-price small { display: block; font-weight: 500; color: var(--soft); }
.plan ul { margin: 10px 0 14px; padding-left: 18px; color: var(--soft); font-size: .93rem; }
.plan li { margin-bottom: 4px; }
.plan .button { width: 100%; }

/* Shown where a gated feature would have been. It names what is missing
   and what is NOT affected, so it reads as an explanation rather than a
   wall. */
.upsell {
  background: var(--lilac);
  border-radius: 16px;
  padding: 18px;
  margin: 18px 0;
}
.upsell strong { display: block; font: 400 1.35rem/1.2 Georgia, serif; margin: 8px 0 6px; }
.upsell p { color: var(--soft); margin-bottom: 12px; }

@media (min-width: 861px) {
  .plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
}

/* ── Parent Recharge ─────────────────────────────────────────────────── */

.recharge-widget {
  background: var(--lilac);
  border-radius: 18px;
  padding: 18px;
  margin: 16px 0;
  display: grid;
  gap: 14px;
}
.recharge-widget strong {
  display: block;
  font: 400 1.5rem/1.2 Georgia, serif;
  margin: 8px 0 6px;
}
.recharge-widget p { margin-bottom: 0; color: var(--soft); }
.recharge-widget-actions { display: grid; gap: 10px; justify-items: start; }
.recharge-widget-actions .button { width: 100%; }

.exercise-grid { display: grid; gap: 12px; margin-top: 14px; }
.exercise {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 10px;
  justify-items: start;
}
.exercise strong { display: block; font-size: 1.05rem; }
.exercise p { margin: 4px 0 0; }
.exercise .button { width: 100%; }

/* The player. The count is the only thing on screen that moves, so it is
   the only thing that needs to be big. */
.ex-stage { margin: 14px 0; }
.ex-stage strong { display: block; font: 400 1.5rem/1.2 Georgia, serif; margin-bottom: 6px; }
.ex-count {
  font: 400 3.4rem/1 Georgia, serif;
  color: var(--forest);
  margin: 0 0 10px;
  font-variant-numeric: tabular-nums;
}
.ex-count.paused { opacity: .45; }

@media (min-width: 861px) {
  .recharge-widget { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .recharge-widget-actions { justify-items: end; }
  .recharge-widget-actions .button { width: auto; }
  .exercise-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exercise { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .exercise .button { grid-column: 2; width: auto; }
}

.danger { border-color: #a35151; color: #8c2f2f; }
.danger:hover { background: #f6e4e4; }

/* Bars: narrow label column on a phone, roomier once there is width. */
.bar-row { grid-template-columns: 84px minmax(0, 1fr) 40px; }
@media (min-width: 861px) {
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 46px; }
}

/* ── Meeting report ──────────────────────────────────────────────────────
   The artifact a parent carries into an IEP or a clinic appointment. It is
   read on paper by people who did not write it, so it states what it is on
   the page rather than relying on the app's framing. */

.report { max-width: 48rem; }
.report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 2px solid var(--forest);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.report-head h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0 0 6px; }
.report-meta { color: var(--soft); font-size: .88rem; margin: 0; }
.report-brand {
  color: var(--forest); font: 700 24px/1 Georgia, serif;
  letter-spacing: -.05em; margin: 0; white-space: nowrap;
}
.report-brand span { color: #648038; }
.report h2 {
  font-size: 1.3rem;
  margin: 26px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.report .note { font-size: .85rem; color: var(--soft); margin: 0 0 10px; }

.report table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.report th, .report td {
  text-align: left;
  vertical-align: top;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.report th { background: var(--sage); font-weight: 700; }

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 0;
}
.summary > div { background: var(--sage); border-radius: 12px; padding: 11px 13px; }
.summary dt { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.summary dd { margin: 4px 0 0; font: 400 1.5rem/1.1 Georgia, serif; }
/* An average means little without the denominator; a reader should be able
   to see "9.8 h" was two nights, not two months. */
.summary .over { display: block; font: 400 .76rem/1.3 system-ui, sans-serif; color: var(--soft); }

.ruled { border-bottom: 1px solid var(--line); height: 30px; }
.report-foot {
  margin-top: 28px; padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--soft);
}
.report-foot p { margin: 0 0 3px; }

@media print {
  /* Only the report leaves the building. */
  .app-nav, .workspace-profile, .toolbar, #gate, #boot, #toast { display: none !important; }
  .shell { display: block !important; }
  .app-content { padding: 0; }
  body { background: white; }
  .report { max-width: none; }
  .report h2 { break-after: avoid; }
  .report table { break-inside: auto; font-size: .78rem; }
  .report tr { break-inside: avoid; }
  /* A table that runs over a page break is unreadable without its headers. */
  .report thead { display: table-header-group; }
  .report th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .caveat, .summary > div {
    background: #f4f4f4 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    break-inside: avoid;
  }
  .questions { break-before: page; }
  a[href]::after { content: ""; }
}
