.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.field__label {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
}
.field__label small {
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
}
.field__error {
	font-size: 14px;
	color: var(--danger);
}
.field.has-error .input,
.field.has-error .textarea,
.field.has-error .select {
	border-color: var(--danger);
}

.input,
.select,
.textarea {
	width: 100%;
	font: inherit;
	color: var(--ink);
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: var(--radius);
	padding: 0 16px;
	min-height: var(--control);
	/* 16px is the floor: below it iOS zooms the page in when a field gets focus */
	font-size: 16px;
	font-weight: 500;
	appearance: none;
	-webkit-appearance: none;
}
.input:focus,
.select:focus,
.textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}
.select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%236b655c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	padding-right: 44px;
}
.select--picker {
	display: flex;
	align-items: center;
	text-align: left;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b655c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}
.select--picker.is-empty {
	color: var(--muted);
	font-weight: 500;
}
.select__value {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.textarea {
	padding: 14px 16px;
	min-height: 120px;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.4;
	resize: vertical;
}
.input--time {
	text-align: center;
	font-family: var(--font-heading);
	font-size: 26px;
	font-weight: 700;
	min-height: 64px;
	padding: 0 10px;
	font-variant-numeric: tabular-nums;
}
.input--number {
	text-align: center;
	font-size: 22px;
	font-weight: 600;
}
.input-unit {
	position: relative;
}
.input-unit span {
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--faint);
	pointer-events: none;
}

.two {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: var(--control);
	padding: 8px 16px;
	width: 100%;
	text-align: left;
	font: inherit;
	font-size: 16px;
	line-height: 1.3;
	font-weight: 500;
	color: var(--ink);
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: var(--radius);
}
.option.is-on {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-text);
	font-weight: 600;
}

.chips {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
}
.chips--3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 6px;
}
.chip {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--chip);
	padding: 0 6px;
	font: inherit;
	font-size: 16px;
	white-space: nowrap;
	font-weight: 600;
	color: var(--ink);
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: var(--radius);
}
.chips--3 .chip {
	min-height: 44px;
	border-radius: 8px;
	font-size: 15px;
}
.chip.is-on {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-text);
}
.chips--3 .chip.is-on {
	background: var(--accent-soft);
	color: var(--accent);
}

.total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: var(--radius);
}
.total__text {
	font-size: 15px;
	color: var(--muted);
	min-width: 0;
}
.total__value {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 3px;
	font-family: var(--font-heading);
	font-size: 26px;
	font-weight: 700;
	color: var(--accent);
	line-height: 1;
	white-space: nowrap;
	flex-shrink: 0;
}
.total.is-bad .total__value {
	color: var(--danger);
}

.button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: var(--button);
	flex-grow: 1;
	padding: 0 16px;
	font: inherit;
	font-size: 21px;
	font-weight: 600;
	color: var(--accent-text);
	background: var(--accent);
	border: 0;
	border-radius: var(--radius-lg);
	cursor: pointer;
	/* also used on links, e.g. the start guard's repair link */
	text-decoration: none;
}
.button:disabled {
	opacity: 0.55;
	cursor: default;
}
.button--ghost {
	flex-grow: 0;
	width: 64px;
	background: var(--surface);
	border: 1.5px solid var(--line);
	color: var(--ink);
}
.button--secondary {
	background: var(--surface);
	border: 1.5px solid var(--line);
	color: var(--ink);
	font-size: 16px;
	min-height: 52px;
}
.link-button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 4px;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	color: var(--accent);
	background: none;
	border: 0;
	cursor: pointer;
}

.row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: var(--control);
	padding: 0 16px;
	width: 100%;
	text-align: left;
	font: inherit;
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: var(--radius);
	color: var(--ink);
}
.row--action {
	border-style: dashed;
	border-color: var(--accent);
	cursor: pointer;
}
.row__main {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 17px;
	font-weight: 500;
}
.row__stack {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.row__stack small {
	font-size: 13px;
	color: var(--muted);
}
.row__action {
	font-size: 16px;
	font-weight: 600;
	color: var(--accent);
}
.row__ok {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 15px;
	font-weight: 600;
	color: var(--success);
}

.switch {
	position: relative;
	width: 64px;
	height: 36px;
	flex-shrink: 0;
}
.switch input {
	position: absolute;
	inset: 0;
	opacity: 0;
	margin: 0;
	cursor: pointer;
}
.switch__track {
	position: absolute;
	inset: 0;
	border-radius: 18px;
	background: var(--line);
	transition: background 0.15s;
}
.switch__knob {
	position: absolute;
	top: 4px;
	left: 4px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.15s;
}
.switch input:checked + .switch__track {
	background: var(--accent);
}
.switch input:checked + .switch__track .switch__knob {
	transform: translateX(28px);
}

.icon {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.spinner {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	animation: spin 0.8s linear infinite;
	flex-shrink: 0;
}
.spinner--dark {
	border-color: rgba(31, 28, 24, 0.2);
	border-top-color: var(--accent);
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}
.notice {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: var(--radius);
	font-size: 16px;
	color: var(--muted);
}

/* Small phones. Up to 380px the time font shrinks so a 12-hour phone ("07:00 AM") still fits;
   up to 340px start and end stack, so each field and its quick picks get the full width. */
@media (max-width: 380px) {
	.input--time {
		font-size: 20px;
		padding: 0 6px;
	}
	.chip {
		font-size: 15px;
		padding: 0 4px;
	}
}
@media (max-width: 340px) {
	.two {
		grid-template-columns: minmax(0, 1fr);
	}
	.input--time {
		font-size: 24px;
	}
}
