/* Pluto Admin — self-hosted styles (no external fonts/CDNs; CSP-clean). */
:root {
	--bg: #0f1320;
	--surface: #161b2c;
	--surface-2: #1d2438;
	--border: #2a3350;
	--text: #e8eaf6;
	--muted: #9aa4c4;
	--primary: #5566ff;
	--primary-ink: #fff;
	--ok: #34d399;
	--bad: #f87171;
	--radius: 10px;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: var(--sans);
	background: var(--bg);
	color: var(--text);
	font-size: 14px;
	line-height: 1.5;
	/* Render native controls (date picker, select dropdown, scrollbars) dark. */
	color-scheme: dark;
}
a { color: #9db0ff; text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Top bar */
.top {
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; padding: 12px 22px;
	background: var(--surface); border-bottom: 1px solid var(--border);
	position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 9px; }
.brand.big { font-size: 19px; justify-content: center; margin-bottom: 18px; }
.dot {
	width: 12px; height: 12px; border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #aab6ff, var(--primary) 60%, #2b1d6b);
	box-shadow: 0 0 10px rgba(85,102,255,.6);
}
.top nav { display: flex; align-items: center; gap: 4px; }
.top nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); }
.top nav a:hover { background: var(--surface-2); text-decoration: none; }
.top nav a.on { background: var(--surface-2); color: var(--text); }
.logout { margin: 0 0 0 8px; }
.logout button { background: none; border: 1px solid var(--border); color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.logout button:hover { color: var(--text); border-color: var(--muted); }

main { max-width: 1040px; margin: 24px auto; padding: 0 20px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-n { font-size: 28px; font-weight: 700; }
.stat-l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 18px 0; }
.panel h2 { margin: 0 0 14px; font-size: 16px; }
details.panel summary { cursor: pointer; font-weight: 600; }
details.panel[open] summary { margin-bottom: 14px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
table.kv th { width: 200px; }

/* Forms */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid .wide, .grid .check { grid-column: 1 / -1; }
.grid button { grid-column: 1 / -1; justify-self: start; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
/* Checkboxes/radios must NOT stretch to full width (that pushed the label text
   into a narrow wrapping column). Keep them their natural size, label flows after. */
label.check input[type="checkbox"], label.check input[type="radio"] { width: auto; flex: 0 0 auto; margin: 0; padding: 0; accent-color: var(--primary); }
label.check span, label.check > :not(input) { flex: 1 1 auto; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
	background: var(--bg); color: var(--text);
	border: 1px solid var(--border); border-radius: 8px;
	padding: 9px 11px; font: inherit; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }

/* Buttons */
.btn {
	display: inline-block; background: var(--surface-2); color: var(--text);
	border: 1px solid var(--border); border-radius: 8px;
	padding: 9px 16px; font: inherit; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #ffd7d7; border-color: #5c2330; }
.btn.danger:hover { background: #3a1620; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.actions form { margin: 0; }
.replace-file { flex-basis: 100%; }
.replace-file > summary { cursor: pointer; font-size: 13px; opacity: 0.8; width: max-content; }
.replace-file > summary:hover { opacity: 1; }
.replace-file form { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.reup { font-size: 12px; white-space: nowrap; }

/* Badges */
.badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.badge.ok { background: rgba(52,211,153,.15); color: var(--ok); }
.badge.bad { background: rgba(248,113,113,.15); color: var(--bad); }

/* Flash */
.flash { padding: 12px 16px; border-radius: 9px; margin: 0 0 18px; }
.flash--ok { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.3); }
.flash--err { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.35); color: #ffd7d7; }
.flash--key { background: var(--surface-2); border: 1px solid var(--primary); }
.keybox { display: block; margin-top: 8px; font-family: var(--mono); font-size: 18px; letter-spacing: 2px; padding: 12px; background: var(--bg); border-radius: 8px; user-select: all; }

/* Login */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: 340px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.login-card label { margin-bottom: 14px; }
.login-card .btn { width: 100%; text-align: center; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 30px 0; }

@media (max-width: 720px) {
	.stats { grid-template-columns: repeat(2, 1fr); }
	.grid { grid-template-columns: 1fr; }
}
