/* =========================================================
   TOOL PARTS: forms, option pickers, file lists, previews,
   and the invoice / quote / receipt document designs.
   Loaded on tool pages after style.css.
   ========================================================= */

@page { size: A4; margin: 0; }

/* ---------- Form controls ---------- */
.input, .tool-area select, .preview-box select, .tool-area textarea,
.tool-area input[type="text"], .tool-area input[type="number"], .tool-area input[type="email"],
.tool-area input[type="tel"], .tool-area input[type="url"], .tool-area input[type="date"],
.tool-area input[type="time"], .tool-area input[type="password"] {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: var(--line); background: var(--white); color: var(--blue);
  font-size: 1rem; line-height: 1.4; border-radius: 0;
  -webkit-appearance: none; appearance: none;
}
.tool-area textarea { min-height: 96px; resize: vertical; }
.tool-area select, .preview-box select {
  padding-inline-end: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231A0089' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 12px 8px; background-repeat: no-repeat;
  background-position: left 14px center;
}
html[dir="ltr"] .tool-area select, html[dir="ltr"] .preview-box select { background-position: right 14px center; }
.tool-area input:focus-visible, .tool-area select:focus-visible, .tool-area textarea:focus-visible {
  outline: 3px solid var(--orange); outline-offset: 0;
}
.tool-area input[type="color"] {
  width: 48px; height: 48px; padding: 2px; border: var(--line); background: var(--white); cursor: pointer;
}
.tool-area input[type="range"] { width: 100%; accent-color: var(--blue); min-height: 32px; }
.tool-area input[type="checkbox"], .tool-area input[type="radio"].native { accent-color: var(--blue); width: 22px; height: 22px; margin: 0; flex: none; }
.tool-area input[dir="ltr"] { text-align: left; }
html[dir="rtl"] .tool-area input.num-input { text-align: right; }

.f { display: block; margin-bottom: 16px; min-width: 0; }
.f > span, .f-label { display: block; font-weight: 600; font-size: .9375rem; margin-bottom: 6px; }
.f small, .hint { display: block; font-size: .8125rem; margin-top: 4px; font-weight: 400; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
@media (min-width: 560px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 500; cursor: pointer; margin-bottom: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* Collapsible form sections */
.panel { border: var(--line); background: var(--white); margin-bottom: 14px; }
.panel > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; font-weight: 600; font-size: 1.0625rem; background: var(--cream);
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: "+"; font-size: 1.4rem; line-height: 1; font-weight: 500; }
.panel[open] > summary::after { content: "−"; }
.panel[open] > summary { border-bottom: var(--line); }
.panel-body { padding: 16px; }
.panel-body > :last-child { margin-bottom: 0; }

/* Option pickers (wrapping buttons) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0 0 16px; }
.chips legend { margin-bottom: 8px; font-size: .9375rem; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips label {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px;
  border: var(--line); background: var(--white); cursor: pointer; font-weight: 500; font-size: .9375rem;
}
.chips input:checked + label { background: var(--blue); color: var(--cream); }
.chips input:focus-visible + label { outline: 3px solid var(--orange); outline-offset: 2px; }
.chips label:hover { text-decoration: underline; }

/* Colour swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border: 0; padding: 0; margin: 0 0 16px; }
.swatches legend { margin-bottom: 8px; font-size: .9375rem; }
.swatches input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatches label.sw { width: 44px; height: 44px; border: var(--line); cursor: pointer; display: block; }
.swatches input:checked + label.sw { outline: 3px solid var(--blue); outline-offset: 3px; }
.swatches input:focus-visible + label.sw { outline: 3px solid var(--orange); outline-offset: 3px; }
.sw-blue { background: #1A0089; } .sw-orange { background: #FF5E33; } .sw-lime { background: #B7CF4F; }
.sw-black { background: #111111; } .sw-green { background: #0F6B4F; } .sw-maroon { background: #7A1F2B; }
.sw-gold { background: #B08D3C; } .sw-teal { background: #0E6E7A; } .sw-grey { background: #5B6470; }
.sw-white { background: #FFFFFF; } .sw-cream { background: #EFE7DB; } .sw-pink { background: #C2185B; }
.swatches .custom-color { display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 500; }

/* File picker */
.file-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.file-pick input[type="file"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-pick .thumb {
  width: 72px; height: 72px; border: var(--line); background: var(--white);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.file-pick .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.file-pick .thumb.empty::after { content: ""; width: 24px; height: 2px; background: var(--blue); }
.file-pick input[type="file"]:focus-visible + label { outline: 3px solid var(--orange); outline-offset: 2px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 150px; padding: 24px; border: 2px dashed var(--blue); background: var(--cream); cursor: pointer;
  font-weight: 600;
}
.dropzone .icon { width: 36px; height: 36px; }
.dropzone small { font-weight: 400; }
.dropzone.is-over { background: var(--lime); }
.dropzone-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone-input:focus-visible + .dropzone { outline: 3px solid var(--orange); outline-offset: 3px; }

/* File list (images to PDF, merge PDF) */
.file-list { list-style: none; margin: 16px 0; padding: 0; border: var(--line); }
.file-list:empty { display: none; }
.file-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--white); }
.file-list li + li { border-top: var(--thin); }
.file-list .fthumb { width: 56px; height: 56px; border: var(--thin); background: var(--cream); display: flex; align-items: center; justify-content: center; overflow: hidden; font-weight: 600; font-size: .75rem; }
.file-list .fthumb img, .file-list .fthumb canvas { max-width: 100%; max-height: 100%; object-fit: contain; }
.file-list .fname { font-weight: 600; font-size: .9375rem; overflow-wrap: anywhere; line-height: 1.4; }
.file-list .fmeta { font-size: .8125rem; }
.file-list .fbtns { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: var(--line); background: var(--white); color: var(--blue); padding: 0; flex: none;
}
.icon-btn:hover { background: var(--blue); color: var(--cream); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn:disabled:hover { background: var(--white); color: var(--blue); }
.icon-btn .icon { width: 20px; height: 20px; }
.btn-sm-tool { min-height: 44px; padding: 8px 16px; font-size: .9375rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.status { min-height: 1.6em; margin: 12px 0 0; font-weight: 600; font-size: .9375rem; }
.status.is-error { color: var(--blue); background: var(--cream); border: var(--line); padding: 8px 12px; }
.status:empty { padding: 0; border: 0; }
.warn { border: var(--line); background: var(--cream); padding: 10px 12px; font-size: .875rem; font-weight: 500; margin: 0 0 16px; }
.warn::before { content: "! "; font-weight: 600; }

/* Progress bar */
.bar { height: 10px; border: var(--line); background: var(--white); margin-top: 6px; position: relative; }
.bar > span { display: block; height: 100%; background: var(--lime); width: 0; }
.bar.over > span { background: var(--orange); }

/* ---------- Wide maker layout: form + live preview ---------- */
.maker { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
@media (min-width: 1100px) { .maker { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; } }
.maker-form.tool-area { padding: 18px; }
@media (min-width: 560px) { .maker-form.tool-area { padding: 24px; } }
.preview-box { border: var(--line); background: #D9D2C6; padding: 14px; }
@media (min-width: 1100px) { .preview-box { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; } }
.preview-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.preview-head h2 { font-size: 1.5rem; }
html[lang="en"] .preview-head h2 { font-size: 1.6rem; }
.sheet-frame { overflow: hidden; }
.sheet-scale { transform-origin: top right; }
html[dir="ltr"] .sheet-scale { transform-origin: top left; }
.jump-preview { display: inline-flex; }
@media (min-width: 1100px) { .jump-preview { display: none; } }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: var(--white); border-top: var(--line); padding: 12px 0 4px; margin-top: 8px; }

/* Item rows (invoice / quote) */
.items { list-style: none; margin: 0 0 12px; padding: 0; counter-reset: item; }
.item-row {
  counter-increment: item; display: grid; gap: 8px 10px; padding: 12px; border: var(--line); background: var(--cream); margin-bottom: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
  grid-template-areas: "desc desc del" "qty price price" "total total total";
}
.item-row .i-desc { grid-area: desc; } .item-row .i-qty { grid-area: qty; } .item-row .i-price { grid-area: price; }
.item-row .i-del { grid-area: del; align-self: end; } .item-row .i-total { grid-area: total; font-weight: 600; font-size: .9375rem; }
@media (min-width: 640px) {
  .item-row { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1.4fr) 44px; grid-template-areas: "desc qty price del" "total total total total"; }
}
.item-row .f { margin: 0; }
.item-row .f > span { font-size: .8125rem; }

/* ---------- Documents (invoice, quote, receipt) ---------- */
.doc {
  --accent: #1A0089; --on-accent: #FFFFFF; --accent-ink: #1A0089; --ink: #1B1B1F; --muted: #5D5D66; --line-c: #D8D8DE;
  width: 210mm; min-height: 297mm; background: #FFFFFF; color: var(--ink);
  padding: 16mm 15mm; font-family: var(--f-body); font-size: 12.5px; line-height: 1.55;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  display: flex; flex-direction: column;
}
.doc * { border-radius: 0; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 26px; }
.doc .brand { display: flex; gap: 14px; align-items: flex-start; max-width: 58%; }
.doc .brand img { max-width: 120px; max-height: 80px; object-fit: contain; }
.doc .brand-name { font-size: 17px; font-weight: 600; margin: 0 0 2px; line-height: 1.35; }
.doc .brand-lines { color: var(--muted); font-size: 11.5px; white-space: pre-line; }
.doc .title-block { text-align: end; }
.doc .doc-title, .rcpt .r-title { font-family: var(--f-body) !important; }
.doc .doc-title { font-size: 26px; font-weight: 600; line-height: 1.2; margin: 0 0 8px; color: var(--accent-ink); }
.doc .doc-title .sub { display: block; font-size: 14px; font-weight: 500; color: var(--muted); }
.doc .meta { border-collapse: collapse; margin-inline-start: auto; font-size: 12px; }
.doc .meta td { padding: 2px 0; }
.doc .meta td:first-child { color: var(--muted); padding-inline-end: 14px; }
.doc .meta td:last-child { font-weight: 600; text-align: end; }
.doc .lbl-sub { display: block; font-size: 10px; color: var(--muted); font-weight: 400; line-height: 1.2; }

.doc .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 22px; }
.doc .party h3, .doc .block-title {
  font-family: var(--f-body); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent-ink); margin: 0 0 6px; line-height: 1.4;
}
.doc .party p { margin: 0; white-space: pre-line; }
.doc .party .pname { font-weight: 600; font-size: 13.5px; }

.doc table.lines { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.doc table.lines th { font-size: 11px; font-weight: 600; text-align: start; padding: 9px 10px; }
.doc table.lines td { padding: 9px 10px; border-bottom: 1px solid var(--line-c); vertical-align: top; }
.doc table.lines .n { text-align: end; white-space: nowrap; }
.doc table.lines .idx { width: 28px; color: var(--muted); }
.doc table.lines td.desc { white-space: pre-line; }

.doc .after-lines { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.doc .left-col { flex: 1; min-width: 0; }
.doc .totals { width: 44%; min-width: 230px; border-collapse: collapse; }
.doc .totals td { padding: 6px 10px; }
.doc .totals td.n { text-align: end; white-space: nowrap; font-weight: 600; }
.doc .totals tr.grand td { background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 600; padding: 10px; }
.doc .totals tr.grand .lbl-sub { color: inherit; }
.doc .words { margin: 12px 0 0; font-size: 11.5px; font-weight: 500; }
.doc .info-block { margin-top: 18px; }
.doc .info-block p { margin: 0; white-space: pre-line; color: var(--ink); }
.doc .sign-row { display: flex; justify-content: space-between; gap: 24px; margin-top: 28px; align-items: flex-end; }
.doc .sign { min-width: 170px; text-align: center; }
.doc .sign img { max-width: 170px; max-height: 100px; object-fit: contain; display: block; margin: 0 auto 4px; }
.doc .sign .line { border-top: 1px solid var(--ink); padding-top: 4px; font-size: 11px; color: var(--muted); }
.doc .doc-foot { margin-top: auto; padding-top: 22px; text-align: center; font-size: 11px; color: var(--muted); }
.doc .foot-thanks { font-weight: 600; color: var(--accent-ink); font-size: 12.5px; margin-bottom: 2px; }
.doc .empty-hint { color: var(--muted); font-style: italic; }

/* Design 1: Classic */
.doc.tpl-classic .doc-head { border-bottom: 3px solid var(--accent); padding-bottom: 18px; }
.doc.tpl-classic table.lines thead th { border-bottom: 2px solid var(--accent); color: var(--accent-ink); }
.doc.tpl-classic .totals tr:not(.grand) td { border-bottom: 1px solid var(--line-c); }

/* Design 2: Modern (colour band) */
.doc.tpl-modern { padding-top: 0; }
.doc.tpl-modern .doc-head { background: var(--accent); color: var(--on-accent); margin: 0 -15mm 26px; padding: 14mm 15mm 10mm; }
.doc.tpl-modern .doc-head .brand-lines, .doc.tpl-modern .doc-head .meta td:first-child, .doc.tpl-modern .doc-title .sub, .doc.tpl-modern .doc-head .lbl-sub { color: var(--on-accent); }
.doc.tpl-modern .doc-title { color: var(--on-accent); }
.doc.tpl-modern .brand img { background: #FFFFFF; padding: 6px; }
.doc.tpl-modern table.lines thead th { background: var(--accent); color: var(--on-accent); }
.doc.tpl-modern table.lines tbody tr:nth-child(even) td { background: #F4F4F6; }

/* Design 3: Minimal */
.doc.tpl-minimal { --line-c: #E6E6EA; padding: 20mm 18mm; }
.doc.tpl-minimal .doc-title { color: var(--ink); font-weight: 500; letter-spacing: .02em; }
.doc.tpl-minimal .doc-title::after { content: ""; display: block; width: 36px; height: 3px; background: var(--accent); margin-top: 8px; margin-inline-start: auto; }
.doc.tpl-minimal table.lines thead th { color: var(--muted); border-bottom: 1px solid var(--ink); font-weight: 500; }
.doc.tpl-minimal .totals tr.grand td { background: transparent; color: var(--ink); border-top: 2px solid var(--ink); font-size: 16px; }
.doc.tpl-minimal .party h3, .doc.tpl-minimal .block-title { color: var(--muted); }

/* Design 4: Bold (square borders, like the site) */
.doc.tpl-bold { --line-c: #1B1B1F; }
.doc.tpl-bold .doc-title { font-size: 34px; color: var(--ink); }
.doc.tpl-bold .doc-head { border: 2px solid var(--ink); padding: 14px 16px; box-shadow: 6px 6px 0 var(--accent); }
.doc.tpl-bold table.lines { border: 2px solid var(--ink); }
.doc.tpl-bold table.lines thead th { background: var(--ink); color: #FFFFFF; }
.doc.tpl-bold table.lines td { border-bottom: 1px solid var(--ink); }
.doc.tpl-bold .totals { border: 2px solid var(--ink); }
.doc.tpl-bold .party { border-inline-start: 4px solid var(--accent); padding-inline-start: 10px; }

/* ---------- Receipts ---------- */
.rcpt {
  --accent: #1A0089; --on-accent: #FFFFFF; --accent-ink: #1A0089; --ink: #1B1B1F; --muted: #5D5D66;
  background: #FFFFFF; color: var(--ink); font-family: var(--f-body); line-height: 1.55;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rcpt.size-a5 { width: 210mm; height: 148mm; padding: 10mm 14mm; font-size: 12.5px; overflow: hidden; display: flex; flex-direction: column; }
.rcpt.size-80 { width: 80mm; padding: 5mm 4mm; font-size: 11px; }
.rcpt-pair { width: 210mm; background: #FFFFFF; }
.rcpt-pair .rcpt { height: 148.4mm; }
.rcpt-pair .cut { height: 0; border-top: 1px dashed #8A8A93; position: relative; }
.rcpt-pair .cut span { position: absolute; top: -9px; inset-inline-start: 14mm; background: #FFFFFF; padding: 0 6px; font-size: 10px; color: #5D5D66; font-family: var(--f-body); }
.rcpt .copy-label { font-size: .8em; color: var(--muted); font-weight: 600; text-align: end; margin-bottom: 2px; }
.rcpt .r-body { flex: 1; }
.rcpt .r-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.rcpt .r-brand { display: flex; gap: 10px; align-items: flex-start; }
.rcpt .r-brand img { max-width: 90px; max-height: 64px; object-fit: contain; }
.rcpt .r-bname { font-weight: 600; font-size: 1.2em; line-height: 1.3; margin: 0; }
.rcpt .r-blines { color: var(--muted); font-size: .88em; white-space: pre-line; }
.rcpt .r-title { font-size: 1.8em; font-weight: 600; color: var(--accent-ink); margin: 0; line-height: 1.2; text-align: end; }
.rcpt .r-title .sub { display: block; font-size: .5em; color: var(--muted); font-weight: 500; }
.rcpt .r-meta { text-align: end; font-size: .92em; margin-top: 4px; }
.rcpt .r-amount { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--accent); color: var(--on-accent); padding: 10px 14px; margin: 6px 0 12px; }
.rcpt .r-amount .big { font-size: 1.6em; font-weight: 600; white-space: nowrap; }
.rcpt .r-fields { width: 100%; border-collapse: collapse; }
.rcpt .r-fields td { padding: 7px 0; border-bottom: 1px dotted #9A9AA3; vertical-align: top; }
.rcpt .r-fields td:first-child { color: var(--muted); width: 34%; padding-inline-end: 10px; font-size: .92em; }
.rcpt .r-fields td:last-child { font-weight: 500; }
.rcpt .r-vat { margin-top: 10px; font-size: .92em; }
.rcpt .r-vat span { margin-inline-end: 14px; }
.rcpt .r-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; align-items: flex-end; }
.rcpt .r-sign .sign { min-width: 140px; text-align: center; }
.rcpt .r-sign img { max-width: 140px; max-height: 80px; object-fit: contain; display: block; margin: 0 auto 4px; }
.rcpt .r-sign .line { border-top: 1px solid var(--ink); padding-top: 3px; font-size: .85em; color: var(--muted); }
.rcpt .r-foot { text-align: center; color: var(--muted); font-size: .85em; margin-top: 14px; }
/* thermal roll: everything stacked, centred */
.rcpt.size-80 .r-head { flex-direction: column; align-items: center; text-align: center; }
.rcpt.size-80 .r-brand { flex-direction: column; align-items: center; }
.rcpt.size-80 .r-title, .rcpt.size-80 .r-meta { text-align: center; }
.rcpt.size-80 .r-amount { flex-direction: column; gap: 2px; }
.rcpt.size-80 .r-fields td:first-child { width: 42%; }
.rcpt.size-80 .r-sign { flex-direction: column; align-items: center; }
/* receipt designs */
.rcpt.tpl-classic { border-top: 6px solid var(--accent); }
.rcpt.size-80.tpl-classic { border-top-width: 4px; }
.rcpt.tpl-outline .r-amount { background: transparent; color: var(--ink); border: 2px solid var(--accent); }
.rcpt.tpl-outline { border: 2px solid var(--accent); }
.rcpt.tpl-mono { --accent: #1B1B1F; }
.rcpt.tpl-mono .r-amount { background: transparent; color: var(--ink); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }

/* ---------- Stats (word counter, results) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: var(--line); }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: 12px 14px; border-bottom: var(--thin); border-inline-end: var(--thin); background: var(--white); }
.stat b { display: block; font-size: 1.6rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .875rem; }
.stat.hl { background: var(--lime); }

.big-result { border: var(--line); background: var(--orange); padding: 14px 16px; margin-top: 16px; }
.big-result .label { font-weight: 600; display: block; }
.big-result .value { font-size: 2rem; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big-result.lime { background: var(--lime); }
.big-result.plain { background: var(--white); }

.calc-cards { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .calc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.calc-card { border: var(--line); background: var(--white); padding: 18px; box-shadow: 6px 6px 0 var(--blue); margin-right: 6px; }
.calc-card h2 { font-size: 1.5rem; margin-bottom: 12px; }
html[lang="en"] .calc-card h2 { font-size: 1.7rem; }
.calc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 500; }
.calc-line input { width: 120px !important; flex: 0 0 auto; }
.calc-out { margin-top: 12px; padding: 10px 12px; background: var(--cream); border: var(--line); font-weight: 600; font-size: 1.125rem; min-height: 52px; overflow-wrap: anywhere; }

table.data { width: 100%; border-collapse: collapse; border: var(--line); background: var(--white); font-size: .9375rem; }
table.data th, table.data td { padding: 10px 12px; text-align: start; border-bottom: var(--thin); }
table.data th { background: var(--cream); font-weight: 600; }
table.data td.n { font-weight: 600; font-variant-numeric: tabular-nums; }
table.data tr.is-current td { background: var(--lime); }

/* ---------- Timer ---------- */
.timer-face { text-align: center; padding: 24px 12px; border: var(--line); background: var(--cream); }
.timer-face.is-break { background: var(--lime); }
.timer-phase { font-weight: 600; font-size: 1.125rem; }
.timer-time { font-size: clamp(4rem, 22vw, 8rem); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.timer-count { font-size: .9375rem; }
.timer-progress { height: 12px; border: var(--line); background: var(--white); margin: 14px auto 0; max-width: 520px; }
.timer-progress > span { display: block; height: 100%; background: var(--blue); width: 0; }

/* ---------- QR preview ---------- */
.qr-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.qr-preview canvas { width: 100%; max-width: 360px; height: auto; border: var(--line); background: var(--white); }
.card-preview canvas { max-width: 420px; }

/* ---------- Reference list ---------- */
.ref-list { list-style: none; margin: 0; padding: 0; border: var(--line); background: var(--white); }
.ref-list:empty { display: none; }
.ref-list li { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.ref-list li + li { border-top: var(--thin); }
.ref-text { font-family: "Times New Roman", Times, serif; font-size: 1.0625rem; line-height: 1.6; padding-inline-start: 2em; text-indent: -2em; overflow-wrap: anywhere; }
.ref-intext { font-size: .875rem; margin-top: 4px; }
.authors-list { list-style: none; margin: 0 0 10px; padding: 0; }
.author-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; margin-bottom: 8px; align-items: end; }
.author-row .f { margin: 0; }

/* ---------- Print: only the document ---------- */
.print-only { display: none; }
@media print {
  html, body { background: #FFFFFF !important; }
  .doc-page .site-header, .doc-page .site-footer, .doc-page .back-link, .doc-page .tool-intro,
  .doc-page .maker-form, .doc-page .preview-head, .doc-page .how-to, .doc-page .tool-bottom,
  .doc-page .skip-link, .doc-page .no-print, .doc-page .how-wrap { display: none !important; }
  .doc-page main, .doc-page .wrap, .doc-page .maker, .doc-page .preview-box, .doc-page .sheet-frame {
    padding: 0 !important; margin: 0 !important; border: 0 !important; box-shadow: none !important;
    position: static !important; display: block !important; max-width: none !important;
    max-height: none !important; overflow: visible !important; background: #FFFFFF !important; height: auto !important;
  }
  .doc-page .sheet-scale { transform: none !important; width: auto !important; height: auto !important; }
  .doc { box-shadow: none !important; min-height: 296mm; break-after: avoid; page-break-after: avoid; }
  .rcpt { break-inside: avoid; }
  .print-only { display: block; }
}

/* How-to under a full-width tool */
.how-wrap { grid-template-columns: minmax(0, 1fr) !important; margin-top: 48px; max-width: 760px; }
.how-wrap .how-to { border-top: var(--line); padding-top: 26px; }
.form-top { margin-bottom: 14px; justify-content: flex-end; }
.sticky-actions .grow, .row .grow { flex: 1 1 auto; }
.sticky-actions { padding: 10px 0 6px; }
.tool-area .input-row input[type="text"] { border: 0; min-height: 56px; font-size: 1.5rem; font-weight: 600; }
.tool-area .input-row input[type="text"]:focus-visible { outline: none; }
small.field-error { display: block; }
.color-f { display: inline-flex; flex-direction: column; margin-inline-end: 18px; }
.color-f > span { font-size: .875rem; }
.qr-size-f { width: 100%; max-width: 360px; margin: 0; }
.scan-badge { display: flex; align-items: flex-start; gap: 8px; width: 100%; max-width: 360px; margin: 0; padding: 8px 12px; border: var(--line); background: var(--cream); font-weight: 600; font-size: .9375rem; }
.scan-badge .icon { display: none; margin-top: 2px; }
.scan-badge.ok { background: var(--lime); }
.scan-badge.ok .icon { display: block; }

/* Menu QR printing */
.print-sheet { display: none; }
@media print {
  .print-sheet { display: grid; width: 210mm; height: 296mm; align-content: start; justify-content: center; padding-top: 10mm; }
  .print-sheet.four { grid-template-columns: repeat(2, auto); gap: 0; padding-top: 0; align-content: center; }
  .print-sheet img { display: block; }
  .print-sheet.card-a6 img { width: 105mm; height: 148mm; }
  .print-sheet.card-square img { width: 100mm; height: 100mm; }
  .print-sheet.card-a5 img { width: 148mm; height: 210mm; }
  .print-sheet.four img { outline: 0.2mm dashed #9A9AA3; }
}

/* Courses (GPA) */
.course-row {
  display: grid; gap: 8px 10px; padding: 12px; border: var(--line); background: var(--cream); margin-bottom: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 44px; grid-template-areas: "name name del" "cred grade grade";
}
.course-row .c-name { grid-area: name; } .course-row .c-cred { grid-area: cred; } .course-row .c-grade { grid-area: grade; } .course-row .c-del { grid-area: del; align-self: end; }
.course-row .f { margin: 0; } .course-row .f > span { font-size: .8125rem; }
@media (min-width: 640px) { .course-row { grid-template-columns: minmax(0, 2fr) 96px minmax(0, 1.3fr) 44px; grid-template-areas: "name cred grade del"; } }
.cum-panel { margin-top: 18px; }
.big-result small { display: block; font-weight: 500; }

/* Word counter */
.sub-h { font-size: 1.5rem; margin: 26px 0 10px; }
html[lang="en"] .sub-h { font-size: 1.7rem; }
.lim { margin-bottom: 14px; font-size: .9375rem; }
.lim .lim-n { font-variant-numeric: tabular-nums; }
.target-f { margin-top: 8px; max-width: 360px; }
.top-words { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.top-words li { border: var(--line); background: var(--white); padding: 4px 10px; }
.top-words b { margin-inline-start: 6px; }
.wc-area textarea { min-height: 220px; font-size: 1.0625rem; line-height: 1.8; }

/* References */
.ref-out { margin-top: 6px; }
.ref-out .ref-text { font-size: 1.0625rem; margin-top: 6px; }
.ref-out .ref-text, .ref-out .ref-intext { text-align: left; }
.ref-list .fbtns { display: flex; gap: 4px; }
.ref-list .ref-text, .ref-list .ref-intext { text-align: left; }
@media (max-width: 560px) {
  .ref-list li { grid-template-columns: minmax(0, 1fr); }
  .ref-list .fbtns { justify-content: flex-end; }
}
.fthumb img.rot-90 { transform: rotate(90deg); }
.fthumb img.rot-180 { transform: rotate(180deg); }
.fthumb img.rot-270 { transform: rotate(270deg); }

/* Everyday tools */
.calc-cards.one-col { grid-template-columns: minmax(0, 1fr); }
.tool-area .calc-card { box-shadow: none; margin-right: 0; }
.today-line { font-weight: 600; background: var(--cream); border: var(--line); padding: 10px 14px; margin: 0 0 18px; }
.copy-btn { margin-top: 10px; }
.big-result .sub { display: block; font-weight: 500; }
.unit-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); gap: 10px; align-items: end; }
.unit-row .swap-btn { margin-bottom: 20px; width: 44px; height: 48px; }
.u-value-out { font-size: 1.5rem !important; }
.rs-thumbs { display: flex; gap: 14px; align-items: center; margin: 14px 0; }
.rs-thumbs img { max-width: 160px; max-height: 160px; object-fit: contain; border: var(--line); background: var(--white); }
.rs-thumbs:empty { display: none; }
.empty-hint { font-weight: 400; font-size: .9375rem; }
.doc .empty-hint, .rcpt .empty-hint { font-size: inherit; color: var(--muted); }
.doc.tpl-modern table.lines thead .lbl-sub, .doc.tpl-bold table.lines thead .lbl-sub { color: inherit; }
