@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&family=Outfit:wght@600;700&display=swap");

:root {
	--bg: #12151a;
	--bg-elev: #1a1f27;
	--bg-soft: #222833;
	--text: #f2f4f7;
	--muted: #9aa3b2;
	--faint: #6b7380;
	--line: rgba(255, 255, 255, 0.08);
	--line-strong: rgba(255, 255, 255, 0.14);
	--accent: #2dd4bf;
	--accent-dim: rgba(45, 212, 191, 0.14);
	--accent-text: #0b3d38;
	--warn: #f5a524;
	--ok: #3ecf8e;
	--err: #ff6b7a;
	--radius: 12px;
	--shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
	--font: "DM Sans", system-ui, sans-serif;
	--display: "Outfit", "DM Sans", sans-serif;
	--mono: "JetBrains Mono", ui-monospace, monospace;
	--nav-w: 240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	min-height: 100vh;
	font-family: var(--font);
	color: var(--text);
	background:
		radial-gradient(900px 480px at 0% 0%, rgba(45, 212, 191, 0.09), transparent 55%),
		radial-gradient(700px 420px at 100% 10%, rgba(245, 165, 36, 0.06), transparent 50%),
		linear-gradient(180deg, #151922 0%, var(--bg) 40%);
	background-attachment: fixed;
	-webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ——— Shell ——— */
.app {
	display: grid;
	grid-template-columns: var(--nav-w) 1fr;
	min-height: 100vh;
}
.app-guest {
	display: block;
	min-height: 100vh;
}

.sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	padding: 1.4rem 1rem;
	border-right: 1px solid var(--line);
	background: rgba(14, 17, 22, 0.85);
	backdrop-filter: blur(12px);
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}
.brand {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.35rem 0.5rem;
	color: var(--text);
	text-decoration: none !important;
}
.brand-mark {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--accent), #1aa89a 60%, var(--warn));
	box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 8px 20px rgba(45, 212, 191, 0.25);
	animation: pulse-mark 3.5s ease-in-out infinite;
}
.brand-text {
	font-family: var(--display);
	font-weight: 700;
	font-size: 1.05rem;
	letter-spacing: -0.02em;
	line-height: 1.15;
}
.brand-text small {
	display: block;
	font-family: var(--font);
	font-weight: 500;
	font-size: 0.7rem;
	color: var(--muted);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}
.side-nav {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}
.side-nav a {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.7rem 0.85rem;
	border-radius: 10px;
	color: var(--muted);
	text-decoration: none !important;
	font-weight: 500;
	font-size: 0.95rem;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.side-nav a:hover {
	background: var(--bg-soft);
	color: var(--text);
	transform: translateX(2px);
}
.side-nav a.is-active {
	background: var(--accent-dim);
	color: var(--accent);
}
.side-foot {
	margin-top: auto;
	padding: 0.75rem;
	border-radius: 10px;
	background: var(--bg-elev);
	border: 1px solid var(--line);
	font-size: 0.8rem;
	color: var(--muted);
}

.main {
	padding: 1.75rem 2rem 3rem;
	max-width: 1100px;
	animation: fade-up 0.35s ease both;
}
.page-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
}
.page-head h1 {
	margin: 0;
	font-family: var(--display);
	font-size: clamp(1.6rem, 2.5vw, 2rem);
	letter-spacing: -0.03em;
}
.page-head p {
	margin: 0.35rem 0 0;
	color: var(--muted);
	max-width: 42rem;
	line-height: 1.45;
}
.crumb {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin-bottom: 0.65rem;
	font-size: 0.85rem;
	color: var(--muted);
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }

/* ——— Login ——— */
.login-shell {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 2rem 1rem;
	position: relative;
	overflow: hidden;
}
.login-shell::before {
	content: "";
	position: absolute;
	inset: -20%;
	background:
		repeating-linear-gradient(
			-12deg,
			transparent 0,
			transparent 22px,
			rgba(255, 255, 255, 0.015) 22px,
			rgba(255, 255, 255, 0.015) 23px
		);
	pointer-events: none;
	animation: drift 28s linear infinite;
}
.login-card {
	position: relative;
	width: min(420px, 100%);
	padding: 2rem;
	border-radius: 18px;
	background: rgba(26, 31, 39, 0.92);
	border: 1px solid var(--line-strong);
	box-shadow: var(--shadow);
	backdrop-filter: blur(16px);
	animation: fade-up 0.45s ease both;
}
.login-card .brand { margin-bottom: 1.5rem; padding: 0; }
.login-card h1 {
	margin: 0 0 0.35rem;
	font-family: var(--display);
	font-size: 1.65rem;
	letter-spacing: -0.03em;
}
.login-card .lede {
	margin: 0 0 1.5rem;
	color: var(--muted);
	line-height: 1.45;
}

/* ——— Forms ——— */
label {
	display: block;
	margin: 0.85rem 0;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--muted);
	letter-spacing: 0.02em;
}
input, select, textarea {
	width: 100%;
	margin-top: 0.4rem;
	padding: 0.75rem 0.9rem;
	border-radius: 10px;
	border: 1px solid var(--line-strong);
	background: #0e1218;
	color: var(--text);
	font: inherit;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: rgba(45, 212, 191, 0.55);
	box-shadow: 0 0 0 3px var(--accent-dim);
}
.field-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.35rem 1rem;
}
button, .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	width: auto;
	margin-top: 0;
	padding: 0.7rem 1.15rem;
	border-radius: 10px;
	border: 1px solid transparent;
	background: var(--accent);
	color: var(--accent-text);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}
button:hover, .btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
button.secondary, .btn.secondary {
	background: var(--bg-soft);
	color: var(--text);
	border-color: var(--line-strong);
}
button.danger, .btn.danger {
	background: rgba(255, 107, 122, 0.15);
	color: #ff8a95;
	border-color: rgba(255, 107, 122, 0.35);
}
a.btn { text-decoration: none; }
button.sm, .btn.sm {
	padding: 0.45rem 0.75rem;
	font-size: 0.85rem;
	border-radius: 8px;
}
button.linkish {
	background: transparent;
	color: var(--err);
	border: none;
	padding: 0.25rem 0.4rem;
	font-weight: 600;
	width: auto;
}
button.linkish:hover { filter: none; text-decoration: underline; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.1rem; align-items: center; }
.stack { display: flex; flex-direction: column; }
.full-width { width: 100%; }

/* ——— Surfaces ——— */
.card {
	background: var(--bg-elev);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.35rem 1.4rem;
	margin: 0 0 1.25rem;
}
.card h2 {
	margin: 0 0 0.35rem;
	font-family: var(--display);
	font-size: 1.15rem;
	letter-spacing: -0.02em;
}
.card .hint {
	margin: 0 0 1rem;
	color: var(--muted);
	font-size: 0.9rem;
	line-height: 1.45;
}
.grid-2 {
	display: grid;
	grid-template-columns: 1.15fr 0.85fr;
	gap: 1.25rem;
	align-items: start;
}

.flash {
	padding: 0.85rem 1rem;
	border-radius: 10px;
	margin-bottom: 1.15rem;
	font-size: 0.92rem;
	animation: fade-up 0.25s ease both;
}
.flash-ok { background: rgba(62, 207, 142, 0.12); border: 1px solid rgba(62, 207, 142, 0.35); color: #9aebc0; }
.flash-error { background: rgba(255, 107, 122, 0.12); border: 1px solid rgba(255, 107, 122, 0.35); color: #ffb0b8; }

.toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	margin-bottom: 1rem;
}
.search {
	flex: 1;
	min-width: 200px;
	margin: 0;
}
.search input { margin: 0; }
.pill {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	border: 1px solid var(--line);
	background: var(--bg-soft);
	color: var(--muted);
	white-space: nowrap;
}
.pill-ok { background: rgba(62, 207, 142, 0.12); border-color: rgba(62, 207, 142, 0.3); color: #7fe0b0; }
.pill-off { background: rgba(255,255,255,0.04); color: var(--faint); }
.pill-php { background: var(--accent-dim); border-color: rgba(45, 212, 191, 0.3); color: var(--accent); }

/* ——— Domain table ——— */
.table {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg-elev);
}
.tr {
	display: grid;
	grid-template-columns: minmax(160px, 1.5fr) 90px 90px minmax(120px, 1.4fr) 40px;
	gap: 0.75rem;
	align-items: center;
	padding: 0.95rem 1.1rem;
	border-top: 1px solid var(--line);
	color: inherit;
	text-decoration: none !important;
	transition: background 0.12s ease;
}
.tr.th {
	background: rgba(0, 0, 0, 0.25);
	color: var(--faint);
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	border-top: none;
}
a.tr:hover { background: rgba(45, 212, 191, 0.06); }
.strong { font-weight: 600; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--faint); font-size: 1.1rem; justify-self: end; }
.empty {
	padding: 2rem 1.25rem;
	text-align: center;
	color: var(--muted);
}

.meta-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.75rem 0 1.25rem;
}
.stat {
	padding: 0.55rem 0.85rem;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--bg-elev);
	font-size: 0.85rem;
	color: var(--muted);
}
.stat b { color: var(--text); font-weight: 600; }

.list { list-style: none; padding: 0; margin: 0 0 1rem; }
.list li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding: 0.7rem 0;
	border-bottom: 1px solid var(--line);
	font-family: var(--mono);
	font-size: 0.85rem;
}
.inline { display: inline; }
.code {
	background: #0b0e13;
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 1rem;
	overflow: auto;
	font-family: var(--mono);
	font-size: 0.8rem;
	line-height: 1.5;
	color: #c5ced9;
}
.section-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.75rem;
}

@keyframes fade-up {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}
@keyframes pulse-mark {
	0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 8px 20px rgba(45, 212, 191, 0.25); }
	50% { box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 10px 28px rgba(45, 212, 191, 0.4); }
}
@keyframes drift {
	from { transform: translate3d(0, 0, 0); }
	to { transform: translate3d(-40px, 20px, 0); }
}

@media (max-width: 900px) {
	.app { grid-template-columns: 1fr; }
	.sidebar {
		position: relative;
		height: auto;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		border-right: none;
		border-bottom: 1px solid var(--line);
	}
	.side-nav { flex-direction: row; flex-wrap: wrap; }
	.side-foot { display: none; }
	.main { padding: 1.25rem 1rem 2rem; }
	.grid-2 { grid-template-columns: 1fr; }
	.field-grid { grid-template-columns: 1fr; }
	.tr { grid-template-columns: 1fr 1fr; }
	.tr.th { display: none; }
	.chev { display: none; }
}
