/* ===== Child Care Subsidy Guide – CCS Calculator Styles (Refined) ===== */
.ccsg-card {
    --ccsg-border: rgba(15, 23, 42, 0.12);
    --ccsg-muted: rgba(15, 23, 42, 0.62);
    --ccsg-primary: #1f87c9;
    --ccsg-primary-dark: #176ea3;
    --ccsg-bg: #fff;
    --ccsg-bg-soft: rgba(15, 23, 42, 0.03);
    --ccsg-bg-softer: rgba(15, 23, 42, 0.015);
    --ccsg-text: #0f172a;

    max-width: 820px;
    margin: 1rem 0;
    padding: 1.25rem;
    border: 1px solid var(--ccsg-border);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #ffffff 55%, rgba(15, 23, 42, 0.01) 100%);
    color: var(--ccsg-text);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
    font: 400 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial;
}

.ccsg-head {
    margin-bottom: 1rem;
}

.ccsg-title {
    margin: 0 0 0.35rem;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.ccsg-subtitle {
    margin: 0;
    color: var(--ccsg-muted);
    font-size: 0.95rem;
}

/* Sections */
.ccsg-section {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--ccsg-border);
    border-radius: 14px;
    background: #fff;
}

.ccsg-section+.ccsg-section {
    margin-top: 0.9rem;
}

.ccsg-section-head {
    margin-bottom: 0.85rem;
}

.ccsg-section-title {
    margin: 0 0 0.15rem;
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.ccsg-section-desc {
    margin: 0;
    color: var(--ccsg-muted);
    font-size: 0.9rem;
}

/* Form */
.ccsg-form {
    margin: 0;
}

.ccsg-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ccsg-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.95rem;
}

.ccsg-label {
    color: rgba(15, 23, 42, 0.86);
    font-weight: 650;
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
}

.ccsg-required {
    font-style: normal;
    font-weight: 800;
    color: #d14343;
}

.ccsg-inp {
    /* Slightly smaller text + safer line-height to avoid clipping */
    font-size: 0.9rem;
    /* ~15.2px if base is 16px */
    line-height: 1.25;

    /* Ensure enough vertical room in themes that set a fixed height/line-height */
    min-height: 44px;

    padding: 0.62rem 0.7rem;
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 10px;
    background: #fff;
    outline: none;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.05s;
}

.ccsg-inp:focus {
    border-color: rgba(31, 135, 201, 0.75);
    box-shadow: 0 0 0 4px rgba(31, 135, 201, 0.16);
}

.ccsg-inp::placeholder {
    color: rgba(15, 23, 42, 0.40);
}

/* Select chevron */
.ccsg-card select.ccsg-inp {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;

    /* Ensure the chevron doesn't overlap text */
    padding-right: 2.25rem;

    /* Some themes apply odd select heights; keep it consistent */
    height: auto;

    background-image:
        linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, 0.45) 50%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.45) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

/* Help text */
.ccsg-help {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.84em;
    line-height: 1.35;
    color: var(--ccsg-muted);
}

/* Checkbox/toggle grid */
.ccsg-checkgrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.ccsg-check {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--ccsg-border);
    border-radius: 14px;
    background: var(--ccsg-bg-softer);
}

.ccsg-check-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.ccsg-check-title {
    font-weight: 700;
    color: rgba(15, 23, 42, 0.90);
    font-size: 0.95rem;
}

.ccsg-check-desc {
    color: var(--ccsg-muted);
    font-size: 0.88rem;
    line-height: 1.35;
}

/* Accessible toggle */
.ccsg-toggle {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
}

.ccsg-toggle input[type="checkbox"] {
    position: absolute;
    inset: 0;
    width: 44px;
    height: 28px;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.ccsg-toggle-ui {
    width: 44px;
    height: 28px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(15, 23, 42, 0.18);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.ccsg-toggle-ui::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    transform: translateY(-50%);
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
    transition: transform 0.15s;
}

.ccsg-toggle input[type="checkbox"]:focus+.ccsg-toggle-ui {
    box-shadow: 0 0 0 4px rgba(31, 135, 201, 0.16);
    border-color: rgba(31, 135, 201, 0.55);
}

.ccsg-toggle input[type="checkbox"]:checked+.ccsg-toggle-ui {
    background: rgba(31, 135, 201, 0.90);
    border-color: rgba(31, 135, 201, 0.95);
}

.ccsg-toggle input[type="checkbox"]:checked+.ccsg-toggle-ui::after {
    transform: translateY(-50%) translateX(16px);
}

/* Actions */
.ccsg-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.ccsg-btn {
    padding: 0.7rem 1.1rem;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--ccsg-primary) 0%, var(--ccsg-primary-dark) 100%);
    color: #fff;
    cursor: pointer;
    font-weight: 750;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 24px rgba(31, 135, 201, 0.22);
}

.ccsg-btn:hover {
    filter: brightness(0.98);
}

.ccsg-btn:active {
    transform: translateY(1px);
}

.ccsg-btn-ghost {
    padding: 0.65rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: #ffffff;
    color: rgba(15, 23, 42, 0.85);
    cursor: pointer;
    font-weight: 650;
    font-size: 0.95rem;
}

.ccsg-btn-ghost:hover {
    background: rgba(15, 23, 42, 0.03);
}

.ccsg-btn-ghost:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ccsg-actions-note {
    margin-left: auto;
    font-size: 0.88rem;
    color: var(--ccsg-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Result */
.ccsg-hr {
    border: none;
    border-top: 1px solid var(--ccsg-border);
    margin: 1.1rem 0;
}

.ccsg-result-head {
    margin-bottom: 0.75rem;
}

.ccsg-result-title {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 800;
}

.ccsg-result-sub {
    margin: 0;
    color: var(--ccsg-muted);
    font-size: 0.9rem;
}

.ccsg-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.ccsg-metric {
    border: 1px solid var(--ccsg-border);
    border-radius: 14px;
    padding: 0.75rem 0.85rem;
    background: var(--ccsg-bg-softer);
}

.ccsg-metric-label {
    font-size: 0.85rem;
    color: var(--ccsg-muted);
    margin-bottom: 0.2rem;
}

.ccsg-metric-value {
    font-weight: 850;
    font-size: 1.05rem;
    color: rgba(15, 23, 42, 0.95);
}

.ccsg-metric-emph {
    background: rgba(31, 135, 201, 0.10);
    border-color: rgba(31, 135, 201, 0.25);
}

.ccsg-note {
    font-size: 0.9rem;
    color: var(--ccsg-muted);
    margin-top: 0.75rem;
}

/* Save scenario row */
.ccsg-save-row {
    margin-top: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.ccsg-btn-secondary {
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(31, 135, 201, 0.70);
    background: #ffffff;
    color: var(--ccsg-primary);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
}

.ccsg-btn-secondary:hover {
    background: rgba(31, 135, 201, 0.06);
}

.ccsg-save-hint {
    font-size: 0.86rem;
    color: var(--ccsg-muted);
}

/* Saved scenarios section */
.ccsg-scenarios {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ccsg-border);
}

.ccsg-scenarios-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ccsg-scenarios-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.ccsg-compare-btn {
    white-space: nowrap;
}

.ccsg-scenarios-empty {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: var(--ccsg-muted);
}

.ccsg-scenarios-list {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ccsg-scenario {
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: var(--ccsg-bg-soft);
    border: 1px solid rgba(15, 23, 42, 0.10);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ccsg-scenario-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.ccsg-scenario-name {
    font-weight: 800;
    font-size: 0.95rem;
}

.ccsg-scenario-meta {
    font-size: 0.82rem;
    color: var(--ccsg-muted);
}

.ccsg-scenario-summary {
    font-size: 0.92rem;
}

.ccsg-scenario-actions {
    margin-top: 0.35rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ccsg-scenario-btn {
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: #ffffff;
    cursor: pointer;
    font-weight: 650;
}

.ccsg-scenario-btn:hover {
    background: rgba(15, 23, 42, 0.03);
}

/* ===== Modal (Comparison) ===== */
.ccsg-modal[hidden] {
    display: none !important;
}

.ccsg-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.ccsg-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.60);
}

.ccsg-modal-panel {
    position: relative;
    margin: 4vh auto;
    width: min(980px, calc(100% - 1.5rem));
    max-height: 92vh;
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 26px 90px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ccsg-modal-header {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--ccsg-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ccsg-modal-title {
    font-weight: 850;
    font-size: 1rem;
}

.ccsg-modal-close {
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: #fff;
    border-radius: 12px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.ccsg-modal-close:hover {
    background: rgba(15, 23, 42, 0.03);
}

.ccsg-modal-body {
    padding: 1rem;
    overflow: auto;
}

.ccsg-modal-note {
    margin: 0 0 0.85rem;
    color: var(--ccsg-muted);
    font-size: 0.92rem;
}

.ccsg-modal-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--ccsg-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Comparison table */
.ccsg-compare-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ccsg-compare-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--ccsg-border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.ccsg-compare-table th,
.ccsg-compare-table td {
    padding: 0.65rem 0.7rem;
    border-bottom: 1px solid var(--ccsg-border);
    border-right: 1px solid var(--ccsg-border);
    vertical-align: top;
    font-size: 0.92rem;
}

.ccsg-compare-table th:last-child,
.ccsg-compare-table td:last-child {
    border-right: 0;
}

.ccsg-compare-table thead th {
    background: var(--ccsg-bg-soft);
    font-weight: 850;
    text-align: left;
}

.ccsg-compare-rowhead {
    background: #fff;
    font-weight: 800;
    width: 220px;
}

.ccsg-compare-badge {
    display: inline-block;
    padding: 0.14rem 0.55rem;
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 999px;
    font-size: 0.78rem;
    color: rgba(15, 23, 42, 0.82);
    background: #fff;
    margin-left: 0.35rem;
}

/* Responsive */
@media (max-width: 860px) {
    .ccsg-checkgrid {
        grid-template-columns: 1fr;
    }
}

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

    .ccsg-metrics {
        grid-template-columns: 1fr;
    }

    .ccsg-compare-rowhead {
        width: 180px;
    }
}