/* 2026-12-01 (3.15.0) My desk → Bill calculator (billcalc.js). Scoped under .bc and drawn with the dashboard's own tokens (core/dashboard.css:
   cards, the segmented buttons, fields, tables, the hero colours) so the page is UFS's own; light and dark follow. Kanea's four tool colours
   are accents only: the tab underline and dot, and the answer card's left edge. */
.bc { --bc-c: #ffb703; --bc-ink: #7a4f00; }
.bc[data-tool="planner"] { --bc-c: #06b894; --bc-ink: #04634e; }
.bc[data-tool="split"] { --bc-c: #7c5cf0; --bc-ink: #5534cf; }
.bc[data-tool="appliance"] { --bc-c: #ff6b6b; --bc-ink: #a8201f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bc { --bc-ink: #ffd166; }
  :root:not([data-theme="light"]) .bc[data-tool="planner"] { --bc-ink: #5ee3bb; }
  :root:not([data-theme="light"]) .bc[data-tool="split"] { --bc-ink: #c4b8ff; }
  :root:not([data-theme="light"]) .bc[data-tool="appliance"] { --bc-ink: #ffa3a3; }
}
:root[data-theme="dark"] .bc { --bc-ink: #ffd166; }
:root[data-theme="dark"] .bc[data-tool="planner"] { --bc-ink: #5ee3bb; }
:root[data-theme="dark"] .bc[data-tool="split"] { --bc-ink: #c4b8ff; }
:root[data-theme="dark"] .bc[data-tool="appliance"] { --bc-ink: #ffa3a3; }

/* Top management: this page's own ribbon replaces "View only" (dashboard.js showTab sets body.bc-page) */
body.bc-page #uxViewOnly { display: none; }
.bc-ribbon { margin: 10px 0 0; }

.bc-head { margin-bottom: 12px; }
.bc-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 4px; }
.bc-top h2 { font-size: 17px; }
.bc-rates { font-size: 12.5px; font-weight: 600; color: var(--hero-ink); background: var(--hero-bg); border-radius: 99px; padding: 2px 10px; }

/* the four tools: tabs with the tool's colour under the one shown */
.bc-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 14px; overflow-x: auto; scrollbar-width: none; }
.bc-tabs::-webkit-scrollbar { display: none; }
.bc-tabs button { flex: none; display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 600; color: var(--ink-2); background: none; border: 0;
  border-bottom: 3px solid transparent; padding: 9px 14px 8px; cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0; }
.bc-tabs button:hover { color: var(--ink); background: var(--page); }
.bc-tabs button i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.bc-tabs button[data-t="bill"] i { background: #ffb703; }
.bc-tabs button[data-t="planner"] i { background: #06b894; }
.bc-tabs button[data-t="split"] i { background: #7c5cf0; }
.bc-tabs button[data-t="appliance"] i { background: #ff6b6b; }
.bc-tabs button.on { color: var(--ink); border-bottom-color: var(--bc-c); }

/* the form on the left, the answer on the right (stacked on a narrow screen) */
.bc-grid { display: grid; grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.bc-grid > .card { margin: 0; min-width: 0; }
/* the Budget Planner and Share Meter Bill: their lists need the width — the form above, the answer under it */
.bc-grid.bc-stack { grid-template-columns: minmax(0, 1fr); }
.bc-stack .bc-in .bc-fields { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); align-items: start; }
.bc-out { border-left: 4px solid var(--bc-c); }
.bc-h { font-size: 14px; margin: 0 0 10px; }
.bc-out .bc-h { margin-top: 16px; }
.bc-fields { display: grid; gap: 12px; margin: 12px 0; }
.bc-fields.bc-row { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: start; }
.bc-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.bc-f > span, .bc-l { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.bc-f input, .bc-f select { width: 100%; font-size: 15px; padding: 8px 10px; }
.bc-f input[data-k="bill.amount"], .bc-f input[data-k="bill.kwh"] { font-size: 20px; font-weight: 700; }
.bc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bc-hint { display: block; font-size: 12.5px; color: var(--muted); margin: 2px 0 0; line-height: 1.4; }
.bc-seg { width: max-content; max-width: 100%; }
.bc-seg button { padding: 7px 13px; }
.bc-reset { margin-top: 2px; }
.bc-addrow { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 10px 0 4px; }

/* the editable lists (appliances, households) */
.bc-edit td { padding: 4px 4px; vertical-align: middle; }
.bc-edit th { padding: 6px 4px; font-size: 12px; }
.bc-edit table { width: auto; min-width: 100%; }
.bc-edit input, .bc-edit select { width: 100%; min-width: 64px; padding: 5px 7px; font-size: 13px; }
.bc-edit input[type="number"] { max-width: 110px; }
.bc-edit td:first-child input { min-width: 150px; }
.bc-edit td:last-child { width: 1%; }

/* the answer: the hero colours of the dashboard's tiles */
.bc-ans { background: var(--hero-bg); color: var(--hero-ink); border-radius: 12px; padding: 14px 16px; }
.bc-ans-l { font-size: 13px; font-weight: 600; }
.bc-ans-v { font-size: 34px; font-weight: 800; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; margin: 2px 0; }
.bc-ans-v small { font-size: 18px; font-weight: 700; color: var(--hero-ink); }
.bc-ans-d { font-size: 13.5px; }
.bc-ans-d.bad { color: var(--crit); font-weight: 600; }
.bc-line { margin: 10px 0 0; font-size: 13.5px; }
.bc-note { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin: 10px 0 0; font-size: 13.5px; background: var(--surface); }
.bc-note.info { background: #e8f1ff; color: #1849a9; border-color: #b2ccff; }
.bc-note.ok { background: var(--green-bg); color: var(--good-ink); border-color: #abefc6; }
.bc-note.warn { background: #fffaeb; color: #93370d; border-color: #fec84b; }
.bc-note.bad { background: var(--red-bg); color: var(--crit); border-color: #fecdca; }
.bc-note-b { margin-top: 8px; }
.bc-head .bc-note { margin-top: 10px; }
.bc-receipt td .sub, .bc-out td .sub { font-size: 12px; }
.bc-out tr.bc-sub td { font-weight: 600; background: var(--page); }
.bc-out table td.n { white-space: nowrap; }
.bc-foot { margin: 12px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bc-est { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }
.bc-say { border: 1px dashed var(--axis); border-radius: 10px; padding: 10px 12px; background: var(--surface); font-size: 13.5px; line-height: 1.55; }
.bc-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.bc-acts[hidden] { display: none; }
.bc-said { flex-basis: 100%; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bc-note.info { background: #102a56; color: #9ec5ff; border-color: #1d4487; }
  :root:not([data-theme="light"]) .bc-note.ok { background: #0c2a17; color: #75e0a7; border-color: #135c2e; }
  :root:not([data-theme="light"]) .bc-note.warn { background: #33270f; color: #fec84b; border-color: #6a4a10; }
  :root:not([data-theme="light"]) .bc-note.bad { background: #3a1513; color: #fda29b; border-color: #7a271a; }
}
:root[data-theme="dark"] .bc-note.info { background: #102a56; color: #9ec5ff; border-color: #1d4487; }
:root[data-theme="dark"] .bc-note.ok { background: #0c2a17; color: #75e0a7; border-color: #135c2e; }
:root[data-theme="dark"] .bc-note.warn { background: #33270f; color: #fec84b; border-color: #6a4a10; }
:root[data-theme="dark"] .bc-note.bad { background: #3a1513; color: #fda29b; border-color: #7a271a; }

@media (max-width: 1100px) { .bc-grid { grid-template-columns: 1fr; } }
/* 2026-12-01: the big answer repeated at the top of "Know the Unit you buy" on a phone-width screen (billcalc.js fills #bcStrip) */
.bc-strip { display: none; }
.bc-strip:empty { display: none !important; }
@media (max-width: 520px) {
  /* not sticky: stuck to the top it would sit over the full card's own answer and receipt further down */
  .bc-strip { display: block; border-left: 4px solid var(--bc-c); border-radius: 12px; }
  .bc-strip .bc-ans, .bc-strip .bc-note { margin: 0; padding: 10px 14px; }
  .bc-ans-v { font-size: 28px; }
  /* the four tools as two rows of two, so none is out of sight */
  .bc-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 4px; overflow: visible; }
  .bc-tabs button { padding: 8px 6px; font-size: 13px; white-space: normal; text-align: left; line-height: 1.25; }
  .bc-seg { width: 100%; }
  .bc-seg button { flex: 1 1 auto; padding: 7px 8px; }
  .bc-two { grid-template-columns: 1fr 1fr; }
}

/* the print slip: drawn under <body> (#bcPrint) and printed alone */
.bc-slip { display: none; }
@media print {
  body.bc-print > *:not(#bcPrint) { display: none !important; }
  body.bc-print #bcPrint { display: block; color: #000; background: #fff; font-size: 12px; padding: 0; }
  #bcPrint h1 { font-size: 18px; margin: 0 0 2px; }
  #bcPrint .bc-slip-sub { margin: 0 0 10px; color: #444; }
  #bcPrint table { width: 100%; border-collapse: collapse; margin: 8px 0; }
  #bcPrint th, #bcPrint td { border-bottom: 1px solid #ccc; padding: 4px 6px; text-align: left; color: #000; }
  #bcPrint td.n, #bcPrint th.n { text-align: right; }
  #bcPrint .sub { color: #444; font-size: 11px; }
  #bcPrint .kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0; }
  #bcPrint .kv dd { margin: 0; }
  #bcPrint .bc-foot { font-weight: 700; }
}
