/* Income impact page - small UI helpers (scoped to this page only).
   Keeps the core design system in styles.css unchanged. */

/* Info tooltips ------------------------------------------------------- */
.info-tip{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  vertical-align: middle;
  cursor: help;
  outline: none;
  top: -1px;
}

.info-dot{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary) 55%, var(--border));
  background: var(--primary);
  color: white;
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--primary) 22%, transparent);
}

.info-tip:hover .info-dot{
  transform: translateY(-1px);
}

.info-tip:focus-visible .info-dot{
  box-shadow: 0 0 0 4px var(--focus), 0 12px 30px color-mix(in srgb, var(--primary) 22%, transparent);
}

.info-pop{
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 40px));
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
}

.info-pop::after{
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: translateX(-50%) rotate(45deg);
}

.info-tip:hover .info-pop,
.info-tip:focus .info-pop,
.info-tip:focus-within .info-pop{
  opacity: 1;
  pointer-events: auto;
}

/* Key results emphasis ------------------------------------------------ */
.stat--key{
  border-width: 2px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.stat--key .value{
  font-size: 1.38rem;
}

.stat--key.is-loss{
  /* Softer loss styling (less aggressive than bright red),
     while still clearly distinct from neutral cards. */
  border-color: color-mix(in srgb, var(--danger) 38%, var(--border));
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}
.stat--key.is-loss .value{ color: color-mix(in srgb, var(--danger) 75%, var(--text)); }

.stat--key.is-gain{
  border-color: color-mix(in srgb, var(--success) 55%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}
.stat--key.is-gain .value{ color: var(--success); }

/* Time off callout ---------------------------------------------------- */
.timeoff-callout{
  margin-top: 10px;
  border-radius: 16px;
  border: 2px solid color-mix(in srgb, var(--primary) 38%, var(--border));
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  padding: 12px 12px;
}

.timeoff-title{
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.timeoff-body{
  margin-top: 6px;
  color: color-mix(in srgb, var(--text) 92%, var(--muted));
  font-weight: 650;
  white-space: pre-line;
}

@media (max-width: 560px){
  .stat--key .value{ font-size: 1.32rem; }
}

/* Hide empty per-parent net lines (prevents awkward "Net: N/A" look) */
#outP1DeltaNet:empty,
#outP2DeltaNet:empty{
  display: none;
}

/* Household split presets -------------------------------------------- */
.preset-box{
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  padding: 12px;
}

.preset-box .preset-title{
  font-weight: 900;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.preset-row{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn.preset-btn{
  border: 1px solid color-mix(in srgb, var(--primary) 46%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.btn.preset-btn:hover{
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.preset-note{
  margin-top: 8px;
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
  font-size: 0.92rem;
}


/* Breakdown lines inside key result cards -------------------------------- */
.breakdown{
  margin-top: 8px;
  display: grid;
  gap: 8px;
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--primary) 22%, var(--border));
}

.bd-line{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 12px;
}

.bd-label{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 850;
}

.bd-days{
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  font-size: 0.88em;
  font-weight: 750;
  color: color-mix(in srgb, var(--text) 70%, var(--muted));
}

.bd-val{
  white-space: nowrap;
  font-weight: 950;
  justify-self: end;
}

/* Compare table ----------------------------------------------------------- */
.compare-card{
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  padding: 12px;
}

.compare-head{
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.compare-title{
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.compare-sub{
  font-size: 0.94rem;
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}

.compare-table-wrap{
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: auto;
}

.compare-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 480px;
}

.compare-table th,
.compare-table td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.compare-table th{
  text-align: center;
  font-weight: 900;
  color: color-mix(in srgb, var(--text) 86%, var(--muted));
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.compare-table td{
  text-align: center;
}

.compare-table td:first-child{
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.compare-table td.num{
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.compare-table td.num .cmp{
  display: inline-flex;
  justify-content: center;
  align-items: baseline;
  gap: 6px;
}

.compare-table td.num .cmp-word{
  color: color-mix(in srgb, var(--text) 70%, var(--muted));
  font-weight: 750;
}

.compare-table td.num .cmp-money{
  font-weight: 950;
}

.compare-table td.num .cmp-unit{
  margin-left: 6px;
  font-size: 12px;
  color: color-mix(in srgb, var(--text) 70%, var(--muted));
}

.compare-table td.num .cmp-na{
  color: color-mix(in srgb, var(--text) 70%, var(--muted));
  font-weight: 750;
}

.compare-table tr.is-current td{
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

@media (max-width: 560px){
  .compare-table{ min-width: 420px; }
}

/* ------------------------------------------------------------
   Unit costs (loss per day/month)
------------------------------------------------------------ */
.unit-list{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.unit-list .u-line{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
}

.unit-list .u-label{
  color: color-mix(in srgb, var(--text) 70%, var(--muted));
  font-weight: 700;
  min-width: 0;
}

.unit-list .u-val{
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.unit-list .u-empty{
  color: color-mix(in srgb, var(--text) 70%, var(--muted));
}

/* Keep long labels + info icon aligned within stat cards */
.stat .label{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  /* Make KPI numbers line up even when one label wraps to two lines */
  min-height: 2.6em;
}

.stat .label > span:first-child{
  min-width: 0;
}

/* Cost note under the section title */
.cost-note{
  margin-top: 8px;
  margin-bottom: 8px;
  line-height: 1.35;
}



/* -------------------------------
   Per-parent breakdown (Total mode)
---------------------------------- */

.per-parent{
  margin-top: 6px;
}

.per-parent-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.per-parent-grid{
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.per-parent-card{
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
  border-radius: 16px;
  padding: 12px;
}

.pp-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pp-name{
  font-weight: 950;
}

.pp-main{
  margin-top: 6px;
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.pp-sub{
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 700px){
  .per-parent-grid{ grid-template-columns: 1fr; }
}


/* -------------------------------
   Cost estimates tables
---------------------------------- */

.cost-tabs{
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.cost-tab{
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.cost-tab:hover{
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.cost-tab:focus-visible{
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 2px;
}

.cost-tab.is-active{
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.cost-grid{
  margin-top: 12px;
  display: grid;
  /* Stack Parent 1 above Parent 2 for better scanability */
  grid-template-columns: 1fr;
  gap: 10px;
}

.cost-card{
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  padding: 12px;
}

.cost-card-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cost-card-title{
  font-weight: 950;
}

.cost-table-wrap{ overflow-x: auto; }

.cost-table{
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.cost-table th,
.cost-table td{
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.cost-table tbody tr:last-child td{
  border-bottom: none;
}

.cost-table th{
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cost-table td.lvl{
  font-weight: 850;
}

.cost-table td.num,
.cost-table th.num{
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.delta{
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.delta--neg{
  color: color-mix(in srgb, var(--danger) 75%, var(--text));
  font-weight: 900;
}

.delta--pos{
  color: color-mix(in srgb, var(--accent) 80%, var(--text));
  font-weight: 900;
}

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

.cost-foot{
  margin-top: 8px;
}

/* Parent cards (Income impact setup) */
.parent-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.parent-grid[data-cols="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 920px) {
  .parent-grid[data-cols="2"] {
    grid-template-columns: 1fr;
  }
}

.parent-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 18px;
  padding: 14px;
}

.parent-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.parent-card-title {
  font-weight: 950;
  letter-spacing: -0.01em;
}

.subsection-title {
  margin-top: 12px;
  margin-bottom: 8px;
  font-weight: 900;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
}

.tax-details {
  margin-top: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius: 16px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}

.tax-details > summary {
  cursor: pointer;
  font-weight: 900;
  user-select: none;
}

.tax-details > summary::-webkit-details-marker {
  display: none;
}

.tax-details > summary::after {
  content: "▾";
  float: right;
  opacity: 0.7;
}

.tax-details[open] > summary::after {
  content: "▴";
}



/* Layout: keep Results below setup ----------------------------------- */
.calc-layout{
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.calc-layout .sticky{
  position: static !important;
  top: auto !important;
}
