:root {
    --bg: #06101d;
    --bg-elevated: #0a1728;
    --surface: rgba(13, 29, 49, 0.88);
    --surface-strong: #0e1e32;
    --surface-soft: rgba(18, 38, 62, 0.62);
    --border: rgba(148, 174, 209, 0.14);
    --border-strong: rgba(136, 115, 255, 0.38);
    --text: #f4f7ff;
    --muted: #93a5bd;
    --muted-strong: #bac6d6;
    --purple: #8c6cff;
    --purple-strong: #7352f6;
    --cyan: #2dd4c6;
    --blue: #52a8ff;
    --green: #43d99c;
    --amber: #f5bd5c;
    --red: #ff6d83;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 11px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 85% -10%, rgba(140, 108, 255, 0.19), transparent 38%),
        radial-gradient(circle at 5% 35%, rgba(45, 212, 198, 0.09), transparent 34%),
        linear-gradient(150deg, #071321 0%, #050b14 78%);
    font-family: Vazirmatn, "Segoe UI", Tahoma, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

button {
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.boot-screen,
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.boot-screen {
    align-content: center;
    gap: 18px;
    color: var(--muted);
}

.brand-mark {
    width: 58px;
    height: 58px;
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 19px;
    background: linear-gradient(145deg, rgba(140, 108, 255, 0.24), rgba(45, 212, 198, 0.12));
    border: 1px solid rgba(140, 108, 255, 0.36);
    box-shadow: 0 16px 45px rgba(98, 72, 234, 0.24);
}

.brand-mark span {
    position: absolute;
    border: 3px solid var(--purple);
    border-left-color: transparent;
    border-radius: 999px;
}

.brand-mark span:nth-child(1) {
    width: 34px;
    height: 34px;
}

.brand-mark span:nth-child(2) {
    width: 22px;
    height: 22px;
    border-color: var(--cyan);
    border-bottom-color: transparent;
}

.brand-mark span:nth-child(3) {
    width: 7px;
    height: 7px;
    border: 0;
    background: #fff;
    box-shadow: 0 0 18px var(--cyan);
}

.auth-shell {
    width: min(1080px, 100%);
    min-height: 660px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    overflow: hidden;
    background: rgba(7, 18, 31, 0.84);
    border: 1px solid var(--border);
    border-radius: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.auth-visual {
    position: relative;
    padding: 54px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(18, 29, 58, 0.95), rgba(7, 20, 35, 0.95)),
        #0a1424;
}

.auth-visual::before,
.auth-visual::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
}

.auth-visual::before {
    width: 420px;
    height: 420px;
    inset: -180px auto auto -100px;
    background: radial-gradient(circle, rgba(140, 108, 255, 0.36), transparent 68%);
}

.auth-visual::after {
    width: 360px;
    height: 360px;
    inset: auto -130px -160px auto;
    background: radial-gradient(circle, rgba(45, 212, 198, 0.2), transparent 68%);
}

.auth-visual > * {
    position: relative;
    z-index: 1;
}

.wordmark {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.8px;
}

.wordmark em {
    color: var(--cyan);
    font-style: normal;
}

.auth-copy h1 {
    max-width: 520px;
    margin: 0 0 20px;
    font-size: clamp(34px, 4vw, 56px);
    line-height: 1.3;
    letter-spacing: -2px;
}

.auth-copy h1 span {
    background: linear-gradient(90deg, var(--purple), var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-copy p {
    max-width: 520px;
    margin: 0;
    color: var(--muted-strong);
    font-size: 16px;
    line-height: 2;
}

.auth-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-features span {
    padding: 9px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--border);
    color: var(--muted-strong);
    font-size: 13px;
}

.auth-form-wrap {
    display: grid;
    place-items: center;
    padding: 48px;
    background: rgba(5, 13, 24, 0.72);
}

.auth-form {
    width: min(380px, 100%);
}

.auth-form h2 {
    margin: 0 0 9px;
    font-size: 27px;
    letter-spacing: -0.7px;
}

.auth-form > p {
    margin: 0 0 30px;
    color: var(--muted);
    line-height: 1.8;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field label {
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 650;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 50px;
    padding: 0 15px;
    color: var(--text);
    background: rgba(9, 22, 38, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: 160ms ease;
}

.textarea {
    min-height: 92px;
    padding-block: 13px;
    resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(140, 108, 255, 0.1);
}

.input[dir="ltr"] {
    text-align: left;
}

.input::placeholder,
.textarea::placeholder {
    color: #64758d;
}

.btn {
    min-height: 44px;
    padding: 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 750;
    transition: 160ms ease;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}

.btn-primary {
    color: white;
    background: linear-gradient(110deg, var(--purple-strong), #8c6cff);
    box-shadow: 0 12px 28px rgba(115, 82, 246, 0.28);
}

.btn-secondary {
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.btn-ghost {
    color: var(--muted-strong);
    background: transparent;
    border: 1px solid var(--border);
}

.btn-danger {
    color: #ffdce3;
    background: rgba(255, 109, 131, 0.12);
    border: 1px solid rgba(255, 109, 131, 0.25);
}

.btn-block {
    width: 100%;
}

.auth-note {
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.9;
    text-align: center;
}

.error-box,
.info-box {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.8;
}

.error-box {
    color: #ffd7df;
    background: rgba(255, 109, 131, 0.1);
    border: 1px solid rgba(255, 109, 131, 0.22);
}

.info-box {
    color: #cbe9ff;
    background: rgba(82, 168, 255, 0.09);
    border: 1px solid rgba(82, 168, 255, 0.2);
}

.panel-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    background: rgba(5, 14, 25, 0.92);
    border-left: 1px solid var(--border);
    backdrop-filter: blur(22px);
    z-index: 20;
}

.sidebar .wordmark {
    padding: 5px 10px 27px;
    font-size: 21px;
}

.nav-label {
    margin: 12px 12px 8px;
    color: #63758e;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.6px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav-button {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 13px;
    cursor: pointer;
    text-align: right;
    transition: 150ms ease;
}

.nav-button:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.035);
}

.nav-button.active {
    color: white;
    background: linear-gradient(95deg, rgba(115, 82, 246, 0.22), rgba(45, 212, 198, 0.07));
    border-color: rgba(140, 108, 255, 0.25);
}

.nav-icon {
    width: 21px;
    text-align: center;
    color: var(--cyan);
    font-size: 18px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
}

.user-chip {
    padding: 13px;
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    border-radius: 15px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--purple-strong), #4e9dea);
    font-weight: 900;
}

.user-chip strong,
.user-chip span,
.user-chip small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip strong {
    font-size: 13px;
}

.user-chip span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    direction: ltr;
    text-align: right;
}

.user-chip .user-role {
    margin-top: 3px;
    color: var(--cyan);
    font-size: 10px;
}

.main {
    min-width: 0;
    padding: 26px clamp(20px, 3vw, 44px) 60px;
}

.topbar {
    min-height: 62px;
    margin-bottom: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.page-title h1 {
    margin: 0;
    font-size: clamp(24px, 3vw, 32px);
    letter-spacing: -0.8px;
}

.page-title p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    gap: 9px;
}

.mobile-menu {
    display: none;
}

.grid {
    display: grid;
    gap: 18px;
}

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

.metric-card,
.card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(14, 31, 52, 0.9), rgba(9, 22, 38, 0.9));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.1);
}

.metric-card {
    padding: 20px;
}

.metric-card::after {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    inset: -40px auto auto -35px;
    border-radius: 50%;
    background: var(--metric-glow, rgba(140, 108, 255, 0.16));
    filter: blur(8px);
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
}

.metric-value {
    margin-top: 10px;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -1px;
}

.metric-hint {
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
}

.card {
    padding: 22px;
}

.card-header {
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.card-title {
    margin: 0;
    font-size: 17px;
}

.card-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.dashboard-grid {
    margin-top: 18px;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
}

.status-list,
.activity-list {
    display: grid;
    gap: 11px;
}

.status-row,
.activity-row {
    padding: 13px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(148, 174, 209, 0.08);
    border-radius: 12px;
}

.status-info strong,
.status-info span {
    display: block;
}

.status-info strong {
    font-size: 13px;
}

.status-info span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.badge {
    min-height: 27px;
    padding: 4px 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.badge-success {
    color: #a9f5d4;
    background: rgba(67, 217, 156, 0.12);
    border: 1px solid rgba(67, 217, 156, 0.2);
}

.badge-warning {
    color: #ffe0a4;
    background: rgba(245, 189, 92, 0.11);
    border: 1px solid rgba(245, 189, 92, 0.2);
}

.badge-danger {
    color: #ffd3da;
    background: rgba(255, 109, 131, 0.11);
    border: 1px solid rgba(255, 109, 131, 0.2);
}

.badge-muted {
    color: var(--muted-strong);
    background: rgba(148, 174, 209, 0.08);
    border: 1px solid var(--border);
}

.toolbar {
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.search-input {
    min-width: min(320px, 100%);
}

.product-section + .product-section {
    margin-top: 22px;
}

.product-header {
    margin-bottom: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-header h2 {
    margin: 0;
    font-size: 18px;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    gap: 12px;
}

.plan-card {
    padding: 16px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.plan-card.featured {
    border-color: rgba(140, 108, 255, 0.46);
    box-shadow: inset 0 0 0 1px rgba(140, 108, 255, 0.1);
}

.plan-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.plan-card h3 {
    margin: 0;
    font-size: 15px;
}

.price {
    margin: 18px 0 4px;
    font-size: 21px;
    font-weight: 900;
}

.price small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.plan-meta {
    margin-bottom: 15px;
    color: var(--muted);
    font-size: 11px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.table th,
.table td {
    padding: 14px 13px;
    text-align: right;
    border-bottom: 1px solid rgba(148, 174, 209, 0.09);
}

.table th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.table td {
    color: var(--muted-strong);
    font-size: 13px;
}

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

.table .primary-cell {
    color: var(--text);
    font-weight: 700;
}

.action-row {
    display: flex;
    gap: 7px;
}

.icon-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    display: inline-grid;
    place-items: center;
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
}

.empty-state {
    padding: 48px 20px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    display: block;
    margin-bottom: 8px;
    color: var(--muted-strong);
    font-size: 15px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    padding: 20px;
    display: grid;
    place-items: center;
    background: rgba(2, 7, 13, 0.72);
    backdrop-filter: blur(8px);
    z-index: 100;
}

.modal {
    width: min(600px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px;
    background: #0b192b;
    border: 1px solid var(--border-strong);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.modal-header {
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

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

.check-row {
    min-height: 48px;
    padding: 0 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: 11px;
}

.switch {
    width: 44px;
    height: 24px;
    position: relative;
    appearance: none;
    background: #26364b;
    border-radius: 999px;
    cursor: pointer;
    transition: 160ms ease;
}

.switch::after {
    content: "";
    width: 18px;
    height: 18px;
    position: absolute;
    top: 3px;
    right: 3px;
    border-radius: 50%;
    background: white;
    transition: 160ms ease;
}

.switch:checked {
    background: linear-gradient(90deg, var(--purple), var(--cyan));
}

.switch:checked::after {
    transform: translateX(-20px);
}

.modal-actions {
    margin-top: 22px;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}

.toast-root {
    position: fixed;
    left: 22px;
    bottom: 22px;
    z-index: 200;
    display: grid;
    gap: 9px;
}

.toast {
    min-width: 260px;
    max-width: 390px;
    padding: 13px 15px;
    color: var(--text);
    background: #11233a;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: toast-in 180ms ease-out;
}

.toast.error {
    border-color: rgba(255, 109, 131, 0.4);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.skeleton {
    min-height: 100px;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(255,255,255,.025), rgba(255,255,255,.06), rgba(255,255,255,.025));
    background-size: 220% 100%;
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    to { background-position-x: -220%; }
}

@media (max-width: 1180px) {
    .metrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .plan-grid {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }
}

@media (max-width: 860px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 300px;
        padding: 35px;
    }

    .auth-features {
        display: none;
    }

    .auth-form-wrap {
        padding: 35px 24px;
    }

    .panel-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 0 0 auto;
        width: min(290px, 86vw);
        transform: translateX(110%);
        transition: 180ms ease;
        border-left: 1px solid var(--border);
        box-shadow: var(--shadow);
    }

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

    .main {
        padding: 18px 16px 50px;
    }

    .mobile-menu {
        display: inline-flex;
    }

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

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

    .plan-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}

@media (max-width: 560px) {
    .auth-page {
        padding: 0;
    }

    .auth-shell {
        min-height: 100vh;
        border-radius: 0;
        border: 0;
    }

    .auth-visual {
        min-height: 245px;
        padding: 28px 22px;
    }

    .auth-copy h1 {
        font-size: 31px;
    }

    .auth-copy p {
        font-size: 13px;
    }

    .auth-form-wrap {
        align-items: start;
        padding: 30px 22px 42px;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar-actions .btn span {
        display: none;
    }

    .metrics-grid,
    .plan-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        padding: 17px;
    }

    .toolbar,
    .toolbar-group,
    .search-input {
        width: 100%;
    }

    .toolbar-group .btn {
        flex: 1;
    }

    .card {
        padding: 17px;
    }

    .modal {
        padding: 19px;
    }
}
