/* /tools/ pages: the tools index, the Flight Recorder and the smart-compact page. Builds on base.css
   tokens only, so light and dark both work; the shared components (.privacy-note, .card, .cmd) come
   from base.css and are not redefined here. */

.fr .masthead, .tl .masthead { padding-bottom: 0; }
.fr-sec, .fr-load, .tl-sec { max-width: var(--wide); margin: clamp(2.6rem, 6vh, 4rem) auto 0; padding: 0 var(--gutter); }
.fr-sec h2, .tl-sec h2 { font-size: var(--h2-major); letter-spacing: -0.025em; margin: 0 0 .9rem; }
/* text-only sections sit in a reading column centred under the centred masthead; the loader and
   the results keep the wide box */
.fr-about, .sc .tl-sec { max-width: calc(var(--measure) + 2 * var(--gutter)); }
.fr-hint { color: var(--dim); font-size: .95rem; max-width: var(--measure); }
.fr-empty { color: var(--faint); font-family: var(--mono); font-size: .78rem; }

/* ---------- loading ---------- */
.fr-drop {
  margin-top: 1rem; padding: clamp(1.2rem, 4vw, 2rem); border: 1.5px dashed var(--edge); border-radius: 10px;
  background: var(--panel); text-align: center; transition: border-color .15s, background-color .15s;
}
.fr-drop.over { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 7%, var(--panel)); }
.fr-drop.busy { border-style: solid; }
.fr-drop-h { margin: 0 0 1rem; color: var(--bright); font-weight: 500; }
.fr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.fr-actions .fig-btn { font-size: .8rem; padding: .6em 1.15em; }
label.fig-btn { display: inline-flex; align-items: center; }
.fr-file:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 3px; }
.fr-file:disabled + label { opacity: .45; cursor: default; }
.fr-where { color: var(--faint); font-size: .86rem; margin: 1rem auto 0; max-width: 36rem; }
.fr-status { min-height: 1.5em; margin: .9rem 0 0; font-family: var(--mono); font-size: .78rem; color: var(--dim); overflow-wrap: anywhere; }
.fr-status[data-kind="ok"] { color: var(--heal); }
.fr-status[data-kind="error"] { color: var(--rust); }

/* ---------- summary ---------- */
.fr-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); margin: 0; border-top: 1px solid var(--edge-soft); border-left: 1px solid var(--edge-soft); }
.fr-stat { padding: .7rem .9rem; box-shadow: inset -1px -1px 0 var(--edge-soft); }
.fr-stat dt { font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; color: var(--faint); }
.fr-stat dd { margin: .15rem 0 0; color: var(--bright); font-size: 1.05rem; font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.fr-stat-note { color: var(--faint); font-size: .78rem; }
.fr-unread { font-family: var(--mono); font-size: .78rem; color: var(--dim); overflow-wrap: anywhere; }

/* ---------- chart ---------- */
.fr-panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: .8rem; box-shadow: var(--shadow); }
#frChart { display: block; width: 100%; height: 260px; background: var(--bg); border-radius: 6px; touch-action: pan-y; cursor: crosshair; }
#frChart:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fr-legend { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin: .7rem .2rem 0; padding: 0; font-family: var(--mono); font-size: .74rem; color: var(--dim); }
.fr-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.fr-sw { width: .8rem; height: .8rem; border-radius: 2px; display: inline-block; }
.fr-sw[data-c="blue"] { background: color-mix(in srgb, var(--blue) 55%, transparent); border: 1px solid var(--blue); }
.fr-sw[data-c="gold"] { background: color-mix(in srgb, var(--gold) 55%, transparent); border: 1px solid var(--gold); }
.fr-sw[data-c="heal"] { background: color-mix(in srgb, var(--heal) 55%, transparent); border: 1px solid var(--heal); }
.fr-sw[data-c="rust"] { background: color-mix(in srgb, var(--rust) 55%, transparent); border: 1px solid var(--rust); }
.fr-sw-line { width: 1rem; height: 0; border-radius: 0; border-top: 1.5px dashed var(--bright); }
.fr-readout { min-height: 1.6em; margin: .5rem .2rem 0; font-family: var(--mono); font-size: .74rem; color: var(--dim); overflow-wrap: anywhere; }

/* ---------- compactions ---------- */
.fr-cmp { border-top: 1px solid var(--edge-soft); padding: 1.2rem 0 1.4rem; }
.fr-cmp h3 { margin: 0; font-size: 1.1rem; }
.fr-cmp-meta { margin: .2rem 0 .9rem; font-family: var(--mono); font-size: .76rem; color: var(--faint); }
.fr-cmp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin-bottom: .9rem; }
@media (max-width: 720px) { .fr-cmp-grid { grid-template-columns: minmax(0, 1fr); } }
.fr-side { background: var(--panel); border: 1px solid var(--edge-soft); border-radius: 8px; padding: .8rem .9rem; min-width: 0; }
.fr-side h4 { margin: 0 0 .5rem; font-family: var(--mono); font-size: .74rem; font-weight: 500; letter-spacing: .04em; color: var(--faint); }
.fr-side .fig-btn { margin-top: .6rem; }
.fr-marks, .fr-summary { margin: 0; padding: 0; font-size: .9rem; line-height: 1.5; }
.fr-marks { list-style: none; }
.fr-marks li { display: grid; grid-template-columns: 1.1em minmax(0, 1fr); column-gap: .45rem; row-gap: .2rem; margin: .45rem 0; overflow-wrap: anywhere; }
.fr-marks li > .fr-tag { grid-column: 2; justify-self: start; }
.fr-marks li.fr-empty { display: block; }
.fr-glyph { font-family: var(--mono); color: var(--gold); }
.fr-marks li.drop .fr-glyph { color: var(--faint); }
.fr-summary { list-style: none; color: var(--text); }
.fr-summary li { margin: .2rem 0; overflow-wrap: anywhere; }
.fr-tag { font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; color: var(--heal); border: 1px solid color-mix(in srgb, var(--heal) 45%, var(--edge)); border-radius: 999px; padding: 0 .5em; align-self: center; }
.fr-tag.warn { color: var(--rust); border-color: color-mix(in srgb, var(--rust) 45%, var(--edge)); }

/* ---------- detectors ---------- */
.fr-det { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .8rem; }
.fr-card { background: var(--panel); border: 1px solid var(--edge-soft); border-radius: 8px; padding: .8rem .9rem; min-width: 0; }
.fr-card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin: 0 0 .4rem; font-size: 1rem; }
.fr-count { font-family: var(--mono); font-size: .9rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.fr-count.hit { color: var(--rust); }
.fr-card ul { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.fr-card li { display: flex; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-top: 1px solid var(--edge-soft); }
.fr-det-text { overflow-wrap: anywhere; min-width: 0; }
.fr-link { font: inherit; font-family: var(--mono); font-size: .74rem; color: var(--gold); background: none; border: 0; padding: .1rem 0; cursor: pointer; white-space: nowrap; text-decoration: underline; text-underline-offset: .2em; min-height: 24px; }
.fr-link:hover { color: var(--bright); }

/* ---------- timeline ---------- */
.fr-filter { margin-bottom: .9rem; }
@media (max-width: 480px) { .seg.fr-filter:has(> button:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fr-tl { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--edge); }
.fr-row { position: relative; padding: .55rem 0 .55rem 1rem; min-width: 0; }
.fr-row::before { content: ""; position: absolute; left: -4px; top: 1.05rem; width: 7px; height: 7px; border-radius: 50%; background: var(--edge); }
.fr-row.user::before { background: var(--gold); }
.fr-row.side { margin-left: 1.2rem; border-left: 1px dashed var(--edge); }
.fr-row.side::before { left: -4px; background: var(--blue); }
.fr-row.compact { padding: .7rem 0 .7rem 1rem; }
.fr-row.compact::before { background: var(--bright); width: 9px; height: 9px; left: -5px; top: 1.05rem; }
.fr-row-c { font-family: var(--mono); font-size: .76rem; letter-spacing: .04em; color: var(--bright); border: 1px dashed var(--edge); border-radius: 6px; padding: .25rem .6rem; display: inline-block; }
.fr-row.flash { background: color-mix(in srgb, var(--gold) 12%, transparent); border-radius: 6px; }
.fr-row:focus { outline: none; }
.fr-row:focus-visible { outline: 2px solid var(--gold); }
.fr-row-h { display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-family: var(--mono); font-size: .72rem; color: var(--faint); }
.fr-role { color: var(--dim); letter-spacing: .05em; text-transform: uppercase; }
.fr-row.user .fr-role { color: var(--gold); }
.fr-text { margin: .2rem 0 0; font-size: .93rem; line-height: 1.5; overflow-wrap: anywhere; }
.fr-tools { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: .35rem 0 0; padding: 0; }
.fr-tool { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; max-width: 100%; font-family: var(--mono); font-size: .72rem; color: var(--dim); background: var(--panel); border: 1px solid var(--edge-soft); border-radius: 6px; padding: .15rem .5rem; overflow-wrap: anywhere; min-width: 0; }
.fr-tool b { color: var(--bright); font-weight: 500; }
.fr-tool > span { min-width: 0; }
.fr-tool.err { border-color: color-mix(in srgb, var(--rust) 45%, var(--edge)); }
.fr-more { margin: 1rem 0 0; }

/* ---------- about ---------- */
.fr-about p { max-width: var(--measure); }
.fr-aff { font-family: var(--mono); font-size: .76rem; color: var(--faint); }

/* ---------- tools index (/tools/) ---------- */
.tl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }  /* four cards: 2 x 2, not 3 + 1 */
.tl-card { display: flex; flex-direction: column; gap: .6rem; padding: 1.1rem 1.15rem 1.2rem; min-width: 0; }
.tl-card h2 { margin: 0; font-size: 1.25rem; }
.tl-card p { margin: 0; font-size: .95rem; }
.tl-card .tl-kind { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.tl-card .tl-go { margin-top: auto; padding-top: .4rem; }
.tl-card .tl-go a { font-family: var(--mono); font-size: .8rem; }
.tl-note { max-width: 68ch; color: var(--dim); font-size: .95rem; }

/* ---------- smart-compact page ---------- */
.sc-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.sc-table th, .sc-table td { text-align: left; vertical-align: top; padding: .55rem .6rem; border-top: 1px solid var(--edge-soft); }
.sc-table th { font-family: var(--mono); font-size: .72rem; font-weight: 500; letter-spacing: .04em; color: var(--faint); }
.sc-table td:first-child { font-family: var(--mono); color: var(--gold); white-space: nowrap; }
.sc-wrap { overflow-x: auto; }
.tl-sec ul.sc-list { padding-left: 1.2rem; max-width: var(--measure); }
.tl-sec ul.sc-list li { margin: .4rem 0; }
.tl-sec p { max-width: var(--measure); }

@media print {
  .fr-load, .fr-filter, .fr-more, .fr-cmp .fig-btn { display: none; }
}
.tl-card h2 a { color: var(--bright); border: 0; }
.tl-card h2 a:hover { color: var(--gold); }
