@font-face {
    font-family: "Yekan";
    src: url("../fonts/yekan.woff") format("woff"), url("../fonts/yekan.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand: #f28c1e;
    --brand-dark: #d9750a;
    --brand-soft: #fff3e6;
    --ink: #24262b;
    --ink-2: #4a4e57;
    --muted: #8a8f99;
    --line: #e7e9ee;
    --bg: #f4f5f8;
    --card: #ffffff;
    --success: #1f9d61;
    --success-soft: #e6f6ee;
    --danger: #d64545;
    --danger-soft: #fdecec;
    --warning: #c98a00;
    --warning-soft: #fff6dc;
    --info: #2a7bd4;
    --info-soft: #e8f1fc;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(20, 22, 30, .06), 0 4px 16px rgba(20, 22, 30, .05);
    --sidebar: 264px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Yekan", Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: var(--ink);
    background: var(--bg);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--info);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

img {
    max-width: 100%;
}

.ico {
    flex-shrink: 0;
    vertical-align: middle;
}

.ltr {
    direction: ltr;
    unicode-bidi: plaintext;
}

.muted {
    color: var(--muted);
}

.mono {
    font-family: Consolas, "Courier New", monospace;
    font-weight: 700;
    color: var(--ink-2);
    direction: ltr;
    unicode-bidi: plaintext;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar);
    background: #1f2126;
    color: #c9ccd3;
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

    .sidebar-brand img {
        height: 38px;
        width: auto;
        background: #fff;
        border-radius: 8px;
        padding: 4px 8px;
    }

.sidebar-close {
    display: none;
    background: none;
    border: 0;
    color: #c9ccd3;
    cursor: pointer;
    padding: 6px;
}

.nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px 24px;
}

    .nav a, .nav summary {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        border-radius: 9px;
        color: #c9ccd3;
        cursor: pointer;
        list-style: none;
        user-select: none;
    }

        .nav summary::-webkit-details-marker {
            display: none;
        }

        .nav summary::after {
            content: "";
            margin-right: auto;
            width: 7px;
            height: 7px;
            border-left: 2px solid currentColor;
            border-bottom: 2px solid currentColor;
            transform: rotate(-45deg);
            transition: transform .2s;
            opacity: .6;
        }

    .nav details[open] > summary::after {
        transform: rotate(135deg);
    }

    .nav a:hover, .nav summary:hover {
        background: rgba(255, 255, 255, .06);
        color: #fff;
        text-decoration: none;
    }

    .nav a.active {
        background: var(--brand);
        color: #fff;
    }

    .nav details {
        margin-bottom: 2px;
    }

        .nav details .sub {
            padding: 2px 30px 6px 0;
        }

            .nav details .sub a {
                padding: 6px 12px;
                font-size: 13px;
            }

                .nav details .sub a.active {
                    background: rgba(242, 140, 30, .16);
                    color: #ffb36b;
                }

    .nav .group-active > summary {
        color: #fff;
    }

.main {
    margin-right: var(--sidebar);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}

.menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px;
    cursor: pointer;
    color: var(--ink);
}

.topbar-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-user {
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .topbar-user .avatar {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--brand-soft);
    }

    .topbar-user .name {
        font-size: 13px;
        color: var(--ink-2);
    }

.content {
    padding: 24px;
    flex: 1;
    width: 100%;
}

.backdrop {
    display: none;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    margin-bottom: 20px;
}

.card-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

    .card-head h2 {
        font-size: 15px;
        margin: 0;
    }

    .card-head .actions {
        margin-right: auto;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

.card-body {
    padding: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 6px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--brand-dark);
    }

.btn-dark {
    background: var(--ink);
    color: #fff;
}

    .btn-dark:hover {
        background: #000;
    }

.btn-light {
    background: #fff;
    color: var(--ink);
    border-color: var(--line);
}

    .btn-light:hover {
        border-color: #cfd3db;
        background: #fafbfc;
    }

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    min-height: 32px;
    padding: 4px 12px;
    font-size: 12px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    padding: 0;
    text-decoration: none !important;
}

    .icon-btn:hover {
        border-color: #cfd3db;
        color: var(--ink);
    }

    .icon-btn.danger:hover {
        color: var(--danger);
        border-color: #f2c3c3;
        background: var(--danger-soft);
    }

    .icon-btn.on {
        color: var(--success);
        background: var(--success-soft);
        border-color: #c4ead6;
    }

    .icon-btn.off {
        color: var(--muted);
        background: #f3f4f6;
    }

    .icon-btn.star-on {
        color: #fff;
        background: var(--brand);
        border-color: var(--brand);
    }

        .icon-btn.star-on .ico {
            fill: currentColor;
        }

.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

    .row-actions form {
        display: inline;
        margin: 0;
    }

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-soft);
    color: #136b41;
    border-color: #c4ead6;
}

.alert-danger {
    background: var(--danger-soft);
    color: #9b2727;
    border-color: #f2c3c3;
}

.alert-info {
    background: var(--info-soft);
    color: #1b5aa0;
    border-color: #c9ddf6;
}

.alert-warning {
    background: var(--warning-soft);
    color: #7d5600;
    border-color: #f1dea5;
}

.badge {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 22px;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-soft);
    color: #136b41;
}

.badge-danger {
    background: var(--danger-soft);
    color: #9b2727;
}

.badge-warning {
    background: var(--warning-soft);
    color: #7d5600;
}

.badge-info {
    background: var(--info-soft);
    color: #1b5aa0;
}

.badge-muted {
    background: #eef0f3;
    color: var(--ink-2);
}

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search {
    position: relative;
    flex: 1;
    min-width: 220px;
}

    .search input {
        padding-left: 40px;
    }

    .search .ico {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--muted);
        pointer-events: none;
    }

label {
    display: block;
    font-size: 13px;
    color: var(--ink-2);
    margin-bottom: 6px;
}

.req::after {
    content: " *";
    color: var(--danger);
}

.input, select.input, textarea.input {
    width: 100%;
    min-height: 40px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #dadde3;
    border-radius: 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

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

.input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(242, 140, 30, .15);
}

.input-validation-error {
    border-color: var(--danger) !important;
}

.field-error, .field-validation-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.hint {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

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

.field-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

    .field-inline .input {
        flex: 1;
    }

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0 16px;
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
}

    .choice input {
        width: 17px;
        height: 17px;
        accent-color: var(--brand);
    }

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

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

    .table th, .table td {
        padding: 10px 12px;
        text-align: right;
        border-bottom: 1px solid var(--line);
        vertical-align: middle;
    }

    .table th {
        font-size: 12px;
        color: var(--muted);
        font-weight: normal;
        background: #fafbfc;
        white-space: nowrap;
    }

    .table tbody tr:hover {
        background: #fcfcfd;
    }

    .table tr.is-off td {
        color: var(--muted);
    }

    .table .thumb {
        width: 64px;
        height: 64px;
        object-fit: contain;
        border-radius: 8px;
        background: #f6f7f9;
        border: 1px solid var(--line);
    }

    .table .num {
        width: 56px;
        color: var(--muted);
    }

    .table .actions-col {
        width: 1%;
        white-space: nowrap;
    }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 36px 12px !important;
}

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px;
    flex-wrap: wrap;
}

    .pager a, .pager span {
        min-width: 34px;
        height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 8px;
        border-radius: 9px;
        border: 1px solid var(--line);
        background: #fff;
        color: var(--ink-2);
        text-decoration: none;
        font-size: 13px;
    }

    .pager .current {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff;
    }

    .pager .gap {
        border: 0;
        background: none;
    }

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--ink);
    text-decoration: none !important;
}

    .stat .ico-wrap {
        width: 46px;
        height: 46px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--brand-soft);
        color: var(--brand);
    }

    .stat .value, .stat .label {
        display: block;
    }

    .stat .value {
        font-size: 22px;
        font-weight: bold;
        line-height: 1.3;
    }

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

.quick {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

    .quick a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 18px;
        border-radius: var(--radius);
        color: #fff;
        font-size: 15px;
        text-decoration: none;
        box-shadow: var(--shadow);
        transition: transform .15s;
    }

        .quick a:hover {
            transform: translateY(-2px);
        }

.q1 {
    background: #1abc9c;
}

.q2 {
    background: #27ae60;
}

.q3 {
    background: #2f80ed;
}

.q4 {
    background: #8e44ad;
}

.q5 {
    background: #34495e;
}

.q6 {
    background: #e67e22;
}

.info-list {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
    margin: 0;
}

    .info-list dt {
        color: var(--muted);
    }

    .info-list dd {
        margin: 0;
        font-weight: bold;
    }

.totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

    .totals div {
        background: #fafbfc;
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: 12px 14px;
    }

    .totals span {
        display: block;
        font-size: 12px;
        color: var(--muted);
    }

    .totals strong {
        font-size: 18px;
    }

    .totals .grand {
        background: var(--brand-soft);
        border-color: #fbd6ad;
    }

.dropzone {
    border: 2px dashed #cdd2da;
    border-radius: var(--radius);
    padding: 30px 16px;
    text-align: center;
    color: var(--muted);
    background: #fafbfc;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

    .dropzone.drag {
        border-color: var(--brand);
        background: var(--brand-soft);
        color: var(--brand-dark);
    }

    .dropzone input[type=file] {
        display: none;
    }

.previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

    .previews img {
        width: 96px;
        height: 96px;
        object-fit: cover;
        border-radius: 10px;
        border: 1px solid var(--line);
    }

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

    .gallery .item {
        border: 1px solid var(--line);
        border-radius: var(--radius);
        overflow: hidden;
        background: #fff;
    }

        .gallery .item img {
            width: 100%;
            height: 150px;
            object-fit: contain;
            background: #f6f7f9;
            display: block;
        }

        .gallery .item.is-off img {
            opacity: .4;
        }

        .gallery .item .meta {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px 10px;
            font-size: 12px;
            color: var(--muted);
        }

.access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.access-group {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fafbfc;
}

    .access-group > .choice {
        font-weight: bold;
        margin-bottom: 4px;
    }

    .access-group .children {
        padding-right: 22px;
        display: flex;
        flex-direction: column;
    }

        .access-group .children .choice {
            font-size: 13px;
        }

.access-summary {
    max-height: 64px;
    overflow: hidden;
    font-size: 12px;
    color: var(--ink-2);
    position: relative;
}

    .access-summary.open {
        max-height: none;
    }

.link-btn {
    background: none;
    border: 0;
    color: var(--info);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    padding: 0;
}

.preview-img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 10px;
    border: 1px solid var(--line);
    margin-top: 8px;
}

.html-preview {
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
    background: #fafbfc;
}

.option-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 20px;
}

dialog.modal {
    border: 0;
    border-radius: 14px;
    padding: 0;
    width: min(420px, calc(100% - 32px));
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

    dialog.modal::backdrop {
        background: rgba(20, 22, 30, .45);
    }

    dialog.modal .card-body {
        padding: 20px;
    }

    dialog.modal .modal-img {
        display: block;
        width: 120px;
        height: 120px;
        object-fit: contain;
        margin: 0 auto 14px;
        border-radius: 10px;
        background: #f6f7f9;
    }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1f2126 0%, #34373f 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 30px 26px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

    .login-card .logo {
        display: block;
        margin: 0 auto 20px;
        height: 54px;
        width: auto;
    }

    .login-card h1 {
        text-align: center;
        font-size: 16px;
        margin: 0 0 22px;
        color: var(--ink-2);
        font-weight: normal;
    }

    .login-card .input {
        direction: ltr;
        text-align: left;
    }

.stack > * + * {
    margin-top: 14px;
}

.w-100 {
    width: 100%;
}

@media (max-width: 1200px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
        box-shadow: none;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
        box-shadow: -10px 0 40px rgba(0, 0, 0, .3);
    }

    body.nav-open .backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(20, 22, 30, .45);
        z-index: 35;
    }

    .sidebar-close {
        display: inline-flex;
    }

    .main {
        margin-right: 0;
    }

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

    .content {
        padding: 16px;
    }

    .topbar {
        padding: 10px 16px;
    }

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

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

@media (max-width: 720px) {
    .form-grid, .option-list {
        grid-template-columns: 1fr;
    }

    .topbar-user .name, .topbar-user .store-link span {
        display: none;
    }

    .info-list {
        grid-template-columns: 1fr;
        gap: 2px;
    }

        .info-list dd {
            margin-bottom: 10px;
        }

    .card-body {
        padding: 14px;
    }

    .card-head .actions {
        margin-right: 0;
        width: 100%;
    }

    .table-cards thead {
        display: none;
    }

    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td {
        display: block;
        width: 100%;
    }

        .table-cards tr {
            border: 1px solid var(--line);
            border-radius: 12px;
            margin: 0 0 12px;
            padding: 6px 12px;
            background: #fff;
        }

        .table-cards td {
            border: 0;
            border-bottom: 1px dashed var(--line);
            padding: 8px 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            text-align: left;
        }

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

            .table-cards td::before {
                content: attr(data-label);
                color: var(--muted);
                font-size: 12px;
                text-align: right;
                flex-shrink: 0;
            }

            .table-cards td[data-label=""]::before, .table-cards td:not([data-label])::before {
                content: none;
            }

            .table-cards td.actions-col {
                width: 100%;
                justify-content: flex-end;
            }

            .table-cards td.empty {
                display: block;
                text-align: center;
            }

        .table-cards .num {
            width: auto;
        }

    .table-wrap {
        overflow: visible;
    }
}

@media (max-width: 480px) {
    .stats, .quick {
        grid-template-columns: 1fr;
    }

    .topbar-title {
        font-size: 14px;
    }
}
