/* ════════════════════════════════════════════════════════════════════════
   pfc-app.css — Shared application chrome
   Used on every authenticated page (dashboard, goals, debts, etc.)
   Replaces the ~250 lines of duplicated sidebar/topbar/button CSS that
   was copy-pasted into every page.
   Loaded AFTER pfc-tokens.css so token vars are available.
   ════════════════════════════════════════════════════════════════════════ */

html, body { height: 100%; }
body.pfc-app {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  display: flex;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.pfc-sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 0 16px;
}
.pfc-sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 18px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: var(--t-18);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.pfc-logo-mark {
  width: 32px; height: 32px;
  border-radius: var(--r-xs);
  background: linear-gradient(135deg, #0B1410 0%, #143524 100%);
  border: 1px solid rgba(212,175,106,0.30);
  display: grid; place-items: center;
  position: relative;
  flex-shrink: 0;
}
/* The compound-curve glyph in the logo mark — same as favicon */
.pfc-logo-mark::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 72% 22%, rgba(212,175,106,0.55) 0 1.5px, transparent 2px),
    linear-gradient(115deg,
      transparent 25%,
      rgba(212,175,106,0.85) 25%, rgba(212,175,106,0.85) 27%,
      transparent 27% 100%);
  -webkit-mask:
    linear-gradient(115deg, transparent 30%, black 30%, black 32%, transparent 32%),
    radial-gradient(circle at 72% 22%, black 0 2.5px, transparent 3px);
  mask:
    linear-gradient(115deg, transparent 30%, black 30%, black 32%, transparent 32%),
    radial-gradient(circle at 72% 22%, black 0 2.5px, transparent 3px);
}
.pfc-sidebar-section {
  padding: 18px 12px 6px;
  font-family: var(--font-mono);
  font-size: var(--t-11);
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.pfc-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: var(--r-sm);
  font-size: var(--t-14);
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}
.pfc-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--ink); }
.pfc-nav-item.is-active {
  background: var(--money-soft);
  color: var(--money);
}
.pfc-nav-item .pfc-nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(212,175,106,0.22);
  padding: 2px 7px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
}
.pfc-sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid var(--line);
}
.pfc-user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.pfc-user-pill:hover { background: rgba(255,255,255,0.03); }
.pfc-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--money) 0%, #1B7B57 100%);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: var(--canvas);
  flex-shrink: 0;
}
.pfc-user-name { font-size: var(--t-13); font-weight: 500; color: var(--ink); }
.pfc-user-plan {
  font-family: var(--font-mono);
  font-size: var(--t-11);
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Main column ──────────────────────────────────────────────────────── */
.pfc-main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--canvas);
}
.pfc-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  height: 64px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 20, 16, 0.85);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  position: sticky; top: 0; z-index: 10;
}
.pfc-topbar-title {
  font-family: var(--font-display);
  font-size: var(--t-20);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.pfc-topbar-sub {
  font-size: var(--t-12);
  color: var(--ink-3);
  margin-top: 1px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.pfc-content {
  padding: 32px;
  max-width: 1200px;
  width: 100%;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.pfc-btn {
  font-family: var(--font-body);
  font-size: var(--t-14);
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all var(--t-base) var(--ease-out);
  text-decoration: none;
  color: inherit;
}
.pfc-btn-primary {
  background: var(--money); color: var(--canvas);
  font-weight: 600;
  box-shadow: var(--glow-money);
}
.pfc-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.20) inset, 0 14px 50px var(--money-glow);
}
.pfc-btn-gold {
  background: var(--gold); color: var(--canvas);
  font-weight: 600;
  box-shadow: var(--glow-gold);
}
.pfc-btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
.pfc-btn-outline:hover { border-color: var(--money); background: var(--money-soft); }
.pfc-btn-ghost { background: transparent; color: var(--ink-2); }
.pfc-btn-ghost:hover { color: var(--ink); }
.pfc-btn-danger {
  background: transparent; color: var(--warning);
  border-color: rgba(230,110,92,0.40);
}
.pfc-btn-danger:hover { background: var(--warning-soft); border-color: var(--warning); }
.pfc-btn-lg { padding: 14px 26px; font-size: var(--t-15); }
.pfc-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.pfc-field { margin-bottom: var(--s-4); }
.pfc-field-label {
  display: block;
  font-size: var(--t-13);
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.pfc-input,
.pfc-select,
.pfc-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-size: var(--t-14);
  color: var(--ink);
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}
.pfc-input:focus,
.pfc-select:focus,
.pfc-textarea:focus {
  border-color: var(--money);
  background: var(--surface-3);
}
.pfc-input::placeholder { color: var(--ink-3); }
.pfc-input.is-invalid { border-color: var(--warning); }

/* ── Stat blocks ──────────────────────────────────────────────────────── */
.pfc-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px 24px;
}
.pfc-stat-label {
  font-family: var(--font-mono);
  font-size: var(--t-11);
  color: var(--ink-3);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.pfc-stat-value {
  font-family: var(--font-display);
  font-size: var(--t-36);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.pfc-stat-delta { font-family: var(--font-mono); font-size: var(--t-13); margin-top: 6px; }
.pfc-stat-delta.up   { color: var(--money); }
.pfc-stat-delta.down { color: var(--warning); }

/* ── Eyebrow / section header ─────────────────────────────────────────── */
.pfc-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--t-12);
  font-weight: 500;
  color: var(--money);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.pfc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-14);
}
.pfc-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--t-11);
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.pfc-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.pfc-table tr:last-child td { border-bottom: none; }
.pfc-table tr:hover td { background: rgba(255,255,255,0.02); }
.pfc-table .num { font-family: var(--font-mono); color: var(--ink); }

/* ── Scrollbar (minimal) ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Wave-2 utility layer (Sprint 2 design tokens) ───────────────────────
   New opt-in classes consuming the --space-*/--radius-*/--elev-*/--dur-*
   tokens added in pfc-tokens.css. Existing .pfc-card / .pfc-input rules
   above are preserved unchanged; new behavior is on modifier classes.
   ──────────────────────────────────────────────────────────────────────── */

.num,
[data-num] {
  font-family: var(--font-mono);
  font-feature-settings: var(--feat-numeric);
  font-variant-numeric: tabular-nums;
}

.pfc-card--elev {
  box-shadow: var(--elev-2);
  transition: box-shadow var(--dur-base) var(--ease-out);
}
.pfc-card--elev:hover {
  box-shadow: var(--elev-3), var(--elev-hover);
}
.pfc-card--gold {
  box-shadow: var(--elev-2), 0 0 0 1px var(--gold) inset;
}

.pfc-input--bottom {
  border: none;
  border-bottom: 1px solid var(--pfc-line-strong);
  border-radius: 0;
  padding: var(--space-3) 0;
  background: transparent;
  color: var(--pfc-ink-strong);
  font: 16px/1.4 var(--font-body);
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.pfc-input--bottom:focus {
  outline: none;
  border-bottom-color: var(--money);
}
.pfc-input--bottom.pfc-input--error {
  border-bottom-color: var(--warning);
}

/* WCAG 2.5.5 touch-target floor — applied to any interactive element that
   needs to clear the 44×44 minimum on mobile (sticky CTA, slider thumb
   wrap, sidebar drawer items, primary CTAs). */
.pfc-tap {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* W3 Task 3.5 — Mobile-safe minimum font sizes.
   Prevents iOS auto-zoom on input focus and improves readability at small
   viewport widths. Specific tags can override with their own font-size. */
@media (max-width: 768px) {
  body { font-size: 16px; }
  input, select, textarea, button { font-size: 16px; }
}

/* Hero credibility strip — 4-cell privacy guarantees on index.html. */
.credibility { padding: 64px 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.credibility .grid { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.credibility .cell { text-align: center; padding: 0 16px; border-right: 1px solid var(--line); }
.credibility .cell:last-child { border-right: none; }
.credibility .num { font-family: var(--font-display); font-size: clamp(48px, 5vw, 72px); font-weight: 500; color: var(--gold); line-height: 1; letter-spacing: -0.02em; }
.credibility .lbl { font-family: var(--font-body); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-top: 12px; }
@media (max-width: 700px) { .credibility .grid { grid-template-columns: repeat(2, 1fr); row-gap: 32px; } .credibility .cell:nth-child(2) { border-right: none; } }

@media print {
  body { background: white !important; color: #1A2520 !important; }
  a { color: inherit; text-decoration: none; }
  .no-print { display: none !important; }
}

/* ── Sidebar mobile toggle ─────────────────────────────────────────────
   Floating 44×44 hamburger, top-left. Hidden ≥ 880px; shown on mobile.
   Injected by js/pfc-sidebar.js so no per-page topbar edits are needed. */
.pfc-sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 101;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  border-radius: var(--r-xs, 6px);
  border: 1px solid var(--line, rgba(255,255,255,0.12));
  background: rgba(11,20,16,0.85);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  color: var(--ink-2, #B8C2BC);
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--dur-fast, 160ms) var(--ease-out, ease-out);
}
.pfc-sidebar-toggle:hover { background: rgba(255,255,255,0.04); color: var(--ink, #F0EDE2); }
.pfc-sidebar-toggle:focus-visible { outline: 2px solid var(--gold, #D4AF6A); outline-offset: 2px; }
body.pfc-sidebar-open { overflow: hidden; }
.pfc-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  animation: pfc-fadein var(--dur-base, 200ms) var(--ease-out, ease-out);
}
body.pfc-sidebar-open .pfc-sidebar-backdrop { display: block; }
@keyframes pfc-fadein { from { opacity: 0; } to { opacity: 1; } }

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  body.pfc-app { display: block; }
  .pfc-sidebar {
    position: fixed; inset: 0 auto 0 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease-out);
    box-shadow: 8px 0 24px rgba(0,0,0,0.4);
  }
  .pfc-sidebar.is-open { transform: translateX(0); }
  .pfc-sidebar-toggle { display: inline-flex; }
  .pfc-main { height: auto; min-height: 100vh; }
  .pfc-content { padding: 20px; }
  .pfc-topbar { padding: 0 16px; }
}
