:root {
    --admin-bg: #f4f6f8;
    --admin-ink: #111827;
    --admin-muted: #667085;
    --admin-line: #d9dee7;
    --admin-red: #e11d48;
    --admin-dark: #111116;
}

body {
    background: var(--admin-bg);
    color: var(--admin-ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.fw-black { font-weight: 950; }
.brand-fallback { display: inline-grid; place-items: center; }

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.admin-sidebar {
    background: var(--admin-dark);
    color: #fff;
    padding: 1rem;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 54px;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-brand span:first-child {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--admin-red);
}

.admin-brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 6px;
}

.admin-nav {
    display: grid;
    gap: .25rem;
    margin-top: 1.2rem;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem .85rem;
    color: #e5e7eb;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.4rem;
    background: #fff;
    border-bottom: 1px solid var(--admin-line);
}

.admin-content {
    padding: 1.4rem;
}

.panel {
    background: #fff;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
}

.panel-pad {
    padding: 1.25rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 1rem;
}

.stat-card {
    padding: 1rem;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    color: var(--admin-ink);
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    line-height: 1;
}

.stat-card span {
    color: var(--admin-muted);
    font-weight: 700;
}

.table img.thumb {
    width: 70px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
}

.dashboard-photo {
    display: block;
    color: var(--admin-ink);
    text-decoration: none;
    font-weight: 700;
}

.dashboard-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    margin-bottom: .55rem;
}

.dashboard-photo span {
    display: block;
    font-size: .9rem;
    line-height: 1.25;
}

.menu-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
}

.menu-tree-header strong {
    font-size: 1rem;
}

.menu-tree-header span {
    color: var(--admin-muted);
    font-size: .85rem;
    font-weight: 700;
}

.menu-tree {
    min-height: 58px;
    margin: 0;
    padding: .75rem;
    list-style: none;
    border: 1px dashed var(--admin-line);
    border-radius: 8px;
    background: #f9fafb;
}

.menu-tree-children {
    margin-top: .6rem;
    margin-left: 1.4rem;
    min-height: 42px;
    background: #fff;
}

.menu-tree-item {
    margin-bottom: .65rem;
}

.menu-tree-item:last-child {
    margin-bottom: 0;
}

.menu-tree-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .75rem;
    padding: .7rem;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    background: #fff;
}

.menu-tree-item.dragging {
    opacity: .55;
}

.menu-drag-handle {
    cursor: move;
    color: var(--admin-muted);
    font-size: 1.15rem;
}

.menu-tree-title {
    min-width: 0;
}

.menu-tree-title strong,
.menu-tree-title small {
    display: block;
}

.menu-tree-title small {
    color: var(--admin-muted);
    overflow-wrap: anywhere;
}

.menu-tree-meta,
.menu-tree-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.admin-menu-help {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--admin-muted);
    font-weight: 700;
}

.admin-menu-help i {
    color: var(--admin-red);
}

.form-help {
    color: var(--admin-muted);
    font-size: .85rem;
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: #111116;
}

.login-panel {
    width: min(430px, 100%);
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
}

@media (max-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }

    .admin-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
