/* RE:RISE systems — free tools for ФОП (/tools/). Loaded after styles.css and apps.css; prefix tl-. Tokens from styles.css :root. */

.tl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- hero ---------- */
.tl-hero { position: relative; border-bottom: 1px solid var(--line); overflow: hidden; isolation: isolate; padding: 40px 0 46px; }
.tl-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 82% 30%, rgba(20,184,166,.16), transparent 38%), radial-gradient(circle at 10% 0%, rgba(57,200,255,.10), transparent 30%); }
.tl-hero .ap-crumbs { margin-bottom: 22px; }
.tl-hero h1 { margin: 14px 0 14px; max-width: 900px; font-size: clamp(30px, 3.6vw, 48px); line-height: 1.1; font-weight: 800; letter-spacing: -.01em; }
.tl-lead { max-width: 760px; margin: 0; color: var(--muted); font-size: 17.5px; line-height: 1.6; }

.tl-section { padding: 40px 0; border-bottom: 1px solid var(--line); }
.tl-section--tool { padding: 36px 0 48px; }
.tl-section--cta { padding: 56px 0; }

/* ---------- form controls ---------- */
.tl-fs { margin: 0 0 16px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(180deg, rgba(21,31,43,.82), rgba(11,16,23,.82)); min-width: 0; }
.tl-fs legend { float: left; width: 100%; margin: 0 0 14px; padding: 0; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.tl-fs > :not(legend) { clear: both; }
.tl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.tl-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tl-field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.tl-field small { color: rgba(174,184,197,.75); font-size: 12px; }
.tl-wide { grid-column: 1 / -1; }
.tl input:not([type=radio]):not([type=checkbox]), .tl select, .tl textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(5,7,10,.55);
  color: var(--text); font-size: 16px; line-height: 1.35; outline: none; transition: border-color .15s, background .15s;
}
.tl textarea { resize: vertical; min-height: 64px; }
.tl select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.tl select option { background: #0d1218; color: var(--text); }
.tl input::placeholder, .tl textarea::placeholder { color: rgba(174,184,197,.45); }
.tl input:focus, .tl select:focus, .tl textarea:focus { border-color: rgba(57,200,255,.7); background: rgba(5,7,10,.8); }
.tl input[type=date] { color-scheme: dark; }
.tl-remember { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 14px; }
.tl-check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; }
.tl-check input { width: 18px; height: 18px; accent-color: #05a6d9; }
.tl-textbtn { padding: 6px 0; border: 0; background: none; color: var(--cyan); font-size: 13px; font-weight: 700; cursor: pointer; }
.tl-textbtn:hover { color: #fff; }

/* ---------- document builder ---------- */
.tl-docapp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: clamp(20px, 3vw, 36px); align-items: start; }
.tl-form { min-width: 0; }
.tl-rows-head { display: none; }
.tl-rows { display: grid; gap: 10px; }
.tl-row { display: grid; grid-template-columns: 26px minmax(0, .8fr) minmax(0, .9fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 34px;
  grid-template-areas: "n name name name name del" ". qty unit price sum sum"; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(5,7,10,.35); }
.tl-row-n { grid-area: n; align-self: center; color: var(--cyan); font-weight: 800; font-size: 13px; text-align: center; }
.tl-row label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tl-row label > span { position: static; width: auto; height: auto; clip: auto; overflow: visible; font-size: 11px; font-weight: 700; color: var(--muted); }
.tl-c-name { grid-area: name; }
.tl-c-name > span { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; }
.tl-c-qty { grid-area: qty; } .tl-c-unit { grid-area: unit; } .tl-c-price { grid-area: price; }
.tl-c-sum { grid-area: sum; align-self: end; min-height: 44px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-c-sum::before { content: "Сума, грн"; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: auto; }
.tl-del { grid-area: del; align-self: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.tl-del:hover { border-color: var(--red); color: var(--red); }
.tl-rows-foot { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-top: 14px; }
.tl-vat { width: min(220px, 100%); }
.tl-form-end { display: none; }

.tl-preview { position: sticky; top: 92px; min-width: 0; }
.tl-preview-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.tl-preview-total span, .tl-form-end span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tl-preview-total b, .tl-form-end b { font-size: 22px; font-variant-numeric: tabular-nums; }
.tl-form-end b { font-size: 19px; white-space: nowrap; }
.tl-preview-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-words { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.tl-words b { color: var(--text); font-weight: 700; }
.tl-paper { position: relative; overflow: hidden; border-radius: 6px; box-shadow: 0 24px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08); background: #fff; }
.tl-hint { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* the A4 sheet (794 px = 210 mm at 96 dpi), scaled down on screen by tools.js */
.tl-sheet { width: 794px; min-height: 1123px; padding: 56px 60px; background: #fff; color: #111; transform-origin: 0 0;
  font: 13px/1.45 Inter, Arial, sans-serif; font-variant-numeric: tabular-nums; }
.tl-sheet b { font-weight: 700; }
.tl-doc-h { margin: 0 0 22px; font-size: 22px; line-height: 1.25; font-weight: 800; text-align: center; color: #000; }
.tl-doc-h small { display: block; margin-top: 4px; font-size: 13px; font-weight: 500; color: #333; }
.tl-doc-sub { margin: 18px 0 8px; font-size: 16px; font-weight: 800; color: #000; }
.tl-place { display: flex; justify-content: space-between; gap: 20px; margin: -6px 0 16px; }
.tl-parties { width: 100%; margin: 0 0 18px; border-collapse: collapse; }
.tl-parties th { width: 110px; padding: 6px 12px 6px 0; text-align: left; vertical-align: top; font-weight: 700; color: #000; }
.tl-parties td { padding: 6px 0; vertical-align: top; }
.tl-p { margin: 0 0 12px; text-align: justify; }
.tl-t { width: 100%; margin: 6px 0 10px; border-collapse: collapse; }
.tl-t th, .tl-t td { padding: 6px 8px; border: 1px solid #444; vertical-align: top; }
.tl-t th { background: #f1f3f5; font-weight: 700; font-size: 12px; }
.tl-t .c { text-align: center; width: 1%; white-space: nowrap; }
.tl-t .r { text-align: right; white-space: nowrap; }
.tl-t tfoot td { border: 0; padding: 3px 8px; }
.tl-t tfoot .big td { font-size: 14px; font-weight: 800; padding-top: 6px; }
.tl-ph { color: #9aa1a9; }
.tl-sum { margin: 6px 0 16px; }
.tl-note { margin: 0 0 18px; padding: 10px 12px; border-left: 3px solid #0aa2c0; background: #f5f9fb; }
.tl-note p { margin: 0 0 4px; }
.tl-note p:last-child { margin: 0; }
.tl-small { margin: 0 0 6px; font-size: 12px; line-height: 1.45; }
.tl-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 28px; break-inside: avoid; }
.tl-signs--one { grid-template-columns: minmax(0, 360px); }
.tl-sign-h { margin: 0 0 6px; font-weight: 800; color: #000; }
.tl-sign-n { margin: 0 0 26px; }
.tl-sign-line { display: flex; justify-content: space-between; gap: 10px; padding-top: 4px; border-top: 1px solid #222; font-size: 11px; color: #444; }
.tl-sign .tl-sign-h:empty { display: none; }
.tl-sign { margin-top: 30px; }
.tl-blank { display: inline-block; vertical-align: bottom; height: 1.2em; border-bottom: 1px solid #999; }

/* ---------- calculator ---------- */
.tl-calc { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.tl-calc-in { margin: 0; display: grid; gap: 18px; }
.tl-limits { grid-column: 1 / -1; margin: 0; display: grid; gap: 14px; }
.tl-big input { font-size: 26px !important; font-weight: 800; min-height: 58px !important; font-variant-numeric: tabular-nums; }
.tl-seg-group { display: grid; gap: 8px; }
.tl-seg-l { font-size: 13px; font-weight: 700; color: var(--muted); }
.tl-seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,7,10,.45); }
.tl-seg label { flex: 1 1 auto; position: relative; cursor: pointer; }
.tl-seg input { position: absolute; opacity: 0; pointer-events: none; }
.tl-seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 700; color: var(--muted); text-align: center; transition: background .15s, color .15s; }
.tl-seg input:checked + span { background: linear-gradient(135deg, #0a6cff, #05a6d9); color: #fff; }
.tl-seg input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 1px; }
.tl-calc-out { padding: 22px; border: 1px solid var(--line-strong); border-radius: 8px; background: linear-gradient(160deg, rgba(10,108,255,.12), rgba(20,184,166,.08) 60%, rgba(11,16,23,.9)); }
.tl-out-h { margin: 0 0 14px; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.tl-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tl-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: rgba(5,7,10,.5); min-width: 0; }
.tl-card span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
.tl-card em { font-style: normal; color: var(--cyan); }
.tl-card b { display: block; margin-top: 4px; font-size: 22px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tl-card--total { border-color: rgba(57,200,255,.55); background: rgba(57,200,255,.1); }
.tl-out-line { margin: 14px 0 0; font-size: 15px; color: var(--muted); }
.tl-out-line b { color: var(--text); }
.tl-out-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.tl-out-note b { color: var(--text); }
.tl-warn { margin: 14px 0 0; padding: 12px 14px; border: 1px solid rgba(255,107,107,.55); border-radius: 8px; background: rgba(255,107,107,.1); font-size: 14px; }
.tl-limits .tl-field { max-width: 460px; }
.tl-limit { display: grid; gap: 6px; }
.tl-limit-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.tl-limit-top span { color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-bar { height: 10px; border-radius: 5px; background: rgba(255,255,255,.08); overflow: hidden; }
.tl-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #14b8a6, #39c8ff); transition: width .3s; }
.tl-limit small { color: var(--muted); font-size: 12.5px; }
.tl-limit.is-near .tl-bar i { background: linear-gradient(90deg, #f5b544, #f97316); }
.tl-limit.is-over .tl-bar i { background: var(--red); }
.tl-limit.is-over small { color: var(--red); }
.tl-asof { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.tl-asof--inline { margin: 0 0 10px; }

/* ---------- tables, two columns ---------- */
.tl-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); }
.tl-two .ap-head { margin-bottom: 22px; }
.tl-two p, .tl-article p { color: var(--muted); font-size: 15.5px; line-height: 1.7; }
.tl-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: rgba(11,16,23,.6); }
.tl-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.tl-table caption { padding: 14px 16px 6px; text-align: left; font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); }
.tl-table th, .tl-table td { padding: 11px 16px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.tl-table th { color: var(--muted); font-size: 13px; font-weight: 700; }
.tl-table td:not(:first-child) { font-variant-numeric: tabular-nums; }
.tl-table small { color: var(--muted); font-size: 12.5px; }
.tl-tr-total td { font-weight: 800; background: rgba(57,200,255,.07); }

/* ---------- CTA ---------- */
.tl-cta { position: relative; display: grid; grid-template-columns: 80px minmax(0, 1fr) 190px; gap: 26px; align-items: center; padding: 30px 32px; overflow: hidden;
  border: 1px solid rgba(20,184,166,.5); border-radius: 10px; background: radial-gradient(circle at 88% 40%, rgba(20,184,166,.22), transparent 45%), linear-gradient(90deg, rgba(57,200,255,.08), rgba(20,184,166,.06)); }
.tl-cta-icon { width: 80px; height: 80px; border-radius: 20px; border: 1px solid rgba(255,255,255,.14); align-self: start; }
.tl-cta h2 { margin: 6px 0 8px; font-size: clamp(24px, 2.6vw, 34px); line-height: 1.15; }
.tl-cta p { margin: 0; color: var(--muted); max-width: 640px; }
.tl-cta-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.tl-cta-btns .btn svg { width: 16px; height: 16px; margin-left: 8px; }
.tl .tl-cta-hint { margin-top: 10px; font-size: 13px; }
.tl-cta-shot { width: 190px; margin: -30px 0 -110px; border-radius: 22px 22px 0 0; border: 6px solid #0c1118; border-bottom: 0; box-shadow: 0 20px 50px rgba(0,0,0,.5); transform: rotate(-3deg); }
.tl-mini-cta { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 18px; align-items: center; margin-top: 18px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(180deg, rgba(21,31,43,.85), rgba(11,16,23,.85)); }
.tl-mini-cta img { width: 56px; height: 56px; border-radius: 14px; border: 1px solid rgba(255,255,255,.12); }
.tl-mini-cta h3 { margin: 0; font-size: 18px; }
.tl-mini-cta p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.tl-mini-cta .btn svg { width: 16px; height: 16px; margin-left: 8px; }

/* ---------- tool cards ---------- */
.tl-tools { display: grid; gap: 14px; }
.tl-tools--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tl-tools--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tl-tool { display: grid; grid-template-columns: 48px minmax(0, 1fr) 18px; gap: 16px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: 8px;
  background: linear-gradient(180deg, rgba(21,31,43,.88), rgba(11,16,23,.88)); }
.tl-tool:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.tl-tool-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: rgba(57,200,255,.1); color: var(--cyan); border: 1px solid rgba(57,200,255,.3); }
.tl-tool-ico svg { width: 26px; height: 26px; }
.tl-tool h2, .tl-tool h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.tl-tool p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.tl-tool > svg { width: 18px; height: 18px; color: var(--cyan); }
.tl-tool--big { padding: 26px; }
.tl-tool--big h2 { font-size: 21px; }
.tl-why { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 26px 0 0; padding: 0; list-style: none; }
.tl-why li { display: flex; gap: 12px; }
.tl-why b { display: block; }
.tl-why span:not(.ap-sq) { color: var(--muted); font-size: 14.5px; }

/* ---------- article ---------- */
.tl-article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(28px, 5vw, 72px); align-items: start; }
.tl-article { max-width: 780px; min-width: 0; }
.tl-article h3 { margin: 30px 0 10px; font-size: 21px; line-height: 1.3; }
.tl-article .ap-head + h3 { margin-top: 0; }
.tl-article p { margin: 0 0 12px; }
.tl-article a, .tl-two a { color: var(--cyan); text-decoration: underline; text-decoration-color: rgba(57,200,255,.35); text-underline-offset: 3px; }
.tl-article a:hover { color: #fff; }
.tl-article .ap-list { margin: 0 0 14px; }
.tl-article .ap-list li { color: var(--muted); }
.tl-aside { position: sticky; top: 100px; }
.tl-aside-box { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: rgba(11,16,23,.7); }
.tl-aside-h { margin: 0 0 8px; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.tl-aside ul { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 8px; }
.tl-aside ul:last-child { margin-bottom: 0; }
.tl-aside a { font-size: 14.5px; font-weight: 600; }
.tl-aside a:hover { color: var(--cyan); }
.tl-sources { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.tl-sources li { color: var(--muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .tl-tools--3 { grid-template-columns: 1fr; }
  .tl-cta { grid-template-columns: 80px minmax(0, 1fr); }
  .tl-cta-shot { display: none; }
}
@media (max-width: 980px) {
  .tl-docapp, .tl-calc, .tl-two, .tl-article-grid { grid-template-columns: 1fr; }
  .tl-preview { position: static; }
  .tl-form-end { display: flex; position: sticky; bottom: 0; z-index: 5; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -2px 16px; padding: 12px 14px;
    border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(5,7,10,.94); backdrop-filter: blur(12px); }
  .tl-aside { position: static; }
  .tl-why { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tl-hero { padding: 28px 0 32px; }
  .tl-hero h1 { font-size: 29px; }
  .tl-lead { font-size: 16px; }
  .tl-fs { padding: 16px 14px; }
  .tl-grid { grid-template-columns: 1fr; }
  .tl-row { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) 34px; grid-template-areas: "n name name del" ". qty unit unit" ". price sum sum"; padding: 10px; }
  .tl-tools--2 { grid-template-columns: 1fr; }
  .tl-cards { grid-template-columns: 1fr 1fr; }
  .tl-card { padding: 12px; }
  .tl-card b { font-size: 18px; }
  .tl-calc-out { padding: 16px; }
  .tl-cta { grid-template-columns: 1fr; padding: 24px 20px; gap: 16px; }
  .tl-cta-icon { width: 64px; height: 64px; border-radius: 16px; }
  .tl-cta-btns > * { width: 100%; }
  .tl-mini-cta { grid-template-columns: 48px minmax(0, 1fr); }
  .tl-mini-cta img { width: 48px; height: 48px; }
  .tl-mini-cta .btn { grid-column: 1 / -1; }
  .tl-preview-btns { width: 100%; }
  .tl-preview-btns .btn { flex: 1 1 auto; }
  .tl-table { font-size: 14px; }
  .tl-table th, .tl-table td { padding: 10px 12px; }
}

/* ---------- print: only the A4 sheet ---------- */
@media print {
  @page { size: A4; margin: 12mm 12mm 14mm; }
  .tl-doc-page, html:has(.tl-doc-page) { background: #fff !important; color: #000 !important; }
  .tl-doc-page::before, .tl-doc-page::after { display: none !important; }
  .tl-doc-page .skip-link, .tl-doc-page .header, .tl-doc-page .footer, .tl-doc-page main > :not(.tl-section--tool),
  .tl-doc-page .tl-section--tool .container > :not(.tl-docapp),
  .tl-doc-page .tl-form, .tl-doc-page .tl-preview-bar, .tl-doc-page .tl-words, .tl-doc-page .tl-hint { display: none !important; }
  .tl-doc-page .tl-section--tool { padding: 0 !important; border: 0 !important; }
  .tl-doc-page .container { width: auto !important; margin: 0 !important; }
  .tl-doc-page .tl-docapp { display: block !important; }
  .tl-doc-page .tl-preview { position: static !important; }
  .tl-doc-page .tl-paper { height: auto !important; overflow: visible !important; box-shadow: none !important; border-radius: 0 !important; }
  .tl-doc-page .tl-sheet { width: auto !important; min-height: 0 !important; padding: 0 !important; transform: none !important; }
  .tl-ph { visibility: hidden; }
  .tl-t tr, .tl-note, .tl-signs { break-inside: avoid; }
  .tl-t th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tl .tl-form-end, .tl-cta-shot { display: none !important; }
}
