.csc-wrap {
  --csc-ink: #111827;
  --csc-muted: #5f6570;
  --csc-line: #e1e4e8;
  --csc-soft: #f6f6f6;
  --csc-card: #fff;
  --csc-accent: #4f7182;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 0;
  color: var(--csc-ink);
  font-family: inherit;
}

.csc-wrap * { box-sizing: border-box; }
.csc-shell { display: flex; flex-direction: column; gap: 22px; }
.csc-panel { min-width: 0; overflow: hidden; background: var(--csc-card); border: 1px solid var(--csc-line); border-radius: 14px; box-shadow: none; }
.csc-form { padding: 18px; }
.csc-form-grid { display: grid; gap: 18px 22px; }
.csc-form-grid + .csc-form-grid { margin-top: 14px; }
.csc-form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.csc-form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.csc-field { min-width: 0; }
.csc-field label { display: block; margin-bottom: 7px; color: #111; font-size: 13px; font-weight: 400; line-height: 1.3; }
.csc-field label span { color: var(--csc-muted); font-size: 11px; }
.csc-wrap input[type="number"],
.csc-wrap input[type="date"],
.csc-wrap select { width: 100%; min-width: 0; height: 42px; padding: 8px 10px; border: 1px solid #90949a; border-radius: 2px; outline: none; background: #fff; color: #111; font: inherit; font-size: 16px; font-weight: 400; }
.csc-wrap input:focus,
.csc-wrap select:focus,
.csc-wrap button:focus-visible,
.csc-wrap summary:focus-visible { border-color: var(--csc-accent); outline: 2px solid rgba(79, 113, 130, .24); outline-offset: 1px; }
.csc-wrap input:disabled { cursor: not-allowed; opacity: .58; background: #f1f1f1; }
.csc-amount-choice input:placeholder-shown:not(:disabled) { background: #f4f5f6; }
.csc-amount-choice input::placeholder { color: #72777d; opacity: 1; }
.csc-field-help { margin: 5px 0 0; color: var(--csc-muted); font-size: 11px; font-weight: 400; line-height: 1.35; }
.csc-duration-combo { display: grid; grid-template-columns: minmax(76px, .7fr) minmax(94px, 1fr); gap: 7px; }
.csc-contribution-section { margin-top: 18px; padding: 15px; border: 1px solid var(--csc-line); border-radius: 10px; background: #fafafa; }
.csc-section-head { margin-bottom: 13px; }
.csc-section-head strong, .csc-section-head small { display: block; }
.csc-section-head strong { color: #111; font-size: 14px; font-weight: 600; }
.csc-section-head strong span { color: var(--csc-muted); font-size: 11px; font-weight: 400; }
.csc-section-head small { margin-top: 4px; color: var(--csc-muted); font-size: 11px; font-weight: 400; line-height: 1.4; }

.csc-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin-top: 18px; }
.csc-option { display: flex; align-items: flex-start; gap: 9px; min-width: 0; padding: 0; cursor: pointer; background: transparent; border: 0; }
.csc-option input { flex: 0 0 auto; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--csc-accent); }
.csc-option span { min-width: 0; }
.csc-option strong, .csc-option small { display: block; }
.csc-option strong { color: #111; font-size: 13px; font-weight: 500; }
.csc-option small { margin-top: 3px; color: var(--csc-muted); font-size: 11px; font-weight: 400; line-height: 1.4; }

.csc-actions { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.csc-btn { min-width: 112px; padding: 12px 18px; cursor: pointer; border: 1px solid #cfcfcf; border-radius: 13px; background: #fff; color: #111; font: inherit; font-size: 15px; font-weight: 600; }
.csc-btn-primary { width: min(240px, 100%); background: #f1f1f1; }
.csc-btn:hover { background: #e9e9e9; }
.csc-btn:disabled { cursor: wait; opacity: .65; }
.csc-reset { background: #fff; }

.csc-results-head { padding: 18px 18px 8px; }
.csc-results-title { margin: 0; color: #111; font-size: 19px; font-weight: 600; }
.csc-results-summary { margin: 5px 0 0; color: var(--csc-muted); font-size: 13px; font-weight: 400; }
.csc-results-empty { margin: 0; padding: 18px; color: var(--csc-muted); text-align: center; }
.csc-loading { margin: 10px 18px 18px; padding: 16px; border: 1px solid var(--csc-line); border-radius: 10px; background: var(--csc-soft); color: var(--csc-muted); text-align: center; }
.csc-error { margin-top: 14px; padding: 10px 12px; border: 1px solid #e0a7a7; border-radius: 8px; background: #fff4f4; color: #8c1d1d; font-size: 13px; font-weight: 500; }
.csc-results > .csc-error { margin: 10px 18px 18px; }
.csc-pattern-notice { margin: 10px 18px 12px; padding: 10px 12px; border: 1px solid; border-radius: 8px; font-size: 12px; font-weight: 400; line-height: 1.45; }
.csc-pattern-notice.is-success { border-color: #a9d4bd; background: #f3faf6; color: #185f3e; }
.csc-pattern-notice.is-warning { border-color: #e5c27c; background: #fff9ec; color: #71510c; }
.csc-pattern-notice.is-info { border-color: #b8cbd4; background: #f3f7f9; color: #345563; }

.csc-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px 18px; }
.csc-kpi { min-width: 0; padding: 12px; border: 1px solid var(--csc-line); border-radius: 9px; background: #fff; }
.csc-kpi span { display: block; color: var(--csc-muted); font-size: 10px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.csc-kpi strong { display: block; overflow-wrap: anywhere; margin-top: 6px; color: #111; font-size: clamp(16px, 2vw, 20px); font-weight: 600; line-height: 1.2; }
.csc-kpi-primary { background: #f7f7f7; }
.csc-formula-box { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 12px; margin: 4px 18px 14px; padding: 12px 14px; border: 1px solid var(--csc-line); border-radius: 9px; background: #fafafa; }
.csc-formula-box > span { color: var(--csc-muted); font-size: 10px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.csc-formula-box strong { color: #222; font-size: 14px; font-weight: 600; }
.csc-formula-box small { flex: 1 1 100%; color: var(--csc-muted); font-size: 11px; font-weight: 400; }

.csc-viewbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin: 6px 18px 12px; padding: 10px; border: 1px solid var(--csc-line); border-radius: 9px; background: #fafafa; }
.csc-viewbar-label { display: block; margin: 0 0 5px 2px; color: var(--csc-muted); font-size: 10px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; }
.csc-view-toggle, .csc-mini-actions { display: flex; gap: 7px; }
.csc-view-btn, .csc-mini-btn { min-width: 72px; padding: 8px 11px; cursor: pointer; border: 1px solid #d0d0d0; border-radius: 7px; background: #fff; color: #222; font: inherit; font-size: 12px; font-weight: 500; }
.csc-view-btn.is-active { border-color: #7c8b92; background: #eceff0; }
.csc-chart-wrap { margin: 0 18px 12px; padding: 12px; overflow-x: auto; border: 1px solid var(--csc-line); border-radius: 9px; background: #fff; }
.csc-chart-wrap canvas { display: block; width: 100% !important; max-height: 360px; }

.csc-table-scroll { margin: 0 18px 12px; overflow-x: auto; border: 1px solid var(--csc-line); border-radius: 9px; }
.csc-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
.csc-table th, .csc-table td { padding: 10px 12px; border-bottom: 1px solid var(--csc-line); text-align: right; white-space: nowrap; }
.csc-table th { position: sticky; top: 0; background: #f4f4f4; color: #333; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.csc-table th:first-child, .csc-table td:first-child, .csc-table th:nth-child(2), .csc-table td:nth-child(2) { text-align: left; }
.csc-table tbody tr:nth-child(even) { background: #fbfbfb; }
.csc-table tbody tr:last-child td { border-bottom: 0; font-weight: 600; }
.csc-cards { display: none; padding: 0 18px 10px; }
.csc-card { margin-bottom: 10px; overflow: hidden; border: 1px solid var(--csc-line); border-radius: 9px; }
.csc-card header { display: flex; justify-content: space-between; padding: 10px 12px; background: #f4f4f4; color: #333; }
.csc-card header strong { font-weight: 600; }
.csc-card header span { color: var(--csc-muted); font-size: 12px; }
.csc-card dl { margin: 0; padding: 5px 12px; }
.csc-card dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #eee; }
.csc-card dl div:last-child { border-bottom: 0; }
.csc-card dt { color: var(--csc-muted); font-size: 12px; }
.csc-card dd { margin: 0; font-size: 13px; font-weight: 500; text-align: right; }
.csc-assumptions { margin: 8px 18px 16px; border-top: 1px solid var(--csc-line); }
.csc-assumptions summary { padding: 12px 0; cursor: pointer; color: #333; font-size: 13px; font-weight: 500; }
.csc-assumptions-content { padding: 0 0 12px; color: var(--csc-muted); font-size: 12px; font-weight: 400; line-height: 1.55; }
.csc-view-panel[hidden] { display: none !important; }

@media (max-width: 980px) {
  .csc-form-grid-4, .csc-form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .csc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .csc-kpi:first-child { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .csc-form { padding: 14px; }
  .csc-form-grid-4, .csc-form-grid-3, .csc-option-grid { grid-template-columns: 1fr; }
  .csc-form-grid { gap: 13px; }
  .csc-actions { flex-direction: column; }
  .csc-btn, .csc-btn-primary { width: 100%; }
  .csc-kpis { grid-template-columns: 1fr; }
  .csc-kpi:first-child { grid-column: auto; }
  .csc-viewbar > div { width: 100%; }
  .csc-view-toggle, .csc-mini-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .csc-view-toggle { grid-template-columns: repeat(2, 1fr); }
  .csc-view-btn, .csc-mini-btn { min-width: 0; }
  .csc-table-scroll { display: none; }
  .csc-cards { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .csc-wrap * { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  .csc-panel-form, .csc-viewbar, .csc-actions, .csc-assumptions { display: none !important; }
  .csc-panel { border: 0; }
  .csc-table-scroll { display: block; overflow: visible; }
  .csc-cards { display: none; }
}
