﻿:root {
    --bg: #f5f7fb;
    --bg2: #eef2ff;
    --surface: rgba(255,255,255,.82);
    --surface2: rgba(255,255,255,.96);
    --text: #0f172a;
    --muted: #64748b;
    --brand: #4f46e5;
    --brand2: #0ea5e9;
    --success: #16a34a;
    --danger: #dc2626;
    --warn: #d97706;
    --info: #0284c7;
    --r: 18px;
    --shadow: 0 18px 45px rgba(15,23,42,.08);
    --shadow2: 0 10px 24px rgba(15,23,42,.06);
    --border: 1px solid rgba(15,23,42,.08);
    --blur: blur(14px);
    --gap: 16px;
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Tahoma, Arial;
}

/* base */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    background:
        radial-gradient(900px 500px at 10% 0%, rgba(79,70,229,.10), transparent 60%),
        radial-gradient(700px 420px at 100% 0%, rgba(14,165,233,.10), transparent 50%),
        linear-gradient(180deg, var(--bg), var(--bg2));
    color: var(--text);
    direction: rtl;
    background-attachment: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

::selection {
    background: rgba(79,70,229,.18);
}

/* layout */
.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 290px 1fr;
}

@media (max-width: 992px) {
    .app {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px;
    border-inline-end: var(--border);
    background: rgba(255,255,255,.66);
    backdrop-filter: var(--blur);
}

@media (max-width: 992px) {
    .sidebar {
        display: none;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: var(--border);
    border-radius: var(--r);
    background: var(--surface2);
    box-shadow: var(--shadow2);
}

.brand .logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    box-shadow: 0 10px 25px rgba(79,70,229,.18);
}

.brand h1 {
    font-size: 16px;
    margin: 0;
    color: var(--text);
}

.brand p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.nav {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 14px;
    border: var(--border);
    background: rgba(255,255,255,.50);
    color: var(--text);
    transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.nav a:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,.96);
    border-color: rgba(79,70,229,.18);
    box-shadow: var(--shadow2);
}

.nav a.active,
.nav a[aria-current="page"] {
    background: linear-gradient(135deg, rgba(79,70,229,.10), rgba(14,165,233,.08));
    border-color: rgba(79,70,229,.22);
    color: #312e81;
}

.main {
    padding: 18px 18px 90px;
}

@media (min-width: 993px) {
    .main {
        padding: 22px 26px;
    }
}

/* topbar (mobile) */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: none;
    padding: 14px;
    margin-bottom: 14px;
    border-radius: var(--r);
    border: var(--border);
    background: rgba(255,255,255,.78);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow2);
}

@media (max-width: 992px) {
    .topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
}

/* bottom nav (mobile) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 14px;
    inset-inline: 14px;
    padding: 10px;
    border-radius: 22px;
    border: var(--border);
    background: rgba(255,255,255,.86);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow);
    z-index: 50;
}

.bottom-nav .row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 16px;
    transition: transform .18s ease, background .18s ease;
    color: var(--muted);
}

.bottom-nav a.active {
    color: var(--brand);
    background: rgba(79,70,229,.10);
}

.bottom-nav a:hover {
    transform: translateY(-2px);
}

.bottom-nav small {
    font-size: 11px;
}

@media (max-width: 992px) {
    .bottom-nav {
        display: block;
    }
}

/* cards */
.cardx {
    border: var(--border);
    background: var(--surface);
    backdrop-filter: var(--blur);
    border-radius: var(--r);
    box-shadow: var(--shadow2);
}

.cardx .hd {
    padding: 16px 16px 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.cardx .hd h2 {
    margin: 0;
    font-size: 17px;
    color: var(--text);
}

.cardx .hd p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.cardx .bd {
    padding: 14px 16px 16px;
}

/* grid */
.grid {
    display: grid;
    gap: var(--gap);
}

.grid.cols-2 {
    grid-template-columns: 1fr 1fr;
}

.grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 992px) {
    .grid.cols-2,
    .grid.cols-3 {
        grid-template-columns: 1fr;
    }
}

/* buttons */
.btnx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: var(--border);
    background: rgba(255,255,255,.95);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.btnx:hover {
    transform: translateY(-2px);
    background: #fff;
    box-shadow: var(--shadow2);
}

.btnx:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btnx.primary {
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    border: 0;
    color: #fff;
    box-shadow: 0 14px 30px rgba(79,70,229,.18);
}

.btnx.primary:hover {
    filter: brightness(1.02);
}

.btnx.danger {
    background: rgba(220,38,38,.08);
    color: #991b1b;
    border-color: rgba(220,38,38,.18);
}

.btnx.ghost {
    background: transparent;
}

.btnx.success {
    background: rgba(22,163,74,.10);
    color: #166534;
    border-color: rgba(22,163,74,.18);
}

/* inputs */
.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.inputx, .selectx, .textareax {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: var(--border);
    background: rgba(255,255,255,.96);
    color: var(--text);
    outline: none;
    transition: border-color .18s ease, transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.inputx:focus, .selectx:focus, .textareax:focus {
    border-color: rgba(79,70,229,.30);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79,70,229,.10);
}

.help {
    font-size: 12px;
    color: var(--muted);
}

select option {
    background-color: #ffffff;
    color: var(--text);
}

/* table */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.tablex {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.tablex th {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
    text-align: right;
    padding: 0 12px;
    white-space: nowrap;
}

.tablex td {
    padding: 14px 12px;
    background: rgba(255,255,255,.92);
    border-top: 1px solid rgba(15,23,42,.05);
    border-bottom: 1px solid rgba(15,23,42,.05);
}

.tablex tr td:first-child {
    border-radius: 14px 0 0 14px;
    border-inline-start: 1px solid rgba(15,23,42,.05);
}

.tablex tr td:last-child {
    border-radius: 0 14px 14px 0;
    border-inline-end: 1px solid rgba(15,23,42,.05);
}

.tablex tr {
    transition: transform .18s ease;
}

.tablex tr:hover {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .tablex, .tablex thead {
        display: none;
    }

    .table-cards {
        display: grid;
        gap: 12px;
    }

    .rowcard {
        border: var(--border);
        background: rgba(255,255,255,.90);
        border-radius: var(--r);
        padding: 14px;
        box-shadow: var(--shadow2);
    }

    .rowcard .k {
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }

    .rowcard .v {
        margin-top: 4px;
    }
}

/* badges */
.badgex {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,.08);
    font-size: 12px;
    font-weight: 700;
    background: rgba(255,255,255,.88);
    color: var(--text);
}

.badgex.success {
    background: rgba(22,163,74,.10);
    color: #166534;
    border-color: rgba(22,163,74,.16);
}

.badgex.danger {
    background: rgba(220,38,38,.10);
    color: #991b1b;
    border-color: rgba(220,38,38,.16);
}

.badgex.info {
    background: rgba(2,132,199,.10);
    color: #075985;
    border-color: rgba(2,132,199,.16);
}

.badgex.warn {
    background: rgba(217,119,6,.12);
    color: #92400e;
    border-color: rgba(217,119,6,.16);
}

.badgex.brand {
    background: rgba(79,70,229,.10);
    color: #4338ca;
    border-color: rgba(79,70,229,.16);
}

/* toast */
.toastx {
    position: fixed;
    top: 16px;
    inset-inline: 16px;
    max-width: 520px;
    margin-inline: auto;
    z-index: 60;
    display: none;
    border-radius: 16px;
    border: var(--border);
    background: rgba(255,255,255,.96);
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow);
    padding: 12px 14px;
}

.toastx.show {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    animation: toastIn .28s ease both;
}

@keyframes toastIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* page transitions */
.page {
    animation: pageIn .28s ease both;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 992px) {
    .grid.cols-4 {
        grid-template-columns: 1fr;
    }
}
/* misc */
.notif-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-size: 20px;
}
.noti-container{
    position: relative;
}
.notif-badge {
    position: absolute;
    top: 6px;
    right: -10px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 7px;
    border-radius: 50px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
    animation: notifPulse 1.8s infinite;
}

@keyframes notifPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.mobile-nav-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: 100%;
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.mobile-nav-btn small {
    font-size: 12px;
    color: inherit;
}

.mobile-only {
    display: none;
}

.icon-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: rgba(255,255,255,.85);
    color: inherit;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    box-shadow: var(--shadow2);
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: .25s ease;
    z-index: 70;
}

.mobile-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(88vw, 360px);
    height: 100vh;
    background: #ffffff;
    color: var(--text);
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 80;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(15,23,42,.12);
    border-left: 1px solid rgba(15,23,42,.08);
}

.mobile-drawer.show {
    transform: translateX(0);
}

.mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(15,23,42,.08);
}

.mobile-drawer-body {
    padding: 14px;
    overflow-y: auto;
    flex: 1;
}

.mobile-nav-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 12px;
}

.mobile-nav-list a.active,
.mobile-nav-list a[aria-current="page"] {
    background: rgba(79,70,229,.08);
    color: var(--brand);
}

@media (max-width: 991.98px) {
    .mobile-only {
        display: inline-flex;
    }

    .sidebar {
        display: none;
    }
}

@media (min-width: 992px) {
    .mobile-drawer,
    .mobile-overlay {
        display: none !important;
    }
}

.field .btnx {
    width: 100%;
}

td, .v, .help {
    word-break: break-word;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

.pwa-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pwa-modal-backdrop.show {
    display: flex;
}

.pwa-modal {
    width: min(420px, 100%);
    background: #ffffff;
    border-radius: 24px;
    padding: 28px 24px;
    text-align: center;

    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);

    animation: pwaModalIn 0.25s ease both;
}

.pwa-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;

    border-radius: 22px;
    display: grid;
    place-items: center;

    font-size: 34px;
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #0ea5e9);
    box-shadow: 0 16px 34px rgba(79, 70, 229, 0.28);
}

.pwa-modal h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}

.pwa-modal p {
    margin: 12px 0 24px;
    color: #64748b;
    line-height: 1.8;
    font-size: 15px;
}

.pwa-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@keyframes pwaModalIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 480px) {
    .pwa-modal {
        padding: 24px 18px;
        border-radius: 20px;
    }

    .pwa-actions {
        grid-template-columns: 1fr;
    }
}