/* Actually Free Taxes - Utilitarian & Straightforward Stylesheet */
:root {
  --bg-primary: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card-calc: #f8fafc;
  --bg-calc-panel: #f8fafc;
  --bg-card-input: #ffffff;
  --border-color: #cbd5e1;
  --border-calc-panel: #cbd5e1;
  --border-input-panel: #2563eb;
  --border-output-panel: #dc2626;
  --border-focus: #1d4ed8;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;

  --font-size-header: 1.2rem;   /* 19.2px — ONLY for section headers */
  --font-size-base: 0.9375rem;  /* 15px — uniform size for all body text, labels, inputs, formulas, and numbers */

  --color-wages: #10b981;
  --color-withholding: #0284c7;
  --color-ss: #f59e0b;
  --color-medicare: #ec4899;
  --color-state: #8b5cf6;
  --color-adjustments: #6366f1;
  --color-tax: #f97316;
  --color-refund: #15803d;
  --color-owed: #b91c1c;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
}

/* SVG Connection Overlays: unhighlighted above panel bg / below inputs (z-index: 3), highlighted on top of everything except header (z-index: 500) */
#arrow-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 15;
}

#arrow-canvas-highlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 500;
}

.arrow-line {
  transition: stroke 0.2s ease, stroke-width 0.2s ease, stroke-opacity 0.2s ease;
}

.arrow-line.flowing {
  animation: arrowFlow 0.8s linear infinite;
}

@keyframes arrowFlow {
  from {
    stroke-dashoffset: 24;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Flash Highlight for clicked target */
@keyframes flashGlow {
  0% { outline: 3px solid #2563eb; }
  100% { outline: 0px solid transparent; }
}

.flash-highlight {
  animation: flashGlow 0.9s ease-out;
}

/* Active Source / Target highlight classes */
.data-source-active {
  outline: 2px solid #10b981 !important;
  border-color: #10b981 !important;
}

.data-target-active {
  outline: 2px solid #2563eb !important;
  border-color: #2563eb !important;
}

/* Sticky Header Bar (above highlighted dependency arrows at z-index 500) */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 600;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.65rem 1.5rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-icon {
  width: 30px;
  height: 30px;
  background: #0f172a;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: var(--font-size-base);
}

.logo-title {
  font-size: var(--font-size-header);
  font-weight: 700;
  color: #0f172a;
}

.logo-badge {
  font-size: var(--font-size-base);
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.4rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn,
.btn-sm,
.btn-lg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-primary);
  font-family: inherit;
}

.btn:hover,
.btn-sm:hover,
.btn-lg:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-primary {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.btn-primary:hover {
  background: #1e293b;
  border-color: #1e293b;
  color: #ffffff;
}

.toggle-switch-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-switch-label input {
  accent-color: #2563eb;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* App Layout with Left Table of Contents */
.app-layout {
  display: flex;
  max-width: 1640px;
  margin: 1.25rem auto 4rem;
  padding: 0 3.5rem 0 0.75rem;
  gap: 3.75rem;
  position: relative;
  align-items: flex-start;
}

/* Sticky TOC Sidebar */
.toc-sidebar {
  width: 225px;
  flex-shrink: 0;
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  z-index: 20;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #cbd5e1;
}

.toc-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #0f172a;
}

.toc-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toc-group-label {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #475569;
  margin: 0.35rem 0 0.15rem 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toc-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.toc-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.toc-link.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-left-color: #2563eb;
  font-weight: 700;
}

.toc-badge {
  font-size: var(--font-size-base);
  font-weight: 600;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.toc-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem;
  margin-top: 0.25rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
}

.toc-add-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
}

/* Page Container */
.main-content {
  flex: 1;
  max-width: 1100px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  z-index: 10;
}

/* Section Headers — ONLY elements using --font-size-header */
.section-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #cbd5e1;
}

.section-header-bar h2 {
  font-size: var(--font-size-header);
  font-weight: 700;
  color: #0f172a;
}

/* Return Settings & Preset Controls */
.return-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.setting-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.setting-field label {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}

.presets-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

.preset-chip {
  padding: 0.25rem 0.6rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.preset-chip:hover {
  background: #e2e8f0;
}

/* =========================================================
   USER INPUT PANELS vs. READ-ONLY CALCULATED PANELS
========================================================= */
/* Read-only calculated cards: neutral slate border on light gray surface */
.calc-card {
  background: var(--bg-card-calc);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.15rem 1.25rem;
  box-shadow: none;
  position: relative;
}

/* User-input panels: distinct 2px blue border on crisp white surface */
.calc-card.input-panel {
  background: var(--bg-card-input);
  border: 2px solid var(--border-input-panel);
  box-shadow: none;
}

/* Key output panels: distinct 2px red border matching input panel weight */
.calc-card.output-panel,
.state-return-card.output-panel,
.unified-summary-card.output-panel {
  background: #ffffff;
  border: 2px solid var(--border-output-panel);
  box-shadow: none;
}

.input-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.input-card-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.input-sublabel {
  display: block;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.input-card-hint {
  font-size: var(--font-size-base);
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* =========================================================
   LITERAL W-2 DOCUMENT BACKGROUND OVERLAY SYSTEM
========================================================= */
.w2-literal-card {
  background: #ffffff;
  border: 2px solid var(--border-input-panel);
  border-radius: 6px;
  box-shadow: none;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.w2-literal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: #1e293b;
  color: #ffffff;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.w2-literal-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.w2-literal-toolbar .doc-badge {
  background: #2563eb;
  color: white;
  font-weight: 700;
  font-size: var(--font-size-base);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.w2-literal-toolbar .w2-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #ffffff;
}

.w2-literal-toolbar .state-tag-list {
  display: inline-flex;
  gap: 0.3rem;
}

.w2-literal-toolbar .state-tag {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: var(--font-size-base);
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.w2-literal-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.w2-literal-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #e2e8f0;
  padding: 1rem;
  display: flex;
  justify-content: center;
}

.w2-literal-container {
  position: relative;
  width: 100%;
  max-width: 960px;
  min-width: 800px;
  aspect-ratio: 548 / 356;
  background-image: url('../assets/irs_w2_template.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid #94a3b8;
  background-color: #ffffff;
}

/* Individual Overlaid Boxes */
.w2-overlay-box {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2px 4px 4px 4px;
  z-index: 2;
}

.w2-overlay-box:hover {
  background: rgba(37, 99, 235, 0.04);
}

.w2-overlay-box.box-highlight-wages {
  border-bottom: 2.5px solid var(--color-wages);
}

.w2-overlay-box.box-highlight-withholding {
  border-bottom: 2.5px solid var(--color-withholding);
}

.w2-overlay-box.box-highlight-ss {
  border-bottom: 2.5px solid var(--color-ss);
}

.w2-overlay-box.box-highlight-medicare {
  border-bottom: 2.5px solid var(--color-medicare);
}

.w2-overlay-box.box-highlight-state {
  border-bottom: 2.5px solid var(--color-state);
}

.w2-overlay-header {
  position: absolute;
  top: 1px;
  right: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 5;
}

.w2-overlay-input-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.w2-overlay-curr {
  position: absolute;
  left: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--font-size-base);
  color: #475569;
  pointer-events: none;
  z-index: 3;
}

.w2-overlay-input {
  width: 100%;
  height: 24px;
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #94a3b8;
  border-radius: 2px;
  padding: 0 4px;
  outline: none;
  box-sizing: border-box;
}

.w2-overlay-input.num {
  text-align: right;
  padding-left: 14px;
}

.w2-overlay-input:focus {
  background: #ffffff;
  border-color: #2563eb;
  outline: 2px solid rgba(37, 99, 235, 0.35);
  z-index: 4;
}

.w2-overlay-select {
  width: 100%;
  height: 24px;
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #94a3b8;
  border-radius: 2px;
  padding: 0 2px;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
}

.w2-overlay-textarea {
  width: 100%;
  height: calc(100% - 14px);
  resize: none;
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #94a3b8;
  border-radius: 2px;
  padding: 2px 4px;
  outline: none;
  box-sizing: border-box;
  line-height: 1.25;
}

/* Specific Box Coordinates (percentage of 548 x 356 template) */
.box-a  { left: 21.75%; top: 1.69%; width: 23.65%; height: 6.74%; }
.box-b  { left: 0.73%; top: 8.43%; width: 53.87%; height: 6.74%; }
.box-c  { left: 0.73%; top: 15.17%; width: 53.87%; height: 20.22%; }
.box-d  { left: 0.73%; top: 35.39%; width: 53.87%; height: 6.74%; }
.box-e  { left: 0.73%; top: 42.13%; width: 53.87%; height: 20.22%; }
.box-f  { left: 0.73%; top: 62.36%; width: 53.87%; height: 10.11%; }

.box-1  { left: 54.60%; top: 8.43%; width: 22.34%; height: 6.74%; }
.box-2  { left: 76.93%; top: 8.43%; width: 22.34%; height: 6.74%; }
.box-3  { left: 54.60%; top: 15.17%; width: 22.34%; height: 6.74%; }
.box-4  { left: 76.93%; top: 15.17%; width: 22.34%; height: 6.74%; }
.box-5  { left: 54.60%; top: 21.91%; width: 22.34%; height: 6.74%; }
.box-6  { left: 76.93%; top: 21.91%; width: 22.34%; height: 6.74%; }
.box-7  { left: 54.60%; top: 28.65%; width: 22.34%; height: 6.74%; }
.box-8  { left: 76.93%; top: 28.65%; width: 22.34%; height: 6.74%; }
.box-9  { left: 54.60%; top: 35.39%; width: 22.34%; height: 3.37%; }
.box-10 { left: 76.93%; top: 35.39%; width: 22.34%; height: 6.74%; }
.box-11 { left: 54.60%; top: 38.76%; width: 22.34%; height: 6.74%; }
.box-12 { left: 76.93%; top: 42.13%; width: 22.34%; height: 26.97%; }
.box-13 { left: 54.60%; top: 45.51%; width: 22.34%; height: 6.74%; }
.box-14 { left: 54.60%; top: 52.25%; width: 22.34%; height: 20.22%; }

/* State Row 1 */
.row1-box-15-state { left: 0.73%; top: 72.47%; width: 6.20%; height: 6.74%; }
.row1-box-15-id    { left: 6.93%; top: 72.47%; width: 22.71%; height: 6.74%; }
.row1-box-16       { left: 29.64%; top: 72.47%; width: 15.77%; height: 6.74%; }
.row1-box-17       { left: 45.40%; top: 72.47%; width: 14.45%; height: 6.74%; }
.row1-box-18       { left: 59.85%; top: 72.47%; width: 15.77%; height: 6.74%; }
.row1-box-19       { left: 75.62%; top: 72.47%; width: 14.45%; height: 6.74%; }
.row1-box-20       { left: 90.07%; top: 72.47%; width: 9.20%; height: 6.74%; }

/* State Row 2 */
.row2-box-15-state { left: 0.73%; top: 79.21%; width: 6.20%; height: 6.74%; }
.row2-box-15-id    { left: 6.93%; top: 79.21%; width: 22.71%; height: 6.74%; }
.row2-box-16       { left: 29.64%; top: 79.21%; width: 15.77%; height: 6.74%; }
.row2-box-17       { left: 45.40%; top: 79.21%; width: 14.45%; height: 6.74%; }
.row2-box-18       { left: 59.85%; top: 79.21%; width: 15.77%; height: 6.74%; }
.row2-box-19       { left: 75.62%; top: 79.21%; width: 14.45%; height: 6.74%; }
.row2-box-20       { left: 90.07%; top: 79.21%; width: 9.20%; height: 6.74%; }

.btn-remove-row2-state {
  position: absolute;
  top: 1px;
  right: 2px;
  padding: 0 4px;
  height: 16px;
  line-height: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 2px;
  cursor: pointer;
  z-index: 10;
}

.w2-extra-states-container {
  padding: 1rem;
  background: #f8fafc;
  border-top: 1px solid #cbd5e1;
}

.w2-drawers-container {
  padding: 0 1rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.w2-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.w2-input-wrapper .currency-symbol {
  position: absolute;
  left: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #475569;
  font-size: var(--font-size-base);
}

.w2-input {
  width: 100%;
  padding: 0.4rem 0.6rem 0.4rem 1.6rem;
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  outline: none;
  text-align: right;
}

select.w2-input {
  font-family: var(--font-sans);
  padding-left: 0.6rem;
  text-align: left;
  cursor: pointer;
}

.w2-input:focus {
  border-color: #2563eb;
  outline: 2px solid rgba(37, 99, 235, 0.25);
}

.w2-input-text {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: var(--font-size-base);
  font-weight: 500;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  outline: none;
  background: #ffffff;
}

/* =========================================================
   CALCULATED STEPS & FORMULA CARDS
========================================================= */
.step-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.step-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: #475569;
}

.calc-card-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #0f172a;
}

.irs-line-tag {
  font-size: var(--font-size-base);
  font-weight: 600;
  font-family: var(--font-mono);
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* Equation Display Blocks */
.formula-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.formula-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.formula-badge {
  font-size: var(--font-size-base);
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
  min-width: 155px;
  text-align: center;
}

.formula-badge.plugged {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.formula-math {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  color: #334155;
  font-weight: 500;
}

.formula-math.plugged-highlight {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #0f172a;
}

/* Tax Bracket Table */
.brackets-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: var(--font-size-base);
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

.brackets-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
  font-size: var(--font-size-base);
  border-bottom: 1px solid #cbd5e1;
}

.brackets-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
}

.brackets-table tr.active-bracket {
  background: #f8fafc;
  font-weight: 600;
}

.brackets-table tr.active-bracket td:first-child {
  border-left: 3px solid #2563eb;
}

.btn-add-w2-banner {
  width: 100%;
  border: 2px dashed #2563eb;
  border-radius: 6px;
  background: #ffffff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #1d4ed8;
  cursor: pointer;
  margin-top: 0.75rem;
}

.btn-add-w2-banner:hover {
  background: #eff6ff;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
    padding: 0 1rem;
    gap: 1.5rem;
  }
  .toc-sidebar {
    width: 100%;
    position: static;
    max-height: 240px;
  }
}

/* Field Ratings & IRS Risk Assessment */
.field-rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  border: 1px solid #cbd5e1;
  line-height: 1.25;
}

.field-rating-pill.compact {
  padding: 1px 3px;
  gap: 2px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 3px;
  border: 1px solid #94a3b8;
  font-size: 0.7rem;
}

.field-rating-pill.compact:hover {
  background: #ffffff;
  border-color: #2563eb;
}

.field-rating-pill:hover {
  border-color: #64748b;
}

.field-rating-pill:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.field-rating-pill .pill-info-icon {
  font-size: 0.75rem;
  opacity: 0.75;
  font-weight: 700;
  margin-left: 0.1rem;
}

/* Rating Circles Cluster */
.rating-circles-cluster {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
}

.rating-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  font-family: var(--font-mono);
  box-sizing: border-box;
  text-align: center;
  user-select: none;
  flex-shrink: 0;
  position: relative;
}

/* 1. Attention / Safe to Ignore (White to Yellow, ! on max 4) */
.circle-attention.circle-att-1 {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: transparent;
}
.circle-attention.circle-att-2 {
  background: #fef9c3;
  border: 1.5px solid #fde047;
  color: #854d0e;
}
.circle-attention.circle-att-3 {
  background: #fef08a;
  border: 1.5px solid #eab308;
  color: #713f12;
}
.circle-attention.circle-att-4 {
  background: #eab308;
  border: 1.5px solid #ca8a04;
  color: #422006;
  font-weight: 900;
}

/* 2. IRS Risk (White to Red, ! on max 3) */
.circle-risk.circle-risk-1 {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: transparent;
}
.circle-risk.circle-risk-2 {
  background: #fca5a5;
  border: 1.5px solid #f87171;
  color: #7f1d1d;
}
.circle-risk.circle-risk-3 {
  background: #dc2626;
  border: 1.5px solid #b91c1c;
  color: #ffffff;
  font-weight: 900;
}

/* 3. Money Savings (White to Green, ! on max 3) */
.circle-savings.circle-save-0 {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: transparent;
}
.circle-savings.circle-save-1 {
  background: #dcfce7;
  border: 1.5px solid #86efac;
  color: #14532d;
}
.circle-savings.circle-save-2 {
  background: #4ade80;
  border: 1.5px solid #22c55e;
  color: #052e16;
}
.circle-savings.circle-save-3 {
  background: #16a34a;
  border: 1.5px solid #15803d;
  color: #ffffff;
  font-weight: 900;
}

/* Modal Circle Sizes & Banner */
.scorecard-cell .rating-circle {
  width: 20px;
  height: 20px;
  font-size: 12px;
}

.modal-circle-legend-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.25rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  font-size: var(--font-size-base);
  color: #334155;
}

.modal-circle-legend-banner .legend-chip-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.circle-legend-subtext {
  font-size: var(--font-size-base);
  color: #475569;
  font-weight: 500;
  margin-top: 0.1rem;
}

/* Must be 100% accurate */
.badge-priority-must {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* High Savings Opportunity */
.badge-priority-saver {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

/* Safe to ignore if blank */
.badge-priority-skip {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}

/* Verify paper */
.badge-priority-verify {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

/* Inline Expandable Field Explanations */
.btn-explain-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  line-height: 1.25;
  user-select: none;
}

.btn-explain-toggle.icon-only {
  padding: 1px 3px;
  min-width: 18px;
  height: 16px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #94a3b8;
  font-size: 0.7rem;
}

.btn-explain-toggle:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-explain-toggle .explain-btn-arrow {
  display: inline-block;
  font-size: 0.75rem;
}

.btn-explain-toggle[aria-expanded="true"] {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}

.btn-explain-toggle[aria-expanded="true"] .explain-btn-arrow {
  transform: rotate(180deg);
}

.field-explain-drawer {
  margin-top: 0.5rem;
  margin-bottom: 0.35rem;
  width: 100%;
}

.field-explain-drawer[hidden] {
  display: none !important;
}

.explain-drawer-content {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #2563eb;
  border-radius: 4px;
  padding: 0.75rem 0.9rem;
  font-size: var(--font-size-base);
}

.explain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.45rem;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid #cbd5e1;
}

.explain-title {
  font-weight: 700;
  color: #0f172a;
  font-size: var(--font-size-base);
}

.btn-close-drawer {
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: 700;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

.btn-close-drawer:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.explain-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.explain-section {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.explain-label {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #334155;
}

.explain-text {
  font-size: var(--font-size-base);
  color: #334155;
  line-height: 1.45;
  margin: 0;
}

.explain-tip-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  margin-top: 0.2rem;
}

.explain-tip-box .explain-label {
  color: #854d0e;
}

.explain-tip-box .explain-text {
  color: #713f12;
}

/* Itemized Deductions & Smart Comparison */
.deduction-comparison-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: var(--font-size-base);
  font-weight: 700;
}

.deduction-comparison-pill.itemized-wins {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.deduction-comparison-pill.standard-wins {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* Modal / Popover Overlay for Field Scorecard */
.guidance-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
}

.guidance-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.guidance-modal-dialog {
  background: #ffffff;
  border-radius: 8px;
  max-width: 680px;
  width: 100%;
  border: 1px solid #94a3b8;
  overflow: hidden;
  position: relative;
}

.field-guidance-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guidance-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-right: 2.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #cbd5e1;
}

.guidance-form-tag {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #475569;
}

.guidance-field-title {
  font-size: var(--font-size-header);
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.2rem;
}

.guidance-rec-badge {
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-size: var(--font-size-base);
  font-weight: 700;
  white-space: nowrap;
}

.guidance-rec-badge.must_be_accurate {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.guidance-rec-badge.high_savings {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #6ee7b7;
}

.guidance-rec-badge.safe_to_ignore {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.guidance-rec-badge.verify_paper {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fcd34d;
}

.guidance-scorecard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .guidance-scorecard-grid {
    grid-template-columns: 1fr;
  }
}

.scorecard-cell {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cell-label {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #334155;
}

.cell-score {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #0f172a;
}

.rating-meter {
  display: flex;
  gap: 4px;
  height: 6px;
  margin: 0.2rem 0;
}

.meter-bar {
  flex: 1;
  border-radius: 3px;
  background: #e2e8f0;
}

.meter-bar-active.meter-red { background: #ef4444; }
.meter-bar-active.meter-amber { background: #f59e0b; }
.meter-bar-active.meter-green { background: #10b981; }
.meter-bar-active.meter-teal { background: #14b8a6; }
.meter-bar-active.meter-blue { background: #3b82f6; }
.meter-bar-active.meter-purple { background: #8b5cf6; }
.meter-bar-active.meter-gray { background: #94a3b8; }
.meter-bar-active.meter-slate { background: #64748b; }

.cell-tip {
  font-size: var(--font-size-base);
  color: #475569;
  line-height: 1.45;
}

.guidance-verdict-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  font-size: var(--font-size-base);
  line-height: 1.5;
}

.guidance-verdict-banner.must_be_accurate {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.guidance-verdict-banner.high_savings {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.guidance-verdict-banner.safe_to_ignore {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.guidance-verdict-banner.verify_paper {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #92400e;
}

.guidance-modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  z-index: 10;
}

.guidance-modal-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Ratings Filter Toolbar */
.ratings-filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: #334155;
}

.ratings-filter-toolbar .filter-title {
  font-weight: 700;
  color: #0f172a;
  font-size: var(--font-size-base);
  margin-right: 0.25rem;
}

.toolbar-rating-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.legend-circle-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: #334155;
  cursor: help;
}

.legend-circle-label {
  font-size: var(--font-size-base);
}

.legend-max-note {
  font-size: var(--font-size-base);
  color: #475569;
  font-weight: 500;
  margin-left: 0.2rem;
}

.toolbar-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.filter-chip {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid #94a3b8;
  color: #334155;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: 600;
}

.filter-chip:hover {
  background: #f1f5f9;
}

.filter-chip.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* Dimming niche / optional fields when filtering */
body.filter-must-only .w2-box:not(.priority-must),
body.filter-must-only .calc-card:not(.priority-must) {
  opacity: 0.35;
  filter: grayscale(40%);
}

body.filter-savers-only .w2-box:not(.priority-saver),
body.filter-savers-only .calc-card:not(.priority-saver) {
  opacity: 0.35;
  filter: grayscale(40%);
}

body.filter-hide-niche .priority-skip {
  opacity: 0.3;
  filter: grayscale(60%);
}

/* Multi-State Return Cards & Allocation Styles */
.state-return-card {
  background: var(--bg-calc-panel);
  border: 1px solid var(--border-calc-panel);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
  position: relative;
}

.state-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.badge-resident {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.badge-nonresident {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-reciprocal {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-shield {
  background: #fdf4ff;
  color: #86198f;
  border: 1px solid #f0abfc;
}

.badge-no-tax {
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.state-note-box {
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 4px;
  font-size: var(--font-size-base);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
}

.state-note-box.reciprocal {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.state-note-box.shield {
  background: #fdf4ff;
  border-color: #f0abfc;
  color: #701a75;
}

.state-note-box.local {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* Grand Total Unified Tax Summary Ledger */
.unified-summary-card {
  background: var(--bg-calc-panel);
  border: 1px solid var(--border-calc-panel);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  position: relative;
}

.unified-ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-base);
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

.unified-ledger-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #0f172a;
}

.unified-ledger-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
  font-size: var(--font-size-base);
}

.unified-ledger-table td.num-col {
  font-family: var(--font-mono);
  font-weight: 600;
}

.unified-ledger-table tr.total-row td {
  border-top: 2px solid #0f172a;
  border-bottom: none;
  font-weight: 700;
  font-size: var(--font-size-base);
  background: #f8fafc;
}

.unified-ledger-table .val-refund {
  color: #15803d;
  font-weight: 700;
  font-family: var(--font-mono);
}

.unified-ledger-table .val-owed {
  color: #c2410c;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Client-Side Local Storage & Privacy Bar
   ========================================================================== */
.storage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.65rem 1rem;
}

.storage-status-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.storage-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
}

.storage-status-text {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: #0f172a;
}

.storage-privacy-badge {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: #475569;
}

.storage-actions-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.storage-btn {
  font-size: var(--font-size-base);
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid #94a3b8;
  color: #0f172a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.storage-btn:hover {
  background: #f1f5f9;
}

.storage-btn.text-danger {
  color: #b91c1c;
  border-color: #fca5a5;
}

.storage-btn.text-danger:hover {
  background: #fef2f2;
}

/* Footer Link Buttons */
.app-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #cbd5e1;
  color: #475569;
  font-size: var(--font-size-base);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-footer-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.footer-link-btn {
  background: none;
  border: none;
  color: #334155;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.footer-link-btn:hover {
  color: #1d4ed8;
}

/* ==========================================================================
   Terms of Service & Advisory Modal Dialog
   ========================================================================== */
.tos-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
}

.tos-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.tos-modal-dialog {
  background: #ffffff;
  border-radius: 8px;
  max-width: 780px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border: 1px solid #94a3b8;
  overflow: hidden;
  position: relative;
}

.tos-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
}

.tos-header-icon {
  font-size: 1.2rem;
  background: #e2e8f0;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tos-badge {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #475569;
}

.tos-title {
  font-size: var(--font-size-header);
  font-weight: 700;
  color: #0f172a;
  margin: 0.1rem 0 0 0;
}

.tos-modal-close-btn {
  background: #e2e8f0;
  border: none;
  border-radius: 4px;
  width: 30px;
  height: 30px;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tos-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: var(--font-size-base);
  color: #334155;
  line-height: 1.5;
}

.tos-intro-callout {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: #1e40af;
  font-size: var(--font-size-base);
}

.tos-intro-callout p {
  margin: 0;
}

.tos-section-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tos-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.85rem 1rem;
}

.tos-card.warning-card {
  border-left: 4px solid #ef4444;
}

.tos-card.privacy-card {
  border-left: 4px solid #16a34a;
  background: #f0fdf4;
}

.tos-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.tos-card-icon {
  font-size: var(--font-size-base);
}

.tos-card-header h4 {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.tos-card p {
  margin: 0;
  font-size: var(--font-size-base);
  color: #475569;
  line-height: 1.5;
}

.tos-modal-footer {
  padding: 0.85rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.tos-agree-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.btn-accept-tos {
  padding: 0.5rem 1.25rem;
  font-size: var(--font-size-base);
  font-weight: 700;
  border-radius: 4px;
  background: #1d4ed8;
  color: #ffffff;
  border: none;
  cursor: pointer;
}

/* ==========================================================================
   Filing Walkthrough CTA & Modal Wizard Styles
   ========================================================================== */
.filing-cta-card {
  background: var(--bg-calc-panel);
  border: 1px solid var(--border-calc-panel);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.filing-cta-desc {
  margin: 0;
  font-size: var(--font-size-base);
  color: #334155;
  line-height: 1.45;
}

.filing-cta-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-lg {
  padding: 0.45rem 0.9rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: 4px;
}

/* Filing Modal Overlay & Dialog */
.filing-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.filing-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.filing-modal-dialog {
  background: #ffffff;
  border-radius: 18px;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  position: relative;
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.filing-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  background: #0f172a;
  color: #ffffff;
}

.filing-header-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.filing-modal-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.filing-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Return Snapshot Strip */
.filing-snapshot-strip {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.snapshot-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.snapshot-label {
  color: #64748b;
  font-weight: 600;
}

.snapshot-value {
  font-weight: 800;
  font-family: var(--font-mono);
  color: #0f172a;
}

.snapshot-value.is-refund {
  color: #16a34a;
}

.snapshot-value.is-owed {
  color: #ea580c;
}

/* Filing Tab Navigation */
.filing-tab-nav {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.4rem 0.65rem 0 0.65rem;
  gap: 0.35rem;
  overflow-x: auto;
}

.filing-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.65rem 1rem;
  font-size: 0.84rem;
  font-weight: 750;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filing-tab-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.filing-tab-btn.active {
  color: #0f172a;
  background: #ffffff;
  border-bottom-color: #10b981;
}

.filing-tab-content-area {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

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

.filing-tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Envelope Cutout Mailing Slip */
.envelope-cutout {
  border: 2px dashed #94a3b8;
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.25rem 0;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.cutout-scissors-label {
  position: absolute;
  top: -10px;
  left: 20px;
  background: #ffffff;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.envelope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.envelope-from {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.4;
}

.envelope-stamp-box {
  width: 58px;
  height: 68px;
  border: 1px dotted #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  text-align: center;
  color: #64748b;
  margin-left: auto;
  border-radius: 4px;
}

.envelope-to-address {
  grid-column: 1 / -1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.5;
  font-family: var(--font-mono);
}

.filing-step-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.filing-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.86rem;
  color: #334155;
}

.filing-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Cheat Sheet Table */
.cheat-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 1rem;
}

.cheat-sheet-table th {
  background: #f1f5f9;
  text-align: left;
  padding: 0.65rem 0.85rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
}

.cheat-sheet-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #e2e8f0;
}

.cheat-sheet-table .td-val {
  font-weight: 800;
  font-family: var(--font-mono);
  color: #0f172a;
  text-align: right;
}

/* e-File Checkout Box */
.efile-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.efile-price-tag {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.efile-price {
  font-size: 1.75rem;
  font-weight: 850;
  color: #0f172a;
}

.efile-price-sub {
  font-size: 0.82rem;
  color: #64748b;
}

.efile-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.efile-input-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.35rem;
}

.efile-input-group input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
}

.efile-simulation-status {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 1rem;
  color: #065f46;
  font-size: 0.85rem;
  display: none;
}

.efile-simulation-status.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

/* Collapsible Cards & Sections */
.btn-minimize-card,
.btn-minimize-section {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  line-height: 1.25;
}

.btn-minimize-card:hover,
.btn-minimize-section:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.calc-card.is-collapsed .card-collapsible-body {
  display: none;
}

.calc-card.is-collapsed {
  padding-bottom: 0.75rem;
}

.calc-card.is-collapsed .input-card-title {
  margin-bottom: 0;
}

section.is-section-collapsed > :not(.section-header-bar) {
  display: none;
}

.sub-advanced-details {
  margin-top: 0.45rem;
  margin-bottom: 0.35rem;
  border-top: 1px dashed #cbd5e1;
  padding-top: 0.35rem;
}

.sub-advanced-details > summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.35rem;
}

.sub-advanced-details > summary:hover {
  color: #0f172a;
}

/* ==========================================================================
   Welcome, About & How To Use Modals + Info Tooltips
   ========================================================================== */
.welcome-terms-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  max-height: 230px;
  overflow-y: auto;
  font-size: 0.86rem;
  color: #334155;
  line-height: 1.5;
  margin-top: 0.75rem;
}

.welcome-terms-box h4 {
  margin: 0.65rem 0 0.25rem 0;
  font-size: 0.9rem;
  color: #0f172a;
}

.welcome-terms-box h4:first-child {
  margin-top: 0;
}

.welcome-terms-box p {
  margin: 0 0 0.45rem 0;
}

.tos-modal-close-btn:disabled,
.btn:disabled {
  background: #cbd5e1 !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
  cursor: not-allowed !important;
  opacity: 0.75;
}

.info-tip-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
}

.info-tip-badge:hover::after,
.info-tip-badge:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: 280px;
  max-width: 75vw;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
  z-index: 1200;
  pointer-events: none;
  white-space: normal;
}

.about-section-block,
.howto-section-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.about-section-block:last-child,
.howto-section-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.about-section-block h4,
.howto-section-block h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.02rem;
  color: #0f172a;
}

.howto-prompt-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #0f172a;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
  margin: 0.5rem 0;
}

.sources-state-list {
  columns: 2;
  column-gap: 1.5rem;
  padding-left: 1.2rem;
  margin: 0.5rem 0 0 0;
  font-size: 0.86rem;
  line-height: 1.65;
}

@media (max-width: 640px) {
  .sources-state-list {
    columns: 1;
  }
}

.inline-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
}

.howto-ratings-panel {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.howto-rating-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.howto-rating-circles {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 98px;
  flex-shrink: 0;
}

.howto-rating-desc {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #1e293b;
}

@media (max-width: 600px) {
  .howto-rating-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

/* ============================================================================
 * REDESIGNED LAYOUT, MENU BAR, PANELS, W-2 GROUPS, CALC BLOCKS & MODALS
 * ============================================================================ */

/* Hide number input increment/decrement spinners everywhere */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Ensure panels and cards sit above unhighlighted arrows (z-index: 1) and below highlighted arrows (z-index: 500) */
.main-content,
.tax-panel,
.calc-card,
.w2-employer-group,
.w2-literal-card {
  position: relative;
  z-index: 2;
}

/* Top Menu Bar */
.header-left-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.menu-bar {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.menu-dropdown {
  position: relative;
}

.menu-bar-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #1e293b;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.menu-bar-btn:hover,
.menu-dropdown.open .menu-bar-btn {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.menu-drafts-bar-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  margin-left: 0.35rem;
  max-width: 220px;
}

.menu-drafts-bar-btn #active-draft-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.menu-caret {
  font-size: 0.72rem;
  opacity: 0.7;
}

.menu-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  padding: 0.35rem;
  z-index: 600;
}

.menu-dropdown-panel.menu-wide {
  min-width: 280px;
}

.menu-dropdown-panel.menu-settings-panel {
  min-width: 250px;
  padding: 0.5rem 0.6rem;
}

.menu-dropdown.open > .menu-dropdown-panel {
  display: block;
}

.menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  color: #0f172a;
  padding: 0.45rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.menu-item:hover {
  background: #f1f5f9;
}

.menu-item.active-draft-item {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}

.menu-item-danger {
  color: #dc2626 !important;
  font-weight: 600;
}

.menu-item-danger:hover {
  background: #fef2f2 !important;
}

.menu-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.35rem 0;
}

.menu-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  padding: 0.25rem 0.55rem;
}

.menu-radio-item,
.menu-check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #0f172a;
  cursor: pointer;
  border-radius: 5px;
}

.menu-radio-item:hover,
.menu-check-item:hover {
  background: #f1f5f9;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #b91c1c;
}

.btn-danger:disabled {
  background: #fca5a5;
  border-color: #fca5a5;
  cursor: not-allowed;
}

/* Consistent Panel Grid & Sizing */
.panels-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .panels-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .panels-grid {
    grid-template-columns: 1fr;
  }
}

.tax-panel {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: 3px solid #2563eb;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.tax-panel.panel-size-sm {
  grid-column: span 1;
  min-height: 225px;
}

.tax-panel.panel-size-lg {
  grid-column: span 2;
  min-height: 225px;
}

.tax-panel.panel-size-full {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .tax-panel.panel-size-lg {
    grid-column: span 1;
  }
}

.panel-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.panel-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin: 0;
}

.panel-top-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.panel-top-actions .field-rating-pill.compact {
  height: 24px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-close-panel {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #64748b;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-close-panel:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.panel-official-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.panel-inputs {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

.panel-inputs {
  position: relative;
  z-index: 4;
}

.panel-multi-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
  align-items: end;
}

.panel-multi-inputs > div {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.panel-input-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.2rem;
}

.panel-short-desc {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.35;
  margin-top: 0.25rem;
}

.btn-more-info {
  align-self: flex-start;
  margin-top: 0.3rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-more-info:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.more-info-icon {
  font-size: 0.85rem;
  color: #2563eb;
}

/* Add Panel Dropdown */
.add-panel-dropdown-wrap {
  position: relative;
}

.add-panel-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  width: 340px;
  max-height: 380px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 0.35rem;
  z-index: 400;
}

.add-panel-dropdown-wrap.open .add-panel-dropdown-menu {
  display: block;
}

.add-panel-option-row {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.5rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  font-family: inherit;
}

.add-panel-option-row:hover {
  background: #f1f5f9;
}

.add-panel-option-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
}

.add-panel-option-sub {
  font-size: 0.72rem;
  color: #64748b;
  display: block;
}

/* Yellow/Orange Max Circle with White '!' */
.rating-circle.circle-attention.circle-att-4.is-max {
  background: #f97316 !important;
  border-color: #ea580c !important;
  color: #ffffff !important;
}

/* 3-Row Info Modal */
.guidance-scorecard-rows {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.scorecard-row {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.55rem;
  min-height: 82px;
}

.scorecard-row-main {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.scorecard-row-main .rating-circle {
  flex-shrink: 0;
  margin-top: 2px;
}

.scorecard-row-tagline {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0f172a;
  flex-shrink: 0;
  width: 175px;
  min-width: 175px;
  max-width: 175px;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.25;
}

.scorecard-row-desc {
  font-size: 0.86rem;
  color: #334155;
  line-height: 1.4;
  flex: 1;
}

.scorecard-row-meter {
  display: flex;
  justify-content: center;
  width: 100%;
}

.scorecard-row-meter .rating-meter {
  max-width: 240px;
  width: 100%;
}

.meter-bar-active.meter-orange {
  background: #f97316;
}

.meter-bar-active.meter-yellow {
  background: #eab308;
}

.modal-field-details {
  border-top: 1px solid #e2e8f0;
  padding-top: 0.85rem;
}

/* Employer W-2 Grouping & Larger Non-Clipping W-2 Overlay */
.w2-employer-group {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.w2-employer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.w2-employer-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.w2-header-circles {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.w2-add-state-bar {
  margin-top: 0.65rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.w2-literal-container {
  max-width: 1120px;
  min-width: 920px;
}

.w2-overlay-box {
  padding: 1px 3px 2px 3px;
}

.w2-overlay-input,
.w2-overlay-select {
  height: 19px;
  font-size: 0.76rem;
  padding: 0 3px;
}

.w2-overlay-input.num {
  padding-left: 12px;
}

.w2-overlay-curr {
  font-size: 0.74rem;
  left: 3px;
}

.w2-overlay-textarea {
  height: calc(100% - 16px);
  font-size: 0.76rem;
  line-height: 1.15;
}

.state-w2-overlay-card {
  border-left: 4px solid #8b5cf6;
  margin-top: 0.65rem;
}

/* State Sections */
.state-group-block {
  margin-bottom: 2.25rem;
}

.state-subsection {
  margin-bottom: 1.75rem;
}

.state-subsection:last-child {
  margin-bottom: 0;
}

.state-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #cbd5e1;
}

.state-group-header h3 {
  font-size: 1.08rem;
  font-weight: 800;
  color: #4c1d95;
  margin: 0;
}

/* Clustered Calculation Cards */
.calc-hint-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  background: #e2e8f0;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.calc-card.calc-clickable {
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.calc-card.calc-clickable:hover {
  border-color: #3b82f6;
}

.calc-card.calc-selected {
  border: 2px solid #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

.calc-lines-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.calc-line-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 0.65rem 0.85rem;
}

.calc-line-item.is-intermediate {
  background: #f8fafc;
  border-style: dashed;
}

.calc-line-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.calc-line-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.irs-line-tag.intermediate-tag {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}

.formula-var {
  display: inline-block;
  font-weight: 700;
  color: #1d4ed8;
  border-bottom: 1.5px dashed #3b82f6;
  padding: 0 2px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.formula-var:hover {
  background: #dbeafe;
}

.formula-var.var-empty {
  color: #94a3b8;
  border-bottom-color: #cbd5e1;
  opacity: 0.65;
}

/* Variable Breakdown Popover */
.var-breakdown-popover {
  position: fixed;
  z-index: 900;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
  padding: 0.65rem 0.75rem;
}

.var-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.45rem;
}

.var-popover-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
}

.var-popover-close {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  color: #64748b;
  cursor: pointer;
}

.var-popover-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 280px;
  overflow-y: auto;
}

.var-contrib-row {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.82rem;
}

.var-contrib-row:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.var-contrib-row.is-unset {
  opacity: 0.55;
  color: #64748b;
}

.var-contrib-sign {
  font-family: var(--font-mono);
  font-weight: 800;
  width: 16px;
  text-align: center;
}

.var-contrib-sign.sign-plus { color: #15803d; }
.var-contrib-sign.sign-minus { color: #dc2626; }
.var-contrib-sign.sign-info { color: #2563eb; }

.var-contrib-label {
  flex: 1;
  font-weight: 600;
}

.var-contrib-amt {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Ensure W-2 overlay boxes and inputs sit above unhighlighted arrows (z-index 3) */
.w2-overlay-box {
  z-index: 4;
}

.w2-literal-card.panel-selected,
.tax-panel.panel-selected {
  border: 2px solid #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

/* Complete W-2 Box Alignment (e, f, 12a-12d, 13, 14a/14b) */
.w2-overlay-box.box-e {
  justify-content: flex-start;
  padding-top: 16px;
}

.w2-overlay-box.box-f {
  left: 16.5%;
  width: 38.1%;
  top: 62.36%;
  height: 10.11%;
  justify-content: center;
  padding: 2px 4px;
}

.w2-overlay-box.box-f .w2-overlay-textarea {
  height: 100%;
  font-size: 0.74rem;
  line-height: 1.15;
}

.w2-overlay-box.box-12 {
  justify-content: flex-start;
  padding: 0;
}

.box-12-rows {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.box-12-row {
  flex: 1;
  display: flex;
  align-items: flex-end;
  padding: 1px 3px 2px 20px;
  gap: 6px;
}

.box-12-code {
  width: 24% !important;
  text-transform: uppercase;
  text-align: center;
  font-weight: 800;
  height: 18px !important;
  font-size: 0.74rem !important;
}

.box-12-amt-wrap {
  flex: 1;
  margin-left: 4px;
}

.box-12-amt-wrap .w2-overlay-input {
  height: 18px !important;
  font-size: 0.74rem !important;
}

.w2-overlay-box.box-13 {
  justify-content: flex-end;
  padding: 1px 4px 3px 4px;
}

.box-13-checks {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  font-size: 0.65rem;
  font-weight: 700;
  color: #0f172a;
}

.box-13-check-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
}

.box-13-check-label input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: #2563eb;
  cursor: pointer;
}

.w2-overlay-box.box-14 {
  justify-content: flex-start;
  padding: 0;
}

.box-14-rows {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.box-14-row-a {
  height: 50%;
  display: flex;
  align-items: flex-end;
  padding: 2px 4px 3px 4px;
}

.box-14-row-b {
  height: 50%;
  display: flex;
  align-items: flex-end;
  padding: 2px 4px 3px 4px;
  gap: 8px;
}

.box-14-row-b .w2-overlay-input {
  flex: 1;
}

/* Unified Single-Box Multi-Line Calculation Formula Layout */
.unified-formula-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.unified-formula-section {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.unified-formula-section + .unified-formula-section {
  border-top: 1px dashed #e2e8f0;
  padding-top: 0.65rem;
}

.unified-formula-label-col {
  width: 185px;
  flex-shrink: 0;
  padding-top: 2px;
}

.unified-formula-label-col .formula-badge {
  white-space: nowrap;
}

.unified-formula-lines-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.unified-formula-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.45;
  flex-wrap: wrap;
}

.unified-formula-eq {
  flex: 1;
  min-width: 240px;
}

@media (max-width: 720px) {
  .unified-formula-section {
    flex-direction: column;
    gap: 0.35rem;
  }
  .unified-formula-label-col {
    width: auto;
  }
}

/* System-Derived Automatic Panels (Read-Only) */
.auto-panel-card {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px dashed #94a3b8;
  border-top: 3px solid #6366f1;
  cursor: pointer;
}

.auto-panel-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
}

.auto-panel-amount-display {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0.35rem 0 0.25rem;
  font-variant-numeric: tabular-nums;
}

.auto-panel-formula {
  font-size: 0.76rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #475569;
  background: #f1f5f9;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}



