/* Insight card: the standard design for question-based calculators on Moni Calculator Pro.
   One set of tokens drives light and dark mode. Calculator pages load this file and nothing else for the insight. */

:root {
  --ins-surface: #ffffff;
  --ins-surface-muted: #f6f8fa;
  --ins-border: #dbe3ea;
  --ins-border-strong: #cbd5e1;
  --ins-text: #000000;
  --ins-text-muted: #334155;
  --ins-accent: #078c49;
  --ins-accent-soft: #e9f9ef;
  --ins-accent-border: #bfe3cf;
  --ins-value-bg: #fbf3e6;
  --ins-value-border: #d9a05b;
  --ins-value-hover: #f5e6cc;
  --ins-focus: #bbf7d0;
  --ins-warn-bg: #fff7ed;
  --ins-warn-border: #fed7aa;
  --ins-radius: 16px;
  --ins-radius-sm: 12px;
  --ins-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
html.dark {
  --ins-surface: #141418;
  --ins-surface-muted: #1d1d24;
  --ins-border: #2a2a33;
  --ins-border-strong: #4a4a56;
  --ins-text: #f4f4ef;
  --ins-text-muted: #c4c9d1;
  --ins-accent: #7fe0a0;
  --ins-accent-soft: #15382a;
  --ins-accent-border: #2e5c44;
  --ins-value-bg: #2a2418;
  --ins-value-border: #d9a05b;
  --ins-value-hover: #352d1d;
  --ins-focus: #15382a;
  --ins-warn-bg: #2a1d10;
  --ins-warn-border: #6b4a1e;
  --ins-shadow: none;
}

/* Card and sentence */
.ins-panel { margin: 22px 0 8px; padding: 26px 28px; border: 1px solid var(--ins-border); border-radius: var(--ins-radius); background: var(--ins-surface); color: var(--ins-text); box-shadow: var(--ins-shadow); }
.ins-kicker { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ins-accent); }
.ins-sentence { margin: 0 0 16px; max-width: 46ch; font-size: clamp(24px, 3.2vw, 32px); font-weight: 700; line-height: 1.5; color: var(--ins-text); }
.ins-example-note { margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--ins-text); }
.ins-var { display: inline-block; margin: 0 3px; padding: 1px 9px 2px; border: 0; border-bottom: 2px solid var(--ins-value-border); border-radius: 4px 4px 0 0; background: var(--ins-value-bg); color: var(--ins-text); font: inherit; font-weight: 700; cursor: pointer; transition: background-color 160ms ease; }
.ins-var:hover { background: var(--ins-value-hover); }
.ins-var:focus-visible, .ins-lever:focus-visible, .ins-undo:focus-visible, .ins-form-summary:focus-visible, .ins-chip:focus-visible, .ins-done:focus-visible { outline: 3px solid var(--ins-focus); outline-offset: 2px; }

/* Layout: result and levers side by side on desktop, stacked on phones */
.ins-grid { display: grid; gap: 24px; align-items: start; }
@media (min-width: 900px) { .ins-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }

/* Result */
.ins-hero { position: relative; display: grid; gap: 4px; padding: 18px 20px 18px 24px; border: 1px solid var(--ins-accent-border); border-radius: var(--ins-radius-sm); background: var(--ins-accent-soft); overflow: hidden; }
.ins-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ins-accent); }
.ins-hero-label { font-size: 13px; font-weight: 700; color: var(--ins-text); }
.ins-hero-value { font-size: clamp(30px, 4vw, 40px); font-weight: 800; line-height: 1.1; color: var(--ins-accent); font-variant-numeric: tabular-nums; }
.ins-hero-sub { font-size: 13px; color: var(--ins-text-muted); }
.ins-panel.is-example .ins-hero { border-style: dashed; background: var(--ins-surface-muted); }
.ins-panel.is-example .ins-hero::before { background: var(--ins-border-strong); }

/* Working and meaning */
.ins-h { margin: 24px 0 8px; font-size: 17px; font-weight: 800; letter-spacing: normal; text-transform: none; color: var(--ins-text); }
.ins-why { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.7; color: var(--ins-text); }
.ins-why li { margin-bottom: 4px; font-family: ui-monospace, Menlo, monospace; }
.ins-meaning { margin: 0; font-size: 15px; line-height: 1.65; color: var(--ins-text); }

/* Levers: each one is a card with an arrow */
.ins-levers { display: grid; gap: 8px; }
.ins-lever { position: relative; display: grid; gap: 2px; padding: 14px 44px 14px 16px; text-align: left; border: 1px solid var(--ins-border-strong); border-radius: var(--ins-radius-sm); background: var(--ins-surface); color: var(--ins-text); font: inherit; cursor: pointer; transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease; }
.ins-lever:hover { border-color: var(--ins-accent); background: var(--ins-surface-muted); transform: translateY(-1px); }
.ins-lever::after { content: "→"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 18px; font-weight: 700; color: var(--ins-accent); }
.ins-lever:hover::after { transform: translate(3px, -50%); }
.ins-lever-title { font-weight: 700; color: var(--ins-text); }
.ins-lever-detail { font-size: 14px; color: var(--ins-text-muted); }
.ins-error { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--ins-warn-border); border-radius: 10px; background: var(--ins-warn-bg); color: var(--ins-text); }
.ins-undo { margin-top: 12px; height: 40px; padding: 0 14px; border: 1px solid var(--ins-border-strong); border-radius: 10px; background: var(--ins-surface); color: var(--ins-text); font: inherit; font-weight: 700; cursor: pointer; }
.ins-undo:hover { background: var(--ins-surface-muted); }
.ins-form-note { margin: 20px 0 0; font-size: 14px; color: var(--ins-text); }
.ins-form-note a { color: var(--ins-accent); font-weight: 700; }
.ins-form-details { margin: 8px 0 0; }
.ins-form-summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 800; color: var(--ins-text); }

/* Variable editor: bottom sheet on phones, centred on desktop. Native modal dialog for focus and Escape. */
dialog.ins-editor { position: fixed; inset: auto 0 0 0; margin: 0; width: min(100vw, 560px); max-width: 100vw; max-height: 60vh; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--ins-border-strong); border-bottom: 0; border-radius: 18px 18px 0 0; background: var(--ins-surface); color: var(--ins-text); }
dialog.ins-editor[open] { animation: ins-sheet-up 240ms cubic-bezier(.22, 1, .36, 1); }
dialog.ins-editor::backdrop { background: rgba(15, 23, 42, .35); }
html.dark dialog.ins-editor::backdrop { background: rgba(0, 0, 0, .6); }
.ins-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ins-editor-title { margin: 0; font-size: 17px; font-weight: 800; color: var(--ins-text); }
.ins-editor-row { display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 12px; border: 1px solid var(--ins-border-strong); border-radius: 10px; background: var(--ins-surface); }
.ins-editor-row:focus-within { border-color: var(--ins-accent); box-shadow: 0 0 0 3px var(--ins-focus); }
.ins-editor-row input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 20px; font-weight: 700; color: var(--ins-text); }
.ins-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ins-chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--ins-border-strong); border-radius: 999px; background: var(--ins-surface); color: var(--ins-text); font: inherit; font-weight: 700; cursor: pointer; }
.ins-chip:hover { border-color: var(--ins-accent); }
.ins-done { min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--ins-accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
html.dark .ins-done { color: #0b0b0d; }
@media (min-width: 900px) {
  dialog.ins-editor { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(92vw, 420px); max-height: 80vh; border: 1px solid var(--ins-border-strong); border-radius: 16px; padding: 20px; }
  dialog.ins-editor[open] { animation: ins-fade-in 180ms ease-out; }
}
@keyframes ins-sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes ins-fade-in { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@media (prefers-reduced-motion: reduce) { dialog.ins-editor[open], .ins-lever, .ins-var { animation: none; transition: none; } }

/* Headings in the card share one size: section headings, lever titles and the result label. */
.ins-h, .ins-lever-title, .ins-hero-label { font-size: 17px; font-weight: 800; }

/* What-if scenarios: one standard card on every calculator. */
.whatif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.whatif-row { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--ins-border-strong); border-radius: var(--ins-radius-sm); background: var(--ins-surface); color: var(--ins-text); }
.whatif-title { font-size: 15px; font-weight: 800; color: var(--ins-text); }
.whatif-detail { font-size: 14px; line-height: 1.5; color: var(--ins-text-muted); }
.whatif-empty { margin: 0; font-size: 14px; color: var(--ins-text-muted); }

/* All-inputs rows under the question: each input is editable without the classic form. */
.qv-rows { display: grid; gap: 6px; margin-top: 22px; }
.qv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--ins-border); border-radius: var(--ins-radius-sm); background: var(--ins-surface); }
.qv-row-label { font-size: 14px; color: var(--ins-text-muted); }
.qv-row-value { min-height: 36px; padding: 0 12px; border: 1px solid var(--ins-border-strong); border-radius: 10px; background: var(--ins-surface-muted); color: var(--ins-text); font: inherit; font-weight: 700; cursor: pointer; }
.qv-row-value:hover { border-color: var(--ins-accent); }
.qv-row-value:focus-visible { outline: 3px solid var(--ins-focus); outline-offset: 2px; }
.ins-editor-field, .ins-select { width: 100%; min-height: 48px; padding: 0 12px; border: 1px solid var(--ins-border-strong); border-radius: 10px; background: var(--ins-surface); color: var(--ins-text); font: inherit; font-size: 18px; font-weight: 700; }
#qvEditorBody { margin: 6px 0 0; }

/* What-if rows: an editable value box inside each scenario. */
.whatif-box { width: 9ch; margin: 0 4px; padding: 2px 8px; border: 0; border-bottom: 2px solid var(--ins-value-border); border-radius: 4px 4px 0 0; background: var(--ins-value-bg); color: var(--ins-text); font: inherit; font-weight: 700; }
.whatif-box:focus-visible { outline: 3px solid var(--ins-focus); outline-offset: 2px; }
.whatif-title { display: block; font-size: 15px; font-weight: 700; color: var(--ins-text); }

/* What if section: plain sentence-style rows. Overrides the site's form-field styles inside this section only. */
html body #whatIf .whatif-row { display: grid; gap: 4px; padding: 14px 16px; }
html body #whatIf .whatif-title { display: block; font-size: 15px !important; font-weight: 700 !important; letter-spacing: normal !important; text-transform: none !important; color: var(--ins-text) !important; margin: 0; }
html body #whatIf input.whatif-box { display: inline-block !important; width: 9ch !important; min-width: 0 !important; height: auto !important; max-width: 100%; margin: 0 6px !important; padding: 2px 8px 3px !important; border: 0 !important; border-bottom: 2px solid var(--ins-value-border) !important; border-radius: 4px 4px 0 0 !important; background: var(--ins-value-bg) !important; color: var(--ins-text) !important; font: inherit !important; font-size: 16px !important; font-weight: 700 !important; letter-spacing: normal !important; text-transform: none !important; box-shadow: none !important; vertical-align: baseline; }
html body #whatIf .whatif-detail { font-size: 14px !important; color: var(--ins-text-muted) !important; letter-spacing: normal !important; text-transform: none !important; }

/* Dark mode: the reference design (Clarity OS). Light mode is unchanged. */
html.dark {
  --ins-surface: #151815;
  --ins-surface-muted: #1C201C;
  --ins-border: #262B26;
  --ins-border-strong: #313731;
  --ins-text: #F3F2EE;
  --ins-text-muted: #A3A8A2;
  --ins-accent: #6EE7B7;
  --ins-accent-soft: #173524;
  --ins-accent-border: #234D35;
  --ins-value-bg: #262118;
  --ins-value-border: #D9A05B;
  --ins-value-hover: #30291D;
  --ins-focus: #234D35;
  --ins-warn-bg: #2a1d10;
  --ins-warn-border: #6b4a1e;
  --ins-shadow: none;
}
html.dark .ins-panel { background: #111411; }
html.dark .ins-sentence, html.dark #qvSentence { color: #F3F2EE; }
html.dark .ins-hero-value { color: #6EE7B7; }
html.dark .ins-hero-label, html.dark .ins-hero-sub { color: #9AC7B0; }
html.dark .ins-hero { background: #173524; border-color: #234D35; }
html.dark .ins-why, html.dark .ins-why li { color: #E2E5E1; }
html.dark .ins-h { color: #737b73; font-size: 10.5px !important; letter-spacing: .11em; text-transform: uppercase; font-weight: 600 !important; }
html.dark .ins-var { color: #F7F3EA; }
html.dark .ins-lever { background: #151815; border-color: #262B26; }
html.dark .ins-lever:hover { background: #1C201C; border-color: #D9A05B; }
html.dark .ins-lever-title { color: #EFECE6; }
html.dark .ins-lever-detail { color: #8A908A; }
html.dark .ins-undo { background: #151815; border-color: #313731; color: #D9A05B; }

/* Answer hero: plain, no coloured box or side bar. The number keeps its colour. */
.ins-hero, .ins-panel.is-example .ins-hero, html.dark .ins-hero { background: transparent !important; border: 0 !important; padding: 4px 0 !important; box-shadow: none !important; }
.ins-hero::before { display: none !important; }

/* A value and the punctuation after it stay together, so a question mark never drops onto its own line. */
.ins-sentence .ins-nowrap { white-space: nowrap; }
