#tax-profiles-workspace {
  --tax-profiles-ink: #263f35;
  --tax-profiles-fill: #edf1eb;
  --tax-profiles-edge: #b5c4b8;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
  scroll-margin-top: 100px;
}

#tax-profiles-workspace [hidden] { display: none !important; }
#tax-profiles-workspace button { min-height: 42px; width: fit-content; font-weight: 620; }
#tax-profiles-workspace button.tax-profiles-primary { color: #fff; background: var(--tax-profiles-ink); border-color: var(--tax-profiles-ink); }
#tax-profiles-workspace button.tax-profiles-primary:hover { background: #34564a; }
#tax-profiles-workspace summary { cursor: pointer; scroll-margin-top: 4rem; }
#tax-profiles-workspace summary:hover { color: var(--tax-profiles-ink); }

.tax-profiles-panel { min-width: 0; padding: 17px 19px; border: 1px solid var(--line); border-inline-start: 4px solid var(--tax-profiles-ink); background: var(--panel); }
.tax-profiles-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px 15px; flex-wrap: wrap; margin-bottom: 9px; }
.tax-profiles-heading h4 { margin: 0; font-size: .97rem; }
.tax-profiles-kicker { display: block; margin-bottom: 3px; color: var(--muted); font-size: .69rem; font-weight: 700; letter-spacing: .095em; text-transform: uppercase; }
.tax-profiles-note { margin: 6px 0; color: var(--muted); font-size: .84rem; }
.tax-profiles-empty { margin: 8px 0 0; padding: 8px 0; color: var(--muted); border-top: 1px solid var(--line); }
.tax-profiles-message, .tax-profiles-warning { margin: 7px 0 0; padding: 7px 9px; font-size: .87rem; }
.tax-profiles-message:empty { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); }
.tax-profiles-message[data-tone="error"], .tax-profiles-warning { border-inline-start: 2px solid var(--warning); color: var(--warning); background: #fbede6; }
.tax-profiles-message[data-tone="success"] { border-inline-start: 2px solid var(--tax-profiles-ink); color: var(--tax-profiles-ink); background: var(--tax-profiles-fill); }

.tax-profiles-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.tax-profiles-fields.tax-profiles-filter { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 940px; }
.tax-profiles-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.tax-profiles-field { display: grid; align-content: start; gap: 4px; min-width: 0; color: var(--muted); font-size: .84rem; }
.tax-profiles-field input, .tax-profiles-field select, .tax-profiles-field textarea { min-height: 39px; text-align: left; }
.tax-profiles-field textarea { width: 100%; padding: 6px 8px; resize: vertical; border: 1px solid var(--rule); border-radius: 2px; background: #fffdfa; color: var(--text); font: inherit; }
.tax-profiles-wide { grid-column: 1 / -1; }
.tax-profiles-editor, .tax-profiles-section { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.tax-profiles-editor > summary, .tax-profiles-evidence > summary { color: var(--tax-profiles-ink); font-weight: 620; }
.tax-profiles-editor form { margin-top: 8px; }
.tax-profiles-review { padding: 10px 11px; border: 1px solid var(--tax-profiles-edge); }
.tax-profiles-review h4 { margin: 0; scroll-margin-top: 100px; }
.tax-profiles-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.tax-profiles-codes { padding: 8px 9px; border: 1px solid var(--tax-profiles-edge); }
.tax-profiles-codes legend { padding: 0 4px; color: var(--tax-profiles-ink); font-size: .85rem; font-weight: 620; }

.tax-profiles-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 9px 0; border-block: 1px solid var(--tax-profiles-edge); font-variant-numeric: tabular-nums; }
.tax-profiles-metrics > div { min-width: 0; padding: 8px 10px; border-inline-end: 1px solid var(--line); }
.tax-profiles-metrics > div:last-child { color: var(--tax-profiles-ink); background: var(--tax-profiles-fill); border-inline-end: 0; }
.tax-profiles-metrics dt, .tax-profiles-facts dt { color: var(--muted); font-size: .79rem; }
.tax-profiles-metrics dd, .tax-profiles-facts dd { margin: 2px 0 0; }
.tax-profiles-metrics dd { font-size: clamp(.95rem, 1.4vw, 1.3rem); line-height: 1.22; font-weight: 650; }
.tax-profiles-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 7px 10px; margin: 8px 0; padding: 8px 10px; background: var(--tax-profiles-fill); font-size: .86rem; }
.tax-profiles-facts dd { white-space: pre-wrap; }
.tax-profiles-record { padding: 7px 0; border-top: 1px solid var(--line); }
.tax-profiles-record:last-child { border-bottom: 1px solid var(--line); }
.tax-profiles-record > summary { display: grid; grid-template-columns: 10px minmax(0, 1.35fr) minmax(0, 1fr); align-items: baseline; gap: 6px 9px; min-height: 31px; font-size: .91rem; }
.tax-profiles-record > summary::before { content: ""; width: 7px; height: 7px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(-45deg); }
.tax-profiles-record[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
.tax-profiles-record > summary > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.tax-profiles-record small, .tax-profiles-list small { display: block; color: var(--muted); font-size: .79rem; font-weight: 400; }
.tax-profiles-evidence { margin: 8px 0; padding-top: 7px; border-top: 1px solid var(--line); }
.tax-profiles-evidence summary { font-size: .86rem; }
.tax-profiles-list { margin: 5px 0; padding: 0; list-style: none; font-size: .85rem; }
.tax-profiles-list li { padding: 5px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 700px) {
  .tax-profiles-fields.tax-profiles-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  #tax-profiles-workspace, .tax-profiles-review h4 { scroll-margin-top: 16px; }
  .tax-profiles-panel { padding: 12px; }
  .tax-profiles-editor .tax-profiles-fields { grid-template-columns: minmax(0, 1fr); }
  .tax-profiles-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tax-profiles-metrics > div:nth-child(even) { border-inline-end: 0; }
  .tax-profiles-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .tax-profiles-section > .tax-profiles-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tax-profiles-record > summary { gap: 5px 7px; }
}

@media print {
  #tax-profiles-workspace { display: none !important; }
}
