/* Australian Salary / PAYG Calculator - component stylesheet.
   Loaded inside the <aus-pay-calculator> shadow root and by the print popup.
   @font-face lives in the host document (injected by the component script),
   because font faces declared inside a shadow stylesheet are ignored. */

:host, :root {
  --primary: #0B84D8;
  --primary-hover: #096EB5;
  --primary-light: #EBF5FF;
  --primary-focus: rgba(11, 132, 216, 0.2);
  
  --accent: #10B981;
  --accent-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;

  --bg-page: #F8FAFC;
  --card-bg: #FFFFFF;
  --card-border: #E2E8F0;
  --card-border-focus: #CBD5E1;
  --card-hover: #F1F5F9;

  /* High contrast text hierarchy */
  --text-main: #0F172A;       /* Slate 900 */
  --text-muted: #334155;      /* Slate 700 - WCAG AAA */
  --text-subtle: #64748B;     /* Slate 500 */
  --text-inverse: #FFFFFF;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.06);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 14px;
}

:host([data-theme="dark"]), :root[data-theme="dark"] {
  --bg-page: #0B1329;
  --card-bg: #131F37;
  --card-border: #243452;
  --card-border-focus: #3B537A;
  --card-hover: #1A2944;

  --text-main: #F8FAFC;
  --text-muted: #E2E8F0;
  --text-subtle: #94A3B8;

  --primary-light: rgba(11, 132, 216, 0.18);
  --accent-light: rgba(16, 185, 129, 0.18);
  --warning-light: rgba(245, 158, 11, 0.18);
  --danger-light: rgba(239, 68, 68, 0.18);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
}

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

:host {
  display: block;
  font-family: var(--font-sans);
  color: var(--text-main);
  font-size: 0.88rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  font-size: 0.88rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: 1.25rem 0 3rem;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  font-size: 1.5rem;
  background: var(--primary-light);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.brand-titles h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-titles p {
  font-size: 0.78rem;
  color: var(--text-subtle);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-main);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-pill:hover {
  background: var(--card-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* Print / PDF button hidden for now - remove this rule to re-enable it. */
#printBtn { display: none; }


/* Calculator Grid */
.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 1.5rem;
  align-items: start;
}

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

/* Rounded Card Container */
.calc-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
}

.calc-card:last-child {
  margin-bottom: 0;
}

/* Card Header with FY Badge */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.35rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--card-border);
}

.card-title-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-icon {
  font-size: 1.1rem;
}

.card-title-text h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.fy-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 1px solid rgba(11, 132, 216, 0.25);
}

/* Form Section / Spacing */
.form-section {
  margin-bottom: 1.25rem;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Input Fields & Selects */
.select-wrapper {
  position: relative;
}

.form-select {
  width: 100%;
  height: 42px;
  padding: 0 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
  background: var(--card-bg);
}

/* Currency Input (AUD) */
.currency-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 0.9rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-muted);
  pointer-events: none;
}

.currency-badge {
  position: absolute;
  right: 0.75rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-subtle);
  background: var(--card-border);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  pointer-events: none;
}

.form-input {
  width: 100%;
  height: 42px;
  padding: 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-sans);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  color: var(--text-main);
  transition: all 0.15s ease;
}

.form-input.with-currency {
  padding-left: 1.95rem;
  padding-right: 3.25rem;
}

.form-input::placeholder {
  color: #94A3B8;
  font-weight: 500;
  font-size: 0.86rem;
  opacity: 1;
}

:host([data-theme="dark"]) .form-input::placeholder,
:root[data-theme="dark"] .form-input::placeholder {
  color: #64748B;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
  background: var(--card-bg);
}

/* Segmented Control Groups */
.segmented-control {
  display: grid;
  gap: 0.3rem;
  background: var(--bg-page);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--card-border);
  min-height: 40px;
  align-items: stretch;
}

.frequency-segmented {
  grid-template-columns: repeat(4, 1fr);
}

.super-segmented {
  grid-template-columns: repeat(2, 1fr);
}

.residency-segmented {
  grid-template-columns: repeat(3, 1fr);
}

.medicare-segmented {
  grid-template-columns: repeat(3, 1fr);
}

.segmented-btn,
.segmented-label {
  height: 100%;
  min-height: 34px;
  padding: 0 0.4rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  user-select: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.segmented-label input[type="radio"] {
  display: none;
}

.segmented-btn:hover,
.segmented-label:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

:host([data-theme="dark"]) .segmented-btn:hover,
:host([data-theme="dark"]) .segmented-label:hover,
:root[data-theme="dark"] .segmented-btn:hover,
:root[data-theme="dark"] .segmented-label:hover {
  background: rgba(255, 255, 255, 0.06);
}

.segmented-btn.active,
.segmented-label:has(input[type="radio"]:checked) {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Helper Text */
.residency-helper-text {
  font-size: 0.76rem;
  color: var(--text-subtle);
  margin-top: 0.45rem;
  font-weight: 500;
  line-height: 1.35;
}

.input-helper-text {
  font-size: 0.74rem;
  color: var(--text-subtle);
  margin-top: 0.35rem;
  font-weight: 500;
}

/* Custom Super Rate Sub-Section */
.custom-super-wrapper {
  margin-top: 0.65rem;
}

.sub-checkbox {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.conditional-field {
  margin-top: 0.55rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-page);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.salary-sacrifice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.mini-toggle-group {
  display: inline-flex;
  background: var(--card-border);
  padding: 2px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.mini-toggle-btn {
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: flex;
  align-items: center;
}

.mini-toggle-btn input {
  display: none;
}

.mini-toggle-btn.active {
  background: var(--bg-card);
  color: var(--primary-accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.sub-field-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0;
}

.percent-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 140px;
}

.percent-suffix {
  position: absolute;
  right: 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.form-input.sub-input {
  height: 36px;
  font-size: 0.88rem;
}

/* Checkbox Groups & Custom Checkbox Styling */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.custom-check-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--card-border);
  border-radius: 4px;
  background: var(--bg-page);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .custom-check-box {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .custom-check-box::after {
  content: "✓";
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 900;
}

.checkbox-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Info Tooltips */
.info-tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.info-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.7;
  padding: 0.2rem;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
}

.info-icon-btn:hover {
  opacity: 1;
}

.tooltip-popover {
  visibility: hidden;
  opacity: 0;
  width: 220px;
  background: var(--text-main);
  color: var(--text-inverse);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  position: absolute;
  z-index: 50;
  bottom: 125%;
  right: 0;
  box-shadow: var(--shadow-md);
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.tooltip-popover::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 8px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--text-main) transparent transparent transparent;
}

.info-tooltip-wrapper:hover .tooltip-popover,
.info-tooltip-wrapper:focus-within .tooltip-popover {
  visibility: visible;
  opacity: 1;
}

/* Advanced Options Accordion */
.advanced-section-wrap {
  border-top: 1px solid var(--card-border);
  padding-top: 1rem;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0;
  text-align: left;
}

.accordion-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary);
}

.chevron-icon {
  font-size: 1rem;
  color: var(--primary);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-header[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.accordion-content {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeIn 0.25s ease;
}

.sub-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sub-helper-text {
  font-size: 0.74rem;
  color: var(--text-subtle);
  margin-left: 1.65rem;
  line-height: 1.35;
}

/* ---------------------------------------------------- */
/* Right Column: Results, Hero Card & Tables */
/* ---------------------------------------------------- */

.hero-card {
  background: linear-gradient(135deg, #0B84D8 0%, #0862A0 100%);
  color: #FFFFFF;
  border: none;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.hero-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.95;
}

.hero-amount {
  font-size: 2.25rem;
  font-weight: 800;
  margin: 0.25rem 0 0.85rem;
  letter-spacing: -0.03em;
  font-family: var(--font-sans);
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.hero-stat-card .stat-name {
  font-size: 0.72rem;
  opacity: 0.9;
  display: block;
  font-weight: 600;
}

.hero-stat-card .stat-value {
  font-size: 1.02rem;
  font-weight: 800;
}

/* Pay Distribution Meter */
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
}

.tax-visual-meter {
  margin: 0.5rem 0 0.25rem;
}

.meter-bar {
  height: 14px;
  background: var(--bg-page);
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
  border: 1.5px solid var(--card-border);
}

.meter-segment {
  height: 100%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.meter-segment.net { background: #10B981; }
.meter-segment.tax { background: #EF4444; }
.meter-segment.help { background: #F59E0B; }

.meter-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.legend-item {
  display: inline-flex;
  align-items: center;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.35rem;
}

.dot-net { background: #10B981; }
.dot-tax { background: #EF4444; }
.dot-help { background: #F59E0B; }

/* Multi-Frequency Table */
.table-responsive {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.pay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.pay-table th, 
.pay-table td {
  padding: 0.55rem 0.65rem;
  text-align: right;
  border-bottom: 1px solid var(--card-border);
}

.pay-table th:first-child,
.pay-table td:first-child {
  text-align: left;
  font-weight: 700;
}

.pay-table th {
  background: var(--bg-page);
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pay-table tr.highlight-row {
  background: var(--primary-light);
  font-weight: 800;
}

.pay-table tr.highlight-row td {
  color: var(--primary);
  font-size: 0.92rem;
  border-top: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
}

.pay-table tr:hover:not(.highlight-row) {
  background: var(--card-hover);
}

/* Tag Badges */
.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.tag-badge.success {
  background: var(--accent-light);
  color: var(--accent);
}

/* ATO Formula Inspector */
.formula-card {
  background: var(--bg-page);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-top: 0.4rem;
}

.formula-code {
  font-family: var(--font-mono);
  background: var(--card-bg);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  display: block;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.82rem;
}

.formula-details-text {
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-top: 0.45rem;
  line-height: 1.4;
}

/* Reconciliation Card */
.recon-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-top: 0.4rem;
  background: var(--bg-page);
  border: 1.5px solid var(--card-border);
}

.recon-box.refund { border-left: 4px solid var(--accent); }
.recon-box.owing { border-left: 4px solid var(--warning); }

.recon-amount {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.recon-amount.refund { color: var(--accent); }
.recon-amount.owing { color: var(--warning); }

.recon-breakdown {
  font-size: 0.76rem;
  color: var(--text-subtle);
  margin-top: 0.2rem;
}

/* ---------------------------------------------------- */
/* Print & PDF Report Layout (Polished A4 Portrait Style) */
/* ---------------------------------------------------- */

.print-only {
  display: none !important;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 14mm 16mm;
  }

  *, *::before, *::after {
    color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #FFFFFF !important;
    color: #0F172A !important;
    font-size: 8.5pt !important;
    line-height: 1.3 !important;
    padding: 0 !important;
    margin: 0 !important;
    -webkit-print-color-adjust: exact !important;
  }

  .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Hide interactive screen UI */
  .app-header,
  .calculator-grid,
  .inputs-column,
  .results-column,
  .btn-pill,
  button,
  input,
  select {
    display: none !important;
  }

  /* Show Print Report */
  .print-only {
    display: block !important;
  }

  .print-report-container {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #FFFFFF !important;
  }

  /* 1. Print Header */
  .print-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 6px !important;
  }

  .print-brand {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .print-logo {
    font-size: 24pt !important;
    line-height: 1 !important;
  }

  .print-brand-titles {
    display: flex !important;
    flex-direction: column !important;
  }

  .print-title {
    font-size: 15pt !important;
    font-weight: 800 !important;
    color: #0F172A !important;
    margin: 0 !important;
    line-height: 1.15 !important;
    letter-spacing: -0.01em !important;
  }

  .print-subtitle {
    font-size: 8pt !important;
    font-weight: 600 !important;
    color: #64748B !important;
    margin: 0 !important;
  }

  .print-meta {
    text-align: right !important;
  }

  .print-badge {
    background: #EBF5FF !important;
    color: #0B84D8 !important;
    padding: 2px 9px !important;
    border-radius: 9999px !important;
    font-size: 7.5pt !important;
    font-weight: 800 !important;
    border: 1px solid #BAE6FD !important;
    display: inline-block !important;
    margin-bottom: 2px !important;
  }

  .print-date {
    font-size: 7.5pt !important;
    color: #94A3B8 !important;
    font-weight: 600 !important;
  }

  .print-header-divider {
    height: 2px !important;
    background: #0B84D8 !important;
    margin: 6px 0 9px 0 !important;
  }

  /* Print Cards */
  .print-card {
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 7px !important;
    padding: 8px 12px !important;
    margin-bottom: 7px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .print-card-title {
    font-size: 8.8pt !important;
    font-weight: 800 !important;
    color: #0F172A !important;
    margin-bottom: 5px !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  /* 2. Section 1: Hero Card */
  .print-hero-card {
    background: #F8FAFC !important;
    border: 1.5px solid #0B84D8 !important;
    padding: 10px 14px !important;
  }

  .print-hero-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 6px !important;
    margin-bottom: 6px !important;
    border-bottom: 1px solid #E2E8F0 !important;
  }

  .print-hero-label {
    font-size: 8pt !important;
    font-weight: 800 !important;
    color: #0B84D8 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
  }

  .print-hero-sublabel {
    font-size: 7pt !important;
    color: #64748B !important;
    font-weight: 500 !important;
    margin-top: 1px !important;
  }

  .print-hero-amount {
    font-size: 26pt !important;
    font-weight: 900 !important;
    color: #0B84D8 !important;
    letter-spacing: -0.03em !important;
    line-height: 1 !important;
    font-family: var(--font-sans) !important;
  }

  .print-hero-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0 !important;
    align-items: baseline !important;
  }

  .print-hero-stat {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 8px !important;
    border-right: 1px solid #E2E8F0 !important;
  }

  .print-hero-stat:first-child {
    padding-left: 0 !important;
  }

  .print-hero-stat:last-child {
    border-right: none !important;
    padding-right: 0 !important;
  }

  .print-stat-label {
    font-size: 6.8pt !important;
    color: #64748B !important;
    font-weight: 600 !important;
    margin-bottom: 2px !important;
    white-space: nowrap !important;
  }

  .print-stat-val {
    font-size: 10pt !important;
    font-weight: 800 !important;
    color: #0F172A !important;
    line-height: 1.1 !important;
  }

  /* 3. Section 2: Distribution */
  .print-meter-bar {
    height: 14px !important;
    background: #F1F5F9 !important;
    border-radius: 9999px !important;
    overflow: hidden !important;
    display: flex !important;
    border: 1px solid #CBD5E1 !important;
    margin: 4px 0 5px 0 !important;
  }

  .print-meter-segment {
    height: 100% !important;
  }

  .print-meter-segment.net { background: #10B981 !important; }
  .print-meter-segment.tax { background: #F59E0B !important; }

  .print-legend-row {
    display: flex !important;
    justify-content: flex-start !important;
    gap: 20px !important;
    font-size: 7.5pt !important;
    font-weight: 700 !important;
  }

  .print-legend-item {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  .legend-dot.dot-net { background: #10B981 !important; }
  .legend-dot.dot-tax { background: #F59E0B !important; }
  .legend-dot.dot-super { background: #8B5CF6 !important; }

  /* 4. Section 3: Multi-Frequency Table */
  .print-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 7.5pt !important;
  }

  .print-table th, 
  .print-table td {
    padding: 3.5px 6px !important;
    text-align: right !important;
    border-bottom: 1px solid #E2E8F0 !important;
  }

  .print-table th:first-child,
  .print-table td:first-child {
    text-align: left !important;
    font-weight: 700 !important;
  }

  .print-table th {
    background: #0B84D8 !important;
    font-weight: 800 !important;
    color: #FFFFFF !important;
    text-transform: uppercase !important;
    font-size: 7pt !important;
    letter-spacing: 0.03em !important;
  }

  .print-table tbody tr:nth-child(even) td {
    background: #F8FAFC !important;
  }

  .print-table tr.highlight-row td {
    background: #EBF5FF !important;
    color: #0B84D8 !important;
    font-weight: 800 !important;
    border-top: 1.5px solid #0B84D8 !important;
    border-bottom: 1.5px solid #0B84D8 !important;
  }

  .print-table tr.super-row td {
    background: #F5F3FF !important;
    color: #6D28D9 !important;
    font-weight: 700 !important;
  }

  /* Two Column Grid */
  .print-two-col-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-bottom: 7px !important;
  }

  .print-two-col-grid .print-card {
    margin-bottom: 0 !important;
  }

  /* 5. Section 4: Key Val List */
  .print-key-val-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
  }

  .print-kv-row {
    display: flex !important;
    justify-content: space-between !important;
    font-size: 7.5pt !important;
    padding: 2px 0 !important;
    border-bottom: 1px dashed #E2E8F0 !important;
  }

  .print-kv-row.total {
    border-top: 1.5px solid #0F172A !important;
    border-bottom: none !important;
    padding-top: 4px !important;
    margin-top: 2px !important;
    font-weight: 800 !important;
    font-size: 8pt !important;
  }

  .tax-total-orange {
    color: #D97706 !important;
    font-size: 8.5pt !important;
    font-weight: 900 !important;
  }

  /* 6. Section 5: Reconciliation */
  .print-recon-box {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 5px 8px !important;
    border-radius: 6px !important;
    background: #F8FAFC !important;
    border: 1px solid #E2E8F0 !important;
    margin-bottom: 4px !important;
  }

  .print-recon-box.refund {
    border-left: 4px solid #10B981 !important;
    background: #F0FDF4 !important;
  }

  .print-recon-box.owing {
    border-left: 4px solid #F59E0B !important;
    background: #FFFBEB !important;
  }

  .print-recon-status {
    font-weight: 800 !important;
    font-size: 7.5pt !important;
    color: #0F172A !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  .status-icon {
    font-weight: 900 !important;
  }

  .print-recon-box.refund .status-icon { color: #059669 !important; }
  .print-recon-box.owing .status-icon { color: #D97706 !important; }

  .print-recon-amount {
    font-size: 10.5pt !important;
    font-weight: 900 !important;
    font-family: var(--font-mono) !important;
  }

  .print-recon-box.refund .print-recon-amount { color: #059669 !important; }
  .print-recon-box.owing .print-recon-amount { color: #D97706 !important; }

  .print-recon-details {
    font-size: 7pt !important;
    color: #64748B !important;
    font-weight: 600 !important;
    margin-bottom: 2px !important;
  }

  .print-disclaimer {
    font-size: 6.5pt !important;
    color: #94A3B8 !important;
    line-height: 1.2 !important;
    margin-top: 3px !important;
    font-style: italic !important;
  }

  /* 7. Section 6: Assumptions Grid */
  .print-assumptions-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0 16px !important;
  }

  .print-assump-col {
    display: flex !important;
    flex-direction: column !important;
  }

  .print-assump-item {
    font-size: 7.4pt !important;
    display: flex !important;
    justify-content: space-between !important;
    padding: 2px 0 !important;
    border-bottom: 1px dotted #E2E8F0 !important;
  }

  .print-assump-item span {
    color: #64748B !important;
    font-weight: 500 !important;
  }

  .print-assump-item strong {
    color: #0F172A !important;
    font-weight: 700 !important;
  }

  /* 8. Print Footer */
  .print-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 6.8pt !important;
    color: #94A3B8 !important;
    border-top: 1px solid #E2E8F0 !important;
    padding-top: 5px !important;
    margin-top: 5px !important;
  }

  .footer-left { text-align: left !important; }
  .footer-center { text-align: center !important; }
  .footer-right { text-align: right !important; font-weight: 700 !important; }
}

/* =====================================================================
   Accessibility
   Native radios/checkboxes were hidden with display:none, which removed
   them from keyboard focus and the accessibility tree. Visually hide them
   instead (still focusable) and paint a focus ring on the visible proxy.
   ===================================================================== */
.checkbox-label input[type="checkbox"],
.segmented-label input[type="radio"],
.mini-toggle-btn input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.segmented-label:has(input[type="radio"]:focus-visible),
.mini-toggle-btn:has(input[type="radio"]:focus-visible),
.checkbox-label input[type="checkbox"]:focus-visible + .custom-check-box {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-pill:focus-visible,
.info-icon-btn:focus-visible,
.accordion-header:focus-visible,
.form-select:focus-visible,
.form-input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

/* Disclaimer card */
.disclaimer-card {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-subtle);
}

.disclaimer-card p {
  margin: 0 0 0.5rem;
}

.disclaimer-card p:last-child {
  margin-bottom: 0;
}

.disclaimer-card strong {
  color: var(--text-muted);
}

.disclaimer-card a {
  color: var(--primary);
}

.disclaimer-card abbr {
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  cursor: help;
}

/* =====================================================================
   UI refinement — section intros, toggle switches, tax-status field
   ===================================================================== */

/* One-line explainer under a section label */
.section-intro {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--text-subtle);
  margin: -0.15rem 0 0.75rem;
}

/* iOS-style toggle switch. Markup:
   <label class="toggle">
     <input type="checkbox">
     <span class="toggle-track"></span>
     <span class="toggle-body">
       <span class="toggle-text">Label</span>
       <span class="toggle-sub">optional helper</span>
     </span>
   </label> */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.toggle {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: start;
  column-gap: 0.7rem;
  cursor: pointer;
  user-select: none;
}

.toggle input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--card-border);
  transition: background 0.18s ease;
  flex-shrink: 0;
  margin-top: 1px;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.toggle input:checked + .toggle-track {
  background: var(--primary);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.toggle input:disabled + .toggle-track {
  opacity: 0.45;
}

.toggle-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-top: 0.05rem;
}

.toggle-text {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
}

.toggle-sub {
  font-size: 0.73rem;
  line-height: 1.35;
  color: var(--text-subtle);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-row .info-tooltip-wrapper {
  margin-left: auto;
}

/* Sub-toggle (nested, e.g. custom super rate) sits tighter */
.sub-toggle {
  margin-top: 0.6rem;
}

.sub-toggle .toggle-text {
  font-size: 0.8rem;
  font-weight: 600;
}

/* Dim a whole section when it doesn't apply to the chosen tax status */
.form-section.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Presentation only: existing controls, states and print stylesheet are preserved. */
@media screen {
:host{--primary:#047857;--primary-hover:#065f46;--primary-light:#e5f3ec;--primary-focus:rgba(4,120,87,.2);--bg-page:#e6f0ed;--card-border:#d6e3dc;--card-border-focus:#8cad9c;--card-hover:#f1f6f3;--radius-lg:16px;--shadow-card:0 8px 28px -16px rgba(18,60,43,.15)}
:host([data-theme="dark"]){--primary:#34d399;--primary-hover:#6ee7b7;--primary-light:#203b30;--bg-page:#14221f;--card-bg:#1a2d26;--card-border:#34483f;--card-border-focus:#608573;--card-hover:#233b30}
.app-header{padding:8px 0 24px;margin-bottom:28px;gap:18px}.brand-titles h1{font-size:clamp(22px,2.8vw,32px);letter-spacing:-.04em;line-height:1.25}.brand-titles p{margin-top:6px;line-height:1.6}.brand-logo{border-radius:12px;width:48px;height:48px}.calc-card{box-shadow:var(--shadow-card)}.btn-pill{min-height:40px;padding:9px 15px}.form-select,.form-input{min-height:44px}.fy-badge{border-color:var(--card-border)}
@media(max-width:600px){.app-header{align-items:flex-start}.brand-titles h1{font-size:23px}.calc-card{padding:20px}.header-actions{margin-left:auto}}
}
/* Emerald result panel and light-only calculator presentation. */
@media screen { .hero-card { background: linear-gradient(135deg, #047857 0%, #065f46 100%); } #themeToggleBtn { display: none; } }

@media screen and (max-width:760px){input.form-input,select.form-select{font-size:16px}.container{padding-left:20px;padding-right:20px}.calculator-grid>*{min-width:0}}
