/* Free tools (/tools/<slug>/). Built on the theme tokens; loaded only on tool pages. */

.tl-section { padding: var(--sp-stack) 0 var(--sp-section); }
.tl { position: relative; padding: var(--sp-card); border-radius: var(--r-xl); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.tl__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-card); align-items: start; }
.tl__grid--wide { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.tl__grid--form { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
.tl__col { min-width: 0; display: grid; gap: var(--s-16); align-content: start; }
.tl__title { margin: 0; font-size: var(--fs-body); font-weight: var(--fw-strong); color: var(--ink); line-height: var(--lh-body); }

.tl-label { display: block; margin-bottom: var(--s-8); font-family: var(--font-body); font-size: var(--fs-caption); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--muted); line-height: var(--lh-caption); }
.tl-field { display: block; min-width: 0; }
.tl-input, .tl-select, .tl-textarea { display: block; width: 100%; padding: var(--s-12) var(--s-16); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--paper-2); font: inherit; font-family: var(--font-system); font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink); transition: border-color 0.2s, background 0.2s; }
.tl-select { appearance: auto; }
.tl-textarea { min-height: 220px; resize: vertical; line-height: var(--lh-body-lg); }
.tl-textarea--short { min-height: 96px; }
.tl-textarea--code { font-family: var(--font-code); font-size: var(--fs-small); line-height: var(--lh-small); tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto; min-height: 300px; }
.tl-input:focus, .tl-select:focus, .tl-textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; background: var(--paper); }
.tl-input[aria-invalid="true"] { border-color: #b4533c; }
.tl-input--color { padding: var(--s-4); height: 46px; cursor: pointer; }

.tl-row { display: flex; flex-wrap: wrap; gap: var(--s-8); align-items: center; }
.tl-row--split { justify-content: space-between; }
.tl-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-12); }
.tl-cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tl-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.tl-fieldset legend { padding: 0; }

.tl-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-8); min-height: 38px; padding: var(--s-8) var(--s-16); border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--paper); font: inherit; font-size: var(--fs-small); font-weight: var(--fw-body); line-height: var(--lh-small); color: var(--ink); cursor: pointer; text-decoration: none; transition: background 0.2s, border-color 0.2s; }
.tl-btn:hover { background: var(--paper-2); border-color: var(--gold); }
.tl-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tl-btn--primary { background: var(--olive); border-color: var(--olive); color: var(--on-dark); }
.tl-btn--primary:hover { background: var(--olive-2); border-color: var(--olive-2); }
.tl-btn--sm { min-height: 32px; padding: var(--s-4) var(--s-12); font-size: var(--fs-small); line-height: var(--lh-small); }
.tl-btn[aria-pressed="true"] { background: var(--gold-wash); border-color: var(--gold); }

.tl-out { margin: 0; padding: var(--s-16) var(--s-16); border-radius: var(--r-md); background: var(--paper-2); border: 1px solid var(--line); font-family: var(--font-system); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; min-height: 48px; }
.tl-out--big { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.tl-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-8) var(--s-16); margin: 0; font-size: var(--fs-small); line-height: var(--lh-small); }
.tl-kv dt { font-family: var(--font-body); font-size: var(--fs-caption); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--muted); padding-top: var(--s-4); line-height: var(--lh-caption); }
.tl-kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.tl-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: var(--s-12); }
.tl-stat { padding: var(--s-12) var(--s-16); border-radius: var(--r-md); background: var(--paper-2); border: 1px solid var(--line); }
.tl-stat b { display: block; font-size: var(--fs-body-lg); font-weight: var(--fw-strong); line-height: var(--lh-body-lg); color: var(--ink); font-variant-numeric: tabular-nums; }
.tl-stat span { font-size: var(--fs-caption); color: var(--muted); line-height: var(--lh-caption); }
.tl-stat--hero b { font-size: var(--fs-h3); color: var(--gold-ink); line-height: var(--lh-h3); font-family: var(--font-head); font-weight: var(--fw-head); letter-spacing: var(--ls-h3); }

.tl-limits { display: grid; gap: var(--s-12); margin: 0; padding: 0; list-style: none; }
.tl-limit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-4) var(--s-12); font-size: var(--fs-small); color: var(--ink); line-height: var(--lh-small); }
.tl-limit__bar { grid-column: 1 / -1; height: 6px; border-radius: var(--r-sm); background: var(--paper-3); overflow: hidden; }
.tl-limit__bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.25s var(--ease); }
.tl-limit.is-over .tl-limit__bar i { background: #b4533c; }
.tl-limit span { color: var(--muted); font-variant-numeric: tabular-nums; }

.tl-tag { display: inline-flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-8); border-radius: var(--r-sm); font-size: var(--fs-caption); font-weight: var(--fw-strong); line-height: var(--lh-caption); border: 1px solid transparent; }
.tl-tag--ok { background: var(--sage-wash); color: var(--green); border-color: rgba(63, 122, 55, 0.18); }
.tl-tag--warn { background: var(--gold-wash); color: var(--gold-ink); border-color: rgba(166, 138, 100, 0.25); }
.tl-tag--bad { background: rgba(180, 83, 60, 0.1); color: #9a3b26; border-color: rgba(180, 83, 60, 0.2); }

.tl-hint { margin: 0; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.tl-msg { margin: 0; font-size: var(--fs-small); color: var(--ink); line-height: var(--lh-small); }
.tl-msg.is-bad { color: #9a3b26; }
.tl-msg.is-ok { color: var(--green); }
.tl-hint.is-bad { color: #9a3b26; }
.tl-notes { display: grid; gap: var(--s-8); margin: 0; padding-left: var(--s-16); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.tl-notes .is-bad { color: #9a3b26; }
.tl-notes code, .tl-hint code { font-size: var(--fs-caption); overflow-wrap: anywhere; line-height: var(--lh-caption); }
.tl-pwlist { display: grid; gap: var(--s-8); margin: 0; padding: 0; list-style: none; }
.tl-pwlist code { display: block; padding: var(--s-8) var(--s-12); border-radius: var(--r-sm); background: var(--paper-2); border: 1px solid var(--line); font-size: var(--fs-small); overflow-wrap: anywhere; line-height: var(--lh-small); }
.tl-big { margin: 0; font-size: var(--fs-h2); font-weight: var(--fw-head); line-height: var(--lh-h2); color: var(--ink); font-variant-numeric: tabular-nums; font-family: var(--font-head); letter-spacing: var(--ls-h2); }
.tl-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); line-height: var(--lh-small); }
.tl-table th, .tl-table td { padding: var(--s-8) var(--s-8); border-bottom: 1px solid var(--line); text-align: left; }
.tl-table th { font-weight: var(--fw-body); color: var(--ink); }
.tl-table td:last-child { text-align: right; }
.tl-hours { display: grid; gap: var(--s-8); }
.tl-hours__row { display: grid; grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--s-8); align-items: center; font-size: var(--fs-small); line-height: var(--lh-small); }
.tl-hours__row .tl-input { padding: var(--s-8) var(--s-12); font-size: var(--fs-small); line-height: var(--lh-small); }
.tl-check { display: inline-flex; align-items: center; gap: var(--s-8); font-size: var(--fs-small); color: var(--ink); cursor: pointer; line-height: var(--lh-small); }
.tl-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--olive); }
.tl-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s-8) var(--s-16); }
.tl-range { width: 100%; accent-color: var(--olive); }

/* small helpers (the site's Content-Security-Policy ignores style="" attributes) */
.tl-mt6 { margin-top: var(--s-8); }
.tl-mt8 { margin-top: var(--s-8); }
.tl-m0 { margin: 0; }
.tl-row--nowrap { flex-wrap: nowrap; }
.tl-input--swatch { width: 56px; flex: none; }
.tl-select--inline { width: auto; padding: var(--s-8) var(--s-12); }
.tl-offscreen { position: fixed; left: -10000px; top: 0; }

.tl-privacy { display: flex; gap: var(--s-12); align-items: flex-start; margin: var(--s-16) 0 0; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.tl-privacy .ic { flex: none; margin-top: var(--s-2); color: var(--gold-ink); }

/* LinkedIn preview */
.tl-li { padding: var(--s-16); border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); font-family: -apple-system, system-ui, "Segoe UI", Roboto, Arial, sans-serif; }
.tl-li__head { display: flex; gap: var(--s-12); align-items: center; margin-bottom: var(--s-12); }
.tl-li__avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--grad-soft), var(--paper-3); }
.tl-li__head b { display: block; font-size: var(--fs-small); color: #1d1d1d; line-height: var(--lh-small); }
.tl-li__head span { display: block; font-size: var(--fs-caption); color: #666; line-height: var(--lh-caption); }
.tl-li__body { font-size: var(--fs-small); line-height: var(--lh-small); color: #1d1d1d; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 60px; }
.tl-li__more { padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-small); color: #666; cursor: pointer; line-height: var(--lh-small); }
.tl-li__more:hover { color: #0a66c2; text-decoration: underline; }

/* Search result preview */
.tl-serp { padding: 18px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); font-family: Arial, Helvetica, sans-serif; }
.tl-serp__site { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tl-serp__fav { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #f1f3f4; font-size: 13px; font-weight: 700; color: #4d5156; }
.tl-serp__name { display: block; font-size: 14px; color: #202124; }
.tl-serp__url { display: block; font-size: 12px; color: #4d5156; overflow-wrap: anywhere; }
.tl-serp__title { margin: 0 0 4px; font-size: 20px; line-height: 1.3; font-weight: 400; color: #1a0dab; overflow-wrap: anywhere; }
.tl-serp__desc { margin: 0; font-size: 14px; line-height: 1.58; color: #4d5156; overflow-wrap: anywhere; }
.tl-serp--mobile { max-width: 380px; }
.tl-serp--mobile .tl-serp__title { font-size: 18px; }

/* Signature preview */
.tl-sig__logo { display: grid; place-items: center; width: 80px; height: 48px; border: 1px dashed #c9c3b5; border-radius: 6px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #777777; }
.tl-sig { font-family: var(--font-system); padding: 20px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); overflow-x: auto; }

/* Contrast preview */
.tl-contrast { padding: var(--s-24); border-radius: var(--r-md); border: 1px solid var(--line); }
.tl-contrast p { margin: 0 0 var(--s-8); font-size: var(--fs-body); line-height: var(--lh-body); }
.tl-contrast .tl-contrast__big { font-size: var(--fs-body-lg); font-weight: var(--fw-strong); line-height: var(--lh-body-lg); }
.tl-contrast .tl-contrast__small { margin: 0; font-size: var(--fs-small); line-height: var(--lh-small); }
.tl-swatch { display: inline-block; width: 18px; height: 18px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); vertical-align: middle; }

/* Invoice */
.tl-items { display: grid; gap: var(--s-8); }
.tl-item { display: grid; grid-template-columns: minmax(0, 1fr) 72px 110px 36px; gap: var(--s-8); align-items: center; }
.tl-item .tl-input { padding: var(--s-8) var(--s-12); font-size: var(--fs-small); line-height: var(--lh-small); }
.tl-item__del { min-height: 38px; padding: 0; }
.tl-inv { font-family: var(--font-system); padding: clamp(20px, 3vw, 36px); border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); color: #1f2420; font-size: 13.5px; line-height: 1.5; }
.tl-inv__top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 26px; }
.tl-inv__logo { max-width: 160px; max-height: 70px; object-fit: contain; }
.tl-inv__title { margin: 0; font-size: 26px; letter-spacing: 0.04em; text-transform: uppercase; color: #1f2420; }
.tl-inv__meta { text-align: right; font-size: 13px; color: #555; }
.tl-inv__parties { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.tl-inv__parties h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #777; }
.tl-inv__parties p { margin: 0; white-space: pre-wrap; }
.tl-inv table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.tl-inv th { padding: 8px 6px; border-bottom: 2px solid #1f2420; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; text-align: left; color: #555; }
.tl-inv td { padding: 8px 6px; border-bottom: 1px solid #e5e2da; vertical-align: top; }
.tl-inv .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-inv__totals { margin-left: auto; width: min(100%, 280px); }
.tl-inv__totals div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.tl-inv__totals .is-total { margin-top: 4px; padding-top: 8px; border-top: 2px solid #1f2420; font-size: 16px; font-weight: 700; }
.tl-inv__empty { color: #888888; }
.tl-inv__notes { margin-top: 22px; white-space: pre-wrap; color: #444; }

@media (max-width: 900px) {
  .tl__grid, .tl__grid--wide, .tl__grid--form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .tl-cols, .tl-cols--3 { grid-template-columns: minmax(0, 1fr); }
  .tl-item { grid-template-columns: minmax(0, 1fr) 60px 90px 34px; }
  .tl-inv__parties { grid-template-columns: 1fr; }
  .tl-inv__top { flex-direction: column; }
  .tl-inv__meta { text-align: left; }
}

@media print {
  body.tl-printing * { visibility: hidden !important; }
  body.tl-printing .tl-inv, body.tl-printing .tl-inv * { visibility: visible !important; }
  body.tl-printing .tl-inv { position: absolute; left: 0; top: 0; width: 100%; border: 0; padding: 0; }
}

/* ---- wave 3 tools ---- */
.tl-canvas { display: block; max-width: 100%; height: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: repeating-conic-gradient(var(--paper-2) 0% 25%, var(--paper) 0% 50%) 0 0 / 16px 16px; }
.tl-share { border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; overflow: hidden; font-family: -apple-system, system-ui, "Segoe UI", Roboto, Arial, sans-serif; }
.tl-share__img { display: grid; place-items: center; padding: var(--s-32) var(--s-12); background: #e9e6df; font-size: var(--fs-small); color: #666; overflow-wrap: anywhere; text-align: center; line-height: var(--lh-small); }
.tl-share__txt { padding: var(--s-12) var(--s-16) var(--s-12); background: #f2f0eb; }
.tl-share__txt span { display: block; font-size: var(--fs-caption);  color: #777; line-height: var(--lh-caption); }
.tl-share__txt b { display: block; margin: var(--s-2) 0; font-size: var(--fs-body); color: #1d1d1d; overflow-wrap: anywhere; line-height: var(--lh-body); }
.tl-share__txt p { margin: 0; font-size: var(--fs-small); line-height: var(--lh-small); color: #555; overflow-wrap: anywhere; }
.tl-fav { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s-12); }
.tl-fav__tile { display: grid; gap: var(--s-8); justify-items: center; align-content: start; padding: var(--s-12); border-radius: var(--r-md); background: var(--paper-2); border: 1px solid var(--line); font-size: var(--fs-caption); color: var(--muted); line-height: var(--lh-caption); }
.tl-fav__cv { max-width: 100%; height: auto; }
.tl-files { display: grid; gap: var(--s-8); }
.tl-file { display: grid; gap: var(--s-4) var(--s-12); grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: var(--s-12) var(--s-12); border-radius: var(--r-md); background: var(--paper-2); border: 1px solid var(--line); font-size: var(--fs-small); line-height: var(--lh-small); }
.tl-file b { overflow-wrap: anywhere; font-weight: var(--fw-strong); }
.tl-file span { grid-column: 1; color: var(--muted); }
.tl-file span.is-bad { color: #9a3b26; }
.tl-file .tl-btn { grid-column: 2; grid-row: 1 / span 2; }
.tl [hidden] { display: none !important; }
