/* NDIS Funding Split Calculator — scoped for PBSG main app embed (#fundCalcApp) */
#fundCalcApp {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a1d26;
  --text-muted: #5c6478;
  --border: #e2e6ef;
  --accent: #0d6e6e;
  --accent-hover: #0a5858;
  --accent-soft: rgba(13, 110, 110, 0.12);
  --danger-soft: #fde8e8;
  --danger-border: #f5c2c2;
  --danger-text: #842029;
  --success-soft: #e8f5e9;
  --success-border: #c3e6cb;
  --success-text: #155724;
  --warn-soft: #fff8e6;
  --warn-border: #ffe08a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(26, 29, 38, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
}
#fundCalcApp,
#fundCalcApp *,
#fundCalcApp *::before,
#fundCalcApp *::after {
  box-sizing: border-box;
}
#fundCalcApp .app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}#fundCalcApp .header {
  text-align: center;
  margin-bottom: 1.75rem;
}#fundCalcApp .header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}#fundCalcApp .tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 36rem;
  margin-inline: auto;
}#fundCalcApp .main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}#fundCalcApp .card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}#fundCalcApp .section {
  padding: 1.15rem 1.25rem 1.35rem;
}#fundCalcApp .section-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}#fundCalcApp .subsection-title {
  margin: 1.25rem 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}#fundCalcApp .section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}#fundCalcApp .switch-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  position: relative;
}#fundCalcApp .switch-row input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}#fundCalcApp .switch-slider {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #ccd3df;
  position: relative;
  transition: background 0.15s ease;
}#fundCalcApp .switch-slider::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.15s ease;
}#fundCalcApp .switch-row input:checked + .switch-slider {
  background: var(--accent);
}#fundCalcApp .switch-row input:checked + .switch-slider::after {
  transform: translateX(18px);
}#fundCalcApp #categoriesPanel, #fundCalcApp #periodsPanel {
  overflow: visible;
  transition: max-height 0.2s ease, opacity 0.15s ease, margin-top 0.2s ease;
  max-height: 1200px;
  opacity: 1;
  margin-top: 0.3rem;
}#fundCalcApp #categoriesPanel.collapsed, #fundCalcApp #periodsPanel.collapsed {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}#fundCalcApp .section-head .section-title {
  margin-bottom: 0;
}#fundCalcApp .section-lead {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}#fundCalcApp .options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}#fundCalcApp .checkbox-label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.875rem;
  cursor: pointer;
}#fundCalcApp .checkbox-label input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}#fundCalcApp .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  #fundCalcApp .grid-2 {
    grid-template-columns: 1fr;
  }
}#fundCalcApp .grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
}

@media (max-width: 720px) {
  #fundCalcApp .grid-3 {
    grid-template-columns: 1fr;
  }

  #fundCalcApp .even-reduction .field-actions {
    padding-bottom: 0;
  }
}#fundCalcApp .field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}#fundCalcApp .field input, #fundCalcApp .field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font-size: 1rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
}#fundCalcApp .field input:focus, #fundCalcApp .field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}#fundCalcApp .field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}#fundCalcApp .field-msg {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.35rem;
  min-height: 1.1em;
}#fundCalcApp .field-msg.error {
  color: var(--danger-text);
}#fundCalcApp .field-msg.ok {
  color: var(--success-text);
}#fundCalcApp .field input.invalid, #fundCalcApp .field select.invalid {
  border-color: #dc8686;
  background: var(--danger-soft);
}#fundCalcApp .field input.valid-ok {
  border-color: var(--success-border);
  background: var(--success-soft);
}#fundCalcApp .cat-actual-hours {
  background: #f1f4f9 !important;
  color: #384154;
}#fundCalcApp .info-btn {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1;
  padding: 0;
  margin-left: 0.25rem;
  cursor: help;
}#fundCalcApp .info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
}#fundCalcApp .tooltip-box {
  position: absolute;
  left: 0;
  top: calc(100% + 0.25rem);
  width: 220px;
  max-width: min(70vw, 220px);
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1f2430;
  color: #f6f8fc;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 0.08s ease-out, transform 0.08s ease-out, visibility 0.08s;
  pointer-events: none;
}#fundCalcApp .info-tip:hover .tooltip-box, #fundCalcApp .info-tip:focus-within .tooltip-box {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}#fundCalcApp .dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}#fundCalcApp .row-item {
  display: grid;
  grid-template-columns: 1fr 120px 170px 40px;
  gap: 0.5rem;
  align-items: end;
  padding: 0.65rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

@media (max-width: 520px) {
  #fundCalcApp .row-item {
    grid-template-columns: 1fr 1fr;
  }

  #fundCalcApp .row-item .btn-icon {
    grid-column: 2;
    justify-self: end;
  }
}#fundCalcApp .periods-list .row-item {
  grid-template-columns: 1fr 160px 160px 40px;
}

@media (max-width: 720px) {
  #fundCalcApp .periods-list .row-item {
    grid-template-columns: 1fr 1fr;
  }

  #fundCalcApp .periods-list .row-item .period-balance {
    grid-column: auto;
  }

  #fundCalcApp .periods-list .row-item .btn-icon {
    grid-column: 2;
    justify-self: end;
    align-self: start;
  }
}#fundCalcApp .period-name-input {
  background: #f1f4f9 !important;
  color: #384154;
}#fundCalcApp .period-balance-left input {
  background: #f1f4f9 !important;
  color: #384154;
}#fundCalcApp .period-allocation input, #fundCalcApp .period-balance-left input {
  font-variant-numeric: tabular-nums;
}#fundCalcApp .btn {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}#fundCalcApp .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}#fundCalcApp .btn-sm {
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
}#fundCalcApp .btn-primary {
  background: var(--accent);
  color: #fff;
}#fundCalcApp .btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}#fundCalcApp .btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(13, 110, 110, 0.35);
}#fundCalcApp .btn-secondary:hover:not(:disabled) {
  background: rgba(13, 110, 110, 0.2);
}#fundCalcApp .btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}#fundCalcApp .btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}#fundCalcApp .btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--danger-text);
  font-size: 1.1rem;
  line-height: 1;
}#fundCalcApp .btn-icon:hover:not(:disabled) {
  background: var(--danger-soft);
}#fundCalcApp .actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 0;
}#fundCalcApp .validation-banner {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.875rem;
  display: none;
}#fundCalcApp .validation-banner.visible {
  display: block;
}#fundCalcApp .validation-banner.warn {
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: #664d03;
}#fundCalcApp .validation-banner.ok {
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}#fundCalcApp .results-section[hidden] {
  display: none !important;
}#fundCalcApp .summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}#fundCalcApp .summary-card {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #fafbfc 0%, #f0f3f8 100%);
}#fundCalcApp .summary-card .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}#fundCalcApp .summary-card .value {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}#fundCalcApp .summary-card.surplus .value {
  color: var(--success-text);
}#fundCalcApp .summary-card.shortfall .value {
  color: var(--danger-text);
}#fundCalcApp .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
}#fundCalcApp .results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}#fundCalcApp .results-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef1f6;
  border-bottom: 2px solid var(--border);
  padding: 0.55rem 0.5rem;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--border);
}#fundCalcApp .results-table thead th:first-child, #fundCalcApp .results-table tbody td:first-child, #fundCalcApp .results-table tfoot td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}#fundCalcApp .results-table thead th:first-child {
  z-index: 3;
  background: #eef1f6;
}#fundCalcApp .results-table tbody td, #fundCalcApp .results-table tfoot td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}#fundCalcApp .results-table .copy-text {
  cursor: copy;
  display: inline-block;
  transition: color 0.08s ease-out;
}#fundCalcApp .results-table .copy-text.copy-flash {
  animation: copyFlash 0.7s ease-out;
}

@keyframes copyFlash {
  0% {
    color: #ffffff;
  }
  100% {
    color: inherit;
  }
}#fundCalcApp .results-table tbody tr:nth-child(even) td {
  background: #fafbfd;
}#fundCalcApp .results-table tbody tr:nth-child(even) td:first-child {
  background: #fafbfd;
}#fundCalcApp .results-table tfoot td {
  font-weight: 700;
  background: #e8ecf4 !important;
  border-top: 2px solid var(--border);
}#fundCalcApp .results-table .cat-head {
  text-align: center;
  border-left: 1px solid var(--border);
}#fundCalcApp .notes-panel {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  white-space: pre-wrap;
  font-family: var(--mono);
  line-height: 1.45;
}#fundCalcApp .export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}#fundCalcApp .worked-example {
  margin-top: 1.25rem;
}#fundCalcApp .worked-example p {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}#fundCalcApp .worked-example p:last-child {
  margin-bottom: 0;
}#fundCalcApp .how-it-works {
  margin-top: 1rem;
}#fundCalcApp .how-summary {
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 0.25rem 0;
}#fundCalcApp .how-body {
  padding-top: 0.5rem;
}#fundCalcApp .how-body ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}#fundCalcApp .how-body li {
  margin-bottom: 0.4rem;
}#fundCalcApp .footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}#fundCalcApp .footer p {
  margin: 0;
}
