/* ============================================================
   GregPlay — Админ-панель (редизайн)
   Палитра и стиль наследуются от основного сайта.
   ============================================================ */

:root {
    --ap-sidebar-w: 256px;
    --ap-bg: #0a0710;
    --ap-bg-2: #0c0814;
    --ap-shell: rgba(13, 10, 20, 0.82);
    --ap-panel: rgba(20, 15, 30, 0.72);
    --ap-panel-2: rgba(28, 21, 42, 0.55);
    --ap-panel-soft: rgba(255, 255, 255, 0.025);
    --ap-border: rgba(255, 255, 255, 0.07);
    --ap-border-2: rgba(255, 255, 255, 0.12);
    --ap-border-accent: rgba(129, 79, 216, 0.45);
    --ap-text: #ece8f4;
    --ap-muted: #948aab;
    --ap-faint: #6f6788;
    --ap-accent: #8b5cf6;
    --ap-accent-2: #6d33d6;
    --ap-accent-soft: rgba(139, 92, 246, 0.14);
    --ap-ok: #34d399;
    --ap-ok-soft: rgba(52, 211, 153, 0.14);
    --ap-warn: #fbbf24;
    --ap-warn-soft: rgba(251, 191, 36, 0.14);
    --ap-err: #f87171;
    --ap-err-soft: rgba(248, 113, 113, 0.14);
    --ap-radius: 18px;
    --ap-radius-sm: 12px;
    --ap-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
    --ap-glow: 0 0 0 1px rgba(139, 92, 246, 0.25), 0 18px 40px -18px rgba(109, 51, 214, 0.55);
}

* { box-sizing: border-box; }

body.admin-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ap-text);
    background:
        radial-gradient(1100px 600px at 80% -8%, rgba(109, 51, 214, 0.16), transparent 60%),
        radial-gradient(900px 500px at -5% 10%, rgba(88, 60, 160, 0.12), transparent 55%),
        linear-gradient(180deg, var(--ap-bg) 0%, var(--ap-bg-2) 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

body.admin-page[data-auth-state="checking"] .ap-layout {
    visibility: hidden;
}

body.admin-page[data-auth-state="denied"] .ap-layout {
    display: none;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.55); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   LAYOUT
   ============================================================ */
.ap-layout {
    display: flex;
    min-height: 100vh;
}

.ap-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.ap-backdrop.show { opacity: 1; pointer-events: auto; }

/* ---------- Sidebar ---------- */
.ap-sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    width: var(--ap-sidebar-w);
    min-width: var(--ap-sidebar-w);
    height: 100vh;
    padding: 22px 16px 18px;
    border-right: 1px solid var(--ap-border);
    background:
        radial-gradient(420px 260px at 30% 0%, rgba(109, 51, 214, 0.16), transparent 70%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
        rgba(9, 6, 15, 0.92);
    backdrop-filter: blur(20px);
}

.ap-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 18px;
}
.ap-brand__logo {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    font-family: "Sora", sans-serif;
    font-weight: 800;
    font-size: 20px;
    background: linear-gradient(140deg, #9a6cff, #6d33d6);
    box-shadow: 0 8px 22px -8px rgba(109, 51, 214, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0% 50%);
}
.ap-brand__name {
    font-family: "Sora", sans-serif;
    font-weight: 800;
    font-size: 19px;
    letter-spacing: 0.2px;
    line-height: 1;
}
.ap-brand__badge {
    margin-left: 2px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #c4a9ff;
    border: 1px solid var(--ap-border-accent);
    background: var(--ap-accent-soft);
    border-radius: 6px;
    padding: 3px 5px;
    vertical-align: middle;
}
.ap-sidebar__close {
    display: none;
    margin-left: auto;
    width: 34px; height: 34px;
    border-radius: 9px;
    border: 1px solid var(--ap-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ap-text);
    cursor: pointer;
}

.ap-sidebar__label {
    padding: 6px 12px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.16em;
    color: var(--ap-faint);
}

.ap-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
    overflow-y: auto;
    flex: 1;
    padding-right: 2px;
}
.ap-nav__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--ap-muted);
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}
.ap-nav__item svg { width: 19px; height: 19px; flex: none; opacity: 0.9; }
.ap-nav__item:hover {
    color: var(--ap-text);
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(2px);
}
.ap-nav__item.active {
    color: #fff;
    background: linear-gradient(100deg, rgba(139, 92, 246, 0.42), rgba(109, 51, 214, 0.18));
    border-color: var(--ap-border-accent);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 12px 26px -16px rgba(109, 51, 214, 0.9);
}
.ap-nav__item.active::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 22px;
    border-radius: 4px;
    background: linear-gradient(180deg, #b794ff, #7c43e0);
}

.ap-sidebar__back {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--ap-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--ap-muted);
    font-weight: 600;
    font-size: 13.5px;
    transition: all 0.18s ease;
}
.ap-sidebar__back:hover { color: var(--ap-text); border-color: var(--ap-border-accent); background: var(--ap-accent-soft); }

/* ---------- Content ---------- */
.ap-content {
    flex: 1;
    min-width: 0;
    padding: 26px 30px 48px;
}

/* ---------- Topbar ---------- */
.ap-topbar {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 26px;
}
.ap-burger {
    display: none;
    width: 44px; height: 44px;
    border-radius: 12px;
    border: 1px solid var(--ap-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ap-text);
    font-size: 20px;
    cursor: pointer;
}
.ap-pagehead { min-width: 0; }
.ap-pagehead__kicker {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    color: var(--ap-accent);
    text-transform: uppercase;
}
.ap-pagehead__title {
    margin: 8px 0 6px;
    font-family: "Sora", sans-serif;
    font-weight: 800;
    font-size: 32px;
    line-height: 1.05;
}
.ap-pagehead__sub {
    color: var(--ap-muted);
    font-size: 14px;
    max-width: 640px;
}

.ap-topbar__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    flex: none;
}
.ap-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 300px;
    max-width: 36vw;
    padding: 11px 14px;
    border: 1px solid var(--ap-border);
    border-radius: 13px;
    background: var(--ap-panel);
    color: var(--ap-muted);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.ap-search:focus-within { border-color: var(--ap-border-accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.14); }
.ap-search svg { width: 17px; height: 17px; flex: none; }
.ap-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ap-text);
    font: inherit;
    font-size: 13.5px;
}
.ap-search input::placeholder { color: var(--ap-faint); }
.ap-search__kbd {
    font-size: 11px;
    color: var(--ap-faint);
    border: 1px solid var(--ap-border);
    border-radius: 6px;
    padding: 2px 7px;
}

.ap-iconbtn {
    position: relative;
    width: 44px; height: 44px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 13px;
    border: 1px solid var(--ap-border);
    background: var(--ap-panel);
    color: var(--ap-muted);
    cursor: pointer;
    transition: all 0.18s ease;
}
.ap-iconbtn:hover { color: var(--ap-text); border-color: var(--ap-border-accent); }
.ap-iconbtn svg { width: 19px; height: 19px; }
.ap-iconbtn__dot {
    position: absolute;
    top: 7px; right: 8px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 9px;
    background: linear-gradient(140deg, #a974ff, #6d33d6);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 2px var(--ap-bg-2);
}

.ap-userchip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px 5px 5px;
    border: 1px solid var(--ap-border);
    border-radius: 13px;
    background: var(--ap-panel);
    color: var(--ap-text);
    font: inherit;
    cursor: pointer;
    transition: all 0.18s ease;
}
.ap-userchip:hover { border-color: var(--ap-border-accent); }
.ap-userchip__av {
    width: 40px; height: 40px;
    flex: none;
    border-radius: 11px;
    object-fit: cover;
    image-rendering: pixelated;
    background: linear-gradient(140deg, #9a6cff, #6d33d6);
}
.ap-userchip__meta { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; line-height: 1.1; }
.ap-userchip__name { font-size: 14.5px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.ap-userchip__role { font-size: 11.5px; color: var(--ap-accent); font-weight: 600; line-height: 1.1; white-space: nowrap; }
.ap-userchip svg { width: 16px; height: 16px; margin-left: 4px; color: var(--ap-faint); flex: none; }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.ap-card {
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    background: var(--ap-panel);
    backdrop-filter: blur(14px);
    box-shadow: var(--ap-shadow);
}
.ap-card--pad { padding: 22px; }

.ap-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}
.ap-panel-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.13em;
    color: var(--ap-muted);
    text-transform: uppercase;
}
.ap-panel-link {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ap-accent);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: color 0.15s ease, gap 0.15s ease;
}
.ap-panel-link:hover { color: #b794ff; gap: 8px; }

/* Buttons */
.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 12px;
    border: 1px solid var(--ap-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--ap-text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.ap-btn svg { width: 17px; height: 17px; }
.ap-btn:hover { border-color: var(--ap-border-accent); background: rgba(255, 255, 255, 0.06); transform: translateY(-1px); }
.ap-btn--primary {
    border-color: transparent;
    background: linear-gradient(135deg, #9a6cff, #6d33d6);
    color: #fff;
    box-shadow: 0 14px 30px -14px rgba(109, 51, 214, 0.9);
}
.ap-btn--primary:hover { filter: brightness(1.08); box-shadow: 0 18px 36px -14px rgba(109, 51, 214, 1); }
.ap-btn--ghost { background: transparent; }
.ap-btn--sm { padding: 8px 13px; font-size: 12.5px; border-radius: 10px; }

/* Badges */
.ap-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
}
.ap-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ap-badge--ok { color: var(--ap-ok); background: var(--ap-ok-soft); border-color: rgba(52, 211, 153, 0.3); }
.ap-badge--warn { color: var(--ap-warn); background: var(--ap-warn-soft); border-color: rgba(251, 191, 36, 0.3); }
.ap-badge--err { color: var(--ap-err); background: var(--ap-err-soft); border-color: rgba(248, 113, 113, 0.3); }
.ap-badge--accent { color: #b794ff; background: var(--ap-accent-soft); border-color: var(--ap-border-accent); }
.ap-badge--mute { color: var(--ap-muted); background: rgba(255,255,255,0.05); border-color: var(--ap-border); }
.ap-badge--plain::before { display: none; }

.ap-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ap-ok);
}
.ap-trend svg { width: 13px; height: 13px; }
.ap-trend--down { color: var(--ap-err); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.ap-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}
.ap-stat {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    background: var(--ap-panel);
    backdrop-filter: blur(14px);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.ap-stat::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(260px 120px at 90% -20%, rgba(139, 92, 246, 0.16), transparent 70%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.ap-stat:hover { transform: translateY(-3px); border-color: var(--ap-border-accent); box-shadow: var(--ap-glow); }
.ap-stat:hover::after { opacity: 1; }
.ap-stat__icon {
    width: 46px; height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #c4a9ff;
    background: linear-gradient(150deg, rgba(139, 92, 246, 0.28), rgba(109, 51, 214, 0.12));
    border: 1px solid var(--ap-border-accent);
    margin-bottom: 16px;
}
.ap-stat__icon svg { width: 23px; height: 23px; }
.ap-stat__label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--ap-faint);
    text-transform: uppercase;
}
.ap-stat__value {
    margin: 7px 0 9px;
    font-family: "Sora", sans-serif;
    font-weight: 800;
    font-size: 30px;
    line-height: 1;
}

/* ============================================================
   GRID HELPERS
   ============================================================ */
.ap-grid { display: grid; gap: 18px; }
.ap-grid > * { min-width: 0; }
.ap-grid--main { grid-template-columns: 1.55fr 1fr; align-items: start; }
.ap-grid--3 { grid-template-columns: 1.35fr 1fr 1fr; align-items: start; }
.ap-grid--2 { grid-template-columns: 2.2fr 1fr; align-items: start; }
.ap-stack { display: flex; flex-direction: column; gap: 18px; }
.ap-mt { margin-top: 18px; }

/* ============================================================
   CHARTS
   ============================================================ */
.ap-chart-card { padding: 22px; }
.ap-chart {
    position: relative;
    width: 100%;
    height: 230px;
}
.ap-chart svg { width: 100%; height: 100%; overflow: visible; }
.ap-chart__grid line { stroke: rgba(255, 255, 255, 0.05); stroke-width: 1; }
.ap-chart__area { fill: url(#apAreaGrad); }
.ap-chart__line { fill: none; stroke: url(#apLineGrad); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ap-chart__dot { fill: #0a0710; stroke: #b794ff; stroke-width: 2.5; }
.ap-chart__yl, .ap-chart__xl { fill: var(--ap-faint); font-size: 11px; font-family: "Manrope", sans-serif; }

.ap-chart-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 18px;
}
.ap-chart-tile {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--ap-border);
    background: var(--ap-panel-soft);
}
.ap-chart-tile__label { font-size: 11px; color: var(--ap-muted); font-weight: 600; }
.ap-chart-tile__value { font-size: 18px; font-weight: 800; color: var(--ap-ok); margin: 4px 0; font-family: "Sora", sans-serif; }
.ap-chart-tile__spark { height: 22px; }
.ap-chart-tile__spark path { fill: none; stroke: var(--ap-accent); stroke-width: 2; opacity: 0.85; }

/* Donut */
.ap-donut-wrap { display: flex; align-items: center; gap: 20px; }
.ap-donut { position: relative; width: 132px; height: 132px; flex: none; }
.ap-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ap-donut circle { fill: none; stroke-width: 14; }
.ap-donut__center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}
.ap-donut__num { font-family: "Sora", sans-serif; font-weight: 800; font-size: 26px; line-height: 1; }
.ap-donut__cap { font-size: 10.5px; color: var(--ap-muted); margin-top: 3px; }
.ap-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ap-legend__row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.ap-legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ap-legend__name { color: var(--ap-muted); }
.ap-legend__val { margin-left: auto; font-weight: 700; }

/* Gauge (settings) */
.ap-gauge { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.ap-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ap-gauge circle { fill: none; stroke-width: 13; }
.ap-gauge__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1; }

/* ============================================================
   LISTS (activity, news, servers)
   ============================================================ */
.ap-list { display: flex; flex-direction: column; }
.ap-list__row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 0;
    border-top: 1px solid var(--ap-border);
}
.ap-list__row:first-child { border-top: none; padding-top: 0; }
.ap-list__ico {
    width: 38px; height: 38px;
    flex: none;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #c4a9ff;
    background: var(--ap-accent-soft);
    border: 1px solid var(--ap-border-accent);
}
.ap-list__ico svg { width: 18px; height: 18px; }
.ap-list__body { min-width: 0; flex: 1; }
.ap-list__title { font-size: 13.5px; font-weight: 600; }
.ap-list__title b { font-weight: 800; color: #fff; }
.ap-list__meta { font-size: 12px; color: var(--ap-faint); margin-top: 2px; }
.ap-list__time { font-size: 11.5px; color: var(--ap-faint); flex: none; }

/* News mini list (with thumbnails) */
.ap-newsrow {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 0;
    border-top: 1px solid var(--ap-border);
}
.ap-newsrow:first-child { border-top: none; padding-top: 0; }
.ap-newsrow__thumb {
    width: 58px; height: 44px;
    flex: none;
    border-radius: 10px;
    object-fit: cover;
    background: linear-gradient(140deg, #2a1d45, #160f26);
    border: 1px solid var(--ap-border);
}
.ap-newsrow__body { flex: 1; min-width: 0; }
.ap-newsrow__title { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-newsrow__date { font-size: 11.5px; color: var(--ap-faint); margin-top: 3px; }

/* Server status rows */
.ap-srv {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 0;
    border-top: 1px solid var(--ap-border);
}
.ap-srv:first-child { border-top: none; padding-top: 0; }
.ap-srv__logo {
    width: 42px; height: 42px;
    flex: none;
    border-radius: 11px;
    object-fit: cover;
    background: radial-gradient(circle at 40% 30%, #3a2a5e, #140d24);
    border: 1px solid var(--ap-border);
}
.ap-srv__body { flex: 1; min-width: 0; }
.ap-srv__name { font-size: 13.5px; font-weight: 700; }
.ap-srv__ip { font-size: 11.5px; color: var(--ap-faint); font-family: "JetBrains Mono", monospace; margin-top: 2px; }
.ap-srv__right { text-align: right; flex: none; }
.ap-srv__cnt { font-size: 13px; font-weight: 700; }
.ap-srv__cnt span { color: var(--ap-faint); font-weight: 600; }

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.ap-qa { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ap-qa--col { grid-template-columns: 1fr; }
.ap-qa__item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 16px;
    border: 1px solid var(--ap-border);
    border-radius: 14px;
    background: var(--ap-panel-soft);
    cursor: pointer;
    transition: all 0.18s ease;
}
.ap-qa__item:hover { border-color: var(--ap-border-accent); background: var(--ap-accent-soft); transform: translateY(-2px); }
.ap-qa__item:last-child:nth-child(odd) { grid-column: 1 / -1; }
.ap-qa__ico {
    width: 40px; height: 40px;
    flex: none;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #c4a9ff;
    background: linear-gradient(150deg, rgba(139, 92, 246, 0.28), rgba(109, 51, 214, 0.1));
    border: 1px solid var(--ap-border-accent);
}
.ap-qa__ico svg { width: 19px; height: 19px; }
.ap-qa__body { flex: 1; min-width: 0; }
.ap-qa__title { font-size: 13.5px; font-weight: 700; }
.ap-qa__sub { font-size: 11.5px; color: var(--ap-faint); margin-top: 2px; }
.ap-qa__arrow { color: var(--ap-faint); flex: none; transition: transform 0.18s ease; }
.ap-qa__item:hover .ap-qa__arrow { transform: translateX(3px); color: var(--ap-accent); }

/* ============================================================
   TABLES
   ============================================================ */
.ap-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.ap-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; border: 1px solid var(--ap-border); background: var(--ap-panel-soft); }
.ap-tab {
    padding: 8px 14px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--ap-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
}
.ap-tab.active { color: #fff; background: linear-gradient(120deg, rgba(139, 92, 246, 0.42), rgba(109, 51, 214, 0.22)); }
.ap-tab:hover:not(.active) { color: var(--ap-text); }

.ap-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border-radius: 11px;
    border: 1px solid var(--ap-border);
    background: var(--ap-panel-soft);
    color: var(--ap-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.ap-select svg { width: 14px; height: 14px; }
.ap-toolbar__spacer { margin-left: auto; }

.ap-tablewrap { overflow-x: auto; }
.ap-table { width: 100%; border-collapse: collapse; }
.ap-table th {
    text-align: left;
    padding: 0 16px 14px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--ap-faint);
    text-transform: uppercase;
    white-space: nowrap;
}
.ap-table td {
    padding: 14px 16px;
    border-top: 1px solid var(--ap-border);
    font-size: 13.5px;
    vertical-align: middle;
}
.ap-table tbody tr { transition: background 0.15s ease; }
.ap-table tbody tr:hover { background: rgba(139, 92, 246, 0.06); }

.ap-cell-prod, .ap-cell-user { display: flex; align-items: center; gap: 12px; }
.ap-thumb-ico {
    width: 40px; height: 40px;
    flex: none;
    border-radius: 11px;
    object-fit: cover;
    display: grid;
    place-items: center;
    color: #c4a9ff;
    background: linear-gradient(150deg, rgba(139, 92, 246, 0.25), rgba(109, 51, 214, 0.1));
    border: 1px solid var(--ap-border-accent);
}
.ap-thumb-ico svg { width: 19px; height: 19px; }
.ap-avatar {
    width: 38px; height: 38px;
    flex: none;
    border-radius: 10px;
    object-fit: cover;
    image-rendering: pixelated;
    background: linear-gradient(140deg, #9a6cff, #6d33d6);
}
.ap-cell-strong { font-weight: 700; }
.ap-cell-sub { font-size: 11.5px; color: var(--ap-faint); margin-top: 2px; }
.ap-cell-price { font-weight: 800; color: var(--ap-text); font-family: "Sora", sans-serif; }
.ap-cell-old { color: var(--ap-faint); text-decoration: line-through; font-size: 12px; margin-left: 6px; }

.ap-rowact {
    width: 32px; height: 32px;
    border-radius: 9px;
    border: 1px solid var(--ap-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--ap-muted);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ap-rowact:hover { color: var(--ap-text); border-color: var(--ap-border-accent); background: var(--ap-accent-soft); }
.ap-rowact svg { width: 16px; height: 16px; }
.ap-rowacts { display: inline-flex; gap: 7px; }

/* Pagination */
.ap-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.ap-pager__info { font-size: 12.5px; color: var(--ap-faint); }
.ap-pager__nav { display: inline-flex; gap: 6px; }
.ap-pager__btn {
    min-width: 34px; height: 34px;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid var(--ap-border);
    background: var(--ap-panel-soft);
    color: var(--ap-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ap-pager__btn:hover { color: var(--ap-text); border-color: var(--ap-border-accent); }
.ap-pager__btn.active { color: #fff; background: linear-gradient(120deg, #8b5cf6, #6d33d6); border-color: transparent; }

/* Category list (right rail) */
.ap-catlist { display: flex; flex-direction: column; gap: 3px; }
.ap-catlist__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 11px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ap-catlist__item:hover { background: rgba(255, 255, 255, 0.04); }
.ap-catlist__item.active { background: linear-gradient(100deg, rgba(139, 92, 246, 0.4), rgba(109, 51, 214, 0.15)); border-color: var(--ap-border-accent); }
.ap-catlist__name { font-size: 13.5px; font-weight: 600; flex: 1; }
.ap-catlist__count { font-size: 12.5px; font-weight: 700; color: var(--ap-muted); }

/* ============================================================
   FORMS (launcher / settings)
   ============================================================ */
.ap-field { margin-bottom: 16px; }
.ap-field__label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ap-muted); margin-bottom: 7px; }
.ap-input, .ap-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--ap-border);
    border-radius: 11px;
    background: rgba(8, 6, 13, 0.6);
    color: var(--ap-text);
    font: inherit;
    font-size: 13.5px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.ap-input:focus, .ap-textarea:focus { outline: none; border-color: var(--ap-border-accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.14); }
.ap-textarea { resize: vertical; min-height: 86px; font-family: "JetBrains Mono", monospace; font-size: 12.5px; }
.ap-input--mono { font-family: "JetBrains Mono", monospace; font-size: 12.5px; }
.ap-select-native {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--ap-border);
    border-radius: 11px;
    background: rgba(8, 6, 13, 0.6);
    color: var(--ap-text);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23948aab' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.ap-formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.ap-section-sub {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--ap-muted);
    text-transform: uppercase;
    margin: 4px 0 16px;
}
.ap-divider { height: 1px; background: var(--ap-border); margin: 22px 0; }

/* Toggle */
.ap-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--ap-border);
}
.ap-toggle-row:first-of-type { border-top: none; }
.ap-toggle-row__text { min-width: 0; }
.ap-toggle-row__title { font-size: 13.5px; font-weight: 600; }
.ap-toggle-row__sub { font-size: 12px; color: var(--ap-faint); margin-top: 3px; }
.ap-toggle { position: relative; width: 46px; height: 26px; flex: none; cursor: pointer; }
.ap-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.ap-toggle__track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--ap-border);
    transition: background 0.2s ease;
}
.ap-toggle__track::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.22s cubic-bezier(.34,1.56,.64,1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.ap-toggle input:checked + .ap-toggle__track { background: linear-gradient(120deg, #8b5cf6, #6d33d6); border-color: transparent; }
.ap-toggle input:checked + .ap-toggle__track::after { transform: translateX(20px); }

/* Color swatches (appearance) */
.ap-swatches { display: flex; gap: 10px; }
.ap-swatch { width: 30px; height: 30px; border-radius: 9px; cursor: pointer; border: 2px solid transparent; transition: transform 0.15s ease; }
.ap-swatch:hover { transform: scale(1.12); }
.ap-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--ap-bg-2); }

/* Version block (launcher) */
.ap-version {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--ap-border-accent);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(109, 51, 214, 0.05));
}
.ap-version__big { font-family: "Sora", sans-serif; font-weight: 800; font-size: 30px; }

/* small stat rows (launcher/settings right rail) */
.ap-ministat { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 13px; border-top: 1px solid var(--ap-border); }
.ap-ministat:first-child { border-top: none; }
.ap-ministat__k { color: var(--ap-muted); }
.ap-ministat__v { font-weight: 700; }

/* progress bars (node state) */
.ap-progress { margin: 11px 0; }
.ap-progress__head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.ap-progress__head span:last-child { color: var(--ap-muted); }
.ap-progress__bar { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.ap-progress__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8b5cf6, #6d33d6); transition: width 1s ease; }
.ap-progress__fill--warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.ap-progress__fill--err { background: linear-gradient(90deg, #f87171, #ef4444); }

/* Action bar (page-level primary button) */
.ap-actionbar { display: flex; justify-content: flex-end; margin-bottom: 18px; }

/* Toasts */
.ap-toast-container { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.ap-toast {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1px solid var(--ap-border-accent);
    background: var(--ap-shell);
    backdrop-filter: blur(16px);
    color: var(--ap-text);
    font-size: 13.5px; font-weight: 600;
    box-shadow: var(--ap-shadow);
    animation: apToastIn 0.3s ease both;
}
.ap-toast svg { width: 18px; height: 18px; color: var(--ap-accent); }
.ap-toast--error svg { color: var(--ap-err); }
.ap-toast--warn svg { color: var(--ap-warn); }
@keyframes apToastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Backend modal layer */
.ap-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(5, 3, 10, 0.74);
    backdrop-filter: blur(16px);
}

.ap-modal__card {
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    background: linear-gradient(180deg, rgba(24, 17, 34, 0.98), rgba(13, 9, 20, 0.98));
    box-shadow: var(--ap-shadow);
}

.ap-modal__head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 22px 0;
}

.ap-modal__title {
    margin: 0;
    font-family: "Sora", sans-serif;
    font-size: 22px;
}

.ap-modal__sub {
    margin: 7px 0 0;
    color: var(--ap-muted);
    line-height: 1.55;
}

.ap-modal__close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--ap-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ap-text);
    cursor: pointer;
}

.ap-modal__body {
    padding: 22px;
}

.ap-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.ap-field--full { grid-column: 1 / -1; }
.ap-help { display: block; margin-top: 7px; color: var(--ap-faint); font-size: 12px; line-height: 1.45; }
.ap-danger-text { color: var(--ap-err); }
.ap-empty {
    padding: 18px;
    border: 1px dashed var(--ap-border);
    border-radius: 14px;
    color: var(--ap-muted);
    background: rgba(255, 255, 255, 0.025);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes apFadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes apDraw { to { stroke-dashoffset: 0; } }
.ap-section { animation: apFadeUp 0.45s ease both; }
.ap-reveal { opacity: 0; animation: apFadeUp 0.5s ease forwards; }
.ap-reveal[data-d="1"] { animation-delay: 0.05s; }
.ap-reveal[data-d="2"] { animation-delay: 0.1s; }
.ap-reveal[data-d="3"] { animation-delay: 0.15s; }
.ap-reveal[data-d="4"] { animation-delay: 0.2s; }
.ap-reveal[data-d="5"] { animation-delay: 0.25s; }
.ap-reveal[data-d="6"] { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   ACCESS DENIED
   ============================================================ */
.ap-denied { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.ap-denied__card { max-width: 440px; text-align: center; padding: 40px; }
.ap-denied__card h1 { font-family: "Sora", sans-serif; font-size: 26px; margin: 14px 0 10px; }
.ap-denied__card p { color: var(--ap-muted); margin-bottom: 22px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
    .ap-grid--3 { grid-template-columns: 1.4fr 1fr; }
}
@media (max-width: 1080px) {
    .ap-grid--main, .ap-grid--3, .ap-grid--2 { grid-template-columns: 1fr; }
    .ap-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 920px) {
    .ap-sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 0 80px rgba(0,0,0,0.6);
    }
    .ap-sidebar.open { transform: translateX(0); }
    .ap-sidebar__close { display: grid; place-items: center; }
    .ap-burger { display: grid; place-items: center; }
    .ap-content { padding: 18px; }
    .ap-topbar { flex-wrap: wrap; }
    .ap-search { width: 100%; max-width: none; order: 5; }
    .ap-pagehead__title { font-size: 26px; }
}
@media (max-width: 560px) {
    .ap-stats { grid-template-columns: 1fr; }
    .ap-formgrid, .ap-qa { grid-template-columns: 1fr; }
    .ap-topbar__actions { width: 100%; }
}
