/* Etsy Fee Calculator: the shared finance panel, a two-column layout when there is room,
   the order split bar, ranked fee bars, breakdown and comparison tables.
   Chart colours are the shared validated slots (--fin-s1 profit, --fin-s2 Etsy fees,
   --fin-s3 your costs); everything else uses theme tokens. */
@import url('/src/utils/financeCalculator.css');
.efc { container-type: inline-size; }
.efc [hidden] { display: none !important; }
.efc h4 { margin: 1rem 0 .4rem; font-size: 1rem; }

.efc-layout { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
.efc-inputs { display: grid; gap: 1rem; min-width: 0; }
.efc-inputs fieldset.fin-group { margin: 0; }
.efc .efc-result { margin-top: 0; min-width: 0; }
.efc-result h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; }
.efc-currency-tag { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.efc .fin-grid .efc-wide { grid-column: 1 / -1; }
@container (min-width: 60rem) {
  .efc-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); align-items: start; }
}

/* Where the order total goes: one bar, three parts, 2px surface gaps, 4px corners. */
.efc-split { position: relative; margin: 1rem 0 0; padding: .75rem .8rem .8rem; background: var(--bg-2); border: 1.5px solid var(--border-soft); border-radius: 6px; }
.efc-split figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem 1rem; margin-bottom: .55rem; }
.efc-chart-title { font-weight: 700; color: var(--ink); }
.efc-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: 0; padding: 0; list-style: none; font-size: .85rem; color: var(--ink-soft); }
.efc-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.efc-key { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 3px; }
.efc-bar { display: flex; gap: 2px; min-height: 28px; }
.efc-seg { display: flex; align-items: center; min-width: 4px; height: 28px; padding: 0 .45rem; overflow: visible; font: 700 .8rem var(--font-mono); white-space: nowrap; color: #000; border-radius: 4px; flex-basis: 0; cursor: default; }
.efc-seg:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.efc-s1 { background: var(--fin-s1); }
.efc-s2 { background: var(--fin-s2); }
.efc-s3 { background: var(--fin-s3); }
.efc-tip { position: absolute; z-index: 2; max-width: min(20rem, 90%); padding: .4rem .6rem; font-size: .82rem; font-weight: 600; color: var(--ink); pointer-events: none; background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 6px; box-shadow: 3px 3px 0 var(--shade); }
.efc .efc-bar-note { margin-top: .5rem; font-size: .88rem; font-weight: 600; color: var(--ink); }

/* Breakdown table: section rows, wrapping explanations, totals in bold. */
.efc .efc-breakdown th, .efc .efc-breakdown td { vertical-align: top; }
.efc .efc-breakdown th[scope="row"] { font-family: inherit; font-weight: 600; text-align: left; white-space: normal; min-width: 9rem; }
.efc .efc-breakdown .efc-how { min-width: 12rem; font-family: inherit; text-align: left; white-space: normal; color: var(--ink-soft); }
.efc .efc-breakdown th.efc-how { color: var(--ink-soft); }
.efc .efc-breakdown .efc-section { padding-top: .7rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); text-align: left; background: var(--bg-2); }
.efc .efc-breakdown tr.efc-total th, .efc .efc-breakdown tr.efc-total td:last-child { font-weight: 800; color: var(--ink); }
.efc .fin-table-wrap { max-height: none; }

/* Etsy fees by type: ranked horizontal bars in the fee colour, values at the bar end. */
.efc-rank { margin: 1rem 0 0; padding: .75rem .8rem .85rem; background: var(--bg-2); border: 1.5px solid var(--border-soft); border-radius: 6px; }
.efc-rank figcaption { margin-bottom: .55rem; }
.efc-rank-list { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.efc-rank-list li { display: grid; grid-template-columns: minmax(7rem, 13rem) minmax(3rem, 1fr) auto; align-items: center; gap: .6rem; font-size: .85rem; }
.efc-rank-name { color: var(--ink); overflow-wrap: anywhere; }
.efc-rank-track { display: block; height: 14px; }
.efc-rank-bar { display: block; height: 100%; min-width: 3px; background: var(--fin-s2); border-radius: 0 4px 4px 0; }
.efc-rank-value { font: 600 .85rem var(--font-mono); color: var(--ink); text-align: right; }

.efc .efc-current th, .efc .efc-current td { font-weight: 800; color: var(--ink); background: var(--paper-3); }

/* Rates, exchange rates and sources. */
.efc-advanced { margin-top: 1.25rem; padding: .9rem 1rem; border: 2px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.efc-advanced summary { min-height: 32px; font-weight: 700; cursor: pointer; }
.efc-advanced summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.efc-advanced > p { margin: .6rem 0; font-size: .9rem; }
.efc-advanced .fin-grid { margin-top: .4rem; }
.efc-sources { display: grid; gap: .35rem; margin: 0; padding-left: 1.1rem; font-size: .85rem; color: var(--ink-soft); }
.efc a { color: var(--action-text); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.efc a:hover { color: var(--action-text-hover); }
.efc .efc-checked { margin-top: 1rem; padding: .55rem .75rem; font-size: .88rem; color: var(--ink); background: var(--paper-3); border-left: 4px solid var(--action); border-radius: 6px; }

@media (forced-colors: active) {
  .efc-seg, .efc-rank-bar, .efc-key { forced-color-adjust: none; border: 1px solid CanvasText; }
}

/* Narrow panels: tables keep three or five columns but wrap and tighten so they fit a phone. */
@container (max-width: 34rem) {
  .efc table { font-size: .8rem; }
  .efc th, .efc td { padding: .4rem .45rem; }
  .efc .efc-breakdown th[scope="row"] { min-width: 0; }
  .efc .efc-breakdown .efc-how { min-width: 0; }
  .efc [data-efc="compare"] th, .efc [data-efc="compare"] td { padding: .4rem .36rem; }
  .efc [data-efc="compare"] th[scope="row"] { white-space: normal; min-width: 4.5rem; }
  .efc [data-efc="compare"] thead th { white-space: normal; font-size: .7rem; letter-spacing: 0; }
  .efc [data-efc="compare"] .efc-optional { display: none; }
  .efc .fin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .efc .fin-stats dt { letter-spacing: 0; }
  .efc-rank-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .efc-rank-track { grid-column: 1 / -1; grid-row: 2; }
}

/* Space the page holds for this view until it mounts (see .tool-view-placeholder in _workspace.css).
   Each height is a little under the space the view takes at that width, measured as how far the
   content below moves when the view replaces the placeholder, so nothing below it moves. Re-measure
   after changing the view's layout: node scripts/measure-tool-views.js --apply etsy-fee-calculator. */
.tool-view-placeholder[data-tool="etsy-fee-calculator"] { min-height: 2448px; }
@media (max-width: 1056px) { .tool-view-placeholder[data-tool="etsy-fee-calculator"] { min-height: 3655px; } }
@media (max-width: 672px) { .tool-view-placeholder[data-tool="etsy-fee-calculator"] { min-height: 4162px; } }
@media (max-width: 432px) { .tool-view-placeholder[data-tool="etsy-fee-calculator"] { min-height: 5557px; } }
