* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #07111f;
    --bg-2: #0e1b31;
    --bg-3: #13233d;
    --card: rgba(15, 23, 42, 0.92);
    --card-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.09);
    --text: #e5eefb;
    --muted: #9fb0c9;
    --primary: #2f80ed;
    --primary-2: #3b8eff;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
}

html, body {
    width: 100%;
    min-height: 100%;
    font-family: Inter, Segoe UI, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(47, 128, 237, 0.18), transparent 24%),
        radial-gradient(circle at bottom right, rgba(22, 163, 74, 0.12), transparent 22%),
        linear-gradient(135deg, var(--bg), var(--bg-2) 55%, #09101d);
    color: var(--text);
}

body {
    min-height: 100vh;
    overflow: hidden;
}

button, input, select {
    font: inherit;
}

.hidden {
    display: none !important;
}

.shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    padding: 24px;
    background: rgba(7, 17, 31, 0.92);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #ff5f6d, #4b6cb7);
    color: #fff;
    font-weight: 800;
    font-size: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.brand h1 {
    font-size: 24px;
    line-height: 1.1;
}

.brand p {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

.admin-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}

.eyebrow {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

#adminName {
    font-size: 18px;
}

#adminStatus {
    color: var(--muted);
    font-size: 13px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    padding: 14px 16px;
    border-radius: 14px;
    text-align: left;
    cursor: pointer;
    transition: 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: rgba(47, 128, 237, 0.16);
    border-color: rgba(47, 128, 237, 0.28);
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 10px;
}

.content {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100vh;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    padding: 4px 4px 10px;
}

.topbar h2 {
    font-size: 30px;
    margin-bottom: 6px;
}

.topbar p {
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-wrap input,
.select {
    min-width: 240px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 14px;
    padding: 13px 14px;
    outline: none;
}

.search-wrap input::placeholder {
    color: #8ea2bf;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn {
    border: none;
    border-radius: 14px;
    padding: 13px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s ease;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 12px 26px rgba(47, 128, 237, 0.25);
}

.primary-btn:hover {
    transform: translateY(-1px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
    border: 1px solid var(--line);
}

.secondary-btn:hover,
.ghost-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.danger-btn {
    background: rgba(220, 38, 38, 0.16);
    color: #ffcccc;
    border: 1px solid rgba(220, 38, 38, 0.28);
}

.danger-btn:hover {
    background: rgba(220, 38, 38, 0.24);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat-card strong {
    font-size: 30px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.16);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-header h3 {
    font-size: 22px;
    margin-bottom: 6px;
}

.panel-header p {
    color: var(--muted);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-wrap {
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    margin:0 -4px;
    border-radius:14px;
    border: 1px solid var(--line);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    background: rgba(255, 255, 255, 0.02);
}

.table thead th {
    text-align: left;
    font-size: 13px;
    color: #c6d4e8;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
    color: #dce7f6;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 28px !important;
}

.row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 260px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.pill.admin {
    background: rgba(47, 128, 237, 0.17);
    color: #9fcbff;
    border: 1px solid rgba(47, 128, 237, 0.25);
}

.pill.user {
    background: rgba(22, 163, 74, 0.15);
    color: #9ae6b4;
    border: 1px solid rgba(22, 163, 74, 0.22);
}

.pill.action {
    background: rgba(255, 255, 255, 0.08);
    color: #d8e4f3;
    border: 1px solid var(--line);
}

.action-btn {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    transition: 0.2s ease;
    width: 100%;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.action-btn.primary {
    border-color: rgba(47, 128, 237, 0.25);
    background: rgba(47, 128, 237, 0.15);
}

.action-btn.warn {
    border-color: rgba(217, 119, 6, 0.28);
    background: rgba(217, 119, 6, 0.15);
}

.action-btn.danger {
    border-color: rgba(220, 38, 38, 0.28);
    background: rgba(220, 38, 38, 0.16);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(5px);
    display: grid;
    place-items: center;
    z-index: 9999;
    padding: 18px;
}

.modal {
    width: min(92vw, 520px);
    background: #0c1526;
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

.modal-header,
.modal-footer {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-header {
    border-bottom: 1px solid var(--line);
}

.modal-body {
    padding: 18px 20px;
    color: var(--text);
    display: grid;
    gap: 14px;
}

.modal-footer {
    border-top: 1px solid var(--line);
    justify-content: flex-end;
}

.modal-close {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-size: 13px;
    color: var(--muted);
}

.field input,
.field select {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--text);
    padding: 12px 14px;
    outline: none;
}

.help-text {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.toast {
    position: fixed;
    top: 16px;
    right: 16px;
    width: min(92vw, 360px);
    padding: 12px 14px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
    animation: slideIn 0.25s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

.toast-close {
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    width: auto;
    min-width: auto;
    padding: 0;
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ------------------------------------------------ */
/* SEARCH INPUT                                     */
/* ------------------------------------------------ */

.search-input{
    min-width:240px;
    background:rgba(255,255,255,.06);
    border:1px solid var(--line);
    color:var(--text);
    border-radius:14px;
    padding:13px 14px;
    outline:none;
}

.search-input::placeholder{
    color:#8ea2bf;
}


/* ------------------------------------------------ */
/* TABLE BUTTON TWEAKS                              */
/* ------------------------------------------------ */

.action-btn{
    min-height:34px;
    padding:8px 12px;
    font-size:13px;
    border-radius:10px;
}

.table td{
    padding:10px 14px;
}

.sidebar-footer button{
    height:44px;
}


/* ------------------------------------------------ */
/* CUSTOM SELECT                                    */
/* ------------------------------------------------ */

#auditActionFilter.custom-select {
    min-width: 340px;
}

.custom-select {
    position: relative;
    width:100%;
    min-width:300px;
}

.custom-select-trigger {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: #20283c;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    transition: .2s;
}

.custom-select-trigger:hover {
    border-color: #4b8cff;
}

.custom-select.open .custom-select-trigger {
    border-color: #4b8cff;
    box-shadow: 0 0 0 3px rgba(75,140,255,.18);
}

.custom-select-arrow {
    transition: .2s;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: nowrap;
    display: none;
    padding: 8px;
    background: #1a2234;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0,0,0,.45);
    z-index: 1000;
}

.custom-select.open .custom-select-menu {
    display: block;
}

.custom-select-option {
    padding: 12px 18px;
    border-radius: 10px;
    white-space: nowrap;
    cursor: pointer;
    transition: .15s;
    color: #fff;
}

.custom-select-option:hover {
    background: #2f80ed;
}

.custom-select-option.selected {
    background: rgba(47,128,237,.18);
    color: #68a8ff;
    font-weight: 600;
}

.mobile-header {
    display: none;
}

.menu-btn {
    cursor: pointer;
    width:44px;
    height:44px;
    font-size:26px;
    border-radius:12px;
    background:#182235;
    color:white;
    border:none;
    margin-left: auto;
}

.mobile-title h2 {
    font-size: 18px;
    line-height: 1.1;
}

.mobile-title p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;

    width: min(84vw, 320px);
    height: 100vh;

    background: #08111f;

    border-left: 1px solid var(--line);
    border-right: none;

    z-index: 10001;

    padding: 18px;

    display: flex;
    flex-direction: column;
    gap: 12px;

    transform: translateX(100%);
    transition: transform .28s ease;

    box-shadow: -20px 0 50px rgba(0,0,0,.45);
}

.mobile-drawer.open {
    transform: translateX(0);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
}

.drawer-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding-bottom:16px;
    border-bottom:1px solid var(--line);
}

.drawer-close {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
}

.drawer-link {
    width: 100%;
    text-align: left;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-radius: 14px;
    padding: 14px 16px;
    font-weight: 600;
    cursor: pointer;
}


.mobile-drawer{
    padding: 18px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.drawer-link.danger {
    margin-top: auto;
    flex-shrink: 0;

    background: rgba(220, 38, 38, 0.16);
    border-color: rgba(220, 38, 38, 0.28);
    color: #ffcccc;
}



/* ------------------------------------------------ */
/* RESPONSIVE                                       */
/* ------------------------------------------------ */

@media (max-width:1100px){

    .shell{
        grid-template-columns:1fr;
    }

    .sidebar{
        border-right:none;
        border-bottom:1px solid var(--line);
    }

    .stats-grid{
        grid-template-columns:repeat(2,1fr);
    }

    .topbar{
        flex-direction:column;
        align-items:stretch;
    }

    .topbar-actions{
        width:100%;
        flex-direction:column;
        align-items:stretch;
    }

    .search-wrap,
    .search-wrap input,
    .search-input,
    .primary-btn,
    .secondary-btn,
    .custom-select{

        width:100%;
    }

    .search-input,
    .search-wrap input{
        padding:11px 14px;
    }

    .panel-header{
        flex-direction:column;
        align-items:stretch;
    }

    .panel-actions{
        flex-direction:column;
        align-items:stretch;
    }
}

@media (max-width:768px){

    body{
        font-size:14px;
    }

    .custom-select,
    #auditActionFilter.custom-select{
        width:100%;
        min-width:100%;
    }

    .panel{
        margin-top:8px;
    }

    .panel h3{
        font-size:26px;
    }

    .panel p{
        font-size:15px;
    }

    .stat-label{
        font-size:12px;
    }

    .stat-card strong{
        font-size:24px;
    }

    .primary-btn,
    .secondary-btn{
        font-size:15px;
    }

    .table{
        min-width:680px;
    }

    .table th{
        font-size:12px;
    }

    .table td{
        font-size:13px;
    }

    .custom-select-trigger{
        height:48px;
        font-size:15px;
    }

    input{
        font-size:15px;
    }

    .mobile-header{
        display:flex !important;
        align-items:center;
        justify-content: space-between;
        gap:14px;
        padding:14px 18px;
        position:sticky;
        top:0;
        z-index:9000;
        background:#07111f;
        border-bottom:1px solid var(--line);
    }

    .mobile-title {
        flex: 1;
    }

    .sidebar{
        display:none !important;
    }

    .topbar{
        display:none;
    }

    .content{
        padding:10px;
        height:auto;
        min-height:calc(100vh - 72px);
        overflow:visible;
    }

    html,
    body{
        height:auto;
        min-height:100%;
        overflow-y:auto;
        overflow-x:hidden;
    }

    .shell{
        display:block;
        min-height:auto;
    }

    .stats-grid{
        grid-template-columns:repeat(2,1fr);
        margin-top:4px;
    }

}