/* Free tools pages (tools.php) — builds on app.css tokens and components. */
body.tools-page { background: var(--bg, var(--surface-2)); min-height: 100vh; }
.tl-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100vw - 1080px) / 2)); background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.tl-nav { display: flex; align-items: center; gap: 14px; }
.tl-nav > a:not(.btn) { color: var(--text-2); font-weight: 600; font-size: 14px; text-decoration: none; }
.tl-nav > a:not(.btn):hover { color: var(--accent); }
.tl-main { max-width: 1080px; margin: 0 auto; padding: 22px 16px 40px; }
.tl-main > section { margin-top: 26px; }
.tl-main h2 { font: 800 21px var(--font-display); letter-spacing: -.02em; margin: 0 0 12px; }

.tl-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.tl-crumbs a { color: var(--accent); font-weight: 600; text-decoration: none; }
.tl-hero { margin-top: 14px !important; text-align: center; padding: 18px 0 4px; }
.tl-hero h1 { font: 800 clamp(28px, 5vw, 42px)/1.1 var(--font-display); letter-spacing: -.03em; margin: 12px 0 10px; }
.tl-hero p { max-width: 640px; margin: 0 auto; color: var(--text-2); font-size: 16px; line-height: 1.55; }
.tl-ic { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 14px;
  color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); }
.tl-ic .ic { width: 24px; height: 24px; }
.tl-ic.big { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto; }
.tl-ic.big .ic { width: 34px; height: 34px; }

.tl-group { font-size: 15px !important; text-transform: uppercase; letter-spacing: .06em !important; color: var(--muted); margin: 26px 0 10px !important; }
.tl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.tl-grid.small { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.tl-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: transform .2s, box-shadow .2s, border-color .2s; min-width: 0; }
.tl-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c, var(--accent)) 45%, var(--line)); box-shadow: 0 12px 28px -18px color-mix(in srgb, var(--c, var(--accent)) 70%, transparent); }
.tl-card b { display: block; font-size: 15.5px; margin-top: 2px; }
.tl-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 4px; }
.tl-grid.small .tl-card { align-items: center; padding: 12px; }
.tl-grid.small .tl-ic { width: 38px; height: 38px; border-radius: 12px; }

/* the tool itself */
.tl-app { margin-top: 20px !important; }
.tl-card-app { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: grid; gap: 16px; box-shadow: 0 18px 40px -30px rgba(15,23,42,.35); min-width: 0; }
.tl-card-app > * { min-width: 0; }
.tl-card-app > [data-out]:empty { display: none; }
.tl-drop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 34px 16px; border: 2px dashed var(--line-2); border-radius: 18px;
  cursor: pointer; transition: border-color .2s, background .2s; background: var(--surface-2); }
.tl-drop:hover, .tl-drop.over { border-color: var(--accent); background: var(--soft); }
.tl-drop b { font-size: 17px; }
.tl-drop small { color: var(--muted); font-size: 13.5px; margin-bottom: 8px; }
.tl-drop-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--soft); color: var(--accent); margin-bottom: 4px; }
.tl-drop-ic .ic { width: 28px; height: 28px; }
[data-drop].small .tl-drop { padding: 12px 14px; grid-template-columns: auto 1fr auto; justify-items: start; text-align: left; gap: 2px 12px; }
[data-drop].small .tl-drop-ic { width: 40px; height: 40px; border-radius: 12px; margin: 0; grid-row: span 2; }
[data-drop].small .tl-drop-ic .ic { width: 22px; height: 22px; }
[data-drop].small .tl-drop b { font-size: 14.5px; }
[data-drop].small .tl-drop small { margin: 0; font-size: 12.5px; }
[data-drop].small .tl-drop .btn { grid-row: 1 / span 2; grid-column: 3; --bh: 36px; font-size: 13px; }

.tl-set { display: grid; gap: 14px; }
.tl-set[hidden] { display: none; }
.tl-row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; align-items: end; }
.tl-set input[type=range] { width: 100%; accent-color: var(--accent); height: 44px; margin: 0; }
.tl-set input[type=color] { width: 100%; height: 44px; padding: 3px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
.tl-set .field em { font-style: normal; font-weight: 500; color: var(--muted); }
.tl-set .row.compact { padding: 0; border: 0; min-height: 46px; flex-wrap: nowrap; }
.tl-chips, .tl-types { display: flex; flex-wrap: wrap; gap: 8px; }
.chipb { display: grid; gap: 1px; text-align: left; padding: 9px 13px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; font: 600 13.5px var(--font, inherit); transition: .15s; }
.chipb small { color: var(--muted); font-weight: 500; font-size: 12px; }
.chipb:hover { border-color: var(--accent); }
.chipb.on { background: var(--soft); border-color: var(--accent); color: var(--accent); }

/* ordered list (images → PDF, merge) and single file info */
.tl-list { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.tl-list:empty { display: none; }
.tl-item, .tl-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.tl-item:empty { display: none; }
.tl-item .grow, .tl-row .grow { flex: 1; min-width: 0; }
.tl-item .t, .tl-row .t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-item .s, .tl-row .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tl-th { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-3); }
.tl-th.ic-box { display: grid; place-items: center; color: var(--accent); }
.tl-item .ic.up { transform: rotate(180deg); }
.tl-item .icon-btn[disabled] { opacity: .3; pointer-events: none; }

/* results */
.tl-res { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.tl-row .good { color: var(--ok, #10b981); font-weight: 700; }
.tl-row .bad { color: var(--bad); }
.tl-row .btn { flex: none; }
.tl-row a.btn.ok { color: var(--ok, #10b981); }
.tl-all { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.tl-busy { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 12px; padding: 14px; border-radius: 14px; background: var(--surface-2); font-weight: 600; }
.tl-busy .bar { grid-column: 1 / -1; }
.tl-busy .ic { color: var(--accent); }
.tl-audio { width: 100%; margin-bottom: 10px; }

.tl-levels { display: grid; gap: 8px; }
.lvl { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 14px; cursor: pointer; transition: .15s; }
.lvl input { accent-color: var(--accent); margin-top: 3px; width: 18px; height: 18px; flex: none; }
.lvl b { display: block; font-size: 14.5px; }
.lvl small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.lvl:has(input:checked) { border-color: var(--accent); background: var(--soft); }

/* QR */
.tl-qr { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.tl-qr-form { display: grid; gap: 14px; min-width: 0; }
.tl-qr-form form { display: grid; gap: 12px; }
.tl-qr-out { display: grid; gap: 10px; justify-items: center; text-align: center; position: sticky; top: 80px; padding: 16px; border-radius: 18px; background: var(--surface-2); }
.tl-qr-box { width: min(100%, 260px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px; overflow: hidden; background: #fff; padding: 18px; box-sizing: border-box; box-shadow: 0 10px 30px -18px rgba(15,23,42,.5); }
.tl-qr-box canvas, .tl-qr-box img { width: 100% !important; height: 100% !important; display: block; image-rendering: pixelated; }
.tl-qr-box canvas { display: none; }        /* qrcodejs draws both; the img is what people see */
.tl-qr-box.is-empty { background: repeating-linear-gradient(45deg, var(--surface-3) 0 10px, var(--surface-2) 10px 20px); }
.tl-qr-out p { margin: 0; word-break: break-all; }
.tl-qr-out .row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* page sections */
.tl-private { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13.5px; margin: 14px 0 0; text-align: center; }
.tl-private .ic-sm { color: var(--ok, #10b981); flex: none; }
.tl-how ol { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.tl-how li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; line-height: 1.45; }
.tl-how li::before { content: counter(s); display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--soft); color: var(--accent); font-weight: 800; font-size: 13px; }
.tl-faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; margin-bottom: 8px; }
.tl-faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; font-size: 15px; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.tl-faq summary::-webkit-details-marker { display: none; }
.tl-faq summary::after { content: "+"; color: var(--accent); font-size: 20px; line-height: 1; }
.tl-faq details[open] summary::after { content: "−"; }
.tl-faq details p { margin: 0 0 14px; color: var(--text-2); line-height: 1.55; font-size: 14.5px; }
.tl-cta, .tl-ext { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; border-radius: 20px; flex-wrap: wrap; }
.tl-cta { background: linear-gradient(135deg, #4f46e5, #8b5cf6); color: #fff; }
.tl-cta p, .tl-ext p { margin: 4px 0 0; font-size: 14px; opacity: .88; max-width: 560px; line-height: 1.5; }
.tl-cta b, .tl-ext b { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.tl-cta .btn.primary { background: #fff; color: #4f46e5; }
.tl-ext { background: var(--surface); border: 1px solid var(--line); margin-top: 12px !important; }
.tl-ext p { color: var(--text-2); opacity: 1; }
.tl-ext b .ic-sm { color: var(--accent); }
.tl-foot { text-align: center; padding: 24px 16px 40px; color: var(--muted); font-size: 13px; }
.tl-foot a { color: var(--text-2); }

@media (max-width: 720px) {
  .tl-top .brand span { display: none; }
  .tl-nav { gap: 10px; }
  .tl-card-app { padding: 12px; border-radius: 18px; }
  .tl-hero p { font-size: 15px; }
  .tl-qr { grid-template-columns: minmax(0, 1fr); }
  .tl-qr-out { position: static; order: -1; }
  .tl-row { flex-wrap: wrap; }
  .tl-row .grow { flex-basis: calc(100% - 60px); }
  .tl-row .btn { flex: 1; }
  [data-drop].small .tl-drop small { display: none; }
  [data-drop].small .tl-drop b { grid-row: span 2; align-self: center; }
}

/* extension page */
.ext-demo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; align-items: center; }
.ext-menu { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 20px 40px -24px rgba(15,23,42,.45); max-width: 320px; justify-self: center; width: 100%; }
.ext-menu .mi { padding: 8px 12px; border-radius: 8px; font-size: 14px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.ext-menu .mi.on { background: var(--soft); color: var(--accent); font-weight: 700; }
.ext-menu .mi img { width: 18px; height: 18px; border-radius: 5px; }
.ext-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ext-list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; font-size: 14.5px; line-height: 1.45; }
.ext-list .ic-sm { color: var(--accent); flex: none; margin-top: 2px; }
.ext-install { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: grid; gap: 14px; justify-items: start; }
.ext-install h2 { margin: 0 !important; }
.ext-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: 15px; line-height: 1.5; }
.ext-steps code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; font-size: 13.5px; }
@media (max-width: 720px) { .ext-demo { grid-template-columns: minmax(0, 1fr); } .ext-install .btn.lg { width: 100%; } }
