/* SOFTYTOOLS — Prop Firm Consistency Calculator. Loaded only on /prop-firm-consistency-calculator.
   Every selector is prefixed .pfc- (or scoped under .pfc-app), so nothing here can affect another page.
   Colours, radii and fonts come from the existing tokens in style.css, so light and dark mode follow the site. */

.pfc-app [hidden] { display: none !important; }
.pfc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.pfc-privacy {
  display: flex; align-items: center; gap: 8px; margin: 0 0 18px;
  font-size: 0.87rem; color: var(--ink-soft);
}
.pfc-privacy svg { flex: none; color: var(--gain-text); }

.pfc-req, .pfc-opt-tag {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); margin-left: 4px;
}
.pfc-help { font-size: 0.85rem; color: var(--ink-soft); margin: 0 0 12px; }
.pfc-err { min-height: 0; font-size: 0.83rem; color: var(--loss-text); margin-top: 4px; }
.pfc-err:empty { display: none; }
.pfc-app .field input[aria-invalid="true"], .pfc-row input[aria-invalid="true"], .pfc-stage-amt[aria-invalid="true"] { border-color: var(--loss); }

/* ----- radio option cards ----- */
.pfc-fieldset { border: 0; padding: 0; margin: 0 0 6px; min-width: 0; }
.pfc-fieldset legend { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); padding: 0; margin-bottom: 8px; }
.pfc-opt {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
}
.pfc-opt input { margin-top: 4px; accent-color: var(--ember-btn-a); flex: none; }
.pfc-opt span { display: flex; flex-direction: column; min-width: 0; }
.pfc-opt b { font-size: 0.93rem; }
.pfc-opt small { font-size: 0.8rem; color: var(--ink-soft); }
.pfc-opt:has(input:checked) { border-color: var(--ember); background: var(--ember-soft); }
.pfc-opt:focus-within { outline: 2px solid var(--ember); outline-offset: 1px; }

/* ----- manual entry ----- */
.pfc-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.pfc-add .field { margin-bottom: 8px; }
.pfc-add-btnwrap .btn { white-space: nowrap; }
.pfc-rows { max-height: 360px; overflow-y: auto; margin: 10px 0; padding-right: 2px; }
.pfc-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--line);
}
.pfc-idx { font-size: 0.78rem; color: var(--ink-soft); text-align: right; }
.pfc-row input, .pfc-stage-amt, .pfc-app textarea, .pfc-app select {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 0.95rem; font-family: inherit;
}
.pfc-row input:focus, .pfc-stage-amt:focus, .pfc-app textarea:focus, .pfc-app select:focus { border-color: var(--ember); outline: none; }
.pfc-app textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pfc-row-err { grid-column: 2 / -1; font-size: 0.8rem; color: var(--loss-text); }
.pfc-row-err:empty { display: none; }
.pfc-listbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 0.85rem; color: var(--ink-soft); }
.pfc-check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.87rem; margin: 10px 0 4px; cursor: pointer; }
.pfc-check input { margin-top: 3px; accent-color: var(--ember-btn-a); }

/* ----- paste / csv ----- */
.pfc-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.pfc-inline .field { flex: 1 1 220px; margin-bottom: 0; }
.pfc-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.pfc-drop {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 26px 16px; border: 2px dashed var(--line-strong); border-radius: var(--radius-md);
  background: var(--paper); cursor: pointer; color: var(--ink);
}
.pfc-drop small { color: var(--ink-soft); font-size: 0.8rem; }
.pfc-drop:hover, .pfc-drop.is-over { border-color: var(--ember); background: var(--ember-soft); }
.pfc-drop:focus-within { outline: 2px solid var(--ember); outline-offset: 2px; }
.pfc-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* ----- preview (staging) table ----- */
.pfc-stage { margin-top: 16px; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--paper); }
.pfc-stage h3 { margin: 0 0 4px; font-size: 1rem; }
.pfc-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin: 8px 0 12px; }
.pfc-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.pfc-table th, .pfc-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pfc-table th { position: sticky; top: 0; background: var(--surface); font-size: 0.75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.pfc-table td:first-child, .pfc-table th:first-child { width: 36px; color: var(--ink-soft); }
.pfc-table .pfc-stage-amt { min-width: 110px; padding: 6px 8px; }
.pfc-stage-state { min-width: 140px; color: var(--ink-soft); }
.pfc-stage-state.is-bad { color: var(--loss-text); }
.pfc-btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.pfc-note-warn, .pfc-note-ok { font-size: 0.85rem; margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-sm); }
.pfc-note-warn { background: var(--ember-soft); color: var(--ink); }
.pfc-note-ok { background: var(--gain-soft); color: var(--gain-text); }

/* ----- result column ----- */
.pfc-side { align-self: start; }
@media (min-width: 801px) {
  .pfc-side { position: sticky; top: calc(var(--nav-h) + 12px); max-height: calc(100vh - var(--nav-h) - 24px); overflow-y: auto; }
}
.pfc-status {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
}
.pfc-status-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--line-strong); color: var(--ink); font-size: 0.9rem; line-height: 1;
}
.pfc-st-within .pfc-status { background: var(--gain-soft); border-color: var(--gain); color: var(--gain-text); }
.pfc-st-within .pfc-status-icon { background: var(--gain); color: #fff; }
.pfc-st-above .pfc-status, .pfc-st-at-limit .pfc-status { background: var(--loss-soft); border-color: var(--loss); color: var(--loss-text); }
.pfc-st-above .pfc-status-icon, .pfc-st-at-limit .pfc-status-icon { background: var(--loss); color: #fff; }
.pfc-st-at-limit .pfc-status { border-style: dashed; }
.pfc-explain { margin: 10px 0 8px; font-size: 0.9rem; }
.pfc-note { font-size: 0.8rem; color: var(--ink-soft); margin: 0 0 8px; }
.pfc-note:empty { display: none; }
.pfc-result .result-row b { font-variant-numeric: tabular-nums; }
.pfc-ruleline { margin-top: 8px; font-weight: 600; }

/* compact status chip, shown only on small screens (sticks under the site header) */
.pfc-chip { display: none; }
@media (max-width: 800px) {
  .pfc-chip {
    display: block; position: sticky; top: 8px; z-index: 20; margin: 0 -8px 14px;
    padding: 8px 12px; text-align: center; font-weight: 700; font-size: 0.9rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.08);
  }
  .pfc-chip.pfc-st-within { background: linear-gradient(var(--gain-soft), var(--gain-soft)), var(--surface); border-color: var(--gain); color: var(--gain-text); }
  .pfc-chip.pfc-st-above, .pfc-chip.pfc-st-at-limit { background: linear-gradient(var(--loss-soft), var(--loss-soft)), var(--surface); border-color: var(--loss); color: var(--loss-text); }
}

/* ----- small screens ----- */
@media (max-width: 560px) {
  .pfc-app .calc-panel-inner { padding: 18px 14px; }
  .pfc-add { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pfc-add-btnwrap .btn { width: 100%; }
  .pfc-row { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "i d d" "i a x" "e e e"; row-gap: 6px; }
  .pfc-row .pfc-idx { grid-area: i; align-self: start; padding-top: 12px; }
  .pfc-row .pfc-date { grid-area: d; }
  .pfc-row .pfc-amt { grid-area: a; }
  .pfc-row .pfc-del { grid-area: x; }
  .pfc-row .pfc-row-err { grid-area: e; }
  .pfc-grid2 { grid-template-columns: minmax(0, 1fr); }
  .pfc-row input, .pfc-app textarea, .pfc-app select, .pfc-app .field input { font-size: 16px; }   /* avoids iOS zoom on focus */
  .pfc-btnrow .btn { flex: 1 1 100%; }
  .pfc-stage { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { .pfc-app * { transition: none !important; } }

/* =====================================================================
   Phase 4 — daily P&L chart (native SVG). Same .pfc- prefix, same site tokens.
   ===================================================================== */
.pfc-chart-card { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.pfc-chart-card h2 { margin-top: 0; }
.pfc-chart-empty { padding: 28px 18px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--paper); color: var(--ink-soft); }
.pfc-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; padding: 0; margin: 0 0 10px; font-size: 0.82rem; color: var(--ink-soft); }
.pfc-legend li { display: inline-flex; align-items: center; gap: 6px; }
.pfc-sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex: none; }
.pfc-sw-pos { background: var(--gain); }
.pfc-sw-neg { background: var(--loss); }
.pfc-sw-best { background: var(--ember); border: 2px solid var(--ink); }
.pfc-sw-flat { background: var(--ink-soft); height: 3px; }
.pfc-sw-line { width: 20px; height: 0; border-radius: 0; border-top: 2px dashed var(--ember-deep); }

.pfc-chart-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.pfc-chart-host { display: block; width: 100%; touch-action: pan-y; border-radius: var(--radius-md); }
.pfc-chart-host:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.pfc-svg { display: block; max-width: 100%; user-select: none; -webkit-user-select: none; }
.pfc-svg text { font-size: 11px; fill: var(--ink-soft); font-family: inherit; }
.pfc-grid { stroke: var(--line); stroke-width: 1; }
.pfc-zero { stroke: var(--ink-soft); stroke-width: 1.5; }
.pfc-bar-pos { fill: var(--gain); }
.pfc-bar-neg { fill: var(--loss); }
.pfc-bar-flat { fill: var(--ink-soft); }
.pfc-bar-best { fill: var(--ember); stroke: var(--ink); stroke-width: 2; }
.pfc-bar-best.pfc-thin { stroke: none; }
.pfc-cursor { fill: var(--ember-soft); }
.pfc-tline { stroke: var(--ember-deep); stroke-width: 2; stroke-dasharray: 6 4; }
.pfc-svg .pfc-tlabel, .pfc-svg .pfc-best-lbl { font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.pfc-svg .pfc-tlabel { fill: var(--ember-deep); }
.pfc-svg .pfc-best-lbl { fill: var(--ink); }

.pfc-tip {
  position: absolute; z-index: 5; pointer-events: none; max-width: 240px; padding: 8px 10px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18); font-size: 0.82rem; line-height: 1.35;
}
.pfc-tip-title { font-weight: 700; margin-bottom: 2px; }
.pfc-chart-summary { font-size: 0.9rem; margin: 12px 0 6px; }
.pfc-details { margin-top: 10px; }
.pfc-details summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; padding: 6px 0; }
.pfc-details summary:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.pfc-table tr.is-best td { font-weight: 700; background: var(--ember-soft); }
@media (max-width: 560px) { .pfc-legend { gap: 6px 14px; font-size: 0.78rem; } }
