/* ──────────────────────────────────────────────────────────────────────────
 * /css/_lib/reminder-sheet.css
 *
 * MANIFEST
 * Purpose: TrustGuard Glass Tier-3 "Set a reminder" sheet (LOCKED C116
 *          Sub-2) — pairs with /js/_lib/reminder-sheet.js
 *          (window.TG.reminderSheet). A backdrop scrim + a glass surface
 *          that slides up as a BOTTOM SHEET below the 640px content-column
 *          breakpoint and presents as a CENTERED glass CARD at/above it —
 *          same presentation contract as /css/_lib/upgrade.css +
 *          /css/_lib/dialog.css.
 *
 *          This file ALSO carries the Reminders-TAB affordances (the
 *          create-button + per-card action buttons + section headers +
 *          due/state labels) under the `.rem-*` prefix. Those classes only
 *          render on reminders.html (the markup exists nowhere else), so
 *          shipping them in this shared _lib file is inert on the other
 *          consumer pages. The card SHELL reuses the proven
 *          /css/page-reminders.css `.reminder-card` / `.card-*` recipe
 *          (already dark-glass per C109) — this file adds only the genuinely
 *          new bits the Sub-2 tab rewrite introduced.
 *
 * Glass:   Tier-3 recipe (LOCKED C97-A) built ENTIRELY from the Glass tokens
 *          in /css/tokens.css. Buttons consume the LOCKED C107-A
 *          --btn-primary-* / --btn-secondary-* tokens. NO hardcoded glass
 *          values. @supports not(backdrop-filter) → solid opaque-tint
 *          fallback.
 *
 * Cascade: A /css/_lib/ shared module (LOCKED C82-A). Loaded AFTER the shared
 *          base layer and BEFORE the page CSS. Single-class `.tg-rem-*` /
 *          `.rem-*` rules — no page CSS competes.
 *
 * Dark-only: DARK is the authoritative value set (launch is dark-only per
 *          LOCKED C99-A). LIGHT values resolve from the provisional light
 *          token set — finalized at the Phase 4 light sprint.
 *
 * Precache: in sw.js PRECACHE_URLS (loaded by the reminder-sheet consumer
 *          pages — same rationale as upgrade.css / dialog.css).
 *
 * Consumed by: reminders.html (sheet + tab) + client-detail.html /
 *          purchased-lead.html / contracts.html (sheet only).
 *
 * Shipped: C116 (Reminders Sub-2 — create UI).
 * ────────────────────────────────────────────────────────────────────────── */

/* ════════════════════════════════════════════════════════════════════════
 * Sheet — `.tg-rem-*`
 * ════════════════════════════════════════════════════════════════════════ */

/* ── Backdrop scrim — bottom-anchored sheet < 640px, centered card ≥ 640px ── */
.tg-rem-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.tg-rem-overlay.tg-rem-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Glass sheet surface (< 640px) ──────────────────────────────────────── */
.tg-rem {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;

  /* Glass recipe — Tier 3 (LOCKED C97-A), tokens only */
  background: var(--tier3-tint);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-edge);
  border-bottom: none;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--edge-highlight);

  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.tg-rem-overlay.tg-rem-open .tg-rem {
  transform: translateY(0);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tg-rem {
    background: var(--tier3-tint-opaque);
  }
}

/* ── Centered glass CARD (≥ 640px) ──────────────────────────────────────── */
@media (min-width: 640px) {
  .tg-rem-overlay {
    align-items: center;
  }
  .tg-rem {
    width: auto;
    min-width: 360px;
    max-width: 440px;
    padding-bottom: var(--space-5);
    border-radius: var(--radius-xl);
    border-bottom: 1px solid var(--glass-edge);
    transform: scale(0.96);
    transition: transform 0.2s ease;
  }
  .tg-rem-overlay.tg-rem-open .tg-rem {
    transform: scale(1);
  }
}

/* ── Title ──────────────────────────────────────────────────────────────── */
.tg-rem-title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  color: var(--text);
}

/* ── Linked-record chip ─────────────────────────────────────────────────── */
.tg-rem-linked {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 var(--space-4);
  padding: var(--space-2-5) var(--space-3-5);
  border-radius: var(--radius-md);
  background: var(--tier2-bg);
  border: 1px solid var(--hairline);
  box-shadow: var(--tier2-inset);
}
.tg-rem-linked-key {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}
.tg-rem-linked-val {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--text);
  word-break: break-word;
}

/* ── Fields ─────────────────────────────────────────────────────────────── */
.tg-rem-field {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-4);
}

.tg-rem-label {
  margin-bottom: var(--space-1-5);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}

.tg-rem-input,
.tg-rem-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: var(--space-2-5) var(--space-3-5);
  border-radius: var(--radius-md);
  background: var(--tier2-bg);
  border: 1px solid var(--hairline);
  box-shadow: var(--tier2-inset);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  color: var(--text);
}

.tg-rem-textarea {
  resize: vertical;
  line-height: var(--leading-normal);
}

.tg-rem-input::placeholder,
.tg-rem-textarea::placeholder {
  color: var(--text-disabled);
}

.tg-rem-input:focus-visible,
.tg-rem-textarea:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

/* ── Inline error line ──────────────────────────────────────────────────── */
.tg-rem-err {
  display: none;
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  color: var(--danger, var(--red));
}
.tg-rem-err.tg-rem-err-show {
  display: block;
}

/* ── Action buttons — Glass button system (LOCKED C107-A) ───────────────── */
.tg-rem-actions {
  display: flex;
  gap: var(--space-2-5);
  margin-top: var(--space-2);
}

.tg-rem-btn {
  flex: 1 1 0;
  min-height: 44px;
  padding: var(--space-2-5) var(--space-4);
  border-radius: var(--btn-radius);
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), filter 0.15s ease;
}
.tg-rem-btn:hover { filter: brightness(1.1); }
.tg-rem-btn:active { transform: scale(var(--press-scale)); }
.tg-rem-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.tg-rem-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.tg-rem-confirm {
  background: var(--btn-primary-bg);
  border: var(--btn-primary-border);
  box-shadow: var(--btn-primary-shadow);
  color: var(--btn-primary-text);
}
.tg-rem-cancel {
  background: var(--btn-secondary-bg);
  border: var(--btn-secondary-border);
  box-shadow: var(--btn-secondary-shadow);
  color: var(--btn-secondary-text);
}

/* ── prefers-reduced-motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tg-rem-overlay { transition: opacity 0.001s linear; }
  .tg-rem,
  .tg-rem-overlay.tg-rem-open .tg-rem { transition: none; transform: none; }
  .tg-rem-btn { transition: filter 0.15s ease; }
}

/* ════════════════════════════════════════════════════════════════════════
 * Reminders TAB affordances — `.rem-*` (renders only on reminders.html)
 * ════════════════════════════════════════════════════════════════════════ */

/* Header row holding the "+ Reminder" create button. */
.rem-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.rem-add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  min-height: 40px;
  padding: var(--space-2) var(--space-3-5);
  border-radius: var(--btn-radius);
  background: var(--btn-primary-bg);
  border: var(--btn-primary-border);
  box-shadow: var(--btn-primary-shadow);
  color: var(--btn-primary-text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s var(--ease-spring), filter 0.15s ease;
}
.rem-add-btn:hover { filter: brightness(1.1); }
.rem-add-btn:active { transform: scale(var(--press-scale)); }
.rem-add-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.rem-add-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; fill: none; flex-shrink: 0; }

/* Section header — "Overdue" / "Upcoming" group dividers in the feed. */
.rem-section-head {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  margin: var(--space-2) 0 calc(-1 * var(--space-1));
  padding: 0 var(--space-1);
}
.rem-section-head.rem-section-overdue {
  color: var(--danger, var(--red));
}

/* Due / state line on a card. */
.rem-due {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  margin-top: var(--space-1-5);
}
.rem-due svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.rem-due.rem-due-overdue { color: var(--danger, var(--red)); }

/* Optional body/notes line. */
.rem-body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: var(--leading-normal);
}

/* Per-card action row (Done / Dismiss / Delete). */
.rem-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.rem-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  min-height: 36px;
  padding: var(--space-1-5) var(--space-3);
  border-radius: var(--btn-radius);
  background: var(--btn-secondary-bg);
  border: var(--btn-secondary-border);
  box-shadow: var(--btn-secondary-shadow);
  color: var(--btn-secondary-text);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), filter 0.15s ease;
}
.rem-action:hover { filter: brightness(1.1); }
.rem-action:active { transform: scale(var(--press-scale)); }
.rem-action:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.rem-action svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }

.rem-action.rem-action-danger {
  color: var(--danger, var(--red));
}

/* Linked-record deep link inside a card (title is an anchor when linkable). */
.rem-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .rem-add-btn,
  .rem-action { transition: filter 0.15s ease; }
}
