:root {
  --invito-blue: #1d67ad;
  --invito-blue-deep: #0d4e86;
  --accent: #5f8f3e;
  --ink: #0e1a2a;
  --muted: #5e6b78;
  --line: #d8e1ea;
  --panel: #ffffff;
  --bg: #f4f7fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--invito-blue-deep);
  color: #fff;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand-lockup img {
  display: block;
  width: 150px;
  height: auto;
}

.site-nav {
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
}

.site-nav a {
  padding-bottom: 0.15rem;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  border-color: rgba(255, 255, 255, 0.75);
}

.page-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.page-shell:has(.reference-admin-head) {
  max-width: 1280px;
  padding-top: 1.35rem;
}

.hero {
  padding: 2rem 0 1rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--invito-blue);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
}

.lede {
  max-width: 52rem;
  margin: 1rem 0 0;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(13, 78, 134, 0.08);
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.list {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.7;
}

.auth-shell,
.section-head,
.workspace-grid {
  display: grid;
  gap: 1.25rem;
}

.auth-shell {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: start;
  padding-top: 2rem;
}

.section-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 1.25rem;
}

.scenario-tab-header {
  width: min(100%, 1120px);
  margin-left: auto;
  margin-right: auto;
  align-items: start;
}

.scenario-tab-header .lede {
  min-height: 3.6rem;
}

.section-head h1,
.auth-shell h1 {
  margin: 0;
  font-size: 2.2rem;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  align-items: start;
}

.form-panel {
  display: grid;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1rem) 1.05rem, calc(100% - 0.7rem) 1.05rem;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
}

.unit-field {
  position: relative;
  display: block;
}

.unit-field::before,
.unit-field::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 800;
  pointer-events: none;
}

.unit-field.prefix::before {
  content: attr(data-unit);
  left: 0.7rem;
}

.unit-field.suffix::after {
  content: attr(data-unit);
  right: 0.75rem;
}

.unit-field.prefix input {
  padding-left: 1.55rem;
}

.unit-field.suffix input {
  padding-right: 2.1rem;
}

button,
.button,
.tab-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--invito-blue);
  border-radius: 6px;
  background: var(--invito-blue);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  background: #fff;
  color: var(--invito-blue);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  background: var(--line);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
}

.inline-form input {
  min-height: 2.25rem;
}

.inline-form button {
  min-height: 2.25rem;
}

.tab-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tab-nav a {
  background: #fff;
  color: var(--invito-blue);
}

.tab-nav a.active {
  background: var(--invito-blue);
  color: #fff;
}

.form-error {
  margin: 0;
  color: #9f2d20;
  font-weight: 700;
}

.scenario-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.scenario-list a {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.scenario-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-list {
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.metric-list dt {
  color: var(--muted);
  font-weight: 700;
}

.metric-list dd {
  margin: 0;
  font-weight: 800;
}

.calculator-sheet {
  display: grid;
  gap: 0.85rem;
  max-width: 860px;
}

.sheet-section {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(13, 78, 134, 0.07);
}

.sheet-section header,
.sheet-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(170px, 220px);
  align-items: center;
}

.sheet-section header {
  min-height: 2.4rem;
  background: #e8eff6;
  border-bottom: 1px solid var(--line);
}

.sheet-section header span,
.step-cell {
  padding: 0.65rem 0.8rem;
  color: var(--invito-blue-deep);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sheet-section header strong {
  grid-column: 2 / 4;
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem;
}

.sheet-row {
  min-height: 2.9rem;
  border-bottom: 1px solid var(--line);
}

.sheet-row:last-child {
  border-bottom: 0;
}

.sheet-row > label,
.sheet-row > span:not(.unit-field),
.sheet-row > strong,
.sheet-row > select,
.sheet-row > .unit-field {
  margin: 0;
  padding: 0.45rem 0.75rem;
}

.sheet-row > label,
.sheet-row > span:not(.unit-field) {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
}

.sheet-row > strong {
  justify-self: stretch;
  text-align: right;
  font-size: 0.95rem;
}

.sheet-row.editable {
  background: #fbfcf8;
}

.sheet-row.editable .unit-field,
.sheet-row.editable select {
  padding: 0.25rem 0.75rem;
}

.sheet-row.editable input,
.sheet-row.editable select {
  min-height: 2.15rem;
  border-color: #cbd7b8;
  background-color: #fffef5;
  font-weight: 700;
}

.sheet-row.output {
  background: #fff;
}

.sheet-row.total {
  background: #f7fbff;
}

.sheet-row.total > span,
.sheet-row.total > strong {
  font-weight: 850;
}

.sheet-details {
  border-bottom: 1px solid var(--line);
}

.sheet-details summary {
  padding: 0.65rem 0.8rem 0.65rem 5.25rem;
  color: var(--invito-blue);
  cursor: pointer;
  font-weight: 800;
}

.sheet-note,
.disclosure-section p {
  margin: 0;
  padding: 0.75rem 0.9rem 0.85rem 5.25rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  padding: 0.85rem 0;
  background: linear-gradient(180deg, rgba(244, 247, 250, 0), var(--bg) 28%);
}

.sheet-actions button {
  min-width: 180px;
}

.comparison-sheet {
  display: grid;
  gap: 1rem;
  max-width: 920px;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(13, 78, 134, 0.07);
}

.comparison-table th,
.comparison-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

.comparison-table thead th {
  background: #edf3f8;
  color: var(--ink);
  font-weight: 850;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
  width: 46%;
  color: var(--ink);
  text-align: left;
}

.comparison-table td.summary-label {
  text-align: right;
  font-weight: 750;
}

.comparison-table td.deduction-label {
  font-style: italic;
}

.comparison-table td.negative-value {
  color: #c00000;
}

.comparison-table .section-row th {
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
  background: #e8eff6;
  color: var(--invito-blue-deep);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
}

.comparison-table .total-row td {
  font-weight: 850;
  background: #f7fbff;
}

.comparison-table .benefit-row td:last-child {
  color: var(--invito-blue-deep);
  font-weight: 850;
}

.federal-breakdown {
  display: grid;
  gap: 0.65rem;
}

.federal-breakdown > header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.federal-breakdown > header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.federal-phase-grid {
  display: grid;
  gap: 0.75rem;
}

.federal-phase {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(13, 78, 134, 0.07);
}

.federal-phase summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
  gap: 1rem;
  align-items: center;
  padding: 0.65rem 0.8rem;
  background: #e8eff6;
  color: var(--invito-blue-deep);
  cursor: pointer;
  font-weight: 850;
}

.federal-phase summary strong {
  text-align: right;
}

.federal-phase-summary,
.federal-bracket-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.federal-phase-summary th,
.federal-phase-summary td,
.federal-bracket-table th,
.federal-bracket-table td {
  padding: 0.38rem 0.55rem;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.federal-phase-summary th,
.federal-bracket-table th {
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.federal-phase-summary td,
.federal-bracket-table td {
  text-align: right;
}

.federal-phase-summary th {
  width: 62%;
}

.federal-phase-summary .total-row th,
.federal-phase-summary .total-row td {
  background: #f7fbff;
  font-weight: 850;
}

.federal-bracket-table {
  border-top: 3px solid #8fb0ca;
}

.federal-bracket-table thead th {
  background: #d8e8f5;
  color: var(--invito-blue-deep);
}

.federal-bracket-table tbody tr {
  color: var(--muted);
}

.federal-bracket-table tbody tr.active {
  color: var(--ink);
  background: #fffdf2;
}

.federal-bracket-table th:first-child,
.federal-bracket-table td:first-child {
  text-align: left;
}

.comparison-disclosure {
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.comparison-disclosure h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.comparison-disclosure p {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.comparison-disclosure p:last-child {
  margin-bottom: 0;
}

.tracker-sheet {
  display: grid;
  gap: 1rem;
  width: calc(100vw - (2 * clamp(1.25rem, 3vw, 3rem)));
  max-width: none;
  margin-left: calc(50% - 50vw + clamp(1.25rem, 3vw, 3rem));
  margin-right: calc(50% - 50vw + clamp(1.25rem, 3vw, 3rem));
}

.tracker-title h2 {
  margin: 0;
  font-size: 1.2rem;
}

.tracker-title p,
.tracker-note,
.tracker-definition p {
  margin: 0.25rem 0 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.35;
}

.tracker-section {
  display: grid;
  gap: 0.35rem;
}

.tracker-section h3,
.tracker-definition h3 {
  margin: 0;
  padding: 0.25rem 0.45rem;
  background: #a6a6a6;
  color: #111827;
  font-size: 0.96rem;
  font-weight: 850;
}

.tracker-table-scroll {
  overflow-x: auto;
  border: 1px solid #c8d2dd;
  background: #fff;
}

.tracker-input-table,
.tracker-schedule-table,
.tracker-grid-table,
.tracker-risk-table {
  border-collapse: collapse;
  background: #fff;
  color: #111827;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.84rem;
}

.tracker-input-table th,
.tracker-input-table td,
.tracker-schedule-table th,
.tracker-schedule-table td,
.tracker-grid-table th,
.tracker-grid-table td,
.tracker-risk-table th,
.tracker-risk-table td {
  border: 1px solid #d4d9df;
  padding: 0.22rem 0.4rem;
  line-height: 1.25;
  vertical-align: middle;
}

.tracker-input-table {
  min-width: 460px;
}

.tracker-input-table th {
  min-width: 330px;
  text-align: left;
  font-size: 0.84rem;
  font-weight: 850;
}

.tracker-input-table td {
  min-width: 120px;
  text-align: right;
  font-weight: 750;
}

.tracker-input-value {
  background: #ddebf7;
}

.tracker-unit-field {
  display: grid;
  align-items: center;
  position: relative;
}

.tracker-unit-field input {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 750;
  line-height: 1.25;
  padding-top: 0;
  padding-bottom: 0;
  text-align: right;
  outline: 0;
}

.tracker-unit-field.prefix::before,
.tracker-unit-field.suffix::after {
  position: absolute;
  color: #111827;
  content: attr(data-unit);
  font-weight: 850;
  pointer-events: none;
}

.tracker-unit-field.prefix::before {
  left: 0;
}

.tracker-unit-field.prefix input {
  padding-left: 1rem;
}

.tracker-unit-field.suffix::after {
  right: 0;
}

.tracker-unit-field.suffix input {
  padding-right: 1rem;
}

.tracker-input-value:focus-within {
  box-shadow: inset 0 0 0 2px var(--invito-blue);
}

.tracker-schedule-table {
  min-width: 760px;
}

.tracker-schedule-table th {
  text-align: left;
  font-weight: 850;
}

.tracker-schedule-table td:first-child,
.tracker-schedule-table td:nth-child(2) {
  text-align: right;
  font-weight: 750;
}

.tracker-schedule-table td:nth-child(3) {
  font-style: italic;
}

.tracker-total-row th,
.tracker-total-row td {
  font-weight: 850;
}

.tracker-grid-table {
  min-width: 1280px;
  width: 100%;
}

.tracker-grid-table th,
.tracker-grid-table td {
  min-width: 96px;
  text-align: right;
  white-space: nowrap;
}

.tracker-grid-table th:first-child {
  left: 0;
  min-width: 340px;
  max-width: 340px;
  position: sticky;
  z-index: 1;
  background: #fff;
  text-align: left;
  white-space: normal;
}

.tracker-grid-table thead th {
  background: #f3f4f6;
  font-weight: 850;
  text-align: center;
}

.tracker-grid-table thead th:first-child {
  z-index: 2;
  background: #f3f4f6;
  text-align: left;
}

.tracker-vintage-heading th,
.tracker-vintage-heading td,
.tracker-car-row th,
.tracker-car-row td {
  font-weight: 850;
}

.tracker-subrow {
  font-size: 0.8rem;
  font-style: italic;
  font-weight: 500 !important;
}

.tracker-subscription-cell {
  color: #008000;
}

.tracker-spacer-row td {
  height: 0.6rem;
  padding: 0;
  border-left-color: transparent;
  border-right-color: transparent;
}

.tracker-risk-table {
  min-width: 380px;
}

.tracker-risk-table th {
  min-width: 280px;
  text-align: left;
  font-weight: 500;
}

.tracker-risk-table td {
  min-width: 80px;
}

.risk-low {
  background: #c6efce;
}

.risk-mid {
  background: #ffeb9c;
}

.risk-high {
  background: #ffc7ce;
}

.tracker-definition {
  display: grid;
  gap: 0.15rem;
}

.tracker-actions {
  display: flex;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  padding: 0.85rem 0;
  background: linear-gradient(180deg, rgba(244, 247, 250, 0), var(--bg) 28%);
}

.tracker-actions button {
  min-width: 180px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 0.85rem;
}

.audit-list li {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.advisor-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.advisor-row div {
  display: grid;
  gap: 0.2rem;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}

.admin-tabs button {
  min-height: 2.15rem;
  padding: 0.38rem 0.75rem;
  border-radius: 5px;
  background: #fff;
  color: var(--invito-blue);
}

.admin-tabs button.active {
  background: var(--invito-blue);
  color: #fff;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.active {
  display: block;
}

.reference-admin-head {
  margin-bottom: 0.7rem;
}

.reference-admin-head .eyebrow {
  margin-bottom: 0.45rem;
}

.reference-admin-head h1 {
  font-size: 1.9rem;
}

.reference-admin-head .lede {
  margin-top: 0.55rem;
  font-size: 1rem;
}

.admin-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.admin-save-bar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.75rem;
}

.admin-save-status {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.reference-data-dirty .admin-save-status {
  color: #8a5a00;
}

.admin-save-bar button:disabled {
  cursor: not-allowed;
  background: #d8e4ef;
  border-color: #d8e4ef;
  color: #607284;
  opacity: 1;
}

.worksheet-panel {
  display: grid;
  gap: 1.15rem;
}

.worksheet-panel.panel {
  padding: 0.75rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.worksheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.reference-state-panel .worksheet-header {
  margin-bottom: -0.15rem;
}

.reference-state-panel .worksheet-header .muted {
  display: none;
}

.reference-product-panel {
  max-width: 760px;
}

.reference-product-panel .worksheet-header {
  margin-bottom: -0.35rem;
}

.worksheet-header h2,
.worksheet-panel h3 {
  margin: 0;
}

.worksheet-header h2 {
  font-size: 1rem;
}

.worksheet-header .muted {
  margin: 0.25rem 0 0;
}

.worksheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.worksheet-grid section,
.worksheet-subsection {
  display: grid;
  gap: 0.45rem;
}

.worksheet-grid section + section {
  padding-left: 0.85rem;
  border-left: 3px solid #8fb0ca;
}

.worksheet-subsection {
  padding-top: 0.9rem;
  border-top: 3px solid #8fb0ca;
}

.worksheet-table {
  overflow: hidden;
  border: 2px solid #9db4c7;
  border-radius: 0;
  background: #fff;
  font-size: 0.88rem;
}

.worksheet-table th {
  padding: 0.52rem 0.65rem;
  border: 1px solid #b7c9d9;
  background: #d9eaf7;
  color: #123a5a;
  font-weight: 850;
}

.worksheet-table td {
  padding: 0;
  border: 1px solid #d0d9e2;
  height: 1px;
  vertical-align: top;
}

.worksheet-label-cell {
  padding: 0.58rem 0.65rem !important;
}

.state-tax-table .worksheet-label-cell {
  padding: 0.33rem 0.65rem !important;
  line-height: 1.05;
}

.state-tax-table .worksheet-label-cell .muted {
  display: block;
  font-size: 0.82rem;
  line-height: 1.05;
}

.worksheet-cell-input {
  display: block;
  width: 100%;
  min-width: 5.5rem;
  height: 100%;
  min-height: 2.15rem;
  box-sizing: border-box;
  margin: 0;
  padding: 0.36rem 0.65rem;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  font: inherit;
}

.worksheet-cell-input:focus {
  outline: 2px solid #2f80ed;
  outline-offset: -2px;
  background: #fff;
}

.worksheet-cell-input.active-cell {
  box-shadow: inset 0 0 0 2px #2f80ed;
}

.worksheet-cell-input[readonly].active-cell {
  cursor: cell;
}

.worksheet-cell-input.editing-cell {
  cursor: text;
  box-shadow: inset 0 0 0 3px #2f80ed;
}

.worksheet-row-form {
  justify-content: flex-start;
}

.worksheet-row-form button {
  padding: 0.42rem 0.7rem;
}

.worksheet-notes-input {
  min-width: 18rem;
  min-height: 2.15rem;
  white-space: normal;
  overflow: hidden;
  resize: none;
}

.worksheet-editable td {
  background: #fff1bf;
}

.worksheet-calculated td {
  background: #dcefd2;
}

.product-assumptions-table {
  width: 100%;
}

.product-assumptions-table th:first-child {
  width: auto;
}

.product-assumptions-table th:last-child {
  width: 210px;
}

.product-assumptions-table th,
.product-assumptions-table td {
  line-height: 1.2;
}

.product-assumptions-table th {
  padding: 0.44rem 0.65rem;
}

.product-assumptions-table .worksheet-label-cell {
  padding: 0.42rem 0.65rem !important;
}

.product-assumptions-table td:last-child {
  padding: 0;
}

.product-assumptions-table .worksheet-cell-input {
  min-height: 1.95rem;
  padding: 0.34rem 0.65rem;
  background: transparent;
}

.product-assumptions-table .worksheet-cell-input:focus,
.product-assumptions-table .worksheet-cell-input.editing-cell {
  background: #fff;
}

.product-assumptions-table .worksheet-calculated td {
  background: #f7fbf3;
}

.state-tax-table th:nth-child(1) {
  width: 16%;
}

.state-tax-table th:nth-child(2),
.state-tax-table th:nth-child(3) {
  width: 11%;
}

.state-nonconforming td {
  background: #f9ddcf;
}

.table-scroll {
  overflow-x: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(7, 25, 43, 0.48);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  width: min(100%, 34rem);
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(7, 25, 43, 0.22);
}

.modal-dialog h2 {
  margin: 0 0 0.35rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.1rem;
}

.modal-actions .secondary {
  background: #fff;
  color: var(--invito-blue);
  border: 1px solid var(--line);
}

.report-hero {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}

.report-hero h1 {
  margin: 0;
  font-size: 2.4rem;
}

.report-sheet {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(13, 78, 134, 0.08);
}

.report-sheet header {
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--invito-blue);
}

.report-brand {
  margin: 0 0 0.35rem;
  color: var(--invito-blue);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-sheet h2,
.report-sheet h3 {
  margin: 0 0 1rem;
}

.report-sheet footer {
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

@media (max-width: 860px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .auth-shell,
  .section-head,
  .workspace-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .sheet-section header,
  .sheet-row {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }

  .sheet-section header strong {
    grid-column: 2;
  }

  .sheet-row > strong,
  .sheet-row > select,
  .sheet-row > .unit-field {
    grid-column: 2;
    text-align: left;
  }

  .sheet-details summary,
  .sheet-note,
  .disclosure-section p {
    padding-left: 4.25rem;
  }

  .comparison-sheet {
    overflow-x: auto;
  }

  .comparison-table {
    min-width: 720px;
  }

  .federal-breakdown {
    overflow-x: auto;
  }

  .federal-phase {
    min-width: 720px;
  }

  .admin-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-save-bar {
    width: 100%;
    justify-content: flex-end;
  }

  .worksheet-grid {
    grid-template-columns: 1fr;
  }

  .worksheet-grid section + section {
    padding-top: 0.9rem;
    padding-left: 0;
    border-top: 3px solid #8fb0ca;
    border-left: 0;
  }

  .worksheet-table {
    min-width: 620px;
  }

  .worksheet-grid,
  .worksheet-subsection,
  .table-scroll {
    overflow-x: auto;
  }

  .scenario-tab-header .lede {
    min-height: 0;
  }
}
