/* Clinical Budget Widget — cbw-style.css */

.cbw-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e5e5e5;
    max-width: 780px;
    margin: 0 auto;
}

/* Header */
.cbw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
}
.cbw-title {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    margin: 0;
}
.cbw-subtitle {
    font-size: 13px;
    color: #666;
    margin-top: 3px;
}
.cbw-reset-btn {
    font-size: 12px;
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f7f7f7;
    cursor: pointer;
    color: #555;
    white-space: nowrap;
    transition: background .15s;
}
.cbw-reset-btn:hover { background: #eee; }

/* Params card */
.cbw-params-card {
    background: #f8f8f8;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.cbw-params-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 12px;
}
.cbw-params-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (max-width: 540px) {
    .cbw-params-grid { grid-template-columns: repeat(2, 1fr); }
}
.cbw-param-item label {
    display: block;
    font-size: 11px;
    color: #777;
    margin-bottom: 4px;
}
.cbw-param-item input[type=number] {
    width: 100%;
    padding: 7px 10px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #ddd;
    border-radius: 7px;
    background: #fff;
    color: #111;
    box-sizing: border-box;
    transition: border-color .15s;
}
.cbw-param-item input[type=number]:focus {
    outline: none;
    border-color: #3B8BD4;
}

/* Phase blocks */
.cbw-phase-block { margin-bottom: 5px; }

.cbw-phase-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #e5e5e5;
    border-radius: 9px;
    cursor: pointer;
    background: #fff;
    transition: background .12s;
    user-select: none;
}
.cbw-phase-header:hover { background: #f8f8f8; }
.cbw-phase-header.is-open {
    border-radius: 9px 9px 0 0;
    border-bottom-color: transparent;
}

.cbw-phase-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}
.cbw-phase-label {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    flex: 1;
}
.cbw-phase-badge {
    font-size: 11px;
    color: #888;
    background: #f2f2f2;
    padding: 2px 9px;
    border-radius: 99px;
    border: 1px solid #e5e5e5;
    white-space: nowrap;
}
.cbw-phase-badge.has-sel {
    background: inherit;
    border-color: inherit;
}
.cbw-chevron {
    font-size: 18px;
    color: #aaa;
    transition: transform .2s;
    line-height: 1;
}
.cbw-phase-header.is-open .cbw-chevron { transform: rotate(90deg); }

/* Phase body */
.cbw-phase-body {
    border: 1px solid #e5e5e5;
    border-top: none;
    border-radius: 0 0 9px 9px;
}
.cbw-section-note {
    font-size: 11px;
    color: #999;
    padding: 6px 14px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

/* Module rows */
.cbw-module-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f5f5f5;
    background: #fff;
    transition: background .1s;
}
.cbw-module-row:last-child { border-bottom: none; }
.cbw-module-row:hover { background: #fafafa; }
.cbw-module-row.is-checked { background: #fafcff; }

.cbw-mod-check {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-top: 3px;
    cursor: pointer;
    accent-color: #3B8BD4;
}
.cbw-module-label {
    flex: 1;
    cursor: pointer;
    display: block;
}
.cbw-mod-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #222;
}
.cbw-mod-desc {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    line-height: 1.4;
}
.cbw-module-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}
.cbw-mod-unitprice {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.cbw-mod-unit {
    font-size: 10px;
    font-weight: 400;
    color: #aaa;
    margin-left: 2px;
}
.cbw-mod-subtotal {
    font-size: 11px;
    white-space: nowrap;
    font-weight: 500;
}

/* Connector */
.cbw-connector {
    display: flex;
    justify-content: center;
    height: 14px;
    align-items: center;
}
.cbw-connector-line {
    width: 2px;
    height: 100%;
    background: #e0e0e0;
}

/* Summary card */
.cbw-summary-card {
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px 18px;
    margin-top: 16px;
}
.cbw-sum-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
}
.cbw-sum-empty {
    font-size: 12px;
    color: #aaa;
}
.cbw-sum-group-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #bbb;
    margin: 10px 0 4px;
}
.cbw-sum-line {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #444;
    font-weight: 500;
    padding: 2px 0;
    gap: 8px;
}
.cbw-sum-line span:first-child {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cbw-sum-breakdown {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #bbb;
    padding: 0 0 4px;
}
.cbw-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    gap: 12px;
}
.cbw-total-label {
    font-size: 14px;
    font-weight: 600;
    color: #222;
}
.cbw-total-range {
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
}
.cbw-total-value {
    font-size: 24px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
}
.cbw-total-note {
    font-size: 11px;
    color: #aaa;
    margin-top: 8px;
    line-height: 1.5;
}
.cbw-btn-cta {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 11px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #3B8BD4;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
    box-sizing: border-box;
}
.cbw-btn-cta:hover { opacity: .88; color: #fff; }

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .cbw-wrap { background:#1a1a1a; border-color:#333; }
    .cbw-title { color:#f0f0f0; }
    .cbw-subtitle { color:#999; }
    .cbw-params-card { background:#222; border-color:#333; }
    .cbw-param-item input[type=number] { background:#2a2a2a; border-color:#444; color:#eee; }
    .cbw-phase-header { background:#1e1e1e; border-color:#333; }
    .cbw-phase-header:hover { background:#252525; }
    .cbw-phase-label { color:#ddd; }
    .cbw-phase-badge { background:#2a2a2a; border-color:#444; color:#888; }
    .cbw-phase-body { border-color:#333; }
    .cbw-section-note { background:#222; border-color:#333; color:#666; }
    .cbw-module-row { background:#1e1e1e; border-color:#2a2a2a; }
    .cbw-module-row:hover { background:#232323; }
    .cbw-module-row.is-checked { background:#1a2030; }
    .cbw-mod-name { color:#ddd; }
    .cbw-mod-desc { color:#666; }
    .cbw-summary-card { background:#222; border-color:#333; }
    .cbw-sum-line { color:#bbb; }
    .cbw-summary-total { border-color:#333; }
    .cbw-total-label { color:#ddd; }
    .cbw-total-value { color:#eee; }
    .cbw-reset-btn { background:#2a2a2a; border-color:#444; color:#aaa; }
}
