@import url("design-tokens.css");

:root {
	color: var(--ink);
	background: var(--page-background);
	font-family: "Segoe UI", "Malgun Gothic", sans-serif;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	overflow-x: hidden;
	background:
		linear-gradient(120deg, rgba(36, 132, 91, 0.12), transparent 34%),
		linear-gradient(310deg, rgba(36, 95, 147, 0.14), transparent 36%),
		var(--page-background);
}

.app-shell {
	display: grid;
	grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
	min-height: 100vh;
	min-width: 0;
}

.sidebar {
	display: flex;
	flex-direction: column;
	gap: 28px;
	padding: 28px 18px;
	min-width: 0;
	max-width: 100%;
	border-right: 1px solid var(--line);
	background: rgba(251, 252, 248, 0.78);
	backdrop-filter: blur(18px);
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	color: var(--ink);
	text-decoration: none;
}

.brand-mark {
	display: grid;
	width: 42px;
	height: 42px;
	place-items: center;
	border-radius: var(--radius);
	background: var(--ink);
	color: #f8fbf6;
	font-weight: 900;
}

.brand strong,
.brand small {
	display: block;
}

.brand small,
.operator span,
.metric small,
.server-row small,
.transfer small {
	color: var(--muted);
}

.nav {
	display: grid;
	gap: 6px;
	min-width: 0;
}

.nav a {
	padding: 12px 14px;
	border-radius: 7px;
	color: #3e4945;
	font-weight: 800;
	text-decoration: none;
}

.nav a.active,
.nav a:hover {
	background: var(--ink);
	color: #f8fbf6;
}

.operator {
	margin-top: auto;
	padding: 16px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: #f5f7f1;
}

.operator strong {
	display: block;
	margin-top: 5px;
	font-size: 0.95rem;
}

.workspace {
	padding: var(--space-page);
	min-width: 0;
}

.topbar {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 24px;
}

.eyebrow {
	margin: 0 0 8px;
	color: var(--green);
	font-size: 0.78rem;
	font-weight: 900;
	letter-spacing: 0;
	text-transform: uppercase;
}

h1 {
	margin: 0;
	max-width: 780px;
	color: var(--ink);
	font-size: 2.35rem;
	line-height: 1.12;
	letter-spacing: 0;
}

h2 {
	margin: 0;
	font-size: 1.2rem;
	letter-spacing: 0;
}

.top-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	color: var(--ink);
	cursor: pointer;
	font-weight: 800;
}

button.primary,
.button.primary {
	border-color: var(--ink);
	background: var(--ink);
	color: #fff;
}

.button,
.small-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	color: var(--ink);
	font-weight: 800;
	text-decoration: none;
}

.small-link {
	min-height: 32px;
	padding: 0 10px;
	font-size: 0.86rem;
}

.subcopy {
	margin: 10px 0 0;
	color: var(--muted);
	font-size: 0.98rem;
}

.metric-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
	margin-bottom: 14px;
}

.metric,
.panel {
	min-width: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(251, 252, 248, 0.86);
	box-shadow: var(--shadow);
}

.metric {
	min-height: 122px;
	padding: 20px;
}

.metric span {
	display: block;
	color: var(--muted);
	font-size: 0.86rem;
	font-weight: 800;
}

.metric strong {
	display: block;
	margin: 12px 0 8px;
	font-size: 2.3rem;
	line-height: 1;
}

.metric.warning strong {
	color: var(--red);
}

.content-grid {
	display: grid;
	grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.1fr);
	gap: 14px;
}

.panel {
	padding: 20px;
}

.panel-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
}

.server-list,
.transfer,
.audit-list {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
}

.server-row {
	display: grid;
	grid-template-columns: 10px minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	padding: 14px;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: var(--field);
}

.server-row.selected {
	border-color: rgba(36, 132, 91, 0.42);
	background: #e7f2ea;
}

.server-row.danger {
	background: #f6e9e6;
}

.server-row strong,
.server-row small {
	display: block;
}

.server-row b {
	color: var(--blue);
	font-size: 0.78rem;
}

.state {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--muted);
}

.state.online {
	background: var(--green);
}

.state.idle {
	background: var(--amber);
}

.state.offline {
	background: var(--red);
}

.terminal-panel {
	background: #101817;
	color: #dce8df;
}

.terminal-panel .eyebrow,
.terminal-panel h2 {
	color: #dce8df;
}

.live-badge {
	padding: 6px 9px;
	border-radius: 999px;
	background: #2dd287;
	color: #0d1714;
	font-size: 0.72rem;
	font-weight: 900;
}

.terminal {
	min-height: 300px;
	padding: 18px;
	border-radius: 8px;
	background: #07100e;
	font-family: Consolas, "Courier New", monospace;
	font-size: 0.95rem;
	line-height: 1.7;
}

.terminal p {
	margin: 0 0 8px;
}

.terminal span,
.terminal .ok {
	color: #4ade9b;
}

.transfer div {
	padding: 14px;
	border-radius: 8px;
	background: var(--field);
}

.transfer strong,
.transfer small {
	display: block;
}

.transfer span {
	display: block;
	height: 8px;
	margin-top: 12px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--green), var(--blue));
}

.audit-list {
	list-style: none;
}

.audit-list li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
	color: #394540;
}

.audit-list span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--amber);
}

.data-table {
	display: grid;
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 8px;
}

.table-scroll {
	min-width: 0;
	max-width: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
}

.table-row {
	display: grid;
	grid-template-columns: 1.1fr 1fr 1.2fr 0.6fr auto;
	gap: 14px;
	align-items: center;
	padding: 15px 16px;
	border-bottom: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.48);
}

.data-table.compact .table-row {
	grid-template-columns: 1.2fr 0.8fr 0.6fr;
}

.user-table .table-row {
	grid-template-columns: 0.9fr 0.9fr 1.3fr 0.6fr auto;
}

.table-row:last-child {
	border-bottom: 0;
}

.table-head {
	background: var(--field);
	color: var(--muted);
	font-size: 0.82rem;
	font-weight: 900;
	text-transform: uppercase;
}

.table-row b {
	width: fit-content;
	padding: 5px 8px;
	border-radius: 999px;
	font-size: 0.76rem;
}

.table-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.table-actions a {
	color: var(--blue);
	font-weight: 800;
	text-decoration: none;
}

.table-actions form {
	margin: 0;
}

.table-actions button {
	min-height: 30px;
	padding: 0 8px;
	color: var(--red);
}

.form-panel {
	max-width: 760px;
}

.form-panel form {
	display: grid;
	gap: 8px;
}

.form-panel label {
	margin-top: 8px;
	font-weight: 800;
}

.form-panel input,
.form-panel select,
.form-panel textarea {
	width: 100%;
	min-height: 42px;
	padding: 10px 12px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	font: inherit;
}

.form-panel textarea {
	min-height: 110px;
	resize: vertical;
}

.error-message {
	margin: 0;
	color: var(--red);
	font-size: 0.88rem;
}

.good {
	background: #e0f2e7;
	color: var(--green);
}

.warn {
	background: #f7efd8;
	color: #8a641e;
}

.bad {
	background: #f5dfdc;
	color: var(--red);
}

.terminal.tall {
	min-height: 420px;
}

.event-list li {
	min-height: 48px;
}

@media (max-width: 860px) {
	.app-shell {
		grid-template-columns: 1fr;
	}

	.sidebar {
		gap: 14px;
		padding: 16px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.nav {
		display: flex;
		gap: 6px;
		max-width: 100%;
		overflow-x: auto;
		padding-bottom: 2px;
		-webkit-overflow-scrolling: touch;
	}

	.nav a {
		flex: 0 0 auto;
		white-space: nowrap;
	}

	.operator {
		display: none;
	}

	.workspace {
		padding: 24px 18px;
	}

	.topbar {
		display: grid;
	}

	h1 {
		font-size: 1.85rem;
	}

	.metric-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.content-grid {
		grid-template-columns: 1fr;
	}

	.terminal {
		min-height: 240px;
	}

	.table-scroll .data-table {
		width: 690px;
		max-width: none;
		overflow: visible;
	}

	.table-row,
	.data-table.compact .table-row,
	.user-table .table-row {
		min-width: 690px;
		grid-template-columns: 1.1fr 1fr 1.2fr 0.6fr auto;
		gap: 14px;
	}

	.form-panel {
		max-width: none;
	}
}

@media (max-width: 600px) {
	.brand-mark {
		width: 36px;
		height: 36px;
	}

	.brand small {
		display: none;
	}

	.workspace {
		padding: 18px 14px 28px;
	}

	.topbar {
		gap: 16px;
	}

	.top-actions,
	.top-actions .button {
		width: 100%;
	}

	h1 {
		font-size: 1.7rem;
	}

	.metric-grid {
		grid-template-columns: 1fr;
	}

	.metric {
		min-height: 100px;
	}

	.panel {
		padding: 16px;
	}

	.panel-head {
		align-items: flex-start;
	}

	.server-row {
		grid-template-columns: 10px minmax(0, 1fr);
	}

	.server-row b {
		grid-column: 2;
	}

	.terminal {
		min-height: 220px;
		padding: 14px;
		font-size: 0.82rem;
		overflow-x: auto;
	}

	.form-panel input,
	.form-panel select,
	.form-panel textarea {
		font-size: 16px;
	}
}
