#root {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

/* Main layout */
.app-layout {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* Header */
.app-header {
	padding: 0 24px;
	background: var(--md-surface-container-lowest);
	display: flex;
	align-items: center;
	justify-content: space-between;
	box-shadow: var(--md-elevation-1);
	flex-shrink: 0;
	height: 64px;
	line-height: 64px;
	z-index: 10;
	border-bottom: 1px solid var(--md-outline-variant);
}

@media (max-width: 768px) {
	.app-header {
		padding: 0 12px;
		height: 56px;
		line-height: 56px;
	}
}

/* Sidebar */
.app-sider {
	background: var(--md-surface-container-low) !important;
	border-right: 1px solid var(--md-outline-variant);
}

.app-sider .ant-menu {
	border-right: 0;
	background: transparent;
}

/* Content area */
.app-content {
	margin: 0;
	padding: 0;
	overflow: hidden;
	width: 100%;
	display: flex;
	flex-direction: column;
	flex: 1;
}

/* Device list page */
.device-list-page {
	padding: 20px;
	background: var(--md-surface);
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

@media (max-width: 768px) {
	.device-list-page {
		padding: 12px;
	}
}

.device-list-card {
	background: var(--md-surface-container-lowest);
	border-radius: var(--md-shape-lg);
	padding: 20px;
	box-shadow: var(--md-elevation-1);
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	border: 1px solid var(--md-outline-variant);
}

/* Filter bar */
.device-filter-bar {
	background: var(--md-surface-container-low);
	border-radius: var(--md-shape-sm);
	padding: 12px 16px;
	margin-bottom: 16px;
	border: 1px solid var(--md-outline-variant);
}

.device-filter-bar .ant-form-inline {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

@media (max-width: 1200px) {
	.device-filter-bar .ant-form-inline .ant-form-item {
		margin-bottom: 8px;
	}
}

/* Empty state */
.device-empty-state {
	text-align: center;
	padding: 60px 20px;
	color: var(--md-on-surface-variant);
}

/* Standalone control page */
.standalone-control-page {
	width: 100vw;
	height: 100vh;
	display: flex;
	flex-direction: row;
	background: var(--md-surface);
	overflow: hidden;
	min-width: 0;
	min-height: 0;
}

.modal-control-layout {
	height: 100%;
	display: flex;
	flex-direction: row;
	background: var(--md-surface-container-lowest);
	min-width: 0;
	min-height: 0;
}

/* Control screen area */
.control-screen-area {
	display: flex;
	flex-direction: column;
	height: 100%;
	border-right: 1px solid var(--md-outline-variant);
	background: var(--md-surface-container-lowest);
	flex: 0 0 clamp(420px, 58vw, 980px);
	width: clamp(420px, 58vw, 980px);
	min-width: 360px;
	max-width: 70vw;
	min-height: 0;
	overflow: hidden;
}

@media (max-width: 1366px) {
	.control-screen-area {
		flex-basis: clamp(360px, 60vw, 860px);
		width: clamp(360px, 60vw, 860px);
		max-width: 72vw;
	}
}

/* Toolbar */
.control-toolbar {
	padding: 6px 12px;
	border-bottom: 1px solid var(--md-outline-variant);
	background: var(--md-surface-container-low);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex-wrap: wrap;
	min-height: 40px;
}

.control-toolbar .ant-btn {
	font-size: 12px;
}

@media (max-width: 1200px) {
	.control-toolbar {
		padding: 4px 8px;
	}
	.control-toolbar .ant-btn {
		font-size: 11px;
		padding: 0 6px;
	}
}

/* Screen + reader horizontal layout */
.screen-reader-row {
	display: flex;
	flex-direction: row;
	flex: 1;
	min-height: 0;
	min-width: 0;
	overflow: hidden;
}

.screen-reader-panel {
	width: 50%;
	border-right: 1px solid var(--md-outline-variant);
	position: relative;
	overflow: hidden;
	background: var(--md-surface-container-low);
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
}

.device-screen-panel {
	width: 50%;
	position: relative;
	overflow: hidden;
	background: var(--md-surface-container);
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
}

@media (max-width: 960px) {
	.standalone-control-page {
		flex-direction: column;
	}
	.modal-control-layout {
		flex-direction: column;
	}
	.control-screen-area {
		flex: 0 0 55vh;
		width: 100%;
		max-width: 100%;
		min-width: 0;
		height: 55vh;
		border-right: none;
		border-bottom: 1px solid var(--md-outline-variant);
	}
	.screen-reader-row {
		flex-direction: column;
	}
	.screen-reader-panel,
	.device-screen-panel {
		width: 100% !important;
		height: 50%;
	}
}

/* Text input bar */
.text-input-bar {
	height: 44px;
	border-top: 1px solid var(--md-outline-variant);
	background: var(--md-surface-container-lowest);
	padding: 6px 12px;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.text-input-bar input {
	flex: 1;
	height: 32px;
	padding: 0 12px;
	border: 1px solid var(--md-outline-variant);
	border-radius: var(--md-shape-full);
	font-size: 13px;
	outline: none;
	background: var(--md-surface-container-low);
	color: var(--md-on-surface);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input-bar input:focus {
	border-color: var(--md-primary);
	box-shadow: 0 0 0 2px rgba(212, 160, 168, 0.15);
}

.text-input-bar input::placeholder {
	color: var(--md-on-surface-variant);
}

.text-input-bar button {
	height: 32px;
	padding: 0 16px;
	border: none;
	border-radius: var(--md-shape-full);
	background: var(--md-primary);
	color: var(--md-on-primary);
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	transition: background 0.2s, box-shadow 0.2s;
}

.text-input-bar button:hover:not(:disabled) {
	box-shadow: var(--md-elevation-1);
	filter: brightness(1.05);
}

.text-input-bar button:disabled {
	background: var(--md-surface-container-highest);
	color: var(--md-outline);
	cursor: not-allowed;
}

/* System keys bar */
.system-keys-bar {
	padding: 8px 12px;
	border-top: 1px solid var(--md-outline-variant);
	background: var(--md-surface-container-lowest);
	flex-shrink: 0;
	display: flex;
	justify-content: center;
	gap: 10px;
}

.system-keys-bar .ant-btn {
	min-width: 72px;
	height: 34px;
	border-radius: var(--md-shape-full);
	font-size: 13px;
}

/* Right control panel */
.control-panel-area {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: var(--md-surface-container-lowest);
	min-width: 0;
	overflow: hidden;
}

.control-panel-header {
	padding: 10px 16px;
	border-bottom: 1px solid var(--md-outline-variant);
	background: var(--md-surface-container-low);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 500;
	font-size: 14px;
	color: var(--md-on-surface);
}

.control-panel-body {
	flex: 1;
	overflow: auto;
	padding: 0;
}

/* Bottom status bar */
.screen-reader-status-bar {
	padding: 3px 12px;
	border-top: 1px solid var(--md-outline-variant);
	background: var(--md-surface-container-low);
	font-size: 11px;
	color: var(--md-on-surface-variant);
	text-align: center;
	flex-shrink: 0;
}

/* Mobile overlay */
.mobile-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.25);
	z-index: 999;
	animation: fadeIn 0.2s ease;
}

/* Mobile sidebar */
@media (max-width: 768px) {
	.ant-layout-sider {
		position: fixed !important;
		height: 100vh !important;
		z-index: 1000 !important;
	}
	.ant-layout-header {
		padding: 0 12px !important;
	}
}

/* Table responsive */
.ant-table-wrapper {
	overflow-x: auto;
}

.ant-table {
	font-size: 13px;
}
