:root {
    --bg: #07101c;
    --bg-soft: #0b1624;
    --sidebar: #08121f;
    --card: #0d1a29;
    --card-soft: #101f30;

    --line: rgba(148, 163, 184, .12);

    --text: #f4f8fc;
    --muted: #91a1b5;

    --primary: #3b82f6;
    --primary-2: #2563eb;
    --primary-soft: rgba(59, 130, 246, .12);

    --success: #34A853;
    --success-soft: rgba(52, 168, 83, .12);

    --danger: #D93025;
    --danger-soft: rgba(217, 48, 37, .12);

    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, .12);

    --shadow: 0 20px 60px rgba(0, 0, 0, .25);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

body {
    overflow-x: hidden;
}


/* =====================================================
   BACKGROUND
   ===================================================== */

.bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;

    background:
        radial-gradient(
            circle at 20% 10%,
            rgba(59, 130, 246, .12),
            transparent 30%
        ),
        radial-gradient(
            circle at 85% 85%,
            rgba(59, 130, 246, .06),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #06101b,
            #081321 52%,
            #07101a
        );
}

.grid {
    position: absolute;
    inset: 0;

    background-image:
        linear-gradient(
            rgba(148, 163, 184, .035) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(148, 163, 184, .035) 1px,
            transparent 1px
        );

    background-size: 56px 56px;

    opacity: .5;
}


/* =====================================================
   GLOBAL
   ===================================================== */

.hidden {
    display: none !important;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.input,
.select,
.textarea {
    width: 100%;

    border: 1px solid var(--line);
    outline: none;

    background: rgba(3, 10, 18, .72);
    color: var(--text);

    border-radius: var(--radius-md);

    padding: 12px 14px;

    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

.input::placeholder,
.textarea::placeholder {
    color: #64748b;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: rgba(59, 130, 246, .55);

    box-shadow:
        0 0 0 3px rgba(59, 130, 246, .08);

    transform: translateY(-1px);
}

.textarea {
    min-height: 120px;
    resize: vertical;
}

.label {
    display: block;

    margin-bottom: 7px;

    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.required {
    color: var(--danger);
}

.hint {
    margin-top: 6px;

    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
}


/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
    border: 0;

    border-radius: var(--radius-md);

    padding: 12px 16px;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary-2)
        );

    box-shadow:
        0 10px 28px rgba(37, 99, 235, .20);

    font-weight: 750;

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        filter .18s ease;
}

.btn:hover {
    transform: translateY(-1px);

    box-shadow:
        0 14px 32px rgba(37, 99, 235, .28);

    filter: brightness(1.04);
}

.small-btn {
    border: 1px solid var(--line);

    border-radius: 11px;

    padding: 8px 11px;

    color: var(--text);

    background:
        rgba(255, 255, 255, .035);

    transition:
        background .18s ease,
        border-color .18s ease,
        transform .18s ease;
}

.small-btn:hover {
    background:
        rgba(59, 130, 246, .08);

    border-color:
        rgba(59, 130, 246, .22);

    transform: translateY(-1px);
}


/* =====================================================
   BRAND
   ===================================================== */

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-mark {
    position: relative;

    width: 42px;
    height: 42px;

    border-radius: 13px;

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #2563eb
        );

    box-shadow:
        0 10px 26px rgba(37, 99, 235, .25);
}

.brand-mark::before {
    content: "";

    position: absolute;

    width: 15px;
    height: 15px;

    top: 13px;
    left: 13px;

    border-radius: 50%;

    border: 2px solid rgba(255,255,255,.92);
}

.brand-name {
    font-size: 18px;
    font-weight: 850;
}

.brand-sub {
    margin-top: 2px;

    color: var(--muted);

    font-size: 10px;
}


/* =====================================================
   LOGIN
   ===================================================== */

.center {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: 24px;
}

.login-card {
    width: min(430px, 100%);

    padding: 30px;

    border:
        1px solid var(--line);

    border-radius:
        var(--radius-xl);

    background:
        rgba(10, 22, 36, .90);

    box-shadow:
        var(--shadow);

    backdrop-filter:
        blur(18px);
}

.form {
    display: grid;
    gap: 14px;
}

.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.remember {
    display: flex;
    align-items: center;
    gap: 7px;

    color: var(--muted);

    font-size: 12px;
}

.lang {
    border: 0;

    color: var(--muted);

    background: transparent;

    border-radius: 9px;

    padding: 6px 8px;

    font-size: 11px;
}

.lang:hover,
.lang.active {
    color: var(--text);

    background:
        rgba(255, 255, 255, .05);
}

.stores {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 8px;

    margin-top: 18px;
}

.store {
    padding: 10px;

    text-align: center;

    color: var(--muted);

    border:
        1px solid var(--line);

    border-radius: 12px;

    background:
        rgba(255,255,255,.025);

    font-size: 11px;
}

.languages {
    display: flex;

    justify-content: center;

    gap: 5px;

    flex-wrap: wrap;

    margin-top: 16px;
}


/* =====================================================
   MAIN APPLICATION SHELL
   ===================================================== */

.app-shell {
    min-height: 100vh;

    display: grid;

    grid-template-columns:
        250px minmax(0, 1fr);
}


/* =====================================================
   SIDEBAR
   ===================================================== */

.sidebar {
    position: sticky;
    top: 0;

    height: 100vh;

    display: flex;
    flex-direction: column;

    background:
        rgba(7, 17, 29, .96);

    border-right:
        1px solid var(--line);

    backdrop-filter:
        blur(18px);
}

html[dir="rtl"] .sidebar {
    border-right: 0;

    border-left:
        1px solid var(--line);
}

.side-head {
    padding: 18px;

    border-bottom:
        1px solid var(--line);
}

.side-list {
    flex: 1;

    padding: 12px;

    overflow: auto;
}

.nav {
    display: grid;
    gap: 5px;

    padding-top: 14px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;

    width: 100%;

    padding: 11px 12px;

    border: 1px solid transparent;

    border-radius: 12px;

    color: var(--muted);

    background: transparent;

    text-align: start;

    font-size: 13px;

    transition:
        background .18s ease,
        color .18s ease,
        border-color .18s ease;
}

.nav-item:hover {
    color: var(--text);

    background:
        rgba(59, 130, 246, .06);
}

.nav-item.active {
    color: #fff;

    background:
        rgba(59, 130, 246, .12);

    border-color:
        rgba(59, 130, 246, .20);
}

.nav-icon {
    width: 18px;

    text-align: center;

    opacity: .9;
}


/* =====================================================
   SIDEBAR ACCOUNT
   ===================================================== */

.sidebar-account {
    margin: 12px;

    padding: 12px;

    border:
        1px solid var(--line);

    border-radius:
        var(--radius-md);

    background:
        rgba(255,255,255,.025);
}

.sidebar-account-label {
    color: var(--muted);

    font-size: 10px;

    margin-bottom: 5px;
}

.sidebar-account-name {
    font-size: 12px;
    font-weight: 750;
}

.sidebar-account-id {
    color: var(--muted);

    font-size: 9px;

    margin-top: 4px;

    overflow: hidden;
    text-overflow: ellipsis;
}


/* =====================================================
   CONTENT
   ===================================================== */

.content {
    min-width: 0;

    background:
        linear-gradient(
            180deg,
            #081321,
            #07111d
        );
}


/* =====================================================
   TOPBAR
   ===================================================== */

.top {
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    padding: 0 22px;

    border-bottom:
        1px solid var(--line);

    background:
        rgba(7, 17, 29, .84);

    backdrop-filter:
        blur(16px);

    position: sticky;
    top: 0;
    z-index: 10;
}

.top-left {
    min-width: 0;
}

.top-title {
    font-size: 16px;
    font-weight: 800;
}

.top-subtitle {
    margin-top: 2px;

    color: var(--muted);

    font-size: 10px;
}

.top-actions {
    display: flex;

    align-items: center;

    gap: 7px;
}


/* =====================================================
   PAGE
   ===================================================== */

.page {
    padding: 22px;

    max-width: 1500px;

    margin: 0 auto;
}

.page-header {
    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 15px;

    margin-bottom: 18px;
}

.page-title {
    font-size: 24px;

    font-weight: 850;
}

.page-description {
    margin-top: 5px;

    color: var(--muted);

    font-size: 12px;
}


/* =====================================================
   CARDS
   ===================================================== */

.card {
    border:
        1px solid var(--line);

    border-radius:
        var(--radius-lg);

    background:
        rgba(13, 26, 41, .86);

    box-shadow:
        0 12px 35px rgba(0, 0, 0, .14);
}

.card-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    padding: 16px 18px;

    border-bottom:
        1px solid var(--line);
}

.card-title {
    font-size: 14px;

    font-weight: 800;
}

.card-body {
    padding: 18px;
}


/* =====================================================
   STATS
   ===================================================== */

.stats {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;

    margin-bottom: 16px;
}

.stat {
    padding: 15px;

    border:
        1px solid var(--line);

    border-radius:
        var(--radius-md);

    background:
        rgba(255,255,255,.025);
}

.stat-label {
    color: var(--muted);

    font-size: 11px;
}

.stat-value {
    margin-top: 7px;

    font-size: 21px;

    font-weight: 850;
}

.stat.success .stat-value {
    color: var(--success);
}

.stat.danger .stat-value {
    color: var(--danger);
}

.stat.primary .stat-value {
    color: var(--primary);
}


/* =====================================================
   TABLE
   ===================================================== */

.table-wrap {
    overflow: auto;
}

.table {
    width: 100%;

    border-collapse: collapse;

    min-width: 720px;
}

.table th {
    color: var(--muted);

    font-size: 10px;
    font-weight: 650;

    text-align: start;

    padding:
        11px 12px;

    border-bottom:
        1px solid var(--line);
}

.table td {
    padding:
        13px 12px;

    border-bottom:
        1px solid rgba(148,163,184,.07);

    font-size: 12px;
}

.table tr:hover td {
    background:
        rgba(59,130,246,.025);
}


/* =====================================================
   STATUS
   ===================================================== */

.status {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    border-radius: 999px;

    padding: 5px 9px;

    font-size: 10px;
}

.status::before {
    content: "";

    width: 7px;
    height: 7px;

    border-radius: 50%;
}

.status.online {
    color: #b8f3c8;

    background:
        var(--success-soft);
}

.status.online::before {
    background:
        var(--success);
}

.status.offline {
    color: #aeb9c7;

    background:
        rgba(148,163,184,.08);
}

.status.offline::before {
    background:
        #64748b;
}

.status.error {
    color: #ffb5ae;

    background:
        var(--danger-soft);
}

.status.error::before {
    background:
        var(--danger);
}

.status.warning {
    color: #ffd48b;

    background:
        var(--warning-soft);
}

.status.warning::before {
    background:
        var(--warning);
}


/* =====================================================
   TOOLBAR
   ===================================================== */

.toolbar {
    display: flex;

    align-items: center;

    gap: 8px;

    flex-wrap: wrap;

    margin-bottom: 14px;
}

.toolbar-search {
    flex: 1;

    min-width: 220px;
}


/* =====================================================
   GRID
   ===================================================== */

.grid2 {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 13px;
}

.grid3 {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 13px;
}

.grid4 {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 13px;
}


/* =====================================================
   DRAWER / FORM
   ===================================================== */

.drawer {
    margin-top: 16px;

    padding: 18px;

    border:
        1px solid var(--line);

    border-radius:
        var(--radius-lg);

    background:
        rgba(13, 26, 41, .88);
}

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 13px;
}

.full {
    grid-column:
        1 / -1;
}

.action-row {
    display: flex;

    align-items: center;

    gap: 8px;

    flex-wrap: wrap;

    margin-top: 14px;
}

.result {
    margin-top: 14px;

    padding: 13px;

    border:
        1px solid var(--line);

    border-radius:
        var(--radius-md);

    background:
        rgba(0,0,0,.18);

    color: #dbeafe;

    white-space: pre-wrap;

    overflow: auto;

    max-height: 320px;

    font-family:
        ui-monospace,
        SFMono-Regular,
        Consolas,
        monospace;

    font-size: 11px;
}


/* =====================================================
   DEVICE LIST
   ===================================================== */

.device-list {
    display: flex;

    flex-direction: column;

    gap: 7px;
}

.device {
    padding: 13px;

    border:
        1px solid transparent;

    border-radius:
        var(--radius-md);

    background:
        rgba(255,255,255,.022);

    transition:
        background .18s ease,
        border-color .18s ease,
        transform .18s ease;

    cursor: pointer;
}

.device:hover {
    background:
        rgba(59,130,246,.045);

    border-color:
        rgba(59,130,246,.12);

    transform: translateY(-1px);
}

.device.active {
    background:
        rgba(59,130,246,.10);

    border-color:
        rgba(59,130,246,.28);
}

.device-top {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;
}

.device-name {
    font-size: 13px;

    font-weight: 750;
}

.device-meta {
    margin-top: 4px;

    color: var(--muted);

    font-size: 10px;
}


/* =====================================================
   DEVICE DETAIL
   ===================================================== */

.detail-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 8px;
}

.detail-item {
    padding: 11px;

    border:
        1px solid var(--line);

    border-radius:
        12px;

    background:
        rgba(255,255,255,.025);
}

.detail-label {
    color: var(--muted);

    font-size: 9px;
}

.detail-value {
    margin-top: 4px;

    font-size: 12px;

    word-break: break-word;
}

.empty {
    padding: 45px 20px;

    text-align: center;

    color: var(--muted);

    border:
        1px dashed rgba(148,163,184,.14);

    border-radius:
        var(--radius-lg);
}


/* =====================================================
   MAP
   ===================================================== */

.map-area {
    position: relative;

    min-height:
        calc(100vh - 70px);

    overflow: hidden;

    background:
        #0a1725;
}

.map-grid {
    position: absolute;
    inset: 0;

    background-image:
        linear-gradient(
            rgba(148,163,184,.04) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(148,163,184,.04) 1px,
            transparent 1px
        );

    background-size: 55px 55px;
}

.map-tools {
    position: absolute;

    top: 18px;

    inset-inline-end: 18px;

    display: grid;

    gap: 7px;
}

.tool {
    width: 40px;
    height: 40px;

    border:
        1px solid var(--line);

    border-radius:
        12px;

    color: var(--text);

    background:
        rgba(8, 20, 34, .84);

    backdrop-filter:
        blur(12px);
}

.marker {
    position: absolute;

    width: 17px;
    height: 17px;

    border-radius: 50%;

    background:
        var(--primary);

    border:
        4px solid rgba(255,255,255,.85);

    box-shadow:
        0 0 0 9px rgba(59,130,246,.10),
        0 0 22px rgba(59,130,246,.42);

    transform:
        translate(-50%, -50%);
}


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

@media (max-width: 1100px) {

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

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

}

@media (max-width: 900px) {

    .app-shell {
        grid-template-columns:
            1fr;
    }

    .sidebar {
        position: static;

        height: auto;

        border-left: 0 !important;
        border-right: 0 !important;

        border-bottom:
            1px solid var(--line);
    }

    .side-list {
        padding-bottom: 15px;
    }

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

    .nav-item {
        justify-content: center;
    }

}

@media (max-width: 700px) {

    .page {
        padding: 15px;
    }

    .top {
        padding: 0 15px;
    }

    .page-header {
        flex-direction: column;
    }

    .grid3,
    .grid2,
    .grid4,
    .form-grid,
    .detail-grid {
        grid-template-columns:
            1fr;
    }

    .full {
        grid-column: auto;
    }

    .stats {
        grid-template-columns:
            1fr 1fr;
    }

    .stores {
        grid-template-columns:
            1fr;
    }

}

@media (max-width: 480px) {

    .stats {
        grid-template-columns:
            1fr;
    }

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

}