/* Free tools (/tools) */
.tools-hero { padding-bottom: 1.6rem; }
.tools-search { position: relative; max-width: 620px; margin-top: 1.2rem; }
.tools-search i { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.tools-search input { width: 100%; border: 1px solid #cbd5e1; border-radius: 14px; padding: .85rem 2.8rem .85rem 1rem; font-size: 1.05rem; font-family: inherit; box-shadow: var(--shadow); }
.tools-search input:focus { outline: 3px solid var(--primary-glow); border-color: var(--primary); }
.tools-jump { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.tools-jump a { background: #fff; border: 1px solid var(--border-color); border-radius: 999px; padding: .35rem .9rem; font-size: .92rem; text-decoration: none; color: #0c4a6e; font-weight: 600; }
.tools-jump a:hover { border-color: var(--primary); }
.tools-cluster { margin: 2rem 0 2.4rem; scroll-margin-top: 90px; }
.tools-cluster h2, .tool-related h2, .tool-faq h2 { font-weight: 800; font-size: 1.4rem; color: #0c4a6e; }
.tools-cluster h2 i { color: var(--primary); }
.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .9rem; margin-top: .9rem; }
.tool-card { display: flex; gap: .85rem; align-items: flex-start; background: #fff; border: 1px solid var(--border-color); border-radius: 16px; padding: 1rem 1.05rem; text-decoration: none; color: var(--text-main); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.tool-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.tool-card-icon { flex: 0 0 46px; height: 46px; border-radius: 12px; background: #e0f2fe; color: var(--primary); display: grid; place-items: center; font-size: 1.35rem; }
.tool-card-body strong { display: block; color: #0c4a6e; font-size: 1.03rem; margin-bottom: .2rem; }
.tool-card-body span { display: block; font-size: .9rem; color: var(--text-muted); line-height: 1.6; }
.tools-countries { margin-top: 1rem; line-height: 2.2; font-size: .95rem; }
.tools-countries a { display: inline-block; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; padding: .1rem .55rem; margin: 0 .15rem; text-decoration: none; }
.tools-about { max-width: 820px; }

/* tool page */
.tool-main { max-width: 1040px; }
.tool-head { margin: .6rem 0 1.2rem; }
.tool-head h1 { font-weight: 800; font-size: clamp(1.6rem, 3.6vw, 2.3rem); color: #0c4a6e; margin: .5rem 0 .6rem; }
.tool-chip { display: inline-flex; gap: .35rem; align-items: center; background: #e0f2fe; color: #075985; border-radius: 999px; padding: .25rem .8rem; font-size: .88rem; font-weight: 700; text-decoration: none; }
.tool-badges { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem 1rem; color: #0f766e; font-size: .9rem; font-weight: 600; }
.tool-box { background: #fff; border: 1px solid var(--border-color); border-radius: 20px; box-shadow: var(--shadow); padding: clamp(1rem, 3vw, 1.7rem); }
.tool-download { margin: 1.1rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.tool-content { margin-top: 2rem; }
.tool-content .prose { max-width: 820px; }
.tool-steps li { margin-bottom: .35rem; }
.tool-ref { font-size: .93rem; }
.tool-country-links { columns: 2; padding-right: 1.2rem; }
@media (max-width: 560px) { .tool-country-links { columns: 1; } }

.tool-tayf { margin: 2rem 0; border-radius: 20px; padding: 1.4rem 1.5rem; background: linear-gradient(135deg, #f0f9ff, #ecfeff); border: 1px solid #bae6fd; }
.tool-tayf-chip { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; color: #075985; margin-bottom: .5rem; }
.tool-tayf p { margin-bottom: .9rem; }
.tool-faq { margin: 2rem 0; max-width: 820px; }
.tool-faq details { background: #fff; border: 1px solid var(--border-color); border-radius: 12px; padding: .2rem 1rem; margin-bottom: .55rem; }
.tool-faq summary { cursor: pointer; font-weight: 700; padding: .7rem 0; color: #0c4a6e; }
.tool-faq details p { margin: 0 0 .8rem; color: #334155; }
.tool-related { margin-top: 2rem; }

/* widget core */
.tw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .85rem 1rem; align-items: end; }
.tw-field { display: flex; flex-direction: column; gap: .3rem; margin: 0; }
.tw-label { font-weight: 700; font-size: .92rem; color: #1e293b; }
.tw-inwrap { position: relative; display: flex; }
.tw-field input, .tw-field select, .tw-table input { width: 100%; border: 1px solid #cbd5e1; border-radius: 11px; padding: .65rem .8rem; font-size: 1.05rem; font-family: inherit; background: #fff; color: #0f172a; min-height: 46px; }
.tw-field input[type=color] { padding: .2rem; height: 46px; }
.tw-field input:focus, .tw-field select:focus, .tw-table input:focus { outline: 3px solid var(--primary-glow); border-color: var(--primary); }
.tw-suffix { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; pointer-events: none; }
.tw-inwrap:has(.tw-suffix) input { padding-left: 2.6rem; }
.tw-help { color: var(--text-muted); font-size: .8rem; }
.tw-check { display: flex; align-items: center; gap: .5rem; font-size: .95rem; cursor: pointer; }
.tw-check input { width: 1.15rem; height: 1.15rem; }
.tw-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; margin-top: 1.2rem; }
.tw-res { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: .75rem .9rem; }
.tw-res-label { display: block; font-size: .85rem; color: #475569; margin-bottom: .2rem; }
.tw-res output { display: block; font-size: 1.3rem; font-weight: 800; color: #0f172a; direction: ltr; text-align: right; unicode-bidi: plaintext; }
.tw-res.big { background: #ecfeff; border-color: #a5f3fc; }
.tw-res.big output { font-size: 1.7rem; color: #0e7490; }
output.pos, .tw-cell-out.pos, .tw-note.pos { color: #047857 !important; }
output.neg, .tw-cell-out.neg, .tw-note.neg { color: #b91c1c !important; }
.tw-note { margin: .9rem 0 0; font-size: .95rem; color: #334155; min-height: 1.4em; }
.tw-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tw-tabs button { border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: .45rem 1rem; font-family: inherit; font-weight: 700; color: #334155; cursor: pointer; }
.tw-tabs button[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.tw-text-out { margin-top: 1.1rem; display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; background: #ecfeff; border: 1px solid #a5f3fc; border-radius: 14px; padding: .9rem 1rem; }
.tw-text-out output { flex: 1 1 260px; font-size: 1.2rem; font-weight: 700; color: #0e7490; line-height: 1.8; word-break: break-word; }
.tw-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem; }
.tw-actions-inline { display: inline-flex; gap: .4rem; }
.tw fieldset { border: 1px solid #e2e8f0; border-radius: 14px; padding: .9rem 1rem 1rem; margin: 0 0 1rem; }
.tw legend { float: none; width: auto; font-size: 1rem; font-weight: 800; color: #0c4a6e; padding: 0 .4rem; margin: 0; }
.tw [hidden] { display: none !important; }
.tw-btn-field .btn { min-height: 46px; }

/* tables */
.tw-table-wrap { overflow-x: auto; margin: .4rem 0 .7rem; }
.tw-table { width: 100%; border-collapse: separate; border-spacing: 0 .35rem; min-width: 560px; }
.tw-table th { font-size: .85rem; color: #475569; font-weight: 700; padding: 0 .3rem; text-align: right; }
.tw-table td { padding: 0 .25rem; vertical-align: middle; }
.tw-table input { padding: .5rem .6rem; min-height: 42px; font-size: 1rem; }
.tw-cell-out { font-weight: 700; white-space: nowrap; direction: ltr; text-align: right; }
.tw-del { border: 0; background: #fee2e2; color: #b91c1c; border-radius: 9px; width: 36px; height: 36px; cursor: pointer; }
.tool-ref { min-width: 520px; border-spacing: 0; }
.tool-ref th, .tool-ref td { border-bottom: 1px solid #e2e8f0; padding: .5rem .4rem; }

/* drawer */
.dr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: 1rem; }
.dr-cell { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: .25rem .5rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: .55rem .65rem; margin: 0; }
.dr-den { font-weight: 800; color: #0c4a6e; align-self: center; min-width: 3.2ch; }
.dr-cell input { border: 1px solid #cbd5e1; border-radius: 9px; padding: .35rem .5rem; font-size: 1rem; width: 100%; font-family: inherit; }
.dr-sum { grid-column: 1 / -1; font-size: .82rem; color: #475569; direction: ltr; text-align: right; }

/* loss bars */
.loss-bars { margin-top: 1.1rem; display: grid; gap: .45rem; }
.lb { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: .6rem; align-items: center; font-size: .92rem; }
.lb-bar { background: #f1f5f9; border-radius: 6px; height: 14px; overflow: hidden; }
.lb-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f97316, #dc2626); border-radius: 6px; }
.lb-v { font-weight: 700; direction: ltr; }

/* barcode / qr */
.bc-preview, .qr-preview { margin-top: 1.1rem; background: #fff; border: 1px dashed #cbd5e1; border-radius: 14px; padding: 1rem; display: flex; justify-content: center; overflow-x: auto; min-height: 130px; }
.bc-preview svg { max-width: 100%; height: auto; }
.qr-preview > div { width: min(280px, 100%); aspect-ratio: 1 / 1; }
.qr-preview svg { width: 100%; height: auto; display: block; }

/* invoice */
.tw-wide .inv-form { margin-bottom: 1rem; }
.inv-paper { border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; padding: 1.2rem; overflow-x: auto; }
.inv-doc { min-width: 520px; color: #0f172a; font-size: .97rem; }
.inv-top { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 3px solid #0369a1; padding-bottom: .8rem; margin-bottom: .8rem; }
.inv-store { font-size: 1.35rem; font-weight: 800; margin: 0 0 .25rem; color: #0c4a6e; }
.inv-top p, .inv-meta p { margin: 0; font-size: .9rem; color: #334155; }
.inv-meta { text-align: left; }
.inv-meta h3 { font-size: 1.15rem; font-weight: 800; margin: 0 0 .3rem; color: #0369a1; }
.inv-to { margin-bottom: .7rem; }
.inv-tbl { width: 100%; border-collapse: collapse; }
.inv-tbl th { background: #f0f9ff; color: #075985; font-size: .88rem; }
.inv-tbl th, .inv-tbl td { border: 1px solid #e2e8f0; padding: .45rem .5rem; text-align: right; }
.inv-sums { width: min(320px, 100%); margin-right: auto; margin-top: .7rem; }
.inv-sums p { display: flex; justify-content: space-between; margin: 0; padding: .3rem 0; border-bottom: 1px solid #f1f5f9; }
.inv-total { font-weight: 800; font-size: 1.12rem; color: #0c4a6e; border-bottom: 0 !important; }
.inv-words { margin: .7rem 0 0; background: #f8fafc; padding: .5rem .7rem; border-radius: 8px; font-weight: 600; }
.inv-notes { margin-top: .6rem; color: #334155; }
.inv-foot { margin-top: 1rem; font-size: .75rem; color: #64748b; text-align: center; }

/* printing (invoice, statement, count sheet, labels) */
#tw-print { display: none; }
.pr-doc h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
.pr-table { width: 100%; border-collapse: collapse; margin: .6rem 0; }
.pr-table th, .pr-table td { border: 1px solid #94a3b8; padding: .35rem .45rem; text-align: right; font-size: .9rem; }
.pr-total { font-weight: 800; font-size: 1.1rem; }
.pr-foot { font-size: .75rem; color: #64748b; margin-top: 1rem; }
.lbl-sheet { display: grid; gap: 0; }
.lbl-c3 { grid-template-columns: repeat(3, 1fr); } .lbl-c4 { grid-template-columns: repeat(4, 1fr); } .lbl-c5 { grid-template-columns: repeat(5, 1fr); }
.lbl { border: 1px dashed #cbd5e1; padding: 2mm; text-align: center; break-inside: avoid; display: flex; flex-direction: column; justify-content: center; }
.lbl-c3 .lbl { height: 34mm; } .lbl-c4 .lbl { height: 27mm; } .lbl-c5 .lbl { height: 21mm; }
.lbl-n { font-weight: 700; font-size: 9pt; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl-b svg { width: 100%; height: auto; max-height: 20mm; }
.lbl-c5 .lbl-b svg { max-height: 13mm; }
.lbl-p { font-weight: 800; font-size: 10pt; }
@media print {
  body.tw-printing > *:not(#tw-print) { display: none !important; }
  body.tw-printing #tw-print { display: block !important; }
  body.tw-printing { background: #fff !important; padding: 0 !important; }
  body.tw-printing .inv-doc { min-width: 0; }
  @page { margin: 10mm; }
}
@media (max-width: 575px) {
  .tw-res output { font-size: 1.15rem; }
  .tw-res.big output { font-size: 1.45rem; }
  .lb { grid-template-columns: 1fr auto; }
  .lb-bar { grid-column: 1 / -1; grid-row: 2; }
}
.tw fieldset { min-width: 0; }

@media (max-width: 640px) {
  .tw-table:not(.tool-ref) { min-width: 0; display: block; border-spacing: 0; }
  .tw-table:not(.tool-ref) thead { display: none; }
  .tw-table:not(.tool-ref) tbody { display: block; }
  .tw-table:not(.tool-ref) tr { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem .6rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: .65rem; margin-bottom: .6rem; position: relative; }
  .tw-table:not(.tool-ref) td { display: block; padding: 0; }
  .tw-table:not(.tool-ref) td:first-child { grid-column: 1 / -1; padding-left: 2.6rem; }
  .tw-table:not(.tool-ref) td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: .78rem; color: #475569; margin-bottom: .15rem; font-weight: 600; }
  .tw-table:not(.tool-ref) td:last-child { position: absolute; left: .6rem; top: .6rem; }
  .tw-table:not(.tool-ref) .tw-cell-out { align-self: end; padding-bottom: .55rem; text-align: right; }
  .inv-doc { min-width: 0; font-size: .9rem; }
  .inv-top { flex-direction: column; }
  .inv-meta { text-align: right; }
}
.tool-qr-code-generator .tw-note, .tool-whatsapp-link-generator .tw-note { min-height: 3.2em; }
