/**
 * MSP VFS — shared UI (scores + draw generator)
 */
:root {
	--mspvfs-page: #eef1f5;
	--mspvfs-surface: #ffffff;
	--mspvfs-border: #e1e6ec;
	--mspvfs-text: #16191d;
	--mspvfs-muted: #5a6169;
	--mspvfs-accent: #0b5fff;
	--mspvfs-accent-soft: rgba(11, 95, 255, 0.08);
	--mspvfs-radius: 12px;
	--mspvfs-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
}

.ui-autocomplete {
	max-height: 200px;
	overflow-y: auto;
	overflow-x: hidden;
}

body.mspvfs-app {
	background: var(--mspvfs-page);
	color: var(--mspvfs-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
}

.mspvfs-topbar {
	background: var(--mspvfs-surface);
	border-bottom: 1px solid var(--mspvfs-border);
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.mspvfs-nav {
	padding-top: 0.5rem;
	padding-bottom: 0.5rem;
}

.mspvfs-nav .navbar-brand {
	font-weight: 600;
	letter-spacing: -0.02em;
	color: var(--mspvfs-text) !important;
}

.mspvfs-nav .nav-link {
	font-weight: 500;
	color: var(--mspvfs-muted) !important;
	border-radius: 8px;
	padding: 0.5rem 0.75rem !important;
	margin: 0.125rem 0;
}

.mspvfs-nav .nav-link:hover {
	color: var(--mspvfs-accent) !important;
	background: var(--mspvfs-accent-soft);
}

.mspvfs-nav .nav-item.active .nav-link {
	color: var(--mspvfs-accent) !important;
	background: var(--mspvfs-accent-soft);
}

.mspvfs-main {
	padding-bottom: 2.5rem;
}

.mspvfs-content {
	background: var(--mspvfs-surface);
	border: 1px solid var(--mspvfs-border);
	border-radius: var(--mspvfs-radius);
	box-shadow: var(--mspvfs-shadow);
	padding: 1rem 1rem 1.25rem;
	margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
	.mspvfs-content {
		padding: 1.35rem 1.75rem 1.75rem;
	}
}

.mspvfs-content > h1,
.mspvfs-content > h2,
.mspvfs-page-title {
	font-weight: 600;
	letter-spacing: -0.02em;
	color: var(--mspvfs-text);
}

.mspvfs-content > h1,
.mspvfs-page-title.h1 {
	font-size: 1.65rem;
	margin-bottom: 1rem;
}

.mspvfs-content > h2,
.mspvfs-page-title.h2 {
	font-size: 1.25rem;
	margin-top: 1.75rem;
	margin-bottom: 0.75rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--mspvfs-border);
}

.mspvfs-content > h2:first-child,
.mspvfs-content > h1:first-child {
	margin-top: 0;
}

.mspvfs-content .table {
	margin-bottom: 1.5rem;
}

.mspvfs-content .table:last-child {
	margin-bottom: 0;
}

.mspvfs-content .table thead th {
	border-top: 0;
	border-bottom-width: 2px;
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--mspvfs-muted);
	vertical-align: middle;
}

.mspvfs-content .table td,
.mspvfs-content .table th {
	border-color: var(--mspvfs-border);
	vertical-align: middle;
}

.mspvfs-content .table-striped > tbody > tr:nth-of-type(odd) {
	background-color: #f9fafb;
}

.mspvfs-content .table a {
	font-weight: 500;
}

.mspvfs-content .form-control {
	border-radius: 8px;
	border-color: var(--mspvfs-border);
}

.mspvfs-content .form-control:focus {
	border-color: var(--mspvfs-accent);
	box-shadow: 0 0 0 0.2rem var(--mspvfs-accent-soft);
}

.mspvfs-content label {
	font-weight: 600;
	color: var(--mspvfs-text);
	font-size: 0.9rem;
}

.mspvfs-chart-wrap {
	background: var(--mspvfs-surface);
	border: 1px solid var(--mspvfs-border);
	border-radius: 10px;
	padding: 0.75rem;
	margin-bottom: 1.25rem;
	min-height: 280px;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

.mspvfs-add-grid-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 0 -0.25rem;
	padding: 0 0.25rem;
}

.mspvfs-add-grid {
	min-width: 720px;
}

.mspvfs-add-head {
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--mspvfs-muted);
	padding-top: 0.35rem;
	padding-bottom: 0.35rem;
}

.numeric,
.mspvfs-content .numeric {
	text-align: right;
}

/* Draw generator */
.drawgen-settings-card {
	background: var(--mspvfs-surface);
	border: 1px solid var(--mspvfs-border) !important;
	border-radius: var(--mspvfs-radius) !important;
	box-shadow: var(--mspvfs-shadow);
}

.drawgen-settings-title {
	font-weight: 600;
	letter-spacing: -0.02em;
	margin-bottom: 1.25rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--mspvfs-border);
}

.drawgen-settings-card fieldset {
	margin-bottom: 0;
}

.drawgen-settings-card legend {
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--mspvfs-muted);
	float: none;
	width: 100%;
	padding-top: 0.5rem;
	margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
	.drawgen-settings-card legend {
		font-size: 0.75rem;
	}
}

.drawgen-settings-card .form-check {
	padding: 0.35rem 0.75rem;
	margin-bottom: 0.25rem;
	border-radius: 8px;
	transition: background 0.15s ease;
}

.drawgen-settings-card .form-check:hover {
	background: #f6f8fb;
}

.drawgen-settings-card .form-check-label {
	cursor: pointer;
	user-select: none;
}

.drawgen-settings-card select.form-control {
	border-radius: 8px;
	border-color: var(--mspvfs-border);
	max-width: 100%;
}

.drawgen-submit-wrap .btn {
	width: 100%;
}

@media (min-width: 768px) {
	.drawgen-submit-wrap .btn {
		width: auto;
		min-width: 220px;
	}
}

.drawgen-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.drawgen-toolbar .btn {
	flex: 1 1 calc(50% - 0.25rem);
	min-width: 0;
}

@media (min-width: 768px) {
	.drawgen-toolbar .btn {
		flex: 0 1 auto;
	}
}

.drawgen-actions .btn {
	border-radius: 8px;
	font-weight: 600;
	min-height: 44px;
	padding-left: 1.25rem;
	padding-right: 1.25rem;
}

.drawgen-actions .btn-sm {
	min-height: 40px;
}

.drawgen-response-area {
	background: var(--mspvfs-surface) !important;
	border: 1px solid var(--mspvfs-border);
	border-radius: var(--mspvfs-radius);
	box-shadow: var(--mspvfs-shadow);
	padding: 1rem 1rem 1.25rem;
	margin-top: 0.5rem;
	margin-bottom: 2rem;
}

@media (min-width: 768px) {
	.drawgen-response-area {
		padding: 1.25rem 1.5rem 1.5rem;
	}
}

.drawgen-response-area .drawgen-round {
	background: var(--mspvfs-surface);
	border: 1px solid var(--mspvfs-border) !important;
	border-radius: 10px !important;
}

.drawgen-response-area .formation_name {
	color: var(--mspvfs-muted);
	font-size: 0.9em;
}

.drawgen-response-area .formation {
	vertical-align: top;
	max-width: min(150px, 46vw);
	height: auto;
	margin: 0.2rem;
	border-radius: 6px;
}

.drawgen-formations {
	gap: 0.35rem;
}

.dive_pools {
	background: var(--mspvfs-surface);
	border: 1px solid var(--mspvfs-border);
	border-radius: var(--mspvfs-radius);
	padding: 1rem 1.25rem;
	margin-bottom: 1.5rem;
	box-shadow: var(--mspvfs-shadow);
}

.dive_pools > a {
	display: inline-block;
	margin: 0.25rem 0.5rem 0.25rem 0;
	padding: 0.45rem 0.9rem;
	font-weight: 500;
	border-radius: 8px;
	border: 1px solid var(--mspvfs-border);
	color: var(--mspvfs-text);
	background: #fafbfc;
}

.dive_pools > a:hover {
	text-decoration: none;
	border-color: var(--mspvfs-accent);
	color: var(--mspvfs-accent);
	background: var(--mspvfs-accent-soft);
}

.dive_pools .round {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0.35rem;
	justify-content: center;
}

@media (min-width: 768px) {
	.dive_pools .round {
		justify-content: flex-start;
	}
}

.dive_pools .formation {
	max-width: min(150px, 42vw);
	height: auto;
}

.round {
	margin: 10px;
	page-break-inside: avoid;
	display: table;
}

.formation {
	vertical-align: top;
}

@media only screen and (max-width: 800px) {
	.no-more-tables table,
	.no-more-tables thead,
	.no-more-tables tbody,
	.no-more-tables th,
	.no-more-tables td,
	.no-more-tables tr {
		display: block;
	}

	.no-more-tables thead tr {
		position: absolute;
		top: -9999px;
		left: -9999px;
	}

	.no-more-tables tr {
		border: 1px solid var(--mspvfs-border);
		border-radius: 8px;
		margin-bottom: 0.5rem;
		overflow: hidden;
	}

	.no-more-tables td {
		border: none;
		border-bottom: 1px solid #edf0f4;
		position: relative;
		padding: 0.65rem 0.75rem 0.65rem 50%;
		white-space: normal;
		text-align: left;
	}

	.no-more-tables td:last-child {
		border-bottom: 0;
	}

	.no-more-tables td:before {
		position: absolute;
		top: 0.65rem;
		left: 0.75rem;
		width: 45%;
		padding-right: 10px;
		white-space: nowrap;
		text-align: left;
		font-weight: 600;
		font-size: 0.72rem;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: var(--mspvfs-muted);
		content: attr(data-title);
	}
}

@media print {
	body.mspvfs-app {
		min-height: 0 !important;
	}
}
