.root {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
	overflow: hidden;
	background: transparent;
}

.loader {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1;
	gap: 8px;
	color: variables.$text-tertiary;
	@include typography.font-caption-m;
}

.spinner {
	animation: spin 1s linear infinite;
}

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

@keyframes spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

.empty {
	padding: 24px;
	text-align: center;
	color: variables.$text-tertiary;
	font-size: 14px;
}

.toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 18px 14px;
	border-bottom: 1px solid variables.$border-default;
	background: variables.$bg-default;
	flex-shrink: 0;

	@media (max-width: 720px) {
		flex-direction: column;
		align-items: stretch;
	}
}

.toolbarMeta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.toolbarTitle {
	margin: 0;
	color: variables.$text-primary;
	@include typography.font-body-16(600);
}

.toolbarSummary {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

.segmentCount {
	color: variables.$text-secondary;
	@include typography.font-body-14(500);
}

.headerStatus {
	margin: 0;
	color: variables.$text-tertiary;
	@include typography.font-caption-m;
}

.segmentsList {
	flex: 1;
	overflow-y: auto;
	padding: 14px 18px 18px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.segment {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr);
	gap: 12px;
	border: 1px solid variables.$border-default;
	border-radius: 10px;
	padding: 12px;
	background: variables.$bg-default;
	transition: border-color 0.15s ease, background 0.15s ease,
		box-shadow 0.15s ease;

	&:hover {
		border-color: variables.$border-default;
		background: variables.$bg-surface;
	}

	&.highlight {
		border-color: variables.$color-primary;
		box-shadow: var(--focus-ring);
	}

	@media (max-width: 720px) {
		grid-template-columns: 1fr;
	}
}

.segmentNumber {
	display: inline-flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 7px;
	color: variables.$text-tertiary;
	@include typography.font-caption-m;
	@include typography.font-numeric;
}

.segmentMain {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
}

.segmentMetaRow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.timesGroup {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.actionsGroup {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.timeField {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	padding: 8px 10px;
	border-radius: 8px;
	background: variables.$bg-surface;
	border: 1px solid variables.$border-default;
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;

	&:focus-within {
		background: variables.$bg-default;
		border-color: variables.$color-primary;
		box-shadow: var(--focus-ring);
	}
}

.timeLabelText {
	color: variables.$text-secondary;
	white-space: nowrap;
	@include typography.font-caption-m;
}

.timeInput {
	width: 96px;
	padding: 0;
	border: none;
	border-radius: 0;
	font-family: monospace;
	color: variables.$text-primary;
	background: transparent;
	transition: color 0.2s ease;
	text-align: left;
	@include typography.font-caption-m;
	@include typography.font-numeric;

	&:focus {
		outline: none;
	}
}

.splitButton, .removeButton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid variables.$border-default;
	background: variables.$bg-default;
	color: variables.$text-tertiary;
	cursor: pointer;
	border-radius: 8px;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease,
		box-shadow 0.2s ease;
}

.splitButton {
	&:hover:not(:disabled) {
		color: variables.$color-primary;
		background: variables.$bg-surface;
		border-color: variables.$border-default;
	}

	&:disabled {
		opacity: 0.35;
		cursor: default;
	}
}

.removeButton {
	&:hover {
		color: variables.$color-danger;
		background: variables.$bg-surface;
		border-color: variables.$border-default;
	}
}

.textArea {
	width: 100%;
	min-height: 96px;
	padding: 12px 14px;
	border: 1px solid variables.$border-default;
	border-radius: 8px;
	color: variables.$text-primary;
	background: variables.$bg-surface;
	resize: vertical;
	font-family: inherit;
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	@include typography.font-body-14(400);

	&:hover {
		background: variables.$bg-hover;
	}

	&:focus {
		outline: none;
		background: variables.$bg-default;
		border-color: variables.$color-primary;
		box-shadow: var(--focus-ring);
	}

	&::placeholder {
		color: variables.$text-tertiary;
	}
}

.addButton {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	justify-content: center;
	padding: 10px 12px;
	border: 1px solid variables.$border-default;
	border-radius: 8px;
	background: variables.$bg-default;
	color: variables.$text-secondary;
	@include typography.font-body-14(500);
	cursor: pointer;
	flex-shrink: 0;
	white-space: nowrap;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease,
		box-shadow 0.2s ease;

	&:hover {
		background: variables.$bg-surface;
		border-color: variables.$border-default;
		color: variables.$color-primary;
		box-shadow: var(--shadow-sm);
	}

	@media (max-width: 720px) {
		width: 100%;
	}
}
