:root {
	--bg: #0f1220; --card: #181c2f; --line: #2a3050; --text: #e8eaf6; --muted: #8b91b5;
	--accent: #7c5cff; --accent2: #a98bff; --ok: #3ddc97; --err: #ff6b81;
	color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
	font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	background: radial-gradient(1200px 600px at 10% -10%, #24204a 0, transparent 60%), var(--bg);
	color: var(--text); min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent2); }
.top { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; }
.top nav { display: flex; gap: 1rem; align-items: center; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.3rem; color: var(--text); text-decoration: none; }
.logo img { width: 32px; height: 32px; border-radius: 8px; }
main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 0 1rem 2rem; }
footer { text-align: center; padding: 1rem; font-size: .85rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.25rem; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; }
.card.wide { max-width: 760px; margin: 0 auto; }
h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tab { flex: 1; padding: .6rem; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
textarea, input[type=text], .code-input {
	width: 100%; background: #0d1020; color: var(--text); border: 1px solid var(--line);
	border-radius: 10px; padding: .8rem; font: inherit;
}
textarea { resize: vertical; min-height: 140px; }
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
	display: inline-block; margin-top: .8rem; padding: .75rem 1.3rem; border: 0; border-radius: 10px;
	background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: transparent; border: 1px solid var(--line); color: var(--text); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; }
.drop {
	display: flex; align-items: center; justify-content: center; text-align: center; min-height: 140px;
	border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; padding: 1rem; color: var(--muted); word-break: break-all;
}
.drop.over, .drop:hover { border-color: var(--accent); color: var(--text); }
.drop input { display: none; }
.progress { position: relative; height: 26px; margin-top: 1rem; background: #0d1020; border-radius: 8px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; }
.code { font: 700 3.2rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .3em; text-align: center; margin: 1rem 0; }
.code.expired { opacity: .3; text-decoration: line-through; }
.timer { height: 6px; background: #0d1020; border-radius: 3px; overflow: hidden; }
.timer div { height: 100%; width: 100%; background: var(--ok); transition: width 1s linear; }
.code-input { font: 700 2rem ui-monospace, Menlo, Consolas, monospace; text-align: center; letter-spacing: .3em; }
.error { color: var(--err); list-style: none; padding: 0; }
.success { color: var(--ok); font-weight: 600; }
.badge { background: var(--accent); color: #fff; border-radius: 6px; padding: 0 .4rem; font-size: .75rem; }
.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: #23284a; }
.flash.success { background: #173d31; } .flash.error { background: #4a1f2a; }
.shared-text { white-space: pre-wrap; word-break: break-word; background: #0d1020; border: 1px solid var(--line); border-radius: 10px; padding: 1rem; max-height: 60vh; overflow: auto; font-size: .95rem; }
.file-name { font-size: 1.2rem; font-weight: 600; word-break: break-all; margin: 0; }

/* --- admin --- */
.page-title { margin: 0 0 1rem; font-size: 1.6rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; display: flex; flex-direction: column; }
.stat strong { font-size: 1.4rem; }
.stat span { color: var(--muted); font-size: .85rem; }
main section.card + section.card { margin-top: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.card-head h2 { margin: 0; }
.table-wrap { overflow-x: auto; margin-top: 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: .5rem; }
.table td { border-bottom: 1px solid #22273f; padding: .55rem .5rem; vertical-align: middle; }
.table tr:hover td { background: #1d2238; }
.table tr.editing td { background: #2a2552; }
.table tr.expired-row td { opacity: .55; }
.content-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.actions a { margin-right: .6rem; }
.danger-link { color: var(--err); }
.btn.danger { background: #b8384f; margin: 0; }
.btn.danger:hover { background: var(--err); }
.small-btn { padding: .45rem .9rem; font-size: .85rem; }
.badge.warn { background: #8a6d1d; }
code { background: #0d1020; border: 1px solid var(--line); border-radius: 6px; padding: .1rem .4rem; }
h3 { margin: 1.5rem 0 .8rem; font-size: 1.05rem; }
.admin-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; align-items: end; }
.admin-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
.admin-form input { width: 100%; background: #0d1020; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: .6rem; font: inherit; }
.admin-form .btn { margin: 0; }
.admin-form ul.error { grid-column: 1 / -1; margin: 0; }
