.pbg-page *, .pbg-hub * { box-sizing: border-box; }
.pbg-page, .pbg-hub { min-width: 0; }
.pbg-resource-body { min-width: 0; overflow-wrap: anywhere; }
.pbg-plan-pick { display: inline-flex; gap: 5px; align-items: center; margin: 10px 0 0 12px; font-size: 12px; cursor: pointer; }
.pbg-plan-pick input { margin: 0; }
.pbg-editor-evidence { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 10px; font-size: 13px; }
.pbg-editor-evidence dd { margin: 0; overflow-wrap: anywhere; }
.pbg-kicker,
.pbg-intent-grid span { letter-spacing: 0; }
.pbg-hub h2,
.pbg-page h1 { font-size: 32px; }
.pbg-resource-thumb-empty { display: flex; align-items: center; justify-content: center; color: #517080; background: #eaf1f3; text-decoration: none; font-weight: 750; }
.pbg-match-score { margin-left: auto; color: #fff; background: #147a55; padding: 4px 7px; font-size: 12px; }
.pbg-save-plan,
.pbg-plan-progress,
.pbg-tool-favorite { border: 1px solid #c8d9e0; border-radius: 4px; background: #fff; color: #315f75; padding: 7px 10px; font-size: 12px; line-height: 1.2; cursor: pointer; }
.pbg-match-reasons,
.pbg-decision-reasons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.pbg-match-reasons span,
.pbg-decision-reasons span { padding: 4px 7px; background: #eef6f1; color: #2f654c; font-size: 11px; }
.pbg-match-risk { margin: 7px 0 0; color: #9a5b24; font-size: 11px; line-height: 1.5; }
.pbg-profile-score { display: flex; align-items: flex-end; gap: 5px; }
.pbg-profile-score strong { font-size: 26px; line-height: 1; color: #147a55; }
.pbg-profile-score span { font-size: 11px; color: #687b88; }
.pbg-decision-reasons { padding-bottom: 16px; margin-top: 0; }
.pbg-profile-risks { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 16px; padding: 10px 12px; border-left: 3px solid #c77a32; background: #fff7ee; color: #75502f; font-size: 12px; line-height: 1.6; }
.pbg-profile-risks b { flex: 0 0 auto; color: #8b4f19; }
.pbg-page-gap { display: inline-flex; align-items: center; padding: 0 4px; color: #687b88; }

.pbg-home-match { display: flex; gap: 8px; max-width: 650px; margin-top: 18px; }
.pbg-home-match input { min-width: 0; flex: 1; height: 43px; border: 1px solid #bfd2db; border-radius: 4px; background: #fff; padding: 0 13px; color: #172b3a; }
.pbg-home-match button { flex: 0 0 auto; }
.pbg-match-form { padding: 20px; border: 1px solid #d7e3e8; background: #f7fafb; }
.pbg-goal-field { display: flex; flex-direction: column; gap: 7px; color: #526a78; font-size: 12px; }
.pbg-goal-field input { width: 100%; height: 48px; border: 1px solid #b9ced8; border-radius: 4px; background: #fff; padding: 0 14px; color: #172b3a; font-size: 16px; }
.pbg-match-form fieldset { border: 0; padding: 0; margin: 18px 0 0; }
.pbg-match-form legend { margin-bottom: 7px; color: #526a78; font-size: 12px; }
.pbg-segments { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid #c6d7df; border-radius: 4px; overflow: hidden; }
.pbg-segments label { position: relative; margin: 0; }
.pbg-segments input { position: absolute; opacity: 0; pointer-events: none; }
.pbg-segments span { display: flex; align-items: center; justify-content: center; min-height: 42px; background: #fff; border-right: 1px solid #d8e4e9; color: #3c5868; cursor: pointer; }
.pbg-segments label:last-child span { border-right: 0; }
.pbg-segments input:checked + span { background: #172b3a; color: #fff; }
.pbg-segments input:focus-visible + span { box-shadow: inset 0 0 0 2px #1676b8; }
.pbg-match-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.pbg-match-options > label { display: flex; flex-direction: column; gap: 6px; color: #526a78; font-size: 12px; }
.pbg-match-options select { width: 100%; height: 41px; border: 1px solid #c6d7df; border-radius: 4px; background: #fff; padding: 0 9px; color: #172b3a; }
.pbg-match-options .pbg-check-option { justify-content: flex-end; flex-direction: row; align-items: center; padding-bottom: 10px; gap: 7px; }
.pbg-check-option input { width: 17px; height: 17px; }
.pbg-match-submit { margin-top: 16px; min-width: 150px; }
.pbg-match-summary { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; padding: 18px; border-left: 4px solid #1676b8; background: #edf5f8; }
.pbg-match-summary > div { display: flex; flex-direction: column; gap: 4px; }
.pbg-match-summary span,
.pbg-match-summary small { color: #687b88; font-size: 12px; }
.pbg-match-summary strong { font-size: 18px; }
.pbg-save-plan { flex: 0 0 auto; background: #147a55; border-color: #147a55; color: #fff; padding: 10px 13px; }
.pbg-match-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.pbg-goal-examples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 18px 0; }
.pbg-goal-examples > span { color: #687b88; font-size: 12px; }
.pbg-goal-examples a { padding: 7px 9px; background: #eef4f7; color: #315f75; text-decoration: none; font-size: 13px; }

.pbg-user-plan { margin: 0 0 28px; border: 1px solid #d9e5e9; background: #fff; }
.pbg-user-plan .pbg-section-title { padding: 10px 16px; background: #f2f7f8; }
.pbg-user-plan .pbg-section-title > div span { font-size: 11px; color: #687b88; }
.pbg-user-plan .pbg-section-title h2 { margin: 3px 0; font-size: 18px; }
.pbg-user-plan .pbg-section-title > strong { font-size: 13px; color: #147a55; }
.pbg-user-plan ol { list-style: none; margin: 0; padding: 0 16px; }
.pbg-user-plan li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 55px; border-bottom: 1px solid #e4ebee; }
.pbg-user-plan li:last-child { border-bottom: 0; }
.pbg-user-plan li > span { color: #8aa0ab; font: 700 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.pbg-user-plan li > a { text-decoration: none; }
.pbg-user-plan li.is-done > a { text-decoration: line-through; color: #82939d; }
.pbg-user-plan li.is-done .pbg-plan-progress { background: #147a55; border-color: #147a55; color: #fff; }
.pbg-toast { position: fixed; z-index: 10001; left: 50%; bottom: 86px; max-width: calc(100vw - 32px); transform: translate(-50%, 10px); box-sizing: border-box; padding: 10px 14px; border: 1px solid #4d6471; background: #172b3a; color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s; }
.pbg-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 800px) {
    .pbg-hub h2,
    .pbg-page h1 { font-size: 28px; }
    .pbg-match-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pbg-match-results { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .pbg-hub h2,
    .pbg-page h1 { font-size: 24px; }
    .pbg-home-match { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .pbg-home-match input { width: 100%; }
    .pbg-segments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pbg-segments label:nth-child(2) span { border-right: 0; }
    .pbg-segments label:nth-child(-n+2) span { border-bottom: 1px solid #d8e4e9; }
    .pbg-match-options { grid-template-columns: 1fr; }
    .pbg-match-options .pbg-check-option { justify-content: flex-start; padding: 6px 0; }
    .pbg-match-summary { align-items: flex-start; flex-direction: column; }
    .pbg-save-plan { width: 100%; }
    .pbg-toast { bottom: 145px; }
    .pbg-user-plan li { grid-template-columns: 28px minmax(0, 1fr); padding: 9px 0; }
    .pbg-user-plan li .pbg-plan-progress { grid-column: 2; justify-self: start; }
}

/* Use Zibll's live palette so the hub follows both day and night mode. */
body {
    --pbg-ink: var(--main-color, #172b3a);
    --pbg-muted: var(--muted-color, #687b88);
    --pbg-line: var(--main-border-color, rgba(50, 50, 50, .08));
    --pbg-surface: var(--main-bg-color, #fff);
    --pbg-soft: var(--muted-bg-2-color, #f4f8fa);
    --pbg-blue: var(--theme-color, #1676b8);
    --pbg-green: var(--c-icon-color, #147a55);
}
body .pbg-hub,
body .pbg-page,
body .pbg-tool-panel,
body .pbg-user-plan,
body .pbg-path-card,
body .pbg-request-form,
body .pbg-profile { color: var(--pbg-ink); background: var(--pbg-surface); border-color: var(--pbg-line); }
body .pbg-tool-categorybar,
body .pbg-tool-topbar,
body .pbg-tool-nav,
body .pbg-tool-workbench,
body .pbg-tool-options { background: var(--pbg-surface); border-color: var(--pbg-line); }
body .pbg-tool-categorybar button,
body .pbg-tool-item,
body .pbg-tool-history button { color: var(--pbg-muted); background: transparent; border-color: var(--pbg-line); }
body .pbg-tool-categorybar button.is-active,
body .pbg-tool-item.is-active { color: #fff; background: var(--pbg-blue); border-color: var(--pbg-blue); }
body .pbg-tool-shell { border: 1px solid var(--pbg-line); background: var(--pbg-surface); overflow: hidden; }
.pbg-tool-topbar { display: flex; gap: 14px; align-items: end; padding: 16px; border-bottom: 1px solid var(--pbg-line); }
.pbg-tool-search { display: flex; flex: 1; flex-direction: column; gap: 6px; color: var(--pbg-muted); font-size: 12px; }
.pbg-tool-search input { height: 42px; width: 100%; border: 1px solid var(--pbg-line); border-radius: 4px; padding: 0 12px; color: var(--pbg-ink); background: var(--pbg-soft); }
.pbg-tool-top-actions { display: flex; gap: 7px; }
.pbg-tool-top-actions button,
.pbg-tool-categorybar button { cursor: pointer; border: 1px solid var(--pbg-line); border-radius: 4px; padding: 9px 11px; color: var(--pbg-muted); background: var(--pbg-soft); font-size: 12px; }
.pbg-tool-categorybar { display: flex; gap: 7px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--pbg-line); }
.pbg-tool-categorybar button.is-active { color: #fff; background: var(--pbg-blue); border-color: var(--pbg-blue); }
.pbg-tool-categorybar em { font-style: normal; opacity: .72; }
.pbg-tool-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); min-height: 620px; }
.pbg-tool-nav { padding: 14px 10px; border-right: 1px solid var(--pbg-line); }
.pbg-tool-group { margin-bottom: 16px; }
.pbg-tool-group h2 { margin: 4px 8px 7px; color: var(--pbg-muted); font-size: 11px; font-weight: 650; }
.pbg-tool-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 2px 0; cursor: pointer; border: 1px solid transparent; border-radius: 4px; padding: 9px 9px; text-align: left; font-size: 13px; }
.pbg-tool-item:hover { background: var(--pbg-soft); border-color: var(--pbg-line); }
.pbg-tool-item i { flex: 0 0 auto; font-style: normal; color: var(--pbg-muted); }
.pbg-tool-item.is-active i { color: #fff; }
.pbg-tool-empty { margin: 28px 10px; color: var(--pbg-muted); font-size: 12px; }
.pbg-tool-workbench { min-width: 0; padding: 22px; }
.pbg-tool-workbench-head { display: flex; align-items: start; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--pbg-line); padding-bottom: 17px; }
.pbg-tool-workbench-head h2 { margin: 5px 0; font-size: 22px; }
.pbg-tool-workbench-head p { margin: 4px 0 0; color: var(--pbg-muted); font-size: 13px; }
.pbg-tool-favorite { white-space: nowrap; color: var(--pbg-blue); background: var(--pbg-soft); border-color: var(--pbg-line); }
.pbg-tool-options { display: flex; align-items: center; gap: 12px; min-height: 38px; padding-top: 12px; color: var(--pbg-muted); font-size: 12px; }
.pbg-tool-options label { display: inline-flex; align-items: center; gap: 7px; }
.pbg-tool-options input[type=number] { width: 72px; height: 30px; border: 1px solid var(--pbg-line); border-radius: 4px; padding: 0 7px; color: var(--pbg-ink); background: var(--pbg-soft); }
.pbg-file-button { cursor: pointer; border: 1px solid var(--pbg-line); border-radius: 4px; padding: 7px 10px; background: var(--pbg-soft); }
.pbg-file-button input { display: none; }
.pbg-tool-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.pbg-tool-pane { min-width: 0; }
.pbg-tool-pane-head { display: flex; align-items: center; justify-content: space-between; min-height: 33px; color: var(--pbg-muted); font-size: 12px; }
.pbg-tool-pane-head div { display: flex; gap: 5px; }
.pbg-tool-pane .pbg-secondary { padding: 5px 8px; font-size: 11px; }
.pbg-tool-pane textarea { display: block; width: 100%; min-height: 330px; resize: vertical; border: 1px solid var(--pbg-line); border-radius: 4px; padding: 13px; color: var(--pbg-ink); background: var(--pbg-soft); font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.pbg-tool-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pbg-tool-actions [data-tool-status] { color: var(--pbg-green); font-size: 12px; }
.pbg-tool-history { margin-top: 26px; }
.pbg-tool-history .pbg-section-title { min-height: 38px; }
.pbg-tool-history .pbg-section-title h3 { margin: 8px 0; font-size: 14px; }
.pbg-tool-history .pbg-section-title button { padding: 5px 8px; font-size: 11px; }
.pbg-tool-history-list,
.pbg-tool-history [data-tool-history-list] { display: flex; gap: 7px; flex-wrap: wrap; padding-top: 10px; color: var(--pbg-muted); font-size: 12px; }
.pbg-tool-history [data-tool-history-list] button { cursor: pointer; border: 1px solid var(--pbg-line); border-radius: 4px; padding: 6px 9px; color: var(--pbg-blue); background: var(--pbg-soft); font-size: 12px; }
body .pbg-tool-panel textarea,
body .pbg-tool-panel pre,
body .pbg-request-form input,
body .pbg-request-form textarea { color: var(--pbg-ink); background: var(--pbg-soft); border-color: var(--pbg-line); }
body .pbg-intent-grid a,
body .pbg-goal-examples a,
body .pbg-hub-links a { color: var(--pbg-ink); background: var(--pbg-soft); }
body .pbg-page-title p,
body .pbg-hub p,
body .pbg-card-note,
body .pbg-card-meta { color: var(--pbg-muted); }
body .pbg-primary { background: var(--pbg-blue); border-color: var(--pbg-blue); }
body .pbg-secondary,
body .pbg-favorite { color: var(--pbg-blue) !important; background: var(--pbg-soft); border-color: var(--pbg-line); }
body .pbg-match-form,
body .pbg-explore-filter,
body .pbg-path-hero,
body .pbg-match-summary,
body .pbg-empty,
body .pbg-maintenance { color: var(--pbg-ink); background: var(--pbg-soft); border-color: var(--pbg-line); }
body .pbg-goal-field,
body .pbg-match-form legend,
body .pbg-match-options > label,
body .pbg-filter-grid label { color: var(--pbg-muted); }
body .pbg-goal-field input,
body .pbg-match-options select,
body .pbg-filter-grid select,
body .pbg-home-match input,
body .pbg-segments span { color: var(--pbg-ink); background: var(--pbg-surface); border-color: var(--pbg-line); }
body .pbg-segments input:checked + span { color: #fff; background: var(--pbg-ink); }
body .pbg-user-plan .pbg-section-title { background: var(--pbg-soft); }
body .pbg-type-label,
body .pbg-match-reasons span,
body .pbg-decision-reasons span,
body .pbg-profile-terms a,
body .pbg-resource-thumb-empty { color: var(--pbg-blue); background: var(--pbg-soft); border-color: var(--pbg-line); }
body .pbg-profile-risks { background: var(--pbg-soft); color: var(--pbg-muted); border-color: var(--pbg-line); }
body .pbg-hub-links a:hover,
body .pbg-intent-grid a:hover,
body .pbg-goal-examples a:hover { background: var(--pbg-soft); border-color: var(--pbg-line); }
body.dark-theme .pbg-profile-risks { background: var(--muted-bg-2-color); color: var(--muted-2-color); }

@media (max-width: 760px) {
    .pbg-tool-topbar { align-items: stretch; flex-direction: column; }
    .pbg-tool-top-actions { justify-content: flex-start; }
    .pbg-tool-layout { display: block; min-height: 0; }
    .pbg-tool-nav { border-right: 0; border-bottom: 1px solid var(--pbg-line); max-height: 235px; overflow: auto; }
    .pbg-tool-group { display: block; }
    .pbg-tool-workbench { padding: 16px; }
    .pbg-tool-editor { grid-template-columns: 1fr; }
    .pbg-tool-pane textarea { min-height: 230px; }
}
