* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	color: #0f172a;
	background: #f4f7fb;
}

.app-layout {
	min-height: 100vh;
	display: grid;
	grid-template-columns: 1fr;
}

body.authenticated .app-layout {
	grid-template-columns: 260px 1fr;
}

.sidebar {
	background: #0f172a;
	color: #e2e8f0;
	padding: 1.1rem;
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
}

.sidebar h1 {
	margin: 0;
	font-size: 1.25rem;
}

.me { margin: 0; color: #94a3b8; font-size: 0.9rem; }

.menu {
	display: grid;
	gap: 0.5rem;
}

.menu-item {
	width: 100%;
	text-align: left;
	border: 1px solid #334155;
	background: #1e293b;
	color: #e2e8f0;
}

.menu-item.active {
	border-color: #3b82f6;
	background: #1d4ed8;
}

.content {
	padding: 1rem 1.25rem;
}

body:not(.authenticated) .content {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
}

.topbar {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 1rem;
	gap: 1rem;
}

body:not(.authenticated) .topbar {
	width: min(760px, 100%);
	min-height: 360px;
	margin: 0;
	padding: 2.4rem;
	border: 1px solid #dde5ef;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 24px 50px rgba(15, 23, 42, 0.12);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	text-align: center;
}

body:not(.authenticated) .topbar > div {
	width: min(620px, 100%);
	display: grid;
	justify-items: center;
	text-align: center;
}

.topbar h2 {
	margin: 0;
}

body:not(.authenticated) .topbar h2 {
	font-size: clamp(2rem, 4.3vw, 3rem);
	line-height: 1.05;
}

.hint { margin: 0.2rem 0 0; color: #475569; }

body:not(.authenticated) .hint {
	margin-top: 0.55rem;
	font-size: 1.1rem;
	max-width: 56ch;
}

body:not(.authenticated) #loginBtn {
	display: inline-flex;
	justify-content: center;
	margin: 0 auto;
	font-size: 1.1rem;
	padding: 0.95rem 1.5rem;
	border-radius: 12px;
	min-width: 270px;
}

.card {
	background: #fff;
	border: 1px solid #dde5ef;
	border-radius: 12px;
	padding: 1rem;
	box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.label {
	display: grid;
	gap: 0.25rem;
	font-size: 0.92rem;
	color: #334155;
	margin-bottom: 0.75rem;
}

.form-grid { display: grid; gap: 0.6rem; margin-bottom: 0.9rem; }

.field-group-label {
	margin: 0.15rem 0 0;
	font-size: 0.84rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: #334155;
}

.route-fields {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 0.6rem;
}

.endpoint-incoming-row {
	display: grid;
	grid-template-columns: 340px 1fr;
	gap: 0.6rem;
}

.endpoint-basic-row {
	display: grid;
	grid-template-columns: 1fr 360px;
	gap: 0.6rem;
}

.endpoint-outgoing-row {
	display: grid;
	grid-template-columns: 180px 1fr 220px 220px;
	gap: 0.6rem;
}

input, select, textarea, button {
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	padding: 0.62rem;
	font-size: 0.94rem;
}

textarea { min-height: 86px; resize: vertical; }

button {
	border: none;
	background: #2563eb;
	color: white;
	font-weight: 600;
	cursor: pointer;
}

button.secondary { background: #475569; }
button.warn { background: #b91c1c; }
button.full { width: 100%; margin-top: auto; }
button.ghost {
	background: #eef2ff;
	color: #3730a3;
}

.list { display: grid; gap: 0.6rem; }

.item {
	border: 1px solid #dbe5f2;
	border-radius: 10px;
	padding: 0.75rem;
	background: #f8fbff;
}

.item-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
}

.item-actions {
	display: flex;
	gap: 0.4rem;
}

.item-actions button {
	padding: 0.42rem 0.55rem;
	font-size: 0.82rem;
}

.route-summary {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
}

.route-pattern,
.route-desc,
.route-sep {
	overflow: hidden;
	text-overflow: ellipsis;
}

.route-desc,
.route-sep {
	color: #475569;
}

.badge {
	border: 1px solid #cbd5e1;
	border-radius: 999px;
	padding: 0.2rem 0.45rem;
	font-size: 0.8rem;
	background: #fff;
}

.meta { color: #475569; font-size: 0.86rem; margin-top: 0.25rem; }

.reserved-fqdn {
	display: inline-block;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	background: #eef2ff;
	color: #3730a3;
	border: 1px solid #c7d2fe;
	border-radius: 6px;
	padding: 0.1rem 0.35rem;
}

pre {
	margin: 0;
	background: #f8fafc;
	border: 1px solid #dbe5f2;
	border-radius: 8px;
	padding: 0.7rem;
	white-space: pre-wrap;
}

.error-card {
	border-color: #fecaca;
	background: #fff1f2;
	color: #9f1239;
	font-weight: 500;
	margin-bottom: 1rem;
}

hr {
	border: none;
	border-top: 1px solid #e2e8f0;
	margin: 1rem 0;
}

.hidden { display: none !important; }

@media (max-width: 960px) {
	.app-layout { grid-template-columns: 1fr; }
	.sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
	.menu { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
	button.full { width: auto; margin-top: 0; }
	.route-fields { grid-template-columns: 1fr; }
	.endpoint-basic-row { grid-template-columns: 1fr; }
	.endpoint-incoming-row { grid-template-columns: 1fr; }
	.endpoint-outgoing-row { grid-template-columns: 1fr; }
}
