.whosfree-root {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #1d2327;
	max-width: 100%;
}

.whosfree-root * {
	box-sizing: border-box;
}

.whosfree-loading {
	color: #666;
	font-style: italic;
}

.whosfree-error {
	background: #fce8e8;
	border: 1px solid #d63638;
	color: #7a1a1a;
	padding: 10px 14px;
	border-radius: 6px;
	margin: 0 0 12px;
	font-size: 14px;
}

/* Login panel */
.whosfree-login {
	max-width: 380px;
	padding: 20px;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	background: #fafafa;
}

.whosfree-login h2 {
	margin-top: 0;
	font-size: 18px;
}

.whosfree-field {
	margin-bottom: 14px;
}

.whosfree-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
	font-size: 13px;
}

.whosfree-field input,
.whosfree-field select {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 14px;
}

.whosfree-hint {
	color: #666;
	font-size: 12px;
	margin-top: 4px;
}

.whosfree-btn {
	display: inline-block;
	padding: 8px 16px;
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 14px;
	cursor: pointer;
}

.whosfree-btn:hover {
	background: #135e96;
}

.whosfree-btn.secondary {
	background: #fff;
	color: #2271b1;
	border: 1px solid #2271b1;
}

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

/* Identity + toolbar */
.whosfree-topbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 14px;
}

.whosfree-identity {
	font-size: 14px;
}

.whosfree-identity .whosfree-admin-tag {
	color: #996800;
	font-weight: 600;
}

.whosfree-logout {
	margin-left: 10px;
	color: #b32d2e;
	cursor: pointer;
	text-decoration: underline;
	font-size: 13px;
}

.whosfree-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	margin-bottom: 14px;
}

.whosfree-week-nav {
	display: flex;
	align-items: center;
	gap: 8px;
}

.whosfree-week-label {
	font-weight: 600;
	min-width: 190px;
	text-align: center;
}

.whosfree-sort {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
}

.whosfree-sort select {
	padding: 5px 8px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
}

.whosfree-search {
	display: flex;
	align-items: center;
	flex: 1 1 200px;
	min-width: 160px;
	max-width: 260px;
}

.whosfree-search input[type="search"] {
	width: 100%;
	padding: 6px 10px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 13px;
}

.whosfree-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

/* Grid */
.whosfree-scroll-hint {
	display: none;
	font-size: 12px;
	color: #2271b1;
	margin-bottom: 6px;
}

.whosfree-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid #dcdcde;
	border-radius: 8px;
}

table.whosfree-table {
	border-collapse: collapse;
	width: 100%;
	table-layout: fixed;
	font-size: 13px;
}

table.whosfree-table th,
table.whosfree-table td {
	border-bottom: 1px solid #eee;
	border-right: 1px solid #f0f0f0;
	padding: 6px 4px;
	text-align: center;
	vertical-align: middle;
	width: 10%;
}

table.whosfree-table th {
	background: #f6f7f7;
	font-weight: 600;
	position: sticky;
	top: 0;
}

table.whosfree-table td:first-child,
table.whosfree-table th:first-child {
	text-align: left;
	position: sticky;
	left: 0;
	background: #fff;
	width: 30%;
	min-width: 120px;
	z-index: 1;
}

table.whosfree-table th:first-child {
	background: #f6f7f7;
	z-index: 2;
}

.whosfree-day-head {
	line-height: 1.3;
}

.whosfree-day-head .dow {
	display: block;
}

.whosfree-day-head .date {
	display: block;
	font-weight: 400;
	color: #666;
	font-size: 11px;
}

/* Today's column: understated — just enough to notice, not enough to shout. */
th.whosfree-today-col,
td.whosfree-today-col {
	background: #f5f8fb;
}

th.whosfree-today-col .dow {
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.whosfree-row-name {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
}

.whosfree-row-name .name-team {
	display: flex;
	flex-direction: column;
}

.whosfree-row-name .name {
	font-weight: 600;
}

.whosfree-row-name select.team-select {
	margin-top: 3px;
	font-size: 12px;
	padding: 2px 4px;
	border: 1px solid #ccc;
	border-radius: 3px;
}

.whosfree-team-static {
	font-size: 12px;
	color: #666;
	margin-top: 2px;
}

.whosfree-phone-edit {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 3px;
}

.whosfree-phone-edit .phone-input {
	font-size: 12px;
	padding: 2px 4px;
	border: 1px solid #ccc;
	border-radius: 3px;
	width: 108px;
}

.whosfree-phone-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 13px;
	line-height: 1;
	padding: 2px 4px;
	color: #2271b1;
	text-decoration: none;
	border-radius: 3px;
}

.whosfree-phone-btn:hover {
	background: #eef3f8;
}

.whosfree-phone-link {
	display: inline-block;
	margin-top: 2px;
	font-size: 12px;
	color: #2271b1;
	text-decoration: underline;
}

.whosfree-score {
	display: inline-block;
	min-width: 22px;
	padding: 2px 6px;
	background: #eef3f8;
	color: #2271b1;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 700;
}

.whosfree-remove {
	background: none;
	border: none;
	color: #b32d2e;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	padding: 2px 4px;
}

.whosfree-remove:hover {
	color: #7a1a1a;
}

.whosfree-cell-options {
	display: flex;
	flex-direction: column;
	gap: 3px;
	align-items: center;
}

.whosfree-opt-btn {
	font-size: 10.5px;
	padding: 3px 4px;
	border: 1px solid #ccd0d4;
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
	width: 100%;
	max-width: 72px;
}

.whosfree-opt-btn:disabled {
	cursor: default;
	opacity: 0.55;
}

.whosfree-opt-btn.active[data-status="allday"] {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

.whosfree-opt-btn.active[data-status="evening"] {
	background: #6b3fa0;
	border-color: #6b3fa0;
	color: #fff;
}

.whosfree-weekend-col {
	background: #fbfaf6;
}

.whosfree-legend {
	margin-top: 10px;
	font-size: 12px;
	color: #666;
}

/* ---------------- Mobile ---------------- */

@media ( max-width: 700px ) {
	.whosfree-scroll-hint {
		display: block;
	}

	/* Below this width the grid no longer fits evenly — switch from an
	   evenly-distributed layout to natural widths and let the wrapper
	   scroll sideways, with the name column pinned so context is never lost. */
	table.whosfree-table {
		table-layout: auto;
		font-size: 12px;
	}

	table.whosfree-table th,
	table.whosfree-table td {
		width: auto;
		padding: 5px 3px;
	}

	table.whosfree-table td:first-child,
	table.whosfree-table th:first-child {
		width: auto;
		min-width: 110px;
	}

	.whosfree-opt-btn {
		max-width: none;
		min-width: 54px;
		min-height: 34px;
		font-size: 11px;
	}

	.whosfree-day-head .date {
		font-size: 10px;
	}
}

@media ( max-width: 480px ) {
	.whosfree-topbar,
	.whosfree-controls {
		flex-direction: column;
		align-items: flex-start;
	}

	/* In a column flex container flex-basis applies to height, not width —
	   without this override the search box would stretch tall instead of
	   sitting at a normal input height. */
	.whosfree-search {
		flex: none;
		width: 100%;
		max-width: 100%;
		min-width: 0;
	}

	.whosfree-week-nav {
		flex-wrap: wrap;
	}

	.whosfree-week-label {
		min-width: 0;
	}

	.whosfree-login {
		max-width: 100%;
	}

	.whosfree-btn {
		min-height: 40px;
	}

	.whosfree-opt-btn {
		min-height: 38px;
	}
}
