:root {
	--bg: #0d1633;
	--surface: #13224a;
	--surface2: #1a2f63;
	--border: #284589;
	--accent: #67b4ff;
	--accent-dim: rgba(103, 180, 255, 0.18);
	--accent-hover: #8cc6ff;
	--green: #22c55e;
	--green-dim: rgba(34, 197, 94, 0.12);
	--red: #ef4444;
	--red-dim: rgba(239, 68, 68, 0.12);
	--blue: #6fb2ff;
	--blue-dim: rgba(111, 178, 255, 0.16);
	--text: #edf3ff;
	--text-muted: #95a8d6;
	--text-dim: #b9c8ee;
	--mono: "JetBrains Mono", monospace;
	--sans: "Space Grotesk", sans-serif;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	background:
		radial-gradient(
			ellipse 75% 55% at 50% 0%,
			var(--accent-dim) 0%,
			transparent 72%
		),
		var(--bg);
	color: var(--text);
	font-family: var(--sans);
	min-height: 100vh;
	line-height: 1.5;
}

/* ── LOGIN ─────────────────────────────────────────────────────────────── */
#login-screen {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background:
		radial-gradient(
			ellipse 80% 50% at 50% -20%,
			var(--accent-dim) 0%,
			transparent 70%
		),
		var(--bg);
}

.login-box {
	width: 100%;
	max-width: 400px;
	padding: 48px 40px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-top: 2px solid var(--accent);
}

.login-logo {
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.2em;
	color: var(--accent);
	text-transform: uppercase;
	margin-bottom: 8px;
}

.login-title {
	font-size: 24px;
	font-weight: 600;
	color: var(--text);
	margin-bottom: 32px;
}

.field {
	margin-bottom: 16px;
}

.field label {
	display: block;
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-muted);
	margin-bottom: 8px;
}

.field input {
	width: 100%;
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--text);
	font-family: var(--mono);
	font-size: 14px;
	padding: 10px 14px;
	outline: none;
	transition: border-color 0.15s;
}

.field input:focus {
	border-color: var(--accent);
}

.btn-primary {
	width: 100%;
	background: var(--accent);
	color: #000;
	border: none;
	font-family: var(--mono);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 12px;
	cursor: pointer;
	margin-top: 8px;
	transition: background 0.15s;
}

.btn-primary:hover {
	background: var(--accent-hover);
}
.btn-primary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.error-msg {
	background: var(--red-dim);
	border: 1px solid var(--red);
	color: var(--red);
	font-family: var(--mono);
	font-size: 12px;
	padding: 10px 14px;
	margin-top: 12px;
	display: none;
}

/* ── APP LAYOUT ─────────────────────────────────────────────────────────── */
#app-screen {
	display: none;
}

header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	padding: 0 32px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: sticky;
	top: 0;
	z-index: 10;
}

.header-brand {
	display: flex;
	align-items: center;
	gap: 12px;
}

.brand-icon {
	width: 28px;
	height: 28px;
	background: var(--accent);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
}

.brand-name {
	font-family: var(--mono);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text);
}

.header-user {
	display: flex;
	align-items: center;
	gap: 16px;
}

.user-badge {
	font-family: var(--mono);
	font-size: 11px;
	color: var(--text-muted);
}

.btn-logout {
	background: none;
	border: 1px solid var(--border);
	color: var(--text-dim);
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 6px 12px;
	cursor: pointer;
	transition: all 0.15s;
}

.btn-logout:hover {
	border-color: var(--red);
	color: var(--red);
}

main {
	max-width: 1100px;
	margin: 0 auto;
	padding: 32px 24px;
}

/* ── TABS ───────────────────────────────────────────────────────────────── */
.tabs {
	display: flex;
	gap: 2px;
	margin-bottom: 32px;
	border-bottom: 1px solid var(--border);
}

.tab {
	padding: 10px 20px;
	font-family: var(--mono);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-muted);
	cursor: pointer;
	border: none;
	background: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	transition: all 0.15s;
}

.tab:hover {
	color: var(--text-dim);
}
.tab.active {
	color: var(--accent);
	border-bottom-color: var(--accent);
}

.tab-panel {
	display: none;
}
.tab-panel.active {
	display: block;
}

/* ── SECTION HEADER ─────────────────────────────────────────────────────── */
.section-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 20px;
}

.section-label {
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.section-line {
	flex: 1;
	height: 1px;
	background: var(--border);
}

/* ── DEPLOY CARD ────────────────────────────────────────────────────────── */
.deploy-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
	gap: 20px;
}

.instance-card {
	background: var(--surface);
	border: 1px solid var(--border);
}

.instance-header {
	padding: 16px 20px;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.instance-name {
	font-family: var(--mono);
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

.instance-id {
	font-family: var(--mono);
	font-size: 10px;
	color: var(--text-muted);
	margin-top: 2px;
}

.env-badge {
	font-family: var(--mono);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 3px 10px;
}

.env-badge.production {
	background: var(--red-dim);
	color: var(--red);
	border: 1px solid var(--red);
}
.env-badge.testing {
	background: var(--green-dim);
	color: var(--green);
	border: 1px solid var(--green);
}
.env-badge.default {
	background: var(--blue-dim);
	color: var(--blue);
	border: 1px solid var(--blue);
}

.instance-body {
	padding: 20px;
}

/* Drop zone */
.drop-zone {
	border: 2px dashed var(--border);
	background: var(--bg);
	padding: 32px 24px;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s;
	position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
	border-color: var(--accent);
	background: var(--accent-dim);
}

.drop-zone input[type="file"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
	width: 100%;
	height: 100%;
}

.drop-icon {
	font-size: 28px;
	margin-bottom: 10px;
	display: block;
}
.drop-text {
	font-family: var(--mono);
	font-size: 12px;
	color: var(--text-muted);
	margin-bottom: 4px;
}
.drop-subtext {
	font-family: var(--mono);
	font-size: 10px;
	color: var(--text-muted);
	opacity: 0.6;
}

.selected-file {
	margin-top: 12px;
	background: var(--accent-dim);
	border: 1px solid var(--accent);
	padding: 10px 14px;
	display: none;
	align-items: center;
	justify-content: space-between;
}

.selected-file.show {
	display: flex;
}

.file-name {
	font-family: var(--mono);
	font-size: 12px;
	color: var(--accent);
}
.file-size {
	font-family: var(--mono);
	font-size: 10px;
	color: var(--text-muted);
}

.btn-deploy {
	width: 100%;
	margin-top: 12px;
	background: var(--accent);
	color: #000;
	border: none;
	font-family: var(--mono);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 12px;
	cursor: pointer;
	transition: background 0.15s;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.btn-deploy:hover {
	background: var(--accent-hover);
}
.btn-deploy:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Progress */
.progress-bar {
	height: 3px;
	background: var(--border);
	margin-top: 10px;
	display: none;
	overflow: hidden;
}
.progress-bar.show {
	display: block;
}

.progress-fill {
	height: 100%;
	background: var(--accent);
	width: 0%;
	transition: width 0.3s;
}
.progress-fill.indeterminate {
	width: 40%;
	animation: slide 1.2s infinite ease-in-out;
}

@keyframes slide {
	0% {
		transform: translateX(-100%);
	}
	100% {
		transform: translateX(350%);
	}
}

/* ── TOAST ──────────────────────────────────────────────────────────────── */
.toast-container {
	position: fixed;
	bottom: 24px;
	right: 24px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 100;
}

.toast {
	background: var(--surface2);
	border-left: 3px solid var(--accent);
	padding: 14px 18px;
	font-family: var(--mono);
	font-size: 12px;
	max-width: 360px;
	animation: slideIn 0.2s ease;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast.success {
	border-left-color: var(--green);
}
.toast.error {
	border-left-color: var(--red);
}

.toast-title {
	font-weight: 700;
	letter-spacing: 0.05em;
	margin-bottom: 4px;
}
.toast.success .toast-title {
	color: var(--green);
}
.toast.error .toast-title {
	color: var(--red);
}
.toast-body {
	color: var(--text-dim);
	font-size: 11px;
	line-height: 1.4;
}

@keyframes slideIn {
	from {
		transform: translateX(20px);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

/* ── APPS TAB ───────────────────────────────────────────────────────────── */
.apps-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.app-item {
	background: var(--surface);
	border: 1px solid var(--border);
	padding: 14px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.app-item-left {
	display: flex;
	align-items: center;
	gap: 14px;
}

.app-type-icon {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	background: var(--bg);
	border: 1px solid var(--border);
	flex-shrink: 0;
}

.app-item-name {
	font-family: var(--mono);
	font-size: 13px;
	font-weight: 600;
	color: var(--text);
}
.app-item-meta {
	font-family: var(--mono);
	font-size: 10px;
	color: var(--text-muted);
	margin-top: 2px;
}
.app-item-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.size-badge {
	font-family: var(--mono);
	font-size: 10px;
	color: var(--text-muted);
	background: var(--bg);
	border: 1px solid var(--border);
	padding: 3px 8px;
}

/* ── BACKUPS TAB ────────────────────────────────────────────────────────── */
.instance-selector {
	display: flex;
	gap: 2px;
	margin-bottom: 24px;
}

.inst-tab {
	padding: 8px 16px;
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	background: var(--surface);
	border: 1px solid var(--border);
	color: var(--text-muted);
	cursor: pointer;
	transition: all 0.15s;
}

.inst-tab.active {
	background: var(--accent-dim);
	border-color: var(--accent);
	color: var(--accent);
}

.backup-item {
	background: var(--surface);
	border: 1px solid var(--border);
	padding: 14px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
}

.backup-name {
	font-family: var(--mono);
	font-size: 12px;
	font-weight: 600;
	color: var(--text-dim);
}
.backup-date {
	font-family: var(--mono);
	font-size: 10px;
	color: var(--text-muted);
	margin-top: 2px;
}

.btn-restore {
	background: none;
	border: 1px solid var(--border);
	color: var(--text-muted);
	font-family: var(--mono);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 6px 12px;
	cursor: pointer;
	transition: all 0.15s;
	flex-shrink: 0;
}

.btn-restore:hover {
	border-color: var(--accent);
	color: var(--accent);
}

/* ── SHARED ─────────────────────────────────────────────────────────────── */
.empty-state {
	text-align: center;
	padding: 48px 24px;
	font-family: var(--mono);
	font-size: 12px;
	color: var(--text-muted);
}
.empty-icon {
	font-size: 32px;
	margin-bottom: 12px;
	display: block;
}

.spinner {
	width: 14px;
	height: 14px;
	border: 2px solid rgba(0, 0, 0, 0.3);
	border-top-color: #000;
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
	display: inline-block;
}

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

/* ── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 50;
}

.modal-overlay.show {
	display: flex;
}

.modal {
	background: var(--surface);
	border: 1px solid var(--border);
	border-top: 2px solid var(--accent);
	width: 440px;
	padding: 32px;
}

.modal-title {
	font-family: var(--mono);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 12px;
}

.modal-body {
	font-size: 14px;
	color: var(--text-dim);
	line-height: 1.6;
	margin-bottom: 24px;
}
.modal-body strong {
	color: var(--text);
}
.modal-actions {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}

.btn-cancel {
	background: none;
	border: 1px solid var(--border);
	color: var(--text-muted);
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 8px 16px;
	cursor: pointer;
	transition: all 0.15s;
}

.btn-cancel:hover {
	border-color: var(--text-dim);
	color: var(--text-dim);
}

.btn-confirm {
	background: var(--accent);
	border: none;
	color: #000;
	font-family: var(--mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 8px 16px;
	cursor: pointer;
	transition: background 0.15s;
}

.btn-confirm:hover {
	background: var(--accent-hover);
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.deploy-grid {
		grid-template-columns: 1fr;
	}
	main {
		padding: 20px 16px;
	}
	header {
		padding: 0 16px;
	}
}
