/* Base styles for heading classes */
.h1, .h2, .h3, .h4, .h5, .h6 {
    display: block;
    font-weight: bold;
    margin-top: 0;
}
.h1 { font-size: 2em; margin-bottom: 0.67em; }
.h2 { font-size: 1.5em; margin-bottom: 0.83em; }
.h3 { font-size: 1.17em; margin-bottom: 1em; }
.h4 { font-size: 1em; margin-bottom: 1.33em; }
.h5 { font-size: 0.83em; margin-bottom: 1.67em; }
.h6 { font-size: 0.67em; margin-bottom: 2.33em; }

/* === CSS Variables - Modern Design System === */
:root {
  --primary: #0f172a; /* Slate 900 */
  --primary-light: #1e293b;
  --accent: #ef3b43; /* Blue 600 */
  --bg-soft: #f8fafc;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-sub: #64748b;
  --success: #5ebb46;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* === Main Calculator Wrapper === */
.ctc-wrapper {
  font-family: 'Verdana', -apple-system, BlinkMacSystemFont, sans-serif;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px;
  background: #fff;
  color: var(--text-main);
  min-height: 800px;
  contain: layout;
}

.ctc-wrapper * {
  box-sizing: border-box;
}
/* === Calculator Header === */
/* Header */
.ctc-header {
  text-align: center;
  margin-bottom: 50px;
}

.ctc-header p.h2 {
  margin: 0 0 24px 0;
  color: var(--primary);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
/* === Toggle Switch - Premium Sleek === */
.ctc-mode-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #f0f4f9;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
}

.ctc-switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 30px;
  margin: 0 8px;
}

.ctc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ctc-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #e2e8f0;
  transition: background 0.4s ease;
  border-radius: 999px;
}

.ctc-slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

input:checked + .ctc-slider {
  background: #2563eb;
}

input:checked + .ctc-slider:before {
  transform: translateX(26px) translateY(-50%);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.ctc-toggle-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-sub);
    padding: 6px 12px;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

/* === Form Controls ===*/
.ctc-controls-wrapper {
  display: flex;
  justify-content: center;
}
.ctc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 40px;
  padding: 24px;
  background: #5ebb46;
  border-radius: var(--radius);
  border: 1px solid #3da599;
  color: #fff;
  min-width: 50%;
}

.ctc-form-group {
  flex: 1;
  min-width: 250px;
}

.ctc-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ctc-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  color: #0f172a;
  transition: all 0.2s;
  font-weight: 500;
}

.ctc-input option {
  color: #0f172a;
  background: #fff;
}

.ctc-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.ctc-checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 28px;
}

.ctc-checkbox-group input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ctc-checkbox-group label {
  margin-bottom: 0;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
  text-transform: none;
}

/* === Grid Layout === */
.ctc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
  contain: layout style;
  position: relative;
}

.ctc-person-column p.h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ctc-person-column p.h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background: var(--accent);
    border-radius: 2px;
}

.ctc-person-column.hidden {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* === Accordion Components === */
.ctc-accordion-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
}

.ctc-accordion-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    background: var(--bg-soft);
    transition: background 0.2s;
}

.ctc-accordion-toggle:hover {
    background: #f1f5f9;
}

.ctc-accordion-header-content {
    display: flex;
    flex-direction: column;
}

.ctc-accordion-title {
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.2rem;
}

.ctc-accordion-total {
    font-size: 0.85rem;
    color: var(--text-sub);
    margin-top: 2px;
}

.ctc-chevron {
    color: var(--text-sub);
    transition: transform 0.2s;
}

.ctc-chevron.expanded {
    transform: rotate(180deg);
}

.ctc-accordion-content {
    max-height: 1000px;
    transition: max-height 0.3s ease-in-out, opacity 0.3s;
    opacity: 1;
}

.ctc-accordion-content.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.ctc-accordion-inner {
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* === Form Fields === */
.ctc-field {
  margin-bottom: 16px;
}

.ctc-field-with-toggle {
  margin-bottom: 16px;
}

.ctc-field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* .ctc-field-label-row label:first-child {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 0;
} */

.ctc-ei-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-sub);
}

.ctc-ei-checkbox {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ctc-ei-label {
  font-weight: 500;
  white-space: nowrap;
}

.ctc-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-sub);
  font-weight: 500;
}

/* === Tooltip Component === */
.ctc-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  color: #94a3b8;
  transition: color 0.2s;
}

.ctc-tooltip:hover {
  color: #64748b;
}

.ctc-tooltip svg {
  display: block;
}

.ctc-tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
  width: 220px;
  text-align: center;
  z-index: 100;
  transition: opacity 0.2s, visibility 0.2s;
}

.ctc-tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #fff;
}

.ctc-tooltip-text::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top-color: #e2e8f0;
}

.ctc-tooltip:hover .ctc-tooltip-text {
  visibility: visible;
  opacity: 1;
}

.ctc-input-wrapper {
  position: relative !important;
  display: block !important;
}

.ctc-input-symbol {
  position: absolute !important;
  left: 14px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: #94a3b8 !important;
  font-weight: 400 !important;
  font-size: 0.95rem !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

.ctc-input-field {
  width: 100% !important;
  padding: 12px 16px 12px 42px !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  font-size: 1rem !important;
  transition: all 0.2s !important;
  background: #fff !important;
  color: var(--text-main) !important;
  box-sizing: border-box !important;
}

.ctc-input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  outline: none;
}

/* === Results Section === */
.ctc-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  background: transparent;
  padding: 0;
}

/* === Layout Components === */
.ctc-inputs-wrapper {
  position: relative;
  min-height: 500px;
  contain: layout;
}

/* === Responsive Layout - Desktop === */
@media (min-width: 800px) {
  .ctc-inputs-wrapper.single-person-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
  }

  .ctc-inputs-wrapper.single-person-layout .ctc-grid {
    flex: 0.5;
  }

  .ctc-results.single-person {
    flex: 1;
  }

  .ctc-results.single-person .ctc-result-card {
    padding-top: 16px;
  }

  .ctc-results.single-person .ctc-result-header {
    font-size: 1.5rem;
    margin-bottom: 24px;
  }
}

/* === Tablet Layout === */
@media (max-width: 799px) {
  .ctc-inputs-wrapper.single-person-layout {
    display: block;
  }

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

  .ctc-results {
    grid-template-columns: 1fr;
    margin-top: 24px;
  }
}

/* === Calculation Details === */
.ctc-calculation-details-container {
  margin-top: 30px;
}

.ctc-calculation-details-container:empty {
  display: none;
  margin-top: 0;
}

/* === Disclaimer Note === */
.ctc-disclaimer-note {
  margin-top: 24px;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border-radius: 8px;
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}

/* === Responsive Display Classes === */
.ctc-mobile-only {
  display: none;
}

.ctc-desktop-only {
  display: block;
}

@media (max-width: 991px) {
  .ctc-mobile-only {
    display: block;
  }

  .ctc-desktop-only {
    display: none;
  }
}

.ctc-details-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.ctc-details-card .ctc-calculation-details {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.ctc-details-card .ctc-result-header {
  margin-bottom: 16px;
}

.ctc-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
}

.ctc-result-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.ctc-result-header {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ctc-result-header::before {
  content: '';
  display: block;
  width: 4px;
  height: 24px;
  background: var(--accent);
  border-radius: 2px;
}

/* === Statistics Display === */
.ctc-top-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 70px;
  margin-bottom: 10px;
}

.ctc-big-stat {
  display: flex;
  flex-direction: column;
  grid-column: span 2;
}

.ctc-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-sub);
  margin-bottom: 6px;
  font-weight: 700;
}

.ctc-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-main);
}

.ctc-big-stat .ctc-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}

@media (min-width: 1100px) {
  .ctc-big-stat .ctc-value {
    font-size: 2.2rem;
  }

  .ctc-label {
    font-size: 0.85rem;
  }
}

.ctc-sub-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ctc-sub-stat {
  display: flex;
  flex-direction: column;
}

.ctc-rate-caveat {
  font-size: 0.65rem;
  color: var(--text-sub);
  vertical-align: super;
  margin-left: 1px;
}

.ctc-rate-caveats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding-left: 2px;
}

.ctc-caveat-text {
  font-size: 0.65rem;
  color: var(--text-sub);
  font-style: italic;
}

.ctc-disclaimers {
  margin-top: 24px;
  padding: 16px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--teal);
  font-size: 0.75rem;
  color: var(--text-sub);
  line-height: 1.5;
}

.ctc-disclaimers p {
  margin: 0 0 8px 0;
}

.ctc-disclaimers ul {
  margin: 8px 0;
  padding-left: 20px;
}

.ctc-disclaimers li {
  margin-bottom: 4px;
}

.ctc-disclaimer-final {
  margin-top: 12px !important;
  font-style: italic;
  color: #6c757d;
}

/* === Note Positioning === */
.ctc-note-inline {
  grid-column: 1 / -1;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--teal);
  font-size: 0.75rem;
  color: var(--text-sub);
  line-height: 1.5;
  margin-top: 16px;
  min-height: 60px;
  will-change: opacity;
  transition: opacity 0.2s ease;
  display: block;
}

.ctc-note-inline p {
  margin: 0;
}

/* Note positioning - below (shown on mobile below calc details) */
.ctc-note-below {
  display: block;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--teal);
  font-size: 0.75rem;
  color: var(--text-sub);
  line-height: 1.5;
  margin-top: 16px;
}

.ctc-note-below p {
  margin: 0;
}

/* === Note Display Logic === */
@media (min-width: 992px) {
  .ctc-note-inline {
    display: block;
    opacity: 1;
    visibility: visible;
  }
  .ctc-note-below {
    display: block;
  }
}

/* === Mobile Layout === */
@media (max-width: 991px) {
  .ctc-note-inline {
    display: block;
  }
  .ctc-note-below {
    display: block;
  }
}

/* === Partner Mode Adjustments === */
.ctc-wrapper.has-partner .ctc-note-inline {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
}

.ctc-wrapper.has-partner .ctc-note-below {
  display: block;
}

.ctc-sub-stat .ctc-label {
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.ctc-sub-stat .ctc-value {
  font-size: 1.3rem;
}

.ctc-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* === Pie Chart Visualization === */
.ctc-pie-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
  margin: 12px 0;
}
@media (max-width: 768px) {
  .ctc-pie-container {
    flex-direction: column;
    gap: 12px;
  }
}

.ctc-pie-chart {
  width: 130px;
  height: 130px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.ctc-pie-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ctc-pie-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
}

.ctc-pie-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ctc-pie-legend-label {
  color: var(--text-sub);
  font-weight: 500;
  min-width: 60px;
}

.ctc-pie-legend-pct {
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.8rem;
}

/* Solo mode - bigger pie chart when no partner */
.ctc-pie-container-solo .ctc-pie-chart {
  width: 180px;
  height: 180px;
}

.ctc-pie-container-solo .ctc-pie-legend-item {
  font-size: 0.85rem;
}

.ctc-pie-container-solo .ctc-pie-legend-label {
  min-width: 80px;
}

@media (min-width: 1100px) {
  .ctc-pie-chart {
    width: 150px;
    height: 150px;
  }

  .ctc-pie-container-solo .ctc-pie-chart {
    width: 220px;
    height: 220px;
  }

  .ctc-pie-legend-item {
    font-size: 0.85rem;
  }

  .ctc-pie-legend-label {
    min-width: 80px;
  }

  .ctc-pie-container-solo .ctc-pie-legend-item {
    font-size: 0.95rem;
  }

  .ctc-pie-container-solo .ctc-pie-legend-label {
    min-width: 90px;
  }
}

.ctc-breakdown-section {
  margin-top: 20px;
}

.ctc-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ctc-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-sub);
}

.ctc-section-total {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.ctc-breakdown-table {
  font-size: 0.95rem;
}

.ctc-table-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  color: var(--text-sub);
  font-weight: 500;
}

.ctc-table-row span:last-child {
    color: var(--text-main);
    font-weight: 600;
}

.ctc-breakdown-item {
  font-size: 0.85rem;
  color: #78909c;
  font-weight: 400;
}

.ctc-breakdown-item span:last-child {
    color: #546e7a;
}

.ctc-table-row.highlight {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px dashed var(--border);
  font-weight: 700;
  font-size: 1.1rem;
}

.text-green { color: var(--success); }
.text-red { color: var(--danger); }

.combined-card {
  border: 2px solid var(--primary);
  background: #f8fafc;
}

/* === Calculation Details Component === */
.ctc-calculation-details {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.ctc-calc-toggle {
    background: none;
    border: none;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
}
.ctc-calc-toggle:hover {
    text-decoration: underline;
}

.ctc-calc-toggle svg {
    transition: transform 0.3s;
}

.ctc-calc-toggle-hide {
    display: none;
}

.ctc-calculation-details.open .ctc-calc-toggle-hide {
    display: inline;
}

.ctc-calculation-details.open .ctc-calc-toggle-show {
    display: none;
}

.ctc-calculation-details.open .ctc-calc-toggle svg {
    transform: rotate(180deg);
}

.ctc-calc-content {
    display: none;
    padding-top: 16px;
    font-size: 0.9rem;
}

.ctc-calculation-details.open .ctc-calc-content {
    display: block;
    animation: slideDown 0.3s ease-out;
}

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

.ctc-calc-content p.h4 {
    margin: 16px 0 8px 0;
    font-size: 0.95rem;
    color: var(--primary);
}

.ctc-calc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    table-layout: auto;
    font-size: 0.85rem;
}

.ctc-calc-table th {
    text-align: left;
    color: var(--text-sub);
    font-size: 0.75rem;
    padding: 6px 6px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.ctc-calc-table th:last-child {
    text-align: right;
}

.ctc-calc-table td {
    padding: 6px 6px;
    border-bottom: 1px solid #000000;
}

.ctc-calc-table td:last-child {
    text-align: right;
    white-space: nowrap;
}

.ctc-calc-table tr:last-child td {
    border-bottom: none;
}

/* === Table Layouts === */
.ctc-income-table {
    table-layout: auto;
}

.ctc-income-table td:first-child {
    width: auto;
}

.ctc-income-table td:nth-child(2) {
    width: auto;
}

.ctc-income-table td:last-child {
    width: auto;
    text-align: right;
}

.ctc-tax-table {
    table-layout: auto;
}

.ctc-tax-table th {
    white-space: nowrap;
    font-size: 0.7rem;
}

.ctc-tax-table th:nth-child(2),
.ctc-tax-table th:nth-child(3),
.ctc-tax-table th:nth-child(4),
.ctc-tax-table th:nth-child(5) {
    text-align: right;
}

.ctc-tax-table td:nth-child(2),
.ctc-tax-table td:nth-child(3),
.ctc-tax-table td:nth-child(4),
.ctc-tax-table td:nth-child(5) {
    text-align: right;
    white-space: nowrap;
}

.ctc-credits-header {
    background: #f1f5f9;
}

.ctc-credits-header th {
    color: var(--text-sub);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 8px 6px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.ctc-credits-header th:nth-child(1) { text-align: left; }
.ctc-credits-header th:nth-child(2),
.ctc-credits-header th:nth-child(3),
.ctc-credits-header th:nth-child(4) { text-align: right; }

.ctc-surtax-row td,
.ctc-health-premium-row td {
    color: var(--danger);
    font-weight: 500;
}

.ctc-calc-subtotal td {
    background: #f8fafc;
    border-top: 2px solid var(--border);
    border-bottom: none;
    padding: 10px 8px;
}

.ctc-calc-subtotal td.text-right {
    text-align: right;
}

.ctc-calc-total td {
    border-top: 2px solid var(--primary);
    padding: 12px 8px;
    color: var(--primary);
    font-size: 1rem;
}

.ctc-calc-total td:last-child {
    text-align: right;
}

/* === Mobile Responsive Styles === */
@media (max-width: 768px) {
  .ctc-wrapper {
    padding: 16px;
  }

  .ctc-header p.h2 {
    font-size: 1.5rem;
  }

  .ctc-controls {
    flex-direction: column;
    gap: 16px;
    padding: 20px;
  }

  .ctc-form-group {
    min-width: 100%;
  }

  .ctc-grid {
    gap: 24px;
    grid-template-columns: 1fr;
  }

  .ctc-results {
    padding: 0;
    grid-template-columns: 1fr;
  }

  .ctc-top-stats {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ctc-result-card,
  .ctc-details-card {
    padding: 12px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    margin-bottom: 16px !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* === Table Responsive Styles === */
  .ctc-calc-table {
    font-size: 0.75rem;
    overflow-x: auto;
    display: block;
  }

  .ctc-calc-table thead,
  .ctc-calc-table tbody,
  .ctc-calc-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  .ctc-calc-table th,
  .ctc-calc-table td {
    padding: 8px 4px;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ctc-tax-table {
    min-width: 500px;
  }

  .ctc-tax-table th,
  .ctc-tax-table td {
    padding: 6px 3px;
    font-size: 0.65rem;
  }

  .ctc-income-table {
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }

  .ctc-income-table thead,
  .ctc-income-table tbody,
  .ctc-income-table tr {
    display: table;
    width: 100%;
    table-layout: auto;
  }

  .ctc-credits-header th {
    font-size: 0.6rem;
    padding: 6px 3px;
    letter-spacing: 0;
  }

  /* Mobile table wrapper for horizontal scroll */
  .ctc-calc-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ctc-calc-content::-webkit-scrollbar {
    height: 4px;
  }

  .ctc-calc-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
  }

  .ctc-calc-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
  }

  .ctc-calc-content td {
    /* warp */
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .ctc-result-card,
  .ctc-details-card {
    padding: 6px !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    margin-bottom: 10px !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Extra small screens table optimization */
  .ctc-calc-table {
    font-size: 0.65rem;
  }

  .ctc-calc-table th,
  .ctc-calc-table td {
    padding: 4px 2px;
    font-size: 0.6rem;
  }

  .ctc-tax-table {
    min-width: 450px;
  }

  .ctc-tax-table th,
  .ctc-tax-table td {
    padding: 4px 2px;
    font-size: 0.55rem;
  }

  .ctc-credits-header th {
    font-size: 0.5rem;
    padding: 4px 2px;
  }

  .ctc-calc-subtotal td,
  .ctc-calc-total td {
    padding: 6px 2px;
    font-size: 0.7rem;
  }

  /* Hide less important table columns on very small screens */
  .ctc-tax-table th:nth-child(3),
  .ctc-tax-table td:nth-child(3) {
    display: none;
  }

  /* Make table container scrollable */
  .ctc-calc-content {
    max-width: calc(100vw - 20px);
    overflow-x: auto;
  }

  .ctc-calc-table {
    min-width: 300px;
    margin-bottom: 10px;
  }
}

/* === Province & Territory Links === */
.ctc-province-links {
  margin-top: 56px;
  padding: 0;
  background: transparent;
  border: 0;
}

.ctc-province-links-inner {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) 2fr;
  gap: 36px;
  align-items: start;
}

.ctc-province-links-title {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  color: #1a1a1a;
  letter-spacing: -0.02em;
  text-transform: none;
  max-width: 320px;
}

.ctc-province-link-list {
  list-style: none;
  margin: 0;
  padding: 6px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 28px;
}

.ctc-province-link-item {
  margin: 0;
  padding: 0;
}

.ctc-province-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: 1rem;
  font-weight: 500;
  color: #1d2a3b;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  background: transparent;
  transition: color 0.18s ease;
  white-space: normal;
}

.ctc-province-flag {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 999px;
  flex-shrink: 0;
  display: block;
}

.ctc-province-link:hover,
.ctc-province-link:focus {
  color: #0f4fcf;
  text-decoration: underline;
  outline: none;
}

@media (max-width: 1024px) {
  .ctc-province-links-inner {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ctc-province-links-title {
    font-size: 2rem;
    max-width: 100%;
  }

  .ctc-province-link-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .ctc-province-links {
    padding: 0 8px;
  }

  .ctc-province-links-title {
    font-size: 1.6rem;
  }

  .ctc-province-link-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .ctc-province-link {
    font-size: 0.95rem;
  }
}

/* === Province-Required / Chooser-Mode Lock === */
/* When no province is selected the inputs wrapper is visually dimmed and
   all interactive elements inside it are completely non-interactive.       */
.ctc-inputs-wrapper.ctc-province-required {
  position: relative;
  pointer-events: none;
  user-select: none;
}

/* Transparent overlay — catches pointer events so :hover fires on wrapper */
.ctc-inputs-wrapper.ctc-province-required::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 10;
  pointer-events: auto;
  cursor: not-allowed;
  border-radius: 8px;
}

/* Tooltip shown on hover */
.ctc-inputs-wrapper.ctc-province-required::before {
  content: 'Please select a province or territory first';
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 11;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ctc-inputs-wrapper.ctc-province-required:hover::before {
  opacity: 1;
}

/* skeleton placeholders when results empty */
.ctc-skeleton {
  background-color: #e0e0e0;
  border-radius: 4px;
  animation: ctc-skel-pulse 1.2s ease-in-out infinite;
}
.ctc-skel-bar {
  height: 20px;
  margin-bottom: 6px;
}
.ctc-skel-box {
  width: 100%;
}
@keyframes ctc-skel-pulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* dim form controls directly for extra clarity */
.ctc-inputs-wrapper.ctc-province-required .ctc-input,
.ctc-inputs-wrapper.ctc-province-required .ctc-input-field,
.ctc-inputs-wrapper.ctc-province-required .ctc-select-field {
  background-color: #e9ecef;
  color: #6c757d;
}

.ctc-inputs-wrapper.ctc-province-required .ctc-input-field::placeholder,
.ctc-inputs-wrapper.ctc-province-required .ctc-input::placeholder {
  color: #999;
}
