/* ==========================================================================
   MikroTik User Manager ERP - Modern WinBox / macOS Hybrid UI
   Complete Stylesheet - Fully Responsive & RTL Optimized
   ========================================================================== */

:root {
    --bg-main: #f0f2f5;
    --bg-window: #ffffff;
    --bg-header: #1c2b39;
    --bg-sidebar: #22313f;
    --sidebar-hover: #2c3e50;
    --sidebar-active: #0078d7;
    --toolbar-bg: #eceff1;
    --toolbar-border: #cfd8dc;
    --border-color: #dcdfe6;
    --table-header: #eef2f5;
    --table-row-hover: #e8f4fd;
    --table-row-selected: #d0e8fc;
    --text-main: #2c3e50;
    --text-muted: #607d8b;
    --accent-blue: #0078d7;
    --accent-green: #2ecc71;
    --accent-red: #e74c3c;
    --accent-orange: #f39c12;
    --font-family: -apple-system, BlinkMacSystemFont, "Cairo", "Tajawal", "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
    --bg-main: #12181f;
    --bg-window: #1a232c;
    --bg-header: #0f151b;
    --bg-sidebar: #151e27;
    --sidebar-hover: #1f2b37;
    --sidebar-active: #0078d7;
    --toolbar-bg: #202b36;
    --toolbar-border: #2d3b49;
    --border-color: #2d3b49;
    --table-header: #1e2833;
    --table-row-hover: #263342;
    --table-row-selected: #1e3a5f;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-family);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

#app-root {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

/* ==========================================================================
   TOP HEADER
   ========================================================================== */
.mt-header {
    background-color: var(--bg-header);
    color: #ffffff;
    height: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
    width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
    gap: 8px;
}

.mt-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
}

.mt-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    min-width: 0;
}

.mt-brand .brand-title-full {
    display: inline;
}

.mt-brand .brand-title-short {
    display: none;
}

.mt-brand .badge {
    background: #0078d7;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.mt-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.mt-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.mt-mobile-toggle:hover, .mt-mobile-toggle:active {
    background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   MAIN CONTAINER & SIDEBAR
   ========================================================================== */
.mt-container {
    display: flex;
    flex-direction: row;
    flex: 1;
    width: 100%;
    height: calc(100vh - 44px);
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.mt-sidebar {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    height: 100%;
    background-color: var(--bg-sidebar);
    color: #cfd8dc;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
    border-right: none;
    flex-shrink: 0;
    box-sizing: border-box;
    user-select: none;
    z-index: 50;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="ltr"] .mt-sidebar {
    border-left: none;
    border-right: 1px solid var(--border-color);
}

.mt-sidebar-search {
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mt-sidebar-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    padding: 6px 10px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.mt-sidebar-search input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #0078d7;
    box-shadow: 0 0 0 2px rgba(0, 120, 215, 0.25);
}

.mt-sidebar-search input::placeholder {
    color: #94a3b8;
}

.mt-nav-dept {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mt-nav-dept-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.15s, color 0.15s;
}

.mt-nav-dept-header:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}

.mt-nav-dept.collapsed .mt-nav-dept-items {
    display: none;
}

.mt-nav-dept.collapsed .dept-arrow {
    transform: rotate(-90deg);
}

.dept-arrow {
    font-size: 9px;
    transition: transform 0.2s;
    opacity: 0.7;
}

.mt-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 12px;
    cursor: pointer;
    font-size: 12.5px;
    color: #cbd5e1;
    transition: all 0.15s ease;
    border-right: 3px solid transparent;
}

[dir="ltr"] .mt-nav-item {
    border-right: none;
    border-left: 3px solid transparent;
}

.mt-nav-item:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.mt-nav-item.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
    font-weight: 600;
    border-color: #ffffff;
}

.mt-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.mt-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mt-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ==========================================================================
   MAIN CONTENT & BREADCRUMBS
   ========================================================================== */
.mt-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-window);
    overflow: hidden;
    box-sizing: border-box;
}

.mt-breadcrumb-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

[data-theme="dark"] .mt-breadcrumb-bar {
    background: #151e27;
    border-bottom: 1px solid #2d3b49;
}

.mt-breadcrumb-path {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mt-breadcrumb-path .dept-name {
    color: #0078d7;
    font-weight: 700;
}

.mt-breadcrumb-path .tab-name {
    color: #1e293b;
    font-weight: 700;
}

[data-theme="dark"] .mt-breadcrumb-path .tab-name {
    color: #f1f5f9;
}

#main-view {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    padding: 12px;
    box-sizing: border-box;
}

/* ==========================================================================
   TOOLBARS & CONTROLS
   ========================================================================== */
.mt-toolbar {
    background-color: var(--toolbar-bg);
    border-bottom: 1px solid var(--toolbar-border);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    box-sizing: border-box;
}

.mt-toolbar-left, .mt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 12px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.mt-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.mt-btn-primary {
    background: #0078d7 !important;
    color: #ffffff !important;
    border-color: #0063b1 !important;
}

.mt-btn-primary:hover {
    background: #0063b1 !important;
}

.mt-btn-success {
    background: #10b981 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

.mt-btn-success:hover {
    background: #059669 !important;
}

.mt-btn-danger {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
}

.mt-btn-danger:hover {
    background: #dc2626 !important;
}

.mt-btn-warning {
    background: #f59e0b !important;
    color: #ffffff !important;
    border-color: #d97706 !important;
}

.mt-btn-warning:hover {
    background: #d97706 !important;
}

.mt-input, .mt-select {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    background: var(--bg-window);
    color: var(--text-main);
    outline: none;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.mt-input:focus, .mt-select:focus {
    border-color: #0078d7;
    box-shadow: 0 0 0 2px rgba(0, 120, 215, 0.2);
}

/* ==========================================================================
   DASHBOARD KPI CARDS & GRIDS
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    width: 100%;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.kpi-card {
    background: var(--bg-window);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.kpi-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.kpi-lbl {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.mt-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-window);
    margin-bottom: 12px;
    box-sizing: border-box;
}

.mt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.mt-table th {
    background: var(--table-header);
    color: var(--text-muted);
    font-weight: 700;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.mt-table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.mt-table tr:hover {
    background: var(--table-row-hover);
}

.mt-table tr.selected {
    background: var(--table-row-selected);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.mt-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mt-modal {
    background: var(--bg-window);
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    max-width: 96vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleModal 0.2s ease-out;
    box-sizing: border-box;
}

@keyframes scaleModal {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.mt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--bg-header);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.mt-modal-header .close-btn {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.mt-modal-header .close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

.mt-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    box-sizing: border-box;
}

.mt-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    background: var(--table-header);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
}

/* ==========================================================================
   MOBILE QUICK BOTTOM NAVIGATION
   ========================================================================== */
.mt-mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-header);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 120;
    box-shadow: 0 -3px 10px rgba(0,0,0,0.2);
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
    box-sizing: border-box;
}

.mt-mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    background: transparent;
    border: none;
    font-size: 10px;
    gap: 2px;
    padding: 6px 0;
    cursor: pointer;
    transition: color 0.15s ease;
    font-family: inherit;
}

.mt-mobile-nav-btn i, .mt-mobile-nav-btn span.icon {
    font-size: 17px;
    line-height: 1;
}

.mt-mobile-nav-btn.active {
    color: #38bdf8;
    font-weight: 700;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablets & Small Laptops (<= 1024px) */
@media (max-width: 1024px) {
    .mt-brand .brand-title-full {
        display: none !important;
    }
    .mt-brand .brand-title-short {
        display: inline !important;
    }
    .mt-header-right span.user-greeting {
        display: none !important;
    }
    .mt-header-right button span.btn-label {
        display: none !important;
    }
    .mt-header-right {
        gap: 4px;
    }
}

/* Mobile Devices & Small Tablets (<= 768px) */
@media (max-width: 768px) {
    .mt-header {
        height: 48px !important;
        min-height: 48px !important;
        padding: 0 8px !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
    }
    .mt-header-left {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        min-width: 0 !important;
        flex-shrink: 0 !important;
    }
    .mt-mobile-toggle {
        display: inline-flex !important;
    }
    .mt-brand {
        font-size: 13px;
        gap: 4px;
        min-width: 0;
    }
    .mt-header-right {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex-wrap: nowrap !important;
        flex-shrink: 1 !important;
        min-width: 0 !important;
    }
    .mt-header-right span.user-greeting,
    .mt-header-right .btn-label {
        display: none !important;
    }
    #sam-header-net-switcher,
    .sam-header-net-switcher {
        display: inline-flex !important;
        align-items: center !important;
        max-width: 135px !important;
        padding: 2px 5px !important;
        font-size: 11px !important;
        flex-shrink: 1 !important;
        min-width: 0 !important;
    }
    #sam-header-net-switcher .net-switcher-btn-modal,
    .sam-header-net-switcher .net-switcher-btn-modal,
    .sam-net-switcher-btn {
        display: none !important;
    }
    #sam-active-network,
    .sam-active-network-select {
        max-width: 82px !important;
        font-size: 11px !important;
        padding: 1px 2px !important;
    }
    .mt-header-right .mt-btn {
        min-width: 32px !important;
        padding: 4px 6px !important;
        font-size: 13px !important;
    }

    /* Drawer Sidebar */
    .mt-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 1000 !important;
        box-shadow: -5px 0 25px rgba(0,0,0,0.5);
        transform: translateX(100%) !important;
        border-left: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-right: none !important;
    }
    [dir="ltr"] .mt-sidebar {
        right: auto !important;
        left: 0 !important;
        transform: translateX(-100%) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-left: none !important;
    }
    .mt-sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    .mt-sidebar-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: rgba(0,0,0,0.3);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        color: #f1f5f9;
        font-weight: 700;
        font-size: 13px;
    }

    .mt-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(2px);
        z-index: 999;
    }
    .mt-sidebar-overlay.active {
        display: block !important;
    }

    .mt-container {
        height: calc(100vh - 44px);
    }
    body.has-mobile-nav .mt-container {
        height: calc(100vh - 44px - 56px);
    }
    .mt-mobile-nav {
        display: flex !important;
    }

    #main-view {
        padding: 8px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 4px !important;
    }

    .mt-modal {
        width: 96vw !important;
        max-width: 96vw !important;
        max-height: 90vh !important;
        margin: 10px auto !important;
        border-radius: 12px !important;
    }

    .mt-modal-body {
        max-height: calc(90vh - 120px) !important;
        overflow-y: auto !important;
        padding: 12px !important;
    }

    .form-row {
        flex-direction: column !important;
        gap: 6px !important;
    }
}

/* Small Screens (<= 420px) */
@media (max-width: 420px) {
    .mt-header {
        padding: 0 5px !important;
    }
    .kpi-grid {
        grid-template-columns: 1fr !important;
    }
    .mt-brand .badge {
        display: none !important;
    }
    #sam-header-net-switcher,
    .sam-header-net-switcher {
        max-width: 105px !important;
        padding: 1px 4px !important;
    }
    #sam-active-network,
    .sam-active-network-select {
        max-width: 62px !important;
        font-size: 10px !important;
    }
    .mt-header-right {
        gap: 3px !important;
    }
    .mt-header-right .mt-btn {
        min-width: 28px !important;
        padding: 3px 5px !important;
        font-size: 12px !important;
    }
}


.nd-batch-bar {
position: sticky;
bottom: 15px;
z-index: 100;
background: #0f172a;
color: #f8fafc;
border-radius: 12px;
padding: 12px 20px;
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 12px;
border: 1px solid #334155;
animation: ndSlideUp 0.25s ease-out;
}

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

.badge-dup-mac {
background: #ef4444;
color: #ffffff;
font-weight: 800;
font-size: 11px;
padding: 3px 8px;
border-radius: 4px;
display: inline-flex;
align-items: center;
gap: 4px;
box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
animation: dupPulse 2s infinite;
}

@keyframes dupPulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.85; transform: scale(1.03); }
}

.badge-oui {
font-size: 10px;
padding: 2px 6px;
border-radius: 4px;
font-weight: 700;
margin-right: 4px;
border: 1px solid transparent;
}
.badge-oui-mikrotik { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.badge-oui-ubiquiti { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.badge-oui-tplink { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge-oui-linux { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge-oui-generic { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

.nd-filter-btn {
background: #ffffff;
border: 1px solid #cbd5e1;
color: #334155;
padding: 5px 12px;
border-radius: 6px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
transition: all 0.15s ease;
}
.nd-filter-btn:hover {
background: #f8fafc;
border-color: #94a3b8;
}
.nd-filter-btn.active {
background: #e0f2fe;
color: #0369a1;
border-color: #0284c7;
font-weight: 700;
}

.nd-multiselect-dropdown {
position: absolute;
top: 100%;
right: 0;
z-index: 50;
background: #ffffff;
border: 1px solid #cbd5e1;
border-radius: 8px;
box-shadow: 0 10px 25px rgba(0,0,0,0.15);
min-width: 240px;
max-width: 320px;
max-height: 280px;
overflow-y: auto;
padding: 8px;
margin-top: 4px;
display: none;
}
.nd-multiselect-dropdown.show {
display: block;
}

.nd-group-header {
background: #f8fafc;
border: 1px solid #e2e8f0;
border-right: 4px solid #0284c7;
border-radius: 8px;
padding: 12px 16px;
margin-bottom: 12px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}

/* ========================================================= */

/* ==========================================================================
   INTERACTIVE KPI CARDS & UI CUSTOMIZER STYLING
   ========================================================================== */
.kpi-card-interactive {
    cursor: pointer !important;
    position: relative;
    border: 1px solid var(--border-color);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-window);
}
.kpi-card-interactive:hover {
    transform: translateY(-3px) !important;
    border-color: #0078d7 !important;
    box-shadow: 0 8px 20px rgba(0, 120, 215, 0.15) !important;
    background: #fdfdfd;
}
[data-theme="dark"] .kpi-card-interactive:hover {
    background: #202c38 !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4) !important;
}
.kpi-action-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0,0,0,0.04);
    color: var(--text-muted);
    font-size: 11px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.kpi-card-interactive:hover .kpi-action-arrow {
    background: #0078d7;
    color: #ffffff;
    transform: translateX(-3px);
}

.customizer-box {
    background: var(--bg-window);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.customizer-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.widget-config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.15s ease;
}
.widget-config-item:hover {
    background: #eef2f5;
}
[data-theme="dark"] .widget-config-item:hover {
    background: #263342;
}
.quick-action-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-window);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12.5px;
    color: var(--text-main);
    transition: all 0.15s ease;
    text-decoration: none;
}
.quick-action-card:hover {
    transform: translateY(-2px);
    border-color: #0078d7;
    background: #f0f7ff;
    color: #0078d7;
    box-shadow: 0 4px 12px rgba(0, 120, 215, 0.1);
}
[data-theme="dark"] .quick-action-card:hover {
    background: #1e3a5f;
    border-color: #38bdf8;
    color: #38bdf8;
}

/* Visual voucher template designer */
.designer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 15px;
    height: min(520px, calc(96dvh - 220px));
    min-height: 360px;
}
.designer-canvas-area {
    min-width: 0;
    min-height: 0;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    position: relative;
    background: #2b3a4a;
    border-radius: 6px;
    -webkit-overflow-scrolling: touch;
}
.designer-card-canvas {
    flex: 0 0 auto;
    width: 480px;
    position: relative;
    overflow: hidden;
    background-color: #fff;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 6px;
    box-shadow: 0 8px 25px rgba(0,0,0,.4);
    cursor: default;
    touch-action: none;
}
.designer-element {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 96%;
    padding: 2px 6px;
    overflow: hidden;
    border: 1px dashed rgba(0,120,215,.7);
    border-radius: 3px;
    background: rgba(255,255,255,.5);
    white-space: nowrap;
    cursor: move;
    user-select: none;
    touch-action: none;
}
.designer-element:hover {
    border-color: #0078d7;
    background: rgba(255,255,255,.82);
}
.designer-element.active {
    z-index: 10;
    border: 1.5px solid #0078d7 !important;
    background: rgba(255,255,255,.94);
    box-shadow: 0 0 0 2px rgba(0,120,215,.4);
}
.designer-props-panel {
    width: 280px;
    min-width: 0;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
    background: var(--bg-window);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    scrollbar-gutter: stable;
}

@media (max-width: 820px) {
    .designer-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
    }
    .designer-canvas-area {
        min-height: 300px;
        padding: 10px;
        justify-content: flex-start;
    }
    .designer-props-panel {
        width: 100%;
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 520px) {
    .designer-canvas-area {
        min-height: 255px;
    }
    .designer-card-canvas {
        transform-origin: center center;
    }
    .designer-props-panel {
        padding: 10px;
    }
}

.print-sheet-custom-controls {
    display: flex;
    align-items: end;
    gap: 6px;
    padding: 4px 7px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.print-sheet-custom-controls[hidden] { display: none !important; }
.print-sheet-custom-controls label {
    display: grid;
    gap: 2px;
    font-size: 10px;
    font-weight: 700;
}
.print-sheet-custom-controls input {
    width: 68px;
    padding: 4px;
    text-align: center;
}

#print-mount-point { display: none; }

@media print {
    @page { size: A4 portrait; margin: 0; }
    html, body {
        width: 210mm !important;
        min-width: 210mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }
    body > * { display: none !important; }
    body > #print-mount-point {
        display: block !important;
        position: static !important;
        width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }
    #print-mount-point .pdf-a4-page {
        display: block !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;
        break-after: page !important;
        page-break-after: always !important;
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
    #print-mount-point .pdf-a4-page:last-child {
        break-after: auto !important;
        page-break-after: auto !important;
    }
}
