:root {
    --bg: #0b1122;
    --panel: #121a33;
    --line: rgba(255, 255, 255, .1);
    --text: #e8ecf8;
    --muted: #93a0bd;
    --cyan: #22d3ee;
    --grad: linear-gradient(90deg, #22d3ee, #8b5cf6);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Poppins', sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.side {
    width: 220px; background: #080d1c; border-right: 1px solid var(--line);
    padding: 22px 14px; display: flex; flex-direction: column; gap: 24px;
    position: sticky; top: 0; height: 100vh; flex-shrink: 0;
}
.side-brand img { height: 34px; }
.side nav { display: grid; gap: 4px; }
.side nav a { padding: 10px 14px; border-radius: 9px; font-size: 14.5px; color: var(--muted); }
.side nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.side nav a.on { background: rgba(34, 211, 238, .12); color: var(--cyan); font-weight: 600; }
.side-logout { margin-top: auto; }
.side-logout button {
    width: 100%; padding: 10px; border-radius: 9px; border: 1px solid var(--line);
    background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 14px;
}
.side-logout button:hover { color: #fff; border-color: #f87171; }

.main { flex: 1; padding: 30px 34px; min-width: 0; }
h1 { font-size: 24px; margin-bottom: 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
h2 { font-size: 18px; margin: 30px 0 12px; }

.flash { padding: 11px 18px; border-radius: 10px; margin-bottom: 18px; font-size: 14.5px; }
.flash.ok { background: rgba(52, 211, 153, .12); color: #34d399; border: 1px solid rgba(52, 211, 153, .3); }
.flash.err { background: rgba(248, 113, 113, .12); color: #f87171; border: 1px solid rgba(248, 113, 113, .3); }

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 26px; min-width: 140px; }
.stat b { font-size: 26px; display: block; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--muted); font-size: 13px; }

.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: rgba(255, 255, 255, .04); font-size: 13px; color: var(--muted); }
.tbl tr.muted { opacity: .55; }
.tbl small { color: var(--muted); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm {
    display: inline-block; padding: 5px 12px; border-radius: 7px; font-size: 12.5px;
    border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text);
    cursor: pointer; font-family: inherit;
}
.btn-sm:hover { border-color: var(--cyan); }
.btn-sm.danger:hover { border-color: #f87171; color: #f87171; }

.inline-form { display: flex; gap: 10px; margin-bottom: 18px; }
.inline-form.wrap { flex-wrap: wrap; margin-top: 12px; }
.inline-form input { flex: 1; min-width: 130px; }
input, select, textarea {
    background: #0d1428; border: 1px solid var(--line); border-radius: 9px;
    padding: 10px 13px; color: var(--text); font: inherit; font-size: 14px;
}
:is(input, select, textarea):focus { outline: none; border-color: var(--cyan); }
input[type=color] { padding: 3px; height: 42px; width: 80px; }
input[type=file] { padding: 8px; }
input[type=checkbox] { width: auto; }

.inline-form button, .btn-save {
    padding: 10px 22px; border-radius: 9px; border: none; cursor: pointer;
    background: var(--grad); color: #06121c; font-weight: 600; font-family: inherit; font-size: 14px;
}

.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.edit-grid fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--panel); display: grid; gap: 12px; }
.edit-grid legend { padding: 0 8px; color: var(--cyan); font-weight: 600; font-size: 14px; }
.edit-grid label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.edit-grid label.chk { grid-template-columns: auto 1fr; align-items: center; }
.edit-grid .btn-save { grid-column: 1 / -1; justify-self: start; }

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 8px; }
.thumb { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; position: relative; }
.thumb img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.thumb figcaption { padding: 7px 10px; font-size: 12px; color: var(--muted); }
.thumb form { position: absolute; top: 6px; right: 6px; }

.login-body { display: grid; place-items: center; }
.login-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
    padding: 40px; width: min(380px, 92vw); display: grid; gap: 14px; text-align: center;
}
.login-card img { height: 42px; margin: 0 auto 6px; }
.login-card h1 { font-size: 20px; justify-content: center; margin-bottom: 4px; }
.login-card button {
    padding: 12px; border-radius: 9px; border: none; cursor: pointer;
    background: var(--grad); color: #06121c; font-weight: 700; font: inherit;
}

@media (max-width: 860px) {
    body { flex-direction: column; }
    .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
    .side nav { display: flex; }
    .side-logout { margin: 0; }
    .edit-grid { grid-template-columns: 1fr; }
    .main { padding: 20px 16px; }
    .tbl { display: block; overflow-x: auto; }
}
