/**
 * @file        sg-costs.css
 * @description Styles of the costs module: expense list, quick expense, editor, budget bars, summary tables, SVG charts, converter, public cost summary (X4-01 to X4-20, D4-04, D4-06)
 *
 * @author      Thomas Dobler - SYNTHETIXMIND LTD
 * @company     SYNTHETIXMIND LTD, Paphos, Cyprus
 * @url         https://synthetixmind.com
 *
 * @uid         1c336976-0aa8-4a3a-ac44-74c6141a0440
 * @version     0.1.1.2
 * @created     2026-12-01
 * @updated     2026-12-03
 *
 * @copyright   (c) 2026 by SYNTHETIXMIND LTD
 * @license     Proprietary — All rights reserved
 */

/* Mobile first (360 px): one column, nothing wider than the screen; amounts in IBM Plex Mono never wrap inside a figure. */
.sg-costs-amount, .sg-costs-num, .sg-costs-codes { font-family: var(--font-mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sg-costs-amount--home { color: var(--ink-muted); font-size: 0.9em; }
.sg-costs-codes { white-space: normal; word-break: break-word; }
.sg-costs-num { text-align: right; }
.sg-costs-warn { color: var(--warm-ink); font-weight: 600; }

.sg-costs-tabs { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 16px; border-bottom: 1px solid var(--border); }
.sg-costs-tabs a { padding: 8px 0; min-height: 44px; display: inline-flex; align-items: center; color: var(--ink-muted); text-decoration: none; }
.sg-costs-tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }

.sg-costs-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sg-costs-toast { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
/* X4-04 filter bar: search first, the four filters and Apply; one column at 360 px. */
.sg-costs-filters { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); margin: 0 0 12px; max-width: 100%; }
.sg-costs-filters select, .sg-costs-filters input { width: 100%; max-width: 100%; min-height: 44px; }
.sg-costs-active { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 0 0 12px; }
.sg-costs-active a { min-height: 44px; display: inline-flex; align-items: center; }

.sg-costs-total { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.sg-costs-day__date { font-size: 1rem; margin: 20px 0 8px; color: var(--ink-muted); }
.sg-costs-list { list-style: none; margin: 0; padding: 0; }
.sg-costs-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sg-costs-item__icon svg { width: 24px; height: 24px; }
.sg-costs-item__body p { margin: 0; }
.sg-costs-item__title { font-weight: 600; overflow-wrap: anywhere; }
.sg-costs-item__amount { grid-column: 2; margin: 0; text-align: left; }
.sg-costs-item--excluded .sg-costs-item__amount { color: var(--ink-muted); text-decoration: line-through; }

.sg-costs-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0 0 12px; }
.sg-costs-figures div { min-width: 0; }
.sg-costs-figures dt { color: var(--ink-muted); font-size: 0.9rem; }
.sg-costs-figures dd { margin: 0; font-size: 1.15rem; }
.sg-costs-figures--big dd { font-size: 1.4rem; }
/* X4-11 budget bar as SVG (no style attributes under the CSP): track, fill, 80 % alert line. */
.sg-costs-budget__pct { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: 8px 0 4px; font-size: 0.9rem; }
.sg-costs-budgetbar__track { fill: var(--border); }
.sg-costs-budgetbar__fill { fill: var(--ink-muted); }
.sg-costs-budgetbar__mark { fill: var(--ink); }
.sg-costs-budget--warn .sg-costs-budgetbar__fill { fill: var(--accent); }
.sg-costs-budget--over .sg-costs-budgetbar__fill { fill: var(--warm-ink); }
.sg-costs-alert { margin: 8px 0 0; font-weight: 600; color: var(--accent); }
.sg-costs-alert--over { color: var(--warm-ink); }
.sg-costs-budget-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.sg-costs-budget-list h3 { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.sg-costs-budget-form { display: grid; gap: 4px; max-width: 420px; }

.sg-costs-table caption { text-align: left; font-family: var(--font-head); font-weight: 600; padding: 8px 0; }
.sg-costs-chart { margin: 0 0 24px; max-width: 100%; }
.sg-costs-chart figcaption { font-family: var(--font-head); font-weight: 600; margin: 0 0 8px; }
.sg-costs-svg { display: block; width: 100%; max-width: 100%; overflow: visible; }
.sg-costs-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sg-costs-barrow__label { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 2px; overflow-wrap: anywhere; }
.sg-costs-svg--cols { height: 160px; border-bottom: 1px solid var(--border); }
.sg-costs-svg__bar, .sg-costs-svg__col { fill: var(--ink-muted); }
.sg-costs-svg__label { fill: var(--ink); font: 400 12px var(--font-body); }
.sg-costs-chart__axis { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; }
.sg-costs-chart__table summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

.sg-costs-quick__amount { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.sg-costs-quick__amount label:first-child { flex-basis: 100%; }
.sg-costs-quick__input { flex: 1 1 140px; min-width: 0; font-size: 1.6rem; }
.sg-costs-chipselect { flex: 0 0 auto; min-height: 48px; border-radius: 999px; font-family: var(--font-mono); }
.sg-costs-cats { border: 0; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sg-costs-cats legend { margin-bottom: 8px; }
.sg-costs-cat { position: relative; }
.sg-costs-cat input { position: absolute; opacity: 0; }
.sg-costs-cat span { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 64px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); text-align: center; overflow-wrap: anywhere; cursor: pointer; }
.sg-costs-cat svg { width: 22px; height: 22px; }
.sg-costs-cat input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.sg-costs-cat input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.sg-costs-quick__line { font-size: 0.9rem; }

.sg-costs-editor__money { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 7rem); gap: 0 12px; }
.sg-costs-place, .sg-costs-spread, .sg-costs-refund { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin: 16px 0; min-width: 0; }
.sg-costs-spread__range { display: grid; grid-template-columns: 1fr; gap: 4px; margin: 4px 0 8px 28px; }
.sg-costs-more { margin: 8px 0 16px; }
.sg-costs-more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.sg-costs-hist__diff { margin: 0 0 8px; padding-left: 18px; font-size: 0.9rem; color: var(--ink-muted); overflow-wrap: anywhere; }

.sg-costs-conv__pair { display: grid; grid-template-columns: 1fr; gap: 8px; align-items: end; margin: 8px 0; }
.sg-costs-conv__result { font-size: 1.8rem; margin: 16px 0 4px; }
.sg-costs-owncat__form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sg-costs-owncat__form input[type="text"] { flex: 1 1 160px; min-width: 0; }
.sg-costs-catadd { display: grid; gap: 4px; max-width: 420px; margin-top: 16px; }
.sg-costs-defaults ul { margin: 4px 0 8px; padding-left: 28px; }
.sg-costs-admincat { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sg-costs-admincat input[name="sort_order"] { width: 6rem; }
.sg-costs-years { flex-wrap: wrap; }
.sg-costs-entry { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.sg-costs-public { margin: 24px 0; }
.sg-costs-preview { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px; }

/* Phase 4 mockup pass (2026-12-03): head rows, sheets with a close link, the conversion box, option cards, status cards. */
.sg-costs-head__row, .sg-costs-sheet__head, .sg-costs-section-head, .sg-costs-expenses__head, .sg-costs-day__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; min-width: 0; }
.sg-costs-head__title { min-width: 0; overflow-wrap: anywhere; }
.sg-costs-head__title h1, .sg-costs-sheet__head h1 { margin: 0; }
.sg-costs-head__title p { margin: 4px 0 0; }
.sg-costs-close { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.sg-costs-section-head h2, .sg-costs-expenses__head h2 { margin: 0; }
.sg-costs-expenses__head .sg-costs-total { border: 0; padding: 0; }
.sg-costs-day__head { margin: 20px 0 8px; }
.sg-costs-day__head .sg-costs-day__date { margin: 0; }
.sg-costs-day__head p { margin: 0; font-family: var(--font-mono); font-size: 0.9rem; }
.sg-costs-item__side { grid-column: 2; display: flex; align-items: center; gap: 8px; }
.sg-costs-avatar { flex: none; width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--beige); color: var(--mahogany); font-size: 0.75rem; font-weight: 600; }
.sg-costs-quick__amount { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.sg-costs-quick__amount--error { border-color: var(--warm-ink); }
.sg-costs-convbox { margin: 0 0 16px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sg-costs-convbox__label { margin: 0; color: var(--ink-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.sg-costs-convbox__amount { margin: 2px 0; font-size: 1.3rem; }
.sg-costs-convbox .sg-costs-rate { margin: 0; overflow-wrap: anywhere; }
.sg-costs-editor__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.sg-costs-options, .sg-costs-links { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin: 16px 0; min-width: 0; }
.sg-costs-options .sg-costs-spread, .sg-costs-options .sg-costs-refund { margin: 0 0 12px; }
.sg-costs-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.sg-costs-footer .sg-actions { margin: 0; }
.sg-costs-footer__delete { order: -1; min-height: 44px; color: var(--warm-ink); }
.sg-costs-figures--strip { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sg-costs-years fieldset { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sg-costs-years select { min-height: 44px; }
.sg-costs-conv__amount { width: 100%; max-width: 100%; font-size: 1.4rem; }
.sg-costs-conv__box { margin: 16px 0 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sg-costs-conv__box .sg-costs-conv__result { margin: 4px 0; }
.sg-costs-options-list { border: 0; padding: 0; margin: 16px 0; display: grid; gap: 8px; min-width: 0; }
.sg-costs-option { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; overflow-wrap: anywhere; }
.sg-costs-option > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sg-costs-option:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sg-costs-option:has(input:disabled) { cursor: not-allowed; opacity: 0.7; }
.sg-costs-audience, .sg-costs-note { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-muted); font-size: 0.92rem; }
.sg-costs-audience .sg-icon, .sg-costs-note .sg-icon { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.sg-costs-preview { margin: 16px 0; }
.sg-costs-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0 0 16px; }
.sg-costs-card h2 { font-size: 1rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sg-costs-card__figure { font-size: 1.3rem; margin: 4px 0; overflow-wrap: anywhere; }
.sg-costs-ready p { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 6px; }
.sg-costs-toast .sg-icon { width: 20px; height: 20px; }

@media (min-width: 720px) {
  .sg-costs-filters { grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)) auto; align-items: center; }
  .sg-costs-item { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .sg-costs-item__side { grid-column: 3; }
  .sg-costs-item__amount { text-align: right; }
  .sg-costs-editor__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sg-costs-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sg-costs-cats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sg-costs-spread__range { grid-template-columns: auto 1fr auto 1fr; align-items: center; }
  .sg-costs-conv__pair { grid-template-columns: 1fr auto 1fr; }
}
