.pbmf-wrapper,
.pbmf-wrapper *,
.pbmf-wrapper *::before,
.pbmf-wrapper *::after {
	box-sizing: border-box;
	
}

.pbmf-wrapper {
	max-width: 100%;
	width: 100%;
	margin: 0 auto;
	padding: 30px 20px 60px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #1a2b47;
	overflow-x: hidden;
}

.pbmf-clinic-title {
	text-align: center !important;
	font-size: 22px;
	font-weight: 700;
	color: #1a2b47;
	margin: 0 0 30px;
}

/* Stepper */
.pbmf-stepper {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 20px auto 40px;
	/* max-width: 700px; */
	flex-wrap: nowrap;
}

.pbmf-step-circle-group {
	flex: 0 0 auto;
}

.pbmf-step-circle {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 2px solid #4a90d9;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 16px;
	color: #1a2b47;
	background: #fff;
	transition: background 0.25s ease, color 0.25s ease;
}

.pbmf-step-circle.pbmf-active,
.pbmf-step-circle.pbmf-completed {
	border-color: #4a90d9;
}

.pbmf-step-circle.pbmf-completed {
	background: #4a90d9;
	color: #fff;
}

.pbmf-step-line {
	flex: 1 1 auto;
	height: 2px;
	background: #cfd8e3;
	transition: background 0.25s ease;
	min-width: 30px;
}

.pbmf-step-line.pbmf-completed {
	background: #4a90d9;
}

/* Clinic letterhead - repeats at the top of every step, matching the
   letterhead that repeats at the top of every page of the printed PDF. */
.pbmf-letterhead {
	text-align: center;
	padding-bottom: 14px;
	margin-bottom: 20px;
	border-bottom: 1px solid #dddfe3;
}

.pbmf-letterhead-clinic {
	font-size: 20px;
	font-weight: 700 !important;
	color: #1a2b47;
	margin: 0 0 4px;
}

.pbmf-letterhead-line {
	font-size: 13px;
	font-weight: 400;
	color: #33455e;
	margin: 0 0 2px;
	line-height: 1.4;
}

/* Step heading */
.pbmf-step-heading {
	font-size: 26px;
	font-weight: 700;
	color: #1a2b47;
	margin: 10px 0 25px;
}

.pbmf-section {
	margin-bottom: 34px;
}

.pbmf-section-title {
	text-align: center;
	text-decoration: underline;
	text-underline-offset: 4px;
	font-size: 15px !important;
	font-weight: 700 !important;
	letter-spacing: 0.5px;
	color: #1a2b47;
	margin: 0 0 22px;
}

/* Callout note with arrow icon */
.pbmf-note {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #1a2b47;
	margin: 0 0 20px;
}

.pbmf-note-icon {
	color: #c07a2e;
	font-size: 15px;
	line-height: 1.4;
}

/* Read-only notice paragraphs / lists */
.pbmf-notice-block {
	background: #f7f9fc;
	border: 1px solid #dde5f0;
	border-radius: 6px;
	padding: 18px 20px;
	margin: 0 0 22px;
}

.pbmf-notice-paragraph {
	font-size: 13.5px;
	line-height: 1.6;
	color: #33455e;
	margin: 0 0 12px;
}

.pbmf-notice-paragraph:last-child {
	margin-bottom: 0;
}

.pbmf-notice-list {
	margin: 0 0 12px;
	padding-left: 20px;
	font-size: 13.5px;
	line-height: 1.6;
	color: #33455e;
}

.pbmf-notice-list:last-child {
	margin-bottom: 0;
}

.pbmf-notice-list li {
	margin-bottom: 8px;
}

/* Field grid - a FIXED 3-column grid on desktop, applied the same way to
   every section on every step (1-9). Sections with a multiple of 3 fields
   (3, 6, 9...) fill each row evenly; any other count wraps its remainder
   onto its own row instead of stretching to fill the width (e.g. 4 fields
   = 3 in row one, 1 alone in row two; 5 fields = 3 + 2). Fields flagged
   'full_width' in class-pb-fields.php (long labels, textareas, radio /
   checkbox groups) always span the full row regardless of column count.
   minmax(0, 1fr) keeps long unbroken content (like a select's label) from
   ever blowing out a column's width. Column count steps down at the
   tablet and mobile breakpoints further down. */
.pbmf-field-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px 16px;
	width: 100%;
}

.step6pbmf-field-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px 16px;
	width: 100%;
}

.pbmf-field {
	margin-bottom: 0;
	min-width: 0;
}

.pbmf-field-full,
.pbmf-field-textarea,
.pbmf-field-checkbox_group,
.pbmf-field-checkbox,
.pbmf-field-radio {
	grid-column: 1 / -1;
}

.pbmf-input-box {
	border: 0px solid #9fc4ff !important; 
	border-radius: 4px;
	background: #fff;
}

.pbmf-input-box input,
.pbmf-input-box textarea {
	width: 100%;
	border: none;
	outline: none;
	background: transparent;
	padding: 14px 16px;
	font-size: 11px !important;
	font-weight: 600;
	color: #1a2b47;
	box-sizing: border-box;
	font-size: 11px !important;
	font-family: inherit;
	resize: vertical;
	min-height: 48px;
	border: 1px solid #9fc4ff !important; 
}

.pbmf-input-box textarea {
	min-height: 80px;
}

.pbmf-input-box input::placeholder,
.pbmf-input-box textarea::placeholder {
	color: #1a2b47;
	font-weight: 600;
	opacity: 1;
}

.pbmf-field-error .pbmf-input-box,
.pbmf-field-error .pbmf-select-box select,
.pbmf-field-error .pbmf-checkbox-group,
.pbmf-field-error .pbmf-radio-group {
	border-color: #d9534f !important;
}

.pbmf-matrix.pbmf-matrix-error {
	border-color: #d9534f;
}

/* Select / dropdown fields styled like "Gender:" / "Marital Status:" boxes */
.pbmf-select-box {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	border: 1px solid #9fc4ff;
	border-radius: 4px;
	background: #fff;
	padding: 5px 12px 5px 0px !important;
	min-width: 0;
}

.pbmf-select-label {
	font-size: 11px;
	font-weight: 500;
	color: #1a2b47;
	flex: 0 1 auto;
}

.pbmf-select-box select {
	flex: 1 1 auto;
	min-width: 60px;
	border: none;
	outline: none;
	background: transparent;
	font-size: 11px !important;
	font-weight: 600;
	color: #1a2b47;
	font-family: inherit;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%231a2b47'/></svg>");
	background-repeat: no-repeat;
	background-position: right center;
	padding-right: 16px;
}

/* Checkbox */
.pbmf-field-checkbox {
	border: none;
}

.pbmf-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 14px;
	font-weight: 600;
	color: #1a2b47;
	cursor: pointer;
	margin-bottom: 8px;
}

.pbmf-checkbox-label input[type="checkbox"] {
	margin-top: 3px;
}

/* Step 6: individually checkable office-policy clauses */
.pbmf-policy-checklist {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin: 0 0 18px;
}

.pbmf-policy-item {
	border-bottom: 1px solid #e7edf5;
	padding: 10px 0;
}

.pbmf-policy-item:last-child {
	border-bottom: none;
}

.pbmf-policy-item .pbmf-checkbox-label {
	font-size: 13.5px;
	font-weight: 400;
	line-height: 1.6;
	color: #33455e;
	margin-bottom: 0;
}

.pbmf-policy-item .pbmf-checkbox-label input[type="checkbox"] {
	flex: 0 0 auto;
	margin-top: 4px;
}

.pbmf-field-error.pbmf-policy-item {
	background: #fdecec;
	border-radius: 4px;
	padding-left: 8px;
	padding-right: 8px;
}

.pbmf-checkbox-group-label,
.pbmf-radio-group-label {
	font-size: 14px;
	font-weight: 700;
	color: #1a2b47;
	margin-bottom: 10px;
}

.pbmf-checkbox-group {
	display: flex;
	flex-direction: column;
	border: 1px solid #dde5f0;
	border-radius: 4px;
	padding: 14px 16px;
	background: #fff;
}

.pbmf-radio-group {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 26px;
	border: 1px solid #dde5f0;
	border-radius: 4px;
	padding: 14px 16px;
	background: #fff;
}

.pbmf-radio-inline-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #1a2b47;
	cursor: pointer;
}

/* PHQ-9 style matrix table */
.pbmf-matrix {
	border: 1px solid #4a90d9;
	border-radius: 4px;
	overflow: hidden;
	margin-bottom: 22px;
}

.pbmf-matrix-row {
	display: grid;
	grid-template-columns: 1fr repeat(4, 120px);
	align-items: center;
	border-top: 1px solid #dde5f0;
}

.pbmf-matrix-row:first-child {
	border-top: none;
}

.pbmf-matrix-head {
	background: #eaf2fb;
	font-size: 12px;
	font-weight: 700;
	color: #1a2b47;
	text-align: center;
}

.pbmf-matrix-question {
	padding: 12px 16px;
	font-size: 13.5px;
	font-weight: 600;
	color: #1a2b47;
	line-height: 1.4;
}

.pbmf-matrix-option-head {
	padding: 10px 6px;
	text-align: center;
}

.pbmf-matrix-option {
	display: flex;
	justify-content: center;
	padding: 10px 6px;
}

.pbmf-matrix-option label {
	display: flex;
	cursor: pointer;
}

.pbmf-matrix-option input[type="radio"] {
	width: 18px;
	height: 18px;
	accent-color: #4a90d9;
	cursor: pointer;
}

/* Nav buttons */
.pbmf-nav-buttons {
	display: flex;
	justify-content: space-between;
	margin-top: 30px;
}

.pbmf-btn {
	background: #4a90d9;
	color: #fff;
	border: none;
	border-radius: 4px;
	padding: 12px 30px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.2s ease;
}

.pbmf-btn:hover {
	background: #3a78bd;
}

.pbmf-btn-back {
	background: #fff;
	color: #4a90d9;
	border: 1px solid #4a90d9;
}

.pbmf-btn-back:hover {
	background: #f0f6fc;
}

.pbmf-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Messages */
.pbmf-messages {
	max-width: 700px;
	margin: 0 auto 20px;
	padding: 14px 18px;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
}

.pbmf-messages.pbmf-success {
	background: #e5f6ea;
	color: #1c7c3d;
	border: 1px solid #b6e6c4;
}

.pbmf-messages.pbmf-error {
	background: #fdecec;
	color: #b32d2e;
	border: 1px solid #f3c1c1;
}

#formobtext {
	display: none !important;
}

/* ==========================================================================
   Responsive breakpoints
   --------------------------------------------------------------------------
   Desktop  (>900px):  fixed 3-column grid, same on every step - a 3-field
                        section fills one row, a 4-field section wraps to
                        3 + 1, a 5-field section wraps to 3 + 2, etc. (see
                        .pbmf-field-grid above).
   Tablet   (601-900px): fixed 2-column grid - a 4-field section becomes
                        2 rows of 2, a 5-field section becomes 2 rows of
                        2 plus 1 alone on its own row, etc.
   Mobile   (<=600px): every field drops to a single column, full width.
   ========================================================================== */

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
	.pbmf-wrapper {
		padding: 26px 18px 50px;
	}
	.pbmf-field-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px 14px;
	}
    .step6pbmf-field-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px 14px;
	}

	.pbmf-matrix-row {
		grid-template-columns: 1fr repeat(4, 90px);
	}
}

@media (max-width: 700px) {
	.pbmf-matrix-row {
		grid-template-columns: 1fr repeat(4, 70px);
	}
	.pbmf-matrix-option-head {
		font-size: 10px;
	}
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
	.pbmf-wrapper {
		padding: 20px 16px 44px;
	}
	.pbmf-clinic-title {
		font-size: 20px;
		margin-bottom: 20px;
	}

	.pbmf-letterhead {
		padding-bottom: 10px;
		margin-bottom: 14px;
	}
	.pbmf-letterhead-clinic {
		font-size: 16px;
	}
	.pbmf-letterhead-line {
		font-size: 11.5px;
	}

	#formobtext {
	display: block !important;
    }

	/* Stepper: keep every step on one line and let it scroll horizontally
	   instead of overflowing/breaking the page on narrow phones. */
	.pbmf-stepper {
		justify-content: flex-start;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		padding: 4px 2px 10px;
		margin: 16px auto 28px;
		scrollbar-width: thin;
	}
	.pbmf-step-circle {
		width: 34px;
		height: 34px;
		font-size: 13px;
	}
	.pbmf-step-line {
		min-width: 18px;
	}
	.pbmf-step-heading {
		font-size: 20px;
		margin: 6px 0 18px;
	}

	.pbmf-section {
		margin-bottom: 26px;
	}
	.pbmf-section-title {
		font-size: 14px;
		margin-bottom: 16px;
	}

	/* One field per row on mobile, regardless of how many fields share
	   the section on desktop/tablet. */
	.pbmf-field-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}
	.step6pbmf-field-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	/* 16px inputs prevent iOS Safari from auto-zooming in on focus. */
	.pbmf-input-box input,
	.pbmf-input-box textarea,
	.pbmf-select-box select {
		font-size: 11px;
		padding: 12px 14px;
	}

	/* Let the label wrap above the control instead of forcing a squeeze
	   or horizontal overflow on narrow phones. */
	.pbmf-select-box {
		flex-wrap: wrap;
		white-space: normal;
		row-gap: 4px;
	}
	.pbmf-select-box select {
		min-width: 100%;
	}

	.pbmf-checkbox-group,
	.pbmf-radio-group {
		padding: 12px 14px;
	}
	.pbmf-radio-group {
		gap: 10px 18px;
	}

	.pbmf-nav-buttons {
		flex-direction: column;
		gap: 10px;
	}
	.pbmf-btn {
		width: 100%;
	}
	.pbmf-matrix-row {
		grid-template-columns: 1fr;
	}
	.pbmf-matrix-head {
		display: none;
	}
	.pbmf-matrix-question {
		border-bottom: 1px solid #eee;
	}
	.pbmf-matrix-option {
		justify-content: flex-start;
		padding: 4px 16px;
		gap: 8px;
	}
	.pbmf-matrix-option::before {
		content: attr(data-label);
	}
	.pbmf-messages {
		margin: 0 0 16px;
	}
}

/* ---------- Small phones ---------- */
@media (max-width: 400px) {
	.pbmf-step-circle {
		width: 23px;
		height: 23px;
		font-size: 11px;
	}
	.pbmf-step-line {
		min-width: 10px;
	}
	.pbmf-clinic-title {
		font-size: 18px;
	}
	.pbmf-step-heading {
		font-size: 18px;
	}
}
