/* ===== OPERO free tools =====
   Colours follow the site's dark-mode contract: var(--dk-role, <light value>). The --dk-* tokens
   exist only under html[data-brx-theme="dark"] (Header template 68 / opero-core class-theme), so
   light mode keeps the site's exact light palette. Prefix: opt- (OPERO tools). */

.opt-tool {
  --opt-ink: var(--dk-text, #0b0b0b);
  --opt-ink-2: var(--dk-text-2, #525252);
  --opt-ink-3: var(--dk-text-3, #6b6b6b);
  --opt-page: var(--dk-page, #ffffff);
  --opt-panel: var(--dk-surface, #f4f4f5);
  --opt-card: var(--dk-surface-2, #ffffff);
  --opt-field: var(--dk-surface-2, #ffffff);
  --opt-line: var(--dk-border, #e4e4e7);
  --opt-line-2: var(--dk-border-2, #d4d4d8);
  --opt-good: var(--dk-green, #14804d);
  --opt-bad: var(--dk-red, #b42318);
  --opt-btn: var(--dk-btn-bg, #141414);
  --opt-btn-fg: var(--dk-btn-fg, #ffffff);
  --opt-accent: var(--module-sales, #14804d);
  --opt-r: 14px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--opt-ink);
  font-size: 15px;
  line-height: 1.45;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  text-align: left;
}
.opt-tool *, .opt-tool *::before, .opt-tool *::after { box-sizing: border-box; }
.opt-tool [hidden] { display: none !important; }

/* --- inputs --- */
.opt-inputs { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.opt-sec { background: var(--opt-panel); border-radius: var(--opt-r); padding: 20px; }
.opt-sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.opt-sec-t { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; color: var(--opt-ink); }
.opt-sec-s { font-size: 13px; color: var(--opt-ink-3); }
.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.opt-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opt-f-wide { grid-column: 1 / -1; }
.opt-l { font-size: 13px; font-weight: 550; color: var(--opt-ink-2); }
.opt-hint { font-size: 12px; color: var(--opt-ink-3); }
.opt-in { position: relative; display: flex; align-items: center; }
.opt-in input, .opt-in select, .opt-row input, .opt-row select {
  width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--opt-line); border-radius: 10px;
  background: var(--opt-field); color: var(--opt-ink); font: inherit; font-size: 15px; font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.opt-in select, .opt-row select {
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--opt-ink-3) 50%), linear-gradient(135deg, var(--opt-ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat;
}
.opt-in input:focus, .opt-in select:focus, .opt-row input:focus, .opt-row select:focus { outline: none; border-color: var(--opt-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--opt-ink) 12%, transparent); }
.opt-in .opt-unit { position: absolute; right: 12px; font-size: 13px; color: var(--opt-ink-3); pointer-events: none; }
.opt-in .opt-unit + input, .opt-in input.has-unit { padding-right: 44px; }

/* switch (same look as the pricing page VAT toggle) */
.opt-sw { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--opt-ink-2); cursor: pointer; user-select: none; background: none; border: 0; padding: 0; font: inherit; text-align: left; }
.opt-sw-k { position: relative; width: 38px; height: 22px; flex: none; border-radius: 999px; background: var(--opt-line-2); transition: background-color .18s; }
.opt-sw-k::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: translate .18s cubic-bezier(.2,.7,.2,1); }
.opt-sw[aria-checked="true"] .opt-sw-k { background: var(--opt-accent); }
.opt-sw[aria-checked="true"] .opt-sw-k::after { translate: 16px 0; }
.opt-sw:focus-visible { outline: 2px solid var(--opt-ink); outline-offset: 3px; border-radius: 6px; }

/* segmented choice (venue deal) */
.opt-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.opt-seg button { height: 34px; padding: 0 12px; border: 1px solid var(--opt-line); border-radius: 999px; background: var(--opt-field); color: var(--opt-ink-2); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.opt-seg button:hover { border-color: var(--opt-line-2); color: var(--opt-ink); }
.opt-seg button[aria-pressed="true"] { background: var(--opt-btn); border-color: var(--opt-btn); color: var(--opt-btn-fg); }

/* repeating rows (tickets, costs) */
.opt-rows { display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: grid; gap: 8px; align-items: center; }
.opt-row-head { font-size: 12px; font-weight: 550; color: var(--opt-ink-3); }
.opt-rows[data-kind="tiers"] .opt-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .8fr) 34px; }
.opt-rows[data-kind="costs"] .opt-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 34px; }
.opt-rows[data-kind="ros"] .opt-row { grid-template-columns: minmax(0, 2fr) minmax(0, .8fr) minmax(0, .6fr) minmax(0, 1.1fr) 34px; }
.opt-rows[data-kind="costs"].is-full .opt-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .7fr) 34px; }
.opt-x { width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--opt-ink-3); font-size: 18px; line-height: 1; cursor: pointer; }
.opt-x:hover { background: var(--opt-line); color: var(--opt-ink); }
.opt-add { align-self: flex-start; margin-top: 4px; height: 34px; padding: 0 12px; border: 1px dashed var(--opt-line-2); border-radius: 10px; background: none; color: var(--opt-ink-2); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; }
.opt-add:hover { color: var(--opt-ink); border-color: var(--opt-ink-3); }
.opt-cat-total { display: flex; justify-content: space-between; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--opt-line); font-size: 13px; color: var(--opt-ink-3); }

details.opt-more { border-top: 1px solid var(--opt-line); margin-top: 16px; padding-top: 12px; }
details.opt-more > summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--opt-ink); list-style: none; display: flex; align-items: center; gap: 8px; }
details.opt-more > summary::-webkit-details-marker { display: none; }
details.opt-more > summary::before { content: "+"; display: inline-flex; width: 18px; justify-content: center; color: var(--opt-ink-3); font-weight: 500; }
details.opt-more[open] > summary::before { content: "–"; }
details.opt-more > .opt-grid { margin-top: 14px; }

/* --- result panel --- */
.opt-result { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.opt-card { background: var(--opt-panel); border-radius: var(--opt-r); padding: 22px; }
.opt-k { font-size: 13px; font-weight: 550; color: var(--opt-ink-3); }
.opt-big { margin-top: 4px; font-size: 44px; font-weight: 700; line-height: 1.02; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--opt-ink); }
.opt-big small { font-size: 15px; font-weight: 550; letter-spacing: 0; color: var(--opt-ink-3); margin-left: 6px; }
.opt-sub { margin-top: 6px; font-size: 14px; color: var(--opt-ink-2); }
.opt-tool .opt-pos { color: var(--opt-good); }
.opt-tool .opt-neg { color: var(--opt-bad); }

.opt-meter { position: relative; height: 10px; margin: 16px 0 6px; border-radius: 999px; background: var(--opt-line); overflow: visible; }
.opt-meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--opt-ink); transition: width .25s cubic-bezier(.2,.7,.2,1); }
.opt-meter-mark { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--opt-accent); border-radius: 2px; transition: left .25s cubic-bezier(.2,.7,.2,1); }
.opt-meter-legend { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--opt-ink-3); font-variant-numeric: tabular-nums; }
.opt-meter-legend b { font-weight: 600; color: var(--opt-ink-2); }

.opt-lines { margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--opt-line); display: grid; grid-template-columns: 1fr auto; gap: 7px 0; font-size: 14px; }
.opt-lines dt { color: var(--opt-ink-2); }
.opt-lines dd { margin: 0; padding-left: 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--opt-ink); }
.opt-lines .is-total { padding-top: 8px; border-top: 1px solid var(--opt-line); font-weight: 650; color: var(--opt-ink); }
.opt-lines dt.is-sub { padding-left: 12px; }
.opt-lines .is-sub { font-size: 13px; color: var(--opt-ink-3); }

.opt-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.opt-table th { text-align: right; font-weight: 550; color: var(--opt-ink-3); padding: 0 0 8px; }
.opt-table td { text-align: right; padding: 7px 0; border-top: 1px solid var(--opt-line); color: var(--opt-ink); }
.opt-table th:first-child, .opt-table td:first-child { text-align: left; }

.opt-warn { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--opt-bad) 9%, var(--opt-card)); color: var(--opt-ink); font-size: 13px; line-height: 1.45; }
.opt-warn::before { content: "!"; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--opt-bad); color: #fff; font-size: 12px; font-weight: 700; margin-top: 1px; }
.opt-warn.is-info { background: color-mix(in srgb, var(--opt-accent) 10%, var(--opt-card)); }
.opt-warn.is-info::before { content: "i"; background: var(--opt-accent); }

.opt-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.opt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 12px; border: 1px solid var(--opt-line); border-radius: 10px; background: var(--opt-card); color: var(--opt-ink); font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: border-color .15s, background-color .15s; }
.opt-btn:hover { border-color: var(--opt-ink-3); }
.opt-cta { display: block; padding: 20px 22px; border-radius: var(--opt-r); background: var(--opt-btn); color: var(--opt-btn-fg); text-decoration: none; transition: transform .22s cubic-bezier(.2,.7,.2,1), box-shadow .22s; }
.opt-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -12px #00000066; }
.opt-cta-t { font-size: 16px; font-weight: 650; display: flex; justify-content: space-between; gap: 12px; }
.opt-cta-t::after { content: "→"; font-weight: 500; transition: translate .22s cubic-bezier(.2,.7,.2,1); }
.opt-cta:hover .opt-cta-t::after { translate: 3px 0; }
.opt-cta-s { margin-top: 4px; font-size: 13px; opacity: .72; }
.opt-toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; padding: 10px 16px; border-radius: 10px; background: var(--opt-btn); color: var(--opt-btn-fg); font-size: 14px; font-weight: 550; z-index: 99; opacity: 0; transition: opacity .2s; pointer-events: none; }
.opt-toast.is-on { opacity: 1; }

/* mobile: one column, a slim summary bar follows the visitor */
.opt-bar { display: none; }
@media (max-width: 900px) {
  .opt-tool { grid-template-columns: minmax(0, 1fr); }
  .opt-result { position: static; }
  .opt-bar { display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--opt-btn); color: var(--opt-btn-fg); font-size: 14px; font-variant-numeric: tabular-nums; box-shadow: 0 10px 30px -10px #0000007a; transition: opacity .2s, translate .2s; }
  .opt-bar b { font-size: 16px; }
  .opt-bar.is-away { opacity: 0; translate: 0 12px; pointer-events: none; }
}
@media (max-width: 560px) {
  .opt-sec, .opt-card { padding: 16px; }
  .opt-rows[data-kind="ros"] .opt-row { grid-template-columns: minmax(0, 1fr) 72px 56px 34px; }
  .opt-rows[data-kind="ros"] .opt-row > :nth-child(4) { display: none; }
  .opt-grid, .opt-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .opt-rows[data-kind="costs"].is-full .opt-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; }
  .opt-rows[data-kind="costs"].is-full .opt-row > :nth-child(1) { grid-column: 1 / -1; }
  .opt-rows[data-kind="costs"].is-full .opt-row > :nth-child(4) { display: none; }
  .opt-rows[data-kind="costs"].is-full .opt-row-head { display: none; }
  .opt-actions { grid-template-columns: minmax(0, 1fr); }
  .opt-big { font-size: 38px; }
}

/* --- print sheet (built by printSheet() in opero-tools-ui.js) ---
   On screen it is hidden. In print only the sheet shows: OPERO logo, the result, the inputs as
   tables, and an OPERO ad. @page margin 0 hides the browser's URL/date lines; the repeated
   thead/tfoot spacers give every page its top and bottom margin. */
.opt-print { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(.opt-print) { display: none !important; }
  .opt-print { display: block; color: #111; font: 10pt/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .opp-frame { width: 100%; border-collapse: collapse; }
  .opp-frame > tbody > tr > td, .opp-frame > thead > tr > td, .opp-frame > tfoot > tr > td { padding: 0 16mm; }
  .opp-space { height: 13mm; }
  .opp-space-b { height: 12mm; }
  .opp-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 5mm; border-bottom: 1px solid #e4e4e7; }
  .opp-logo { height: 15px; width: auto; }
  .opp-meta { text-align: right; font-size: 8.5pt; color: #6b6b6b; display: flex; flex-direction: column; }
  .opp-meta b { color: #111; font-weight: 600; }
  .opp-h1 { margin: 7mm 0 5mm; font-size: 20pt; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
  .opp-sec { margin: 0 0 6mm; break-inside: avoid; }
  .opp-sec h3 { margin: 0 0 2.5mm; font-size: 7.5pt; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #6b6b6b; }
  .opp-kvs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8mm; }
  .opp-kv { display: flex; justify-content: space-between; gap: 4mm; padding: 1.6mm 0; border-bottom: 1px solid #ececef; }
  .opp-kv span { color: #525252; }
  .opp-kv b { font-weight: 600; text-align: right; }
  .opp-t { width: 100%; border-collapse: collapse; margin: 0 0 3mm; font-size: 9pt; }
  .opp-t th { text-align: left; font-weight: 600; color: #6b6b6b; font-size: 7.5pt; letter-spacing: .04em; padding: 0 2mm 1.5mm 0; border-bottom: 1px solid #d4d4d8; }
  .opp-t td { padding: 1.6mm 2mm 1.6mm 0; border-bottom: 1px solid #ececef; }
  .opp-t tr { break-inside: avoid; }
  .opt-print .opt-tool.opp-tool {
    display: block; font-size: 10pt; color: #111;
    --opt-ink: #0b0b0b; --opt-ink-2: #525252; --opt-ink-3: #6b6b6b; --opt-page: #fff; --opt-panel: #f6f6f7;
    --opt-card: #fff; --opt-field: #fff; --opt-line: #e4e4e7; --opt-line-2: #d4d4d8; --opt-good: #14804d; --opt-bad: #b42318;
  }
  /* The site's Inter is a variable font. Chrome embeds variable fonts in a PDF as Type 3 glyph
     drawings, and text copied from such a PDF falls apart into single letters. The print sheet
     therefore uses the device's standard sans-serif, which is embedded as real text. */
  .opt-print, .opt-print * { font-family: "Helvetica Neue", Helvetica, Arial, "Segoe UI", Roboto, sans-serif !important; letter-spacing: 0 !important; }
  .opt-print .opt-result { position: static; box-shadow: none; }
  .opt-print .opt-result * { box-shadow: none !important; }
  .opp-ad { display: flex; justify-content: space-between; align-items: center; gap: 8mm; margin: 8mm 0 4mm; padding: 6mm 7mm; border-radius: 4mm; background: #0b0b0b; color: #fff; break-inside: avoid; }
  .opp-ad-l { display: flex; flex-direction: column; gap: 1.5mm; max-width: 120mm; }
  .opp-ad-l b { font-size: 13pt; letter-spacing: -0.02em; }
  .opp-ad-l span { font-size: 9pt; color: #d4d4d8; }
  .opp-ad-r { color: #fff !important; text-decoration: none; text-align: right; font-size: 8.5pt; color: #d4d4d8; display: flex; flex-direction: column; white-space: nowrap; }
  .opp-ad-r b { font-size: 14pt; color: #fff; letter-spacing: -0.01em; }
  .opp-foot { margin: 0; font-size: 8pt; color: #6b6b6b; }
  .opp-foot a { color: #111; }
}

/* profit colour wins over the neutral total row */
.opt-tool .opt-lines dd.opt-pos { color: var(--opt-good); }
.opt-tool .opt-lines dd.opt-neg { color: var(--opt-bad); }
