/* TheiBusiness Analyzer — widget and report.
   Uses the theme tokens when present (--tb-*) with safe fallbacks. Logical properties for RTL. */

.tib-analyzer, .tib-results {
	--a-bg: var(--tb-surface, #fff);
	--a-bg2: var(--tb-surface-2, #f6f7fb);
	--a-bg3: var(--tb-surface-3, #eef0f7);
	--a-text: var(--tb-text, #0b1020);
	--a-muted: var(--tb-muted, #5b6478);
	--a-line: var(--tb-line, #e3e6ef);
	--a-primary: var(--tb-primary, #3a5afe);
	--a-primary-ink: var(--tb-primary-ink, #fff);
	--a-primary-soft: var(--tb-primary-soft, #eef1ff);
	--a-ok: var(--tb-ok, #0f8a6c);
	--a-ok-soft: var(--tb-ok-soft, #e6f6f1);
	--a-warn: var(--tb-warn, #b25e09);
	--a-warn-soft: var(--tb-warn-soft, #fff4e5);
	--a-danger: var(--tb-danger, #c2362b);
	--a-danger-soft: var(--tb-danger-soft, #fdecea);
	--a-radius: var(--tb-radius, 16px);
	--a-shadow: var(--tb-shadow, 0 1px 2px rgba(16,24,40,.04), 0 12px 32px -12px rgba(16,24,40,.12));
	--a-mono: var(--tb-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	color: var(--a-text);
}

.tib-analyzer { background: var(--a-bg); border: 1px solid var(--a-line); border-radius: calc(var(--a-radius) + 6px); box-shadow: var(--a-shadow); padding: clamp(14px, 3vw, 28px); text-align: start; position: relative; }
.tib-analyzer.is-busy .tib-panel, .tib-analyzer.is-busy .tib-levels { opacity: .6; pointer-events: none; }
.tib-icon { flex: none; }
.screen-reader-text { border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important; }

/* Tabs */
.tib-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 5px; background: var(--a-bg2); border-radius: 14px; margin-block-end: 18px; }
.tib-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--a-muted); font: inherit; font-weight: 600; font-size: .95rem; letter-spacing: .01em; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.tib-tab:hover { color: var(--a-text); }
.tib-tab[aria-selected="true"] { background: var(--a-bg); color: var(--a-text); box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 0 0 1px var(--a-line); }
.tib-tab[aria-selected="true"] .tib-icon { color: var(--a-primary); }
@media (max-width: 480px) { .tib-tab { flex-direction: column; gap: 2px; font-size: .78rem; min-height: 54px; } }

/* Segmented source */
.tib-seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--a-line); border-radius: 999px; margin-block-end: 14px; }
.tib-seg__opt { position: relative; }
.tib-seg__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tib-seg__opt span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--a-muted); }
.tib-seg__opt span .tib-icon { width: 16px; height: 16px; }
.tib-seg__opt input:checked + span { background: var(--a-primary-soft); color: var(--a-primary); }
.tib-seg__opt input:focus-visible + span { outline: 2px solid var(--a-primary); outline-offset: 2px; }

/* Inputs */
.tib-textarea, .tib-input { width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--a-text); background: var(--a-bg); border: 1px solid var(--a-line); border-radius: 14px; padding: 14px 16px; transition: border-color .15s, box-shadow .15s; }
.tib-textarea { min-height: 200px; resize: vertical; line-height: 1.55; }
.tib-textarea:focus, .tib-input:focus { outline: none; border-color: var(--a-primary); box-shadow: 0 0 0 4px var(--a-primary-soft); }
.tib-textmeta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block-start: 8px; font-size: .82rem; color: var(--a-muted); }
.tib-label { display: block; font-weight: 600; font-size: .9rem; margin-block-end: 6px; }
.tib-hint { font-size: .82rem; color: var(--a-muted); margin: 8px 0 0; }
.tib-hint--inline { display: flex; align-items: center; gap: 6px; }
.tib-hint--inline .tib-icon { width: 16px; height: 16px; }
.tib-formats { font-size: .8rem; color: var(--a-muted); margin: 10px 0 0; font-family: var(--a-mono); letter-spacing: .01em; }
.tib-link-btn { background: none; border: 0; padding: 4px 2px; color: var(--a-primary); font: inherit; font-weight: 600; cursor: pointer; }
.tib-link-btn:hover { text-decoration: underline; }

/* Drop zone */
.tib-drop { position: relative; border: 1.5px dashed color-mix(in srgb, var(--a-primary) 35%, var(--a-line)); background: linear-gradient(180deg, var(--a-bg2), var(--a-bg)); border-radius: 18px; padding: 34px 18px; text-align: center; transition: border-color .15s, background .15s, transform .15s; }
.tib-drop.is-over { border-color: var(--a-primary); background: var(--a-primary-soft); transform: scale(1.005); }
.tib-drop.has-file { border-style: solid; padding: 18px; text-align: start; }
.tib-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.tib-file-input:focus-visible + .tib-drop__empty .tib-btn { outline: 2px solid var(--a-primary); outline-offset: 2px; }
.tib-drop__icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--a-bg); border: 1px solid var(--a-line); color: var(--a-primary); box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.tib-drop__title { font-weight: 700; margin: 12px 0 2px; font-size: 1.05rem; }
.tib-drop__or { color: var(--a-muted); margin: 0 0 10px; font-size: .85rem; }
.tib-drop__file { display: flex; align-items: center; gap: 14px; }
.tib-drop__info { flex: 1; min-width: 0; }
.tib-drop__name { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.tib-drop__meta { margin: 2px 0 0; color: var(--a-muted); font-size: .85rem; font-family: var(--a-mono); }

/* Levels */
.tib-levels { border: 0; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tib-levels__legend { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--a-muted); margin-block-end: 8px; padding: 0; }
.tib-level { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--a-line); border-radius: 14px; padding: 12px 14px; cursor: pointer; background: var(--a-bg); transition: border-color .15s; }
.tib-level:hover { border-color: color-mix(in srgb, var(--a-primary) 40%, var(--a-line)); }
.tib-level input { margin-block-start: 3px; accent-color: var(--a-primary); width: 16px; height: 16px; }
.tib-level__body { display: flex; flex-direction: column; gap: 2px; }
.tib-level__body strong { font-size: .9rem; }
.tib-level__body small { font-size: .78rem; color: var(--a-muted); }
.tib-level.is-locked { cursor: default; background: var(--a-bg2); }
.tib-level.is-disabled { cursor: not-allowed; opacity: .7; background: var(--a-bg2); }
@media (max-width: 720px) { .tib-levels { grid-template-columns: 1fr; } }

/* Buttons (fallback if theme absent) */
.tib-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 650; font-size: .95rem; text-decoration: none; cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s, color .15s; }
.tib-btn:focus-visible { outline: 2px solid var(--a-primary); outline-offset: 3px; }
.tib-btn--primary { background: var(--a-primary); color: var(--a-primary-ink); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 8px 20px -8px color-mix(in srgb, var(--a-primary) 70%, transparent); }
.tib-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 12px 26px -8px color-mix(in srgb, var(--a-primary) 75%, transparent); }
.tib-btn--secondary { background: var(--a-bg); color: var(--a-text); border-color: var(--a-line); }
.tib-btn--secondary:hover { border-color: color-mix(in srgb, var(--a-text) 25%, var(--a-line)); }
.tib-btn--ghost { background: transparent; color: var(--a-primary); }
.tib-btn--sm { min-height: 36px; padding: 0 14px; font-size: .85rem; border-radius: 10px; }
.tib-btn--lg { min-height: 54px; padding: 0 34px; font-size: 1.05rem; border-radius: 14px; }
.tib-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.tib-actions { display: flex; justify-content: center; margin-block-start: 22px; }
.tib-analyze-btn { min-width: min(280px, 100%); }
.tib-analyze-btn.is-busy .tib-icon { animation: tib-spin 1s linear infinite; }
@keyframes tib-spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) { .tib-analyze-btn { width: 100%; } }

/* Progress / status */
.tib-progress { margin-block-start: 16px; }
.tib-progress__bar { height: 8px; background: var(--a-bg3); border-radius: 99px; overflow: hidden; position: relative; }
.tib-progress__bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--a-primary), color-mix(in srgb, var(--a-primary) 60%, #13b5a6)); border-radius: inherit; transition: width .2s; }
.tib-progress__bar.is-indeterminate span { width: 35% !important; position: absolute; animation: tib-indet 1.2s ease-in-out infinite; }
@keyframes tib-indet { from { inset-inline-start: -35%; } to { inset-inline-start: 100%; } }
.tib-progress__text { margin: 8px 0 0; font-size: .85rem; color: var(--a-muted); text-align: center; }
.tib-status { margin: 12px 0 0; text-align: center; font-size: .92rem; min-height: 1.2em; }
.tib-status.is-error { color: var(--a-danger); font-weight: 600; }
.tib-status.is-success { color: var(--a-ok); }
.tib-privacy { display: flex; gap: 8px; align-items: flex-start; justify-content: center; margin: 18px auto 0; max-width: 62ch; font-size: .8rem; line-height: 1.5; color: var(--a-muted); text-align: start; }
.tib-privacy .tib-icon { width: 16px; height: 16px; margin-block-start: 1px; color: var(--a-ok); }
.tib-notice { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--a-warn-soft); color: var(--a-warn); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .tib-analyzer *, .tib-results * { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ Report */
.tib-results { text-align: start; margin-block-start: 40px; scroll-margin-top: 90px; outline: none; }
.tib-report { background: var(--a-bg); border: 1px solid var(--a-line); border-radius: calc(var(--a-radius) + 6px); box-shadow: var(--a-shadow); overflow: hidden; animation: tib-rise .35s ease-out; }
@keyframes tib-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tib-report__head { padding: clamp(18px, 3vw, 30px); border-block-end: 1px solid var(--a-line); background: radial-gradient(1200px 200px at 0 0, var(--a-primary-soft), transparent 70%); }
.tib-eyebrow { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--a-primary); }
.tib-report__title { margin: 6px 0 4px; font-size: clamp(1.3rem, 2.4vw, 1.7rem); letter-spacing: -.02em; }
.tib-report__source { margin: 0; color: var(--a-muted); font-family: var(--a-mono); font-size: .85rem; overflow-wrap: anywhere; }
.tib-report__tools { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 16px; }
.tib-sec { padding: clamp(18px, 3vw, 30px); border-block-end: 1px solid var(--a-line); }
.tib-sec h3 { margin: 0 0 14px; font-size: 1.12rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tib-sec h4 { margin: 18px 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--a-muted); }
.tib-sec__tag { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--a-muted); background: var(--a-bg2); border: 1px solid var(--a-line); border-radius: 99px; padding: 3px 9px; }
.tib-muted { color: var(--a-muted); }

.tib-verdict { border-radius: 16px; padding: 18px 20px; border: 1px solid var(--a-line); background: var(--a-bg2); display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: end; }
.tib-verdict__label { grid-column: 1 / -1; margin: 0; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--a-muted); }
.tib-verdict__value { margin: 0; font-size: clamp(1.2rem, 2.6vw, 1.55rem); font-weight: 750; letter-spacing: -.02em; line-height: 1.25; }
.tib-verdict__conf { margin: 0; font-size: .9rem; color: var(--a-muted); white-space: nowrap; }
.tib-verdict__conf strong { color: var(--a-text); }
.tib-verdict--declared, .tib-verdict--multiple { background: var(--a-warn-soft); border-color: color-mix(in srgb, var(--a-warn) 30%, transparent); }
.tib-verdict--declared .tib-verdict__value, .tib-verdict--multiple .tib-verdict__value { color: var(--a-warn); }
.tib-verdict--some { background: color-mix(in srgb, var(--a-warn-soft) 55%, var(--a-bg)); }
.tib-verdict--none { background: var(--a-primary-soft); border-color: color-mix(in srgb, var(--a-primary) 20%, transparent); }
@media (max-width: 560px) { .tib-verdict { grid-template-columns: 1fr; } }

.tib-chips { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tib-chip { border: 1px solid var(--a-line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tib-chip__label { font-size: .75rem; color: var(--a-muted); }
.tib-chip__value { font-weight: 700; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; }
.tib-chip__value::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--a-muted); }
.tib-chip--done .tib-chip__value::before { background: var(--a-ok); }
.tib-chip--warn .tib-chip__value::before { background: var(--a-warn); }
.tib-chip--info .tib-chip__value::before { background: var(--a-primary); }
.tib-chip--off .tib-chip__value { color: var(--a-muted); }
@media (max-width: 720px) { .tib-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tib-counts { margin: 12px 0 0; font-size: .88rem; color: var(--a-muted); }
.tib-why ul, .tib-list { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 8px; line-height: 1.55; }
.tib-disclaimer { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--a-bg2); border-inline-start: 3px solid var(--a-primary); font-size: .85rem; color: var(--a-muted); line-height: 1.5; }

.tib-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px 26px; }
.tib-factgroup h4 { margin-block-start: 4px; }
.tib-facts dl, .tib-prov, .tib-ai dl { margin: 0; }
.tib-fact { display: grid; grid-template-columns: minmax(110px, 42%) 1fr; gap: 12px; padding: 8px 0; border-block-end: 1px dashed var(--a-line); font-size: .9rem; }
.tib-fact:last-child { border-block-end: 0; }
.tib-fact dt { color: var(--a-muted); }
.tib-fact dd { margin: 0; font-weight: 600; font-family: var(--a-mono); font-size: .84rem; overflow-wrap: anywhere; }
.tib-fact dd small { display: block; font-family: inherit; font-weight: 400; color: var(--a-muted); margin-block-start: 2px; font-size: .78rem; }
.tib-fact.is-ai dd { color: var(--a-warn); }

.tib-inds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.tib-ind { border: 1px solid var(--a-line); border-radius: 14px; padding: 14px 16px; background: var(--a-bg); }
.tib-ind--weak { border-color: color-mix(in srgb, var(--a-warn) 25%, var(--a-line)); }
.tib-ind--moderate, .tib-ind--strong { border-color: color-mix(in srgb, var(--a-warn) 45%, var(--a-line)); background: color-mix(in srgb, var(--a-warn-soft) 50%, var(--a-bg)); }
.tib-ind__top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tib-ind__label { font-weight: 700; font-size: .92rem; }
.tib-ind__value { margin: 6px 0 4px; font-family: var(--a-mono); font-size: .82rem; overflow-wrap: anywhere; }
.tib-ind__exp { margin: 0; font-size: .84rem; color: var(--a-muted); line-height: 1.5; }
.tib-weight { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; white-space: nowrap; color: var(--a-muted); }
.tib-weight--weak, .tib-weight--moderate, .tib-weight--strong { color: var(--a-warn); }
.tib-weight--none { color: var(--a-ok); }
.tib-meter { display: inline-flex; gap: 2px; }
.tib-meter i { width: 6px; height: 10px; border-radius: 2px; background: var(--a-bg3); }
.tib-meter i.on { background: currentColor; }
.tib-badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; font-family: inherit; }
.tib-badge--ai { background: var(--a-warn-soft); color: var(--a-warn); }
.tib-evidence { margin: 18px 0 0; }
.tib-evidence img { display: block; width: 100%; max-width: 480px; height: auto; border-radius: 12px; border: 1px solid var(--a-line); image-rendering: auto; background: #0f172a; }
.tib-evidence figcaption { font-size: .82rem; color: var(--a-muted); margin-block-start: 8px; }
.tib-report__foot { padding: 14px clamp(18px, 3vw, 30px); font-size: .78rem; color: var(--a-muted); background: var(--a-bg2); }
.tib-report__foot p { margin: 0; }

/* Pricing (shortcode) */
.tib-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; align-items: stretch; }
.tib-plan { display: flex; flex-direction: column; background: var(--tb-surface, #fff); border: 1px solid var(--tb-line, #e3e6ef); border-radius: 20px; padding: 26px; box-shadow: var(--tb-shadow, none); }
.tib-plan.is-highlight { border-color: var(--tb-primary, #3a5afe); box-shadow: 0 0 0 1px var(--tb-primary, #3a5afe), var(--tb-shadow, none); }
.tib-plan__head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.tib-plan__name { margin: 0; font-size: 1.15rem; }
.tib-badge--soon { background: var(--tb-surface-2, #f6f7fb); color: var(--tb-muted, #5b6478); border: 1px solid var(--tb-line, #e3e6ef); }
.tib-plan__price { margin: 16px 0 6px; }
.tib-plan__amount { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; }
.tib-plan__period { color: var(--tb-muted, #5b6478); }
.tib-plan__tba { font-size: 1.05rem; font-weight: 700; color: var(--tb-muted, #5b6478); }
.tib-plan__desc { color: var(--tb-muted, #5b6478); margin: 0 0 16px; }
.tib-plan__features { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; flex: 1; }
.tib-plan__features li { position: relative; padding-inline-start: 26px; }
.tib-plan__features li::before { content: ""; position: absolute; inset-inline-start: 0; top: .3em; width: 16px; height: 16px; border-radius: 50%; background: var(--tb-primary-soft, #eef1ff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2 7 10.5l4.5-5' fill='none' stroke='%233a5afe' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.tib-plan__cta { width: 100%; }
.tib-limits { border-collapse: collapse; width: 100%; }
.tib-limits th, .tib-limits td { text-align: start; padding: 10px 12px; border-block-end: 1px solid var(--tb-line, #e3e6ef); }

/* Print: only the report. */
@media print {
	body * { visibility: hidden; }
	.tib-results, .tib-results * { visibility: visible; }
	.tib-results { position: absolute; inset-inline-start: 0; top: 0; width: 100%; margin: 0; }
	.tib-report { box-shadow: none; border: 0; }
	.tib-report__tools, [data-tib-run-ai] { display: none !important; }
	.tib-sec { break-inside: avoid; }
	.tib-ind, .tib-fact { break-inside: avoid; }
}
