/* X-Aset — admin shell */
:root {
    --brand-accent: #4f46e5;
    --brand-accent-dark: #4338ca;
    --brand-accent-soft: #eef2ff;
    --text-strong: #0f172a;
    --admin-sidebar-bg: #0f172a;
    --admin-sidebar-w: 260px;
    --admin-topbar-h: 56px;
    --admin-accent: var(--brand-accent);
    --admin-accent-dark: var(--brand-accent-dark);
    --focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.35);
}

.skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: auto;
    height: auto;
    margin: 0;
    padding: 12px 16px;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: #fff;
    color: var(--brand-accent-dark);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 10px;
    box-shadow: var(--focus-ring), 0 8px 24px rgba(15, 23, 42, 0.12);
}

.admin-body {
    background: #f4f4f5;
    margin: 0;
    min-height: 100dvh;
}

.admin-body.admin-login {
    background: linear-gradient(165deg, #0f172a 0%, #1e293b 45%, var(--brand-accent-dark) 100%);
    display: flex;
    flex-direction: column;
}

.admin-body.admin-login .admin-topbar-minimal {
    background: transparent;
    border: none;
    box-shadow: none;
}

.admin-body.admin-login .admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    max-width: 440px;
}

/* —— Shell —— */
.admin-shell {
    display: flex;
    min-height: 100dvh;
}

.admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0, 0, 0, 0.45);
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 80;
    width: min(var(--admin-sidebar-w), 88vw);
    background: var(--admin-sidebar-bg);
    color: #f5f5f5;
    display: flex;
    flex-direction: column;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-body.admin-sidebar-open .admin-sidebar {
    transform: translateX(0);
}

.admin-sidebar-head {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
}

.admin-sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    font-size: 13px;
}

.admin-sidebar-brand-text strong {
    font-size: 14px;
    font-weight: 800;
}

.admin-sidebar-brand-text small {
    opacity: 0.72;
    font-weight: 500;
}


.admin-brand-mark {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    color: var(--brand-accent);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(79, 70, 229, 0.18), rgba(67, 56, 202, 0.12));
}

.admin-brand-mark svg {
    width: 70%;
    height: 70%;
}

.admin-brand-logo {
    display: block;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 8px 24px;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--touch, 44px);
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.admin-sidebar-link i {
    width: 20px;
    text-align: center;
    opacity: 0.9;
}

.admin-sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.admin-sidebar-link.is-active {
    background: var(--brand-accent);
    color: #fff;
    box-shadow: inset 3px 0 0 #fff;
}

.admin-sidebar-link-accent.is-active {
    background: rgba(79, 70, 229, 0.28);
    box-shadow: inset 3px 0 0 var(--brand-accent-soft);
}

.admin-workspace {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* —— Topbar —— */
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--admin-topbar-h);
    padding: max(8px, env(safe-area-inset-top)) 12px 8px 12px;
    background: #fff;
    color: var(--text-strong);
    border-bottom: 1px solid #e4e4e7;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar-minimal .admin-brand a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
}

.admin-brand-text { font-size: 1.05rem; }

.admin-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch, 44px);
    height: var(--touch, 44px);
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    background: #fff;
    color: var(--text-strong);
    cursor: pointer;
    flex-shrink: 0;
}

.admin-menu-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.admin-breadcrumb {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: #71717a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-breadcrumb a {
    color: var(--brand-accent-dark);
    text-decoration: none;
}

.admin-breadcrumb a:hover { text-decoration: underline; }

.admin-breadcrumb-sep { margin: 0 6px; opacity: 0.5; }

.admin-breadcrumb-current {
    color: var(--text-strong);
}

.admin-user {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    min-width: 0;
    flex-shrink: 0;
}

.admin-user-meta {
    display: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.role-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--brand-accent-soft);
    color: var(--brand-accent-dark);
    vertical-align: middle;
}

.btn-logout,
.logout-form button {
    min-height: var(--touch, 44px);
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid #e4e4e7;
    background: #fafafa;
    color: var(--text-strong);
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.btn-logout:focus-visible,
.logout-form button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.logout-form { margin: 0; display: inline; }

.admin-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

.admin-main .alert { margin-bottom: 12px; }

.page-header { margin-bottom: 18px; }

.page-header h1 {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-strong);
}

.page-header .page-lead {
    margin-top: 8px;
    font-size: 14px;
    color: #52525b;
    line-height: 1.5;
}

.page-header .page-lead a {
    color: var(--brand-accent-dark);
    font-weight: 600;
}

.admin-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e4e4e7;
}

.admin-card.narrow { width: 100%; margin: 0; }

.login-card { text-align: center; }

.login-card .login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    object-fit: contain;
}

.login-card .login-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--brand-accent), var(--brand-accent-dark));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 22px;
}

.login-card h1 {
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.login-card .login-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-accent);
    margin-bottom: 6px;
}

.login-card .muted { margin-bottom: 20px; font-size: 14px; line-height: 1.55; }

.login-card a { color: var(--brand-accent-dark); font-weight: 700; }

.admin-header-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e4e4e7;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--brand-accent-soft);
    color: var(--brand-accent);
    display: grid;
    place-items: center;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-num {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-strong);
    line-height: 1;
}

.stat-label {
    color: #71717a;
    font-size: 13px;
    margin-top: 4px;
    font-weight: 600;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 1.75rem 0 0.75rem;
    color: var(--text-strong);
}

.form-stack label {
    display: block;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
    color: #3f3f46;
}

.form-stack label .label-required::after {
    content: ' *';
    color: var(--brand-accent);
}

.form-stack .field-help {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #71717a;
}

.form-stack .field-error {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #b91c1c;
}

.form-stack input,
.form-stack textarea,
.form-stack select {
    width: 100%;
    margin-top: 8px;
    padding: 12px 14px;
    border: 1px solid #d4d4d8;
    border-radius: 12px;
    font: inherit;
    font-size: 16px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-stack input:focus-visible,
.form-stack textarea:focus-visible,
.form-stack select:focus-visible {
    outline: none;
    border-color: var(--brand-accent);
    box-shadow: var(--focus-ring);
}

.form-stack textarea { resize: vertical; min-height: 88px; }

.form-section {
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f4f4f5;
}

.form-section:last-of-type { border-bottom: none; }

.form-section-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #71717a;
    margin-bottom: 14px;
}

.form-stack .color-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    width: 100%;
    min-width: 0;
}

.form-stack .color-field .color-picker {
    box-sizing: border-box;
    flex: 0 0 48px;
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    height: 44px;
    margin-top: 0;
    padding: 2px;
    border: 1px solid #d4d4d8;
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
}

.form-stack .color-field .color-hex {
    box-sizing: border-box;
    flex: 1 1 auto;
    width: auto;
    min-width: 120px;
    max-width: none;
    margin-top: 0;
    font-family: ui-monospace, monospace;
    text-transform: uppercase;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.checkbox,
.checkbox-inline {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-weight: 500 !important;
    min-height: var(--touch, 44px);
}

.checkbox input,
.checkbox-inline input {
    width: 20px !important;
    height: 20px;
    margin: 0 !important;
    accent-color: var(--brand-accent);
}

.admin-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.admin-actions .btn { flex: 1 1 auto; }

.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-bar .filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e4e4e7;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }

.data-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #71717a;
    background: #fafafa;
    border-bottom: 1px solid #e4e4e7;
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid #f4f4f5;
    vertical-align: top;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .text-center { text-align: center; }

.data-table .actions,
.data-table .actions .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.data-table .actions a,
.data-table .actions .btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch, 44px);
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: var(--brand-accent-dark);
    background: var(--brand-accent-soft);
}

.data-table .actions form { margin: 0; }

.link-danger,
.btn-link-danger,
.btn-danger {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca;
    cursor: pointer;
    font: inherit;
    min-height: var(--touch, 44px);
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
}

.btn-danger-solid {
    background: #dc2626 !important;
    color: #fff !important;
    border: none;
}

.link-muted {
    background: #f4f4f5 !important;
    color: #3f3f46 !important;
    border: 1px solid #e4e4e7;
    cursor: pointer;
    font: inherit;
    min-height: var(--touch, 44px);
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
}

.link-muted-danger {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-aktif { background: #dcfce7; color: #166534; }
.badge-nonaktif { background: #f4f4f5; color: #52525b; }
.badge-terhapus { background: #fee2e2; color: #991b1b; }
.badge-superadmin { background: #ede9fe; color: #5b21b6; }
.badge-neutral { background: #e4e4e7; color: #3f3f46; }

.summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e4e4e7;
    font-size: 13px;
    font-weight: 600;
    color: #52525b;
    min-height: var(--touch, 44px);
}

.summary-pill strong { color: var(--text-strong); }

.logo-preview-wrap {
    display: inline-block;
    padding: 10px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px dashed #d4d4d8;
    margin: 8px 0;
}

.logo-preview {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.empty-state {
    text-align: center;
    padding: 36px 16px;
    color: #71717a;
}

.empty-state i {
    font-size: 32px;
    color: #d4d4d8;
    margin-bottom: 10px;
    display: block;
}

.empty-state .btn { margin-top: 14px; }

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding: 12px 4px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch, 44px);
    padding: 0 16px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e4e4e7;
    color: var(--brand-accent-dark);
    font-weight: 700;
    text-decoration: none;
}

.pagination-info {
    font-size: 13px;
    color: #71717a;
    font-weight: 600;
}

.inline-form { display: inline; }
.stack-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.impersonate-banner {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: var(--brand-accent-soft, #eef2ff);
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.danger-zone {
    border-color: #fecaca;
    background: #fffafa;
}

.danger-zone h2 { color: #991b1b; }

.info-dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px 16px;
    margin: 0;
}

.info-dl dt {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #71717a;
    margin-top: 12px;
}

.info-dl dt:first-child { margin-top: 0; }

.info-dl dd {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-strong);
    word-break: break-word;
}

@media (min-width: 640px) {
    .info-dl { grid-template-columns: 200px 1fr; }
    .info-dl dt { margin-top: 0; text-align: right; padding-top: 4px; }
    .admin-user-meta { display: inline; }
    .admin-header-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .admin-header-row .admin-actions { margin: 0; flex-wrap: nowrap; }
    .admin-header-row .admin-actions .btn { flex: 0 0 auto; }
    .form-row { grid-template-columns: 1fr 1fr; gap: 12px; }
    .filter-bar { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
    .filter-bar label { flex: 1 1 180px; margin-bottom: 0; }
    .admin-main { padding: 24px; }
}

@media (min-width: 900px) {
    .admin-menu-toggle { display: none; }
    .admin-sidebar-backdrop { display: none !important; }
    .admin-sidebar {
        position: sticky;
        top: 0;
        transform: none;
        flex-shrink: 0;
        height: 100dvh;
        box-shadow: none;
    }
    .admin-shell { display: flex; }
    .admin-workspace { flex: 1; min-width: 0; }
}

@media (max-width: 899px) {
    .data-table thead { display: none; }
    .data-table { min-width: 0; }
    .data-table tbody tr {
        display: block;
        margin: 12px;
        padding: 4px 0;
        border: 1px solid #e4e4e7;
        border-radius: 14px;
        background: #fff;
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 10px 14px;
        border-bottom: 1px solid #f4f4f5;
        text-align: right;
    }
    .data-table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #a1a1aa;
        text-align: left;
        flex-shrink: 0;
    }
    .data-table td.actions {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    .data-table td.actions::before { margin-bottom: 4px; }
    .data-table .empty-row td {
        display: block;
        text-align: center;
    }
    .data-table .empty-row td::before { display: none; }
}

@media print {
    .admin-sidebar, .admin-topbar, .admin-sidebar-backdrop, .admin-actions, .admin-main .alert { display: none !important; }
    .admin-main { max-width: none; padding: 0; }
}

:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}
