/* ==========================================================================
   Admin v2 design system
   ==========================================================================
   New light, card-based theme for the Admin portal (replacing the dark
   "vatebra" nk-* theme, page by page, starting with the Dashboard).

   This file is intentionally self-contained and does not touch vatebra.css -
   pages opt in by using the _AccessV2 layout instead of _Access. Until every
   page has been migrated, both themes coexist in the app.
   ========================================================================== */

:root {
    --av2-bg: #F6F8F7;
    --av2-surface: #FFFFFF;
    --av2-border: #E9EDEB;
    --av2-text: #111827;
    --av2-text-muted: #6B7280;
    --av2-text-faint: #9CA3AF;

    --av2-accent: #16A34A;
    --av2-accent-dark: #0F7A38;
    --av2-accent-soft: #E7F6ED;

    --av2-sidebar-bg: #0B1F16;
    --av2-sidebar-bg-hover: #142E20;
    --av2-sidebar-text: #B7C6BE;
    --av2-sidebar-text-muted: #6F8377;
    --av2-sidebar-active-bg: #16A34A;
    --av2-sidebar-active-text: #FFFFFF;

    --av2-success: #16A34A;
    --av2-success-bg: #E7F6ED;
    --av2-warning: #B45309;
    --av2-warning-bg: #FEF3C7;
    --av2-danger: #DC2626;
    --av2-danger-bg: #FDE7E7;
    --av2-info: #2563EB;
    --av2-info-bg: #EAF1FE;

    --av2-radius-lg: 16px;
    --av2-radius-md: 12px;
    --av2-radius-sm: 8px;
    --av2-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

.av2-app {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--av2-bg);
    color: var(--av2-text);
    min-height: 100vh;
    display: flex;
}

/* ---------- Sidebar ---------- */

.av2-sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: var(--av2-sidebar-bg);
    color: var(--av2-sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}

.av2-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px 20px;
}

.av2-sidebar-brand img {
    height: 28px;
    width: auto;
}

.av2-sidebar-brand-name {
    font-weight: 700;
    font-size: 15px;
    color: #FFFFFF;
}

.av2-nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 12px 12px 12px;
}

.av2-nav-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--av2-sidebar-text-muted);
    text-transform: uppercase;
    padding: 14px 10px 6px 10px;
}

.av2-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--av2-radius-sm);
    color: var(--av2-sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.av2-nav-item:hover {
    background: var(--av2-sidebar-bg-hover);
    color: #FFFFFF;
    text-decoration: none;
}

.av2-nav-item.active {
    background: var(--av2-sidebar-active-bg);
    color: var(--av2-sidebar-active-text);
}

.av2-nav-item .av2-nav-icon {
    width: 18px;
    text-align: center;
    flex: 0 0 18px;
    font-size: 14px;
}

.av2-sidebar-footer {
    flex: 0 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.av2-sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--av2-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex: 0 0 34px;
}

.av2-sidebar-footer-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.av2-sidebar-footer-email {
    color: var(--av2-sidebar-text-muted);
    font-size: 11.5px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.av2-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--av2-accent);
    display: inline-block;
    margin-right: 5px;
}

/* ---------- Main / topbar ---------- */

.av2-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.av2-topbar {
    background: var(--av2-surface);
    border-bottom: 1px solid var(--av2-border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.av2-topbar-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--av2-text);
    margin: 0;
}

.av2-topbar-subtitle {
    font-size: 13px;
    color: var(--av2-text-muted);
    margin: 2px 0 0 0;
}

.av2-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.av2-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--av2-border);
    background: var(--av2-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--av2-text-muted);
    position: relative;
    text-decoration: none;
}

.av2-icon-btn:hover {
    background: var(--av2-bg);
    color: var(--av2-text);
}

.av2-badge-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--av2-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.av2-avatar-chip {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--av2-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.av2-content {
    padding: 22px 28px 40px 28px;
}

/* ---------- Cards / KPI ---------- */

.av2-card {
    background: var(--av2-surface);
    border: 1px solid var(--av2-border);
    border-radius: var(--av2-radius-lg);
    box-shadow: var(--av2-shadow);
}

.av2-card-pad {
    padding: 18px 20px;
}

a.av2-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

a.av2-card-link:hover {
    color: inherit;
    text-decoration: none;
}

a.av2-card-link:hover .av2-card {
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.10);
    border-color: #DCE3DF;
}

.av2-kpi-label {
    font-size: 12.5px;
    color: var(--av2-text-muted);
    font-weight: 500;
    margin: 0;
}

.av2-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--av2-text);
    margin: 6px 0 0 0;
    line-height: 1.2;
}

.av2-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex: 0 0 40px;
}

.av2-kpi-delta {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.av2-kpi-delta.up { color: var(--av2-success); }
.av2-kpi-delta.down { color: var(--av2-danger); }
.av2-kpi-delta.flat { color: var(--av2-text-muted); }

.av2-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--av2-text);
    margin: 0;
}

/* ---------- Pill toggle buttons (Daily/Weekly/Monthly, period selector) ---------- */

.av2-pill-group {
    display: inline-flex;
    background: var(--av2-bg);
    border: 1px solid var(--av2-border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.av2-pill {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--av2-text-muted);
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
}

.av2-pill:hover {
    color: var(--av2-text);
    text-decoration: none;
}

.av2-pill.active {
    background: var(--av2-accent);
    color: #fff;
}

/* ---------- Table ---------- */

.av2-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.av2-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--av2-text-faint);
    padding: 0 10px 10px 10px;
    border-bottom: 1px solid var(--av2-border);
}

.av2-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--av2-border);
    vertical-align: middle;
    color: var(--av2-text);
}

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

.av2-table-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--av2-accent-soft);
    color: var(--av2-accent-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex: 0 0 30px;
}

.av2-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.av2-user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--av2-text);
    line-height: 1.3;
}

.av2-user-email {
    font-size: 11.5px;
    color: var(--av2-text-muted);
    line-height: 1.3;
}

/* ---------- Status badges / alerts ---------- */

.av2-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}

.av2-badge-success { background: var(--av2-success-bg); color: var(--av2-success); }
.av2-badge-warning { background: var(--av2-warning-bg); color: var(--av2-warning); }
.av2-badge-danger { background: var(--av2-danger-bg); color: var(--av2-danger); }
.av2-badge-info { background: var(--av2-info-bg); color: var(--av2-info); }
.av2-badge-neutral { background: #F1F2F4; color: var(--av2-text-muted); }

.av2-alert-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--av2-border);
}

.av2-alert-row:last-child { border-bottom: none; }

.av2-alert-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex: 0 0 26px;
    margin-top: 1px;
}

.av2-alert-message {
    font-size: 13px;
    color: var(--av2-text);
    line-height: 1.4;
}

.av2-alert-time {
    font-size: 11.5px;
    color: var(--av2-text-faint);
    margin-top: 2px;
}

.av2-empty-state {
    color: var(--av2-text-muted);
    font-size: 13px;
    text-align: center;
    padding: 24px 10px;
}

/* ---------- Coming-soon placeholder pages ---------- */

.av2-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    color: var(--av2-text-muted);
}

.av2-coming-soon i {
    font-size: 34px;
    color: var(--av2-text-faint);
    margin-bottom: 14px;
}

.av2-coming-soon h5 {
    color: var(--av2-text);
    font-weight: 700;
    margin-bottom: 6px;
}

/* ---------- Tabs (status filters etc.) ---------- */

.av2-tabs {
    display: flex;
    gap: 22px;
    border-bottom: 1px solid var(--av2-border);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.av2-tab {
    padding: 10px 2px 12px 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--av2-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.av2-tab:hover {
    color: var(--av2-text);
    text-decoration: none;
}

.av2-tab.active {
    color: var(--av2-accent-dark);
    border-bottom-color: var(--av2-accent);
}

/* ---------- Toolbar (search + filter + action buttons above a table) ---------- */

.av2-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.av2-search-input {
    position: relative;
    min-width: 260px;
    flex: 1 1 260px;
    max-width: 380px;
}

.av2-search-input i,
.av2-search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--av2-text-faint);
    font-size: 12px;
    width: 12px;
    height: 12px;
}

.av2-search-input input {
    padding-left: 32px !important;
    height: 31px;
}

.av2-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--av2-radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--av2-border);
    background: var(--av2-surface);
    color: var(--av2-text);
    cursor: pointer;
}

.av2-btn:hover {
    background: var(--av2-bg);
    color: var(--av2-text);
    text-decoration: none;
}

.av2-btn-primary {
    background: var(--av2-accent);
    border-color: var(--av2-accent);
    color: #fff;
}

.av2-btn-primary:hover {
    background: var(--av2-accent-dark);
    border-color: var(--av2-accent-dark);
    color: #fff;
}

/* ---------- Row action icon buttons ---------- */

.av2-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.av2-row-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--av2-border);
    background: var(--av2-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--av2-text-muted);
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
    flex: 0 0 auto;
}

.av2-row-icon-btn:hover {
    background: var(--av2-bg);
    color: var(--av2-text);
    text-decoration: none;
}

.av2-row-icon-btn.danger:hover {
    background: var(--av2-danger-bg);
    color: var(--av2-danger);
    border-color: var(--av2-danger-bg);
}

.av2-row-icon-btn.success:hover {
    background: var(--av2-success-bg);
    color: var(--av2-success);
    border-color: var(--av2-success-bg);
}

/* ---------- Pagination ---------- */

.av2-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    font-size: 12.5px;
    color: var(--av2-text-muted);
}

.av2-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.av2-page-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: var(--av2-radius-sm);
    border: 1px solid var(--av2-border);
    background: var(--av2-surface);
    color: var(--av2-text-muted);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.av2-page-btn:hover {
    background: var(--av2-bg);
    color: var(--av2-text);
    text-decoration: none;
}

.av2-page-btn.active {
    background: var(--av2-accent);
    border-color: var(--av2-accent);
    color: #fff;
}

.av2-page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 992px) {
    .av2-sidebar {
        position: fixed;
        left: 0;
        z-index: 1030;
        transform: translateX(-100%);
        transition: transform 0.18s ease;
    }

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

    .av2-content {
        padding: 16px;
    }

    .av2-topbar {
        padding: 12px 16px;
    }
}

/* ---------- Modal (lightweight, no jQuery/Bootstrap JS dependency) ---------- */

.av2-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 1050;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

.av2-modal-backdrop.open {
    display: flex;
}

.av2-modal {
    background: var(--av2-surface);
    border-radius: var(--av2-radius-lg);
    box-shadow: 0 12px 40px rgba(16, 24, 40, 0.18);
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    position: relative;
    animation: av2ModalIn 0.15s ease;
}

@keyframes av2ModalIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.av2-modal-close {
    position: sticky;
    top: 0;
    float: right;
    margin: 14px 14px 0 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--av2-border);
    background: var(--av2-surface);
    color: var(--av2-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    font-size: 13px;
}

.av2-modal-close:hover {
    background: var(--av2-bg);
    color: var(--av2-text);
}

.av2-modal-loading {
    padding: 60px 20px;
    text-align: center;
    color: var(--av2-text-muted);
    font-size: 13.5px;
}

/* Soften the un-migrated v1 form partials (nk-block/card-bordered/form-label) when they're
   loaded raw into an av2 modal, so they don't look like a foreign fragment. */
.av2-modal-body-inner {
    padding: 4px 26px 26px 26px;
}

.av2-modal-body-inner .nk-block-head { margin-bottom: 14px; }
.av2-modal-body-inner .nk-block-title { font-size: 17px; font-weight: 700; color: var(--av2-text); margin: 0 0 4px 0; }
.av2-modal-body-inner .nk-block-des p { color: var(--av2-text-muted); font-size: 13px; margin: 0; }
.av2-modal-body-inner .card { border: 1px solid var(--av2-border); border-radius: var(--av2-radius-md); box-shadow: none; }
.av2-modal-body-inner .card-header { background: var(--av2-bg); border-bottom: 1px solid var(--av2-border); }
.av2-modal-body-inner .card-title { font-size: 13.5px; font-weight: 700; color: var(--av2-text); margin: 0; }
.av2-modal-body-inner .form-label, .av2-modal-body-inner label { font-size: 12.5px; font-weight: 600; color: var(--av2-text-muted); }
.av2-modal-body-inner .card-footer { background: var(--av2-surface); border-top: 1px solid var(--av2-border); }
