:root {
    --bg: #0f0f12;
    --bg2: #18181f;
    --bg3: #22222c;
    --ink: #f0f0f5;
    --muted: #9a9aad;
    --line: #333340;
    --accent: #f5c542;
    --link: #7eb0ff;
    --ok: #3dba7a;
    --err: #e05555;
    --pad: 16px;
    --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.adm-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px var(--pad);
    background: #08080b;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.adm-brand strong { letter-spacing: .12em; font-size: .85rem; color: var(--accent); }
.adm-brand span { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.adm-nav { display: flex; gap: 14px; font-size: .88rem; }

.adm-main { max-width: 1100px; margin: 0 auto; padding: 20px var(--pad) 48px; }
.adm-crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.adm-title { font-size: 1.35rem; margin: 0 0 20px; font-weight: 600; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: .9rem; }
.flash-ok { background: #143322; border: 1px solid #2a6644; color: #9ee6bc; }
.flash-err { background: #3a1515; border: 1px solid #a44; color: #ffb0b0; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg3);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #2a2a36; text-decoration: none; }
.btn-primary { background: #3d3210; border-color: #6a5518; color: var(--accent); font-weight: 600; }
.btn-sm { padding: 4px 10px; font-size: .82rem; }
.btn-danger { background: #3a1515; border-color: #733; color: #ffb0b0; }
form.inline { display: inline; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.adm-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.adm-table th, .adm-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.adm-table th { color: var(--muted); font-weight: 600; background: var(--bg2); }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tr:hover td { background: rgba(255,255,255,.02); }
.actions { white-space: nowrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge.ok { background: #143322; color: var(--ok); }
.badge.off { background: #2a2a36; color: var(--muted); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.card {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}
.card h3 { margin: 0 0 6px; font-size: .95rem; }
.card p { margin: 0; color: var(--muted); font-size: .82rem; }
.card a { display: block; margin-top: 10px; font-size: .85rem; }

.adm-form {
    display: grid;
    gap: 14px;
    max-width: 560px;
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}
.field { display: grid; gap: 6px; }
.field span { font-size: .82rem; color: var(--muted); }
.field input, .field select, .field textarea {
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
    font: inherit;
}
.field-check { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.field-check input { width: auto; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.adm-foot { text-align: center; padding: 24px; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); }

.empty { color: var(--muted); font-size: .9rem; padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.hint { color: var(--muted); font-size: .88rem; margin: 0 0 16px; line-height: 1.45; }

@media (max-width: 640px) {
    .adm-table { font-size: .8rem; }
    .adm-table th, .adm-table td { padding: 8px; }
}

.cat-hint { font-size: .85rem; color: var(--muted); margin: 0 0 16px; line-height: 1.45; }
.cat-legend { font-weight: 400; color: var(--muted); font-size: .75rem; }
.adm-table-cats .cat-cells { min-width: 280px; max-width: 420px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chip {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--muted);
    font: inherit;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.cat-chip:hover:not(:disabled) { border-color: var(--accent); color: var(--ink); }
.cat-chip-on {
    background: #143322;
    border-color: #2a6644;
    color: #9ee6bc;
}
.cat-chip-principal.cat-chip-on {
    background: #3d3210;
    border-color: #6a5518;
    color: var(--accent);
    font-weight: 700;
}
.cat-chip-busy { opacity: .55; cursor: wait; }
.cat-chip:disabled { cursor: default; opacity: 1; }
