/* MaliBills money calculators (2026-10-11, Phase 1). Same Merpy look as the
   buffet page: 2px ink outlines, hard 0 4px 0 shadows, pastel icon tiles.
   Inputs left, a sticky result card right on wide screens; one column on
   phones (checked at 360px). Uses the ui-kit.css tokens only. */
.cc-page { max-width: 1080px; margin: 0 auto; padding: 8px 16px 72px; }
.cc-grid { display: grid; gap: 18px; align-items: start; }
@media (min-width: 900px) {
  .cc-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); }
  .cc-side { position: sticky; top: calc(var(--nav-h, 76px) + 16px); }
}
.cc-col { display: grid; gap: 18px; min-width: 0; }
.cc-wide { margin-top: 18px; display: grid; gap: 18px; min-width: 0; }

.cc-card { background: var(--surface); border: 2px solid var(--edge, #2b1a12); border-radius: 20px; box-shadow: 0 4px 0 var(--ink-sh, var(--ink, #2b1a12)); overflow: hidden; min-width: 0; }
.cc-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--surface-soft, #ffe8cf); border-bottom: 2px solid var(--edge, #2b1a12); }
.cc-head h2 { margin: 0; flex: 1; font-size: 16.5px; font-weight: 800; line-height: 1.3; }
.cc-ic { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 2px solid var(--edge, #2b1a12); border-radius: 12px; background: var(--t0); }
.cc-ic img { width: 24px; height: 24px; }
.cc-ic.t1 { background: var(--t1); } .cc-ic.t2 { background: var(--t2); } .cc-ic.t3 { background: var(--t3); } .cc-ic.t4 { background: var(--t4); } .cc-ic.t5 { background: var(--t5); }
.cc-body { padding: 16px 18px 18px; display: grid; gap: 14px; min-width: 0; }

/* fields */
.cc-fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.cc-field { display: grid; gap: 6px; font-size: 13px; font-weight: 800; color: var(--muted, #8b6b5a); min-width: 0; align-content: start; }
.cc-field small { font-weight: 600; font-size: 12px; line-height: 1.4; }
.cc-in { position: relative; display: flex; align-items: center; }
.cc-in input, .cc-field select {
  width: 100%; box-sizing: border-box; min-height: 46px; padding: 10px 12px; font: 600 16px/1.3 var(--font-body);
  color: var(--text); background: var(--bg); border: 2px solid var(--line-strong, rgba(43,26,18,.32)); border-radius: 12px; min-width: 0;
  font-variant-numeric: tabular-nums;
}
.cc-in input { padding-right: 58px; }
.cc-in span { position: absolute; right: 12px; font-size: 13px; font-weight: 700; color: var(--muted); pointer-events: none; }
.cc-in input:focus, .cc-field select:focus { outline: none; border-color: var(--app, #ffc21a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--app, #ffc21a) 35%, transparent); }
.cc-check { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--text); cursor: pointer; }
.cc-check input { width: 22px; height: 22px; accent-color: var(--accent, #ff4b2b); flex: none; }
.cc-sub { margin: 4px 0 0; font-size: 14px; font-weight: 800; color: var(--text); }
.cc-sub + .cc-fields { margin-top: -4px; }

/* segmented switch */
.cc-seg { display: inline-flex; border: 2px solid var(--edge, #2b1a12); border-radius: 12px; overflow: hidden; justify-self: start; max-width: 100%; }
.cc-seg button { min-height: 40px; border: 0; background: var(--surface); color: var(--text); font: 800 14px/1.2 var(--font-body); cursor: pointer; box-shadow: none; padding: 6px 14px; }
.cc-seg button + button { border-left: 2px solid var(--edge, #2b1a12); }
.cc-seg button[aria-pressed="true"] { background: var(--app, #ffc21a); color: var(--app-ink, #2b1a12); }
.cc-seg button:focus-visible { outline: 3px solid color-mix(in srgb, var(--app, #ffc21a) 55%, transparent); outline-offset: -3px; }

/* results */
.cc-big { display: grid; gap: 2px; padding: 14px 16px; border: 2px solid var(--edge, #2b1a12); border-radius: 16px; background: var(--app-soft, #fff1c2); }
.cc-big span { font-size: 13px; font-weight: 800; color: var(--muted); }
.cc-big b { font-size: 28px; font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.cc-big small { font-size: 13px; font-weight: 700; color: var(--muted); }
.cc-rows { display: grid; gap: 8px; }
.cc-rows div { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; color: var(--muted); font-weight: 600; }
.cc-rows div span:last-child { font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }
.cc-rows div.total { padding-top: 10px; border-top: 2px dashed var(--line-strong); font-weight: 800; color: var(--text); }
.cc-msg { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--muted); line-height: 1.5; }
.cc-msg:empty { display: none; }
.cc-msg.bad { color: var(--accent, #ff4b2b); }
.cc-msg.good { color: #1f8a4c; }

/* side by side (installment, refinance) */
.cc-vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cc-vs > div { display: grid; gap: 6px; padding: 12px; border: 2px solid var(--edge, #2b1a12); border-radius: 14px; background: var(--bg); min-width: 0; align-content: start; }
.cc-vs h3 { margin: 0; font-size: 14px; font-weight: 900; }
.cc-vs p { margin: 0; display: grid; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cc-vs p b { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cc-vs > div.win { background: var(--app-soft, #fff1c2); }

/* tables */
.cc-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }
.cc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.cc-table th, .cc-table td { padding: 8px 6px; text-align: right; white-space: nowrap; border-bottom: 1px dashed var(--line-strong); }
.cc-table th:first-child, .cc-table td:first-child { text-align: left; }
.cc-table thead th { font-size: 12px; font-weight: 800; color: var(--muted); border-bottom: 2px solid var(--edge, #2b1a12); }
.cc-table tfoot td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--edge, #2b1a12); }
.cc-table tr.hit td { background: var(--app-soft, #fff1c2); font-weight: 800; }
details.cc-more > summary { cursor: pointer; font-weight: 800; font-size: 14.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.cc-more > summary::-webkit-details-marker { display: none; }
details.cc-more > summary::before { content: "›"; display: inline-block; font-size: 20px; line-height: 1; transition: transform .2s; }
details.cc-more[open] > summary::before { transform: rotate(90deg); }
details.cc-more > summary + * { margin-top: 12px; }

/* notes */
.cc-note { padding: 14px 16px; border: 2px dashed var(--line-strong); border-radius: 16px; background: var(--bg); font-size: 14.5px; line-height: 1.65; }
.cc-note p { margin: 0; } .cc-note p + p { margin-top: 8px; }
.cc-note h3 { margin: 0 0 6px; font-size: 15px; font-weight: 900; }
.cc-warn { margin: 0; padding: 10px 12px; border: 2px solid var(--edge, #2b1a12); border-radius: 12px; background: var(--t5, #fff0b3); font-size: 13px; font-weight: 700; line-height: 1.5; }
.cc-warn a { color: inherit; }
.cc-disclaimer { margin: 22px auto 0; max-width: 60ch; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.5; }
.cc-src { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.5; }
.cc-src a { color: inherit; overflow-wrap: anywhere; }

/* the hub */
.cc-tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cc-tool { display: flex; gap: 14px; align-items: flex-start; height: 100%; box-sizing: border-box; padding: 16px; color: var(--text); text-decoration: none;
  background: var(--surface); border: 2px solid var(--edge, #2b1a12); border-radius: 20px; box-shadow: 0 4px 0 var(--ink-sh, var(--ink, #2b1a12)); transition: transform .14s, box-shadow .14s; }
.cc-tool:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink-sh, var(--ink, #2b1a12)); }
.cc-tool:active { transform: translateY(4px); box-shadow: none; }
.cc-tool .cc-ic { width: 52px; height: 52px; border-radius: 14px; }
.cc-tool .cc-ic img { width: 32px; height: 32px; }
.cc-tool b { display: block; font-size: 17px; font-weight: 900; line-height: 1.3; }
.cc-tool small { display: block; margin-top: 4px; font-size: 13.5px; font-weight: 600; color: var(--muted); line-height: 1.5; }
.cc-mali { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 12px 16px; border: 2px solid var(--edge, #2b1a12); border-radius: 18px; background: var(--app-soft, #fff1c2); font-size: 14.5px; font-weight: 700; line-height: 1.55; }
.cc-mali img { width: 72px; height: 72px; flex: none; }

/* a small "the number changed" cue; none when motion is reduced */
@keyframes cc-pop { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
.cc-pop { animation: cc-pop .22s cubic-bezier(.22,1,.36,1); }
@media (prefers-reduced-motion: reduce) {
  .cc-pop { animation: none; }
  .cc-tool, details.cc-more > summary::before { transition: none; }
}
@media (max-width: 700px) {
  .cc-page { padding-bottom: 110px; }
  .cc-body { padding: 14px 14px 16px; }
  .cc-table-wrap { margin: 0 -14px; padding: 0 14px; }
  .cc-big b { font-size: 25px; }
}
@media (max-width: 380px) {
  .cc-head { padding: 10px 14px; }
  .cc-vs { gap: 8px; }
  .cc-vs > div { padding: 10px; }
  .cc-vs p b { font-size: 15.5px; }
}

/* phones: a small floating pill with the main result while the result card
   is off screen (CalcUI.peek); tapping it scrolls to the result */
.cc-peek { display: none; }
@media (max-width: 899px) {
  .cc-peek { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 40; transform: translateX(-50%);
    display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 9px 16px;
    border: 2px solid var(--edge, #2b1a12); border-radius: 999px; background: var(--app, #ffc21a); color: var(--app-ink, #2b1a12);
    font: 800 14px/1.2 var(--font-body); box-shadow: 0 3px 0 var(--ink-sh, var(--ink, #2b1a12)); cursor: pointer; white-space: nowrap;
    transition: opacity .2s, transform .2s; }
  .cc-peek b { font-size: 16px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
  .cc-peek.off { opacity: 0; pointer-events: none; transform: translate(-50%, 12px); }
}
@media (max-width: 899px) and (prefers-reduced-motion: reduce) { .cc-peek { transition: none; } }

/* [hidden] must win over the display rules above */
.cc-page [hidden] { display: none !important; }
.cc-cap { caption-side: top; text-align: right; padding: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
