/* ========== پایه ========== */
:root {
    --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-2: #f7f8fa;
    --input-bg: #ffffff;
    --ink: #121418;
    --ink-2: #394049;
    --muted: #6b7280;
    --line: #e5e7eb;
    --line-2: #eef0f3;
    --accent: #ef5a3c;
    --accent-600: #dc4a2c;
    --accent-soft: #fff1ec;
    --accent-ink: #b5371c;
    --ok: #15803d;
    --ok-soft: #ecfdf3;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 12px 32px -16px rgba(16, 24, 40, .18);
    --sidebar: 264px;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.45; }
[hidden] { display: none !important; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

.meta { display: inline-flex; flex-wrap: wrap; align-items: center; }
.meta > span + span::before { content: "·"; margin: 0 7px; opacity: .55; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

.ic { width: 18px; height: 18px; flex-shrink: 0; }

::selection { background: rgba(239, 90, 60, .22); }

* { scrollbar-width: thin; scrollbar-color: rgba(120, 125, 135, .35) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(120, 125, 135, .35); border-radius: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ========== دکمه‌ها ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(220, 74, 44, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover:not(:disabled) { background: var(--accent-600); }
.btn-light { background: var(--surface); border-color: var(--line); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.btn-light:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { height: 48px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px; height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn.is-done { color: var(--ok); }

/* ========== فرم ========== */
.field { margin-bottom: 18px; }
.field > label { display: block; margin-bottom: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], textarea {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--input-bg);
    color: var(--ink);
    font-size: 14.5px;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}
textarea { height: auto; min-height: 96px; padding: 11px 14px; line-height: 1.9; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9ca3af; font-size: 13.5px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(239, 90, 60, .14); }
input[readonly] { color: var(--ink-2); }
input[type="number"]::-webkit-inner-spin-button { opacity: .5; }

.input-wrap { position: relative; }
.input-wrap input { padding-left: 46px; }
.input-wrap .input-ic + input { padding-right: 42px; }
.input-ic { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); color: #9ca3af; display: flex; pointer-events: none; }
.pass-toggle {
    position: absolute; top: 50%; left: 5px; transform: translateY(-50%);
    width: 36px; height: 36px; display: grid; place-items: center;
    border: 0; border-radius: 9px; background: transparent; color: #9ca3af; cursor: pointer;
}
.pass-toggle:hover { color: var(--ink); background: var(--surface-2); }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }

.alert { padding: 11px 14px; border-radius: 11px; font-size: 13.5px; margin-bottom: 16px; line-height: 1.8; }
.alert-error { background: var(--danger-soft); color: #b42318; border: 1px solid #fecdca; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; font-weight: 500; margin-bottom: 18px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 44px; height: 26px; border-radius: 99px; background: #d4d7dd; transition: background-color .2s; flex-shrink: 0; }
.switch-ui::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(-18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.copy-field, .slug-field {
    display: flex; align-items: center;
    border: 1px solid var(--line); border-radius: 11px;
    background: var(--input-bg); overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.copy-field:focus-within, .slug-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(239, 90, 60, .14); }
.copy-field input, .slug-field input { flex: 1; min-width: 0; border: 0; border-radius: 0; box-shadow: none !important; background: transparent; height: 42px; }
.copy-field input { font-size: 13px; color: var(--ink-2); }
.copy-field .icon-btn, .slug-field .icon-btn { margin: 0 3px; }
.slug-prefix { align-self: stretch; display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); border-right: 1px solid var(--line); color: var(--muted); font-size: 13px; white-space: nowrap; }

.search { margin-bottom: 12px; }

/* ========== اجزای عمومی ========== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 700; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 1; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.link { color: var(--accent-600); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.link:hover { text-decoration: underline; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-on { background: var(--ok-soft); color: var(--ok); }
.pill-off { background: #f1f2f4; color: var(--muted); }

.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty p { margin: 0 0 14px; }
.empty-sm { padding: 24px 12px; }
.empty-icon { width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: #9aa0aa; border: 1px solid var(--line); }
.empty-icon .ic { width: 26px; height: 26px; }

.brand-mark { display: inline-flex; width: 34px; height: 34px; color: var(--accent); flex-shrink: 0; }
.brand-mark svg { width: 100%; height: 100%; }

/* ========== اعلان و پنجره تأیید ========== */
.toasts { position: fixed; bottom: 24px; left: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 48px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: #16181d; color: #f3f4f6; font-size: 14px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .45); animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.2); transition: opacity .25s, transform .25s; }
.toast-ok .ic { color: #4ade80; }
.toast-error .ic { color: #f87171; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.modal { border: 0; padding: 0; border-radius: 18px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .35); }
.modal::backdrop { background: rgba(15, 17, 21, .5); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .2s ease-out; }
.modal-body { padding: 24px; }
.modal-body h3 { margin: 0 0 8px; font-size: 17px; }
.modal-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.9; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-start; padding: 0 24px 22px; }
@keyframes modal-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ========== پنل مدیریت ========== */
.shell { min-height: 100vh; }

.sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: var(--sidebar);
    display: flex; flex-direction: column;
    padding: 20px 14px;
    background: #111317;
    color: #b9bdc6;
    z-index: 50;
    transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 26px; color: #fff; font-weight: 800; font-size: 17px; text-decoration: none; letter-spacing: -.01em; }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a, .nav-foot button {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 10px 12px;
    border: 0; border-radius: 10px;
    background: transparent;
    color: #a3a8b3; font-size: 14.5px; font-weight: 500;
    text-decoration: none; text-align: right; cursor: pointer;
    transition: background-color .15s, color .15s;
}
.nav a:hover, .nav-foot button:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.is-active { background: rgba(239, 90, 60, .13); color: #fff; }
.nav a.is-active .ic { color: var(--accent); }
.nav-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }

.backdrop { display: none; }

.main { margin-right: var(--sidebar); min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 12px;
    min-height: 72px; padding: 12px 32px;
    background: rgba(243, 244, 246, .86);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.topbar-actions { margin-right: auto; display: flex; gap: 8px; }
.menu-btn { display: none; }
.content { padding: 4px 32px 56px; max-width: 1280px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-ic { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.stat-ic .ic { width: 22px; height: 22px; }
.stat-label { display: block; font-size: 13px; color: var(--muted); }
.stat strong { display: block; font-size: 23px; font-weight: 800; line-height: 1.4; }
.stat strong small { font-size: 13px; font-weight: 500; color: var(--muted); }

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

.mini-list { list-style: none; margin: -6px; padding: 0; }
.mini-list a { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 11px; text-decoration: none; transition: background-color .15s; }
.mini-list a:hover { background: var(--surface-2); }
.mini-thumb { width: 72px; height: 42px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: #1b1e24; color: #6b7280; flex-shrink: 0; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-thumb.is-icon { width: 42px; background: var(--accent-soft); color: var(--accent); }
.mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini-text strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-text small { font-size: 12.5px; color: var(--muted); }

/* آپلود */
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 34px 20px; margin-bottom: 20px;
    border: 2px dashed #d5d8de; border-radius: 16px;
    background: var(--surface-2);
    text-align: center; cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-ic { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px; background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.dropzone-ic .ic { width: 24px; height: 24px; }
.dropzone strong { font-size: 15px; font-weight: 600; }
.dropzone small { font-size: 12.5px; color: var(--muted); direction: ltr; unicode-bidi: plaintext; }
.upload.is-busy .dropzone { pointer-events: none; opacity: .6; }

.picked { display: flex; align-items: center; gap: 14px; padding: 12px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.picked-thumb { width: 104px; height: 58px; border-radius: 9px; overflow: hidden; display: grid; place-items: center; background: #1b1e24; color: #6b7280; flex-shrink: 0; }
.picked-thumb img { width: 100%; height: 100%; object-fit: cover; }
.picked-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.picked-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; unicode-bidi: plaintext; }
.picked-text small { color: var(--muted); font-size: 12.5px; }

.progress { margin: 2px 0 18px; }
.progress-track { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #f7845f, var(--accent)); transition: width .25s ease; }
.progress-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.progress-meta span:first-child { font-weight: 700; color: var(--ink); }

/* فهرست ویدیوها */
.vlist { list-style: none; margin: 0; padding: 0; }
.vrow {
    display: grid; grid-template-columns: 24px 34px 132px minmax(0, 1fr) auto;
    align-items: center; gap: 14px;
    padding: 12px; margin-bottom: 10px;
    border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.vrow:last-child { margin-bottom: 0; }
.vrow:hover { border-color: var(--line); box-shadow: var(--shadow-sm); }
.vrow-handle { color: #b6bac2; cursor: grab; display: flex; justify-content: center; touch-action: none; }
.vrow-handle:active { cursor: grabbing; }
.vrow-order { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); font-weight: 700; font-size: 13px; color: var(--ink-2); }
.vrow-thumb { position: relative; width: 132px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: #1b1e24; color: #5b616c; }
.vrow-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vrow-dur, .vw-dur { position: absolute; bottom: 6px; left: 6px; padding: 0 6px; border-radius: 5px; background: rgba(0, 0, 0, .74); color: #fff; font-size: 11.5px; line-height: 1.7; }
.vrow-title { font-weight: 700; font-size: 15px; text-decoration: none; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow-title:hover { color: var(--accent-600); }
.vrow-text p { margin: 2px 0 6px; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow-meta { display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 12px; color: var(--muted); }
.vrow-meta span + span::before { content: "·"; margin: 0 8px; color: #c4c8cf; }
.vrow-actions { display: flex; gap: 2px; }
.vrow-actions form { margin: 0; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow); border-color: var(--accent); }

/* ویرایش */
.edit-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.edit-layout.is-page { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.edit-layout > .card { margin-bottom: 0; }
.preview { border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.preview video { width: 100%; height: 100%; object-fit: contain; }
.preview-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.preview-tools label { cursor: pointer; }
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.specs div { padding: 10px 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line-2); min-width: 0; }
.specs dt { font-size: 12px; color: var(--muted); }
.specs dd { margin: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.specs dd[dir="ltr"] { text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 99px; font-size: 13.5px; cursor: pointer; background: var(--surface); transition: all .15s; user-select: none; }
.chip span em { color: var(--muted); font-style: normal; font-size: 12px; }
.chip .chip-check { display: none; width: 15px; height: 15px; }
.chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chip input:checked + span .chip-check { display: block; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.check-all { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.check-all input { width: 16px; height: 16px; accent-color: var(--accent); }

.pick-list { display: grid; gap: 8px; max-height: 620px; overflow-y: auto; margin: 0 -4px; padding: 0 4px 2px; }
.pick { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line-2); border-radius: 13px; cursor: pointer; transition: border-color .15s, background-color .15s; user-select: none; }
.pick:hover { border-color: var(--line); background: var(--surface-2); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick-box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid #cdd1d8; display: grid; place-items: center; color: transparent; flex-shrink: 0; transition: all .15s; }
.pick-box .ic { width: 14px; height: 14px; stroke-width: 3; }
.pick input:checked ~ .pick-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick:has(input:checked) { border-color: rgba(239, 90, 60, .45); background: var(--accent-soft); }
.pick input:focus-visible ~ .pick-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-thumb { width: 84px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: #1b1e24; color: #5b616c; flex-shrink: 0; }
.pick-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-text strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-text small { font-size: 12px; color: var(--muted); }
.pick.is-hidden { display: none; }

/* صفحات */
.page-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); transition: box-shadow .2s, border-color .2s; min-width: 0; }
.pcard:hover { box-shadow: var(--shadow); }
.pcard-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pcard-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.pcard.is-off .pcard-ic { background: #f1f2f4; color: #9ca3af; }
.pcard-title { flex: 1; min-width: 0; }
.pcard-title a { display: block; font-weight: 700; font-size: 15px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-title a:hover { color: var(--accent-600); }
.pcard-title small { color: var(--muted); font-size: 12.5px; }
.pcard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.pcard-actions form { margin: 0; }
.pcard-actions form:last-child { margin-right: auto; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings-grid .card { margin-bottom: 0; }

/* ورود مدیر */
.is-auth { background: radial-gradient(1000px 500px at 50% -10%, rgba(239, 90, 60, .12), transparent 70%), var(--bg); }
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(410px, 100%); padding: 34px 30px 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-weight: 800; font-size: 17px; }
.auth-card h1 { margin: 0 0 22px; font-size: 21px; font-weight: 800; }

/* ========== بخش کاربران (تیره) ========== */
.is-viewer, .is-plain {
    --bg: #0b0c0f;
    --surface: #131519;
    --surface-2: #1a1d22;
    --input-bg: #0e1013;
    --ink: #f2f3f5;
    --ink-2: #c9cdd4;
    --muted: #868c97;
    --line: #23272e;
    --line-2: #1c1f25;
    color-scheme: dark;
    background: var(--bg);
}

.center-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; }
.is-plain .center-screen { background: radial-gradient(900px 480px at 50% -10%, rgba(239, 90, 60, .16), transparent 70%); }
.msg-card { max-width: 440px; }
.msg-card .brand-mark { width: 54px; height: 54px; margin: 0 auto 20px; }
.msg-card h1 { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.msg-card p { margin: 0; color: var(--muted); }

.lock-screen {
    min-height: 100vh; min-height: 100dvh;
    display: grid; place-items: center; padding: 24px;
    background: radial-gradient(900px 520px at 50% -10%, rgba(239, 90, 60, .2), transparent 70%);
}
.lock-card {
    width: min(380px, 100%);
    padding: 34px 26px 26px;
    text-align: center;
    background: rgba(19, 21, 25, .82);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 40px 100px -40px rgba(0, 0, 0, .8);
    backdrop-filter: blur(12px);
}
.lock-icon { width: 64px; height: 64px; margin: 0 auto 26px; border-radius: 20px; display: grid; place-items: center; background: rgba(239, 90, 60, .14); color: var(--accent); }
.lock-icon .ic { width: 28px; height: 28px; }
.lock-row { display: flex; gap: 10px; }
.lock-row .input-wrap { flex: 1; min-width: 0; }
.lock-card input { height: 52px; text-align: center; font-size: 17px; letter-spacing: .12em; padding-right: 46px; border-radius: 14px; }
.lock-submit { width: 52px; height: 52px; padding: 0; border-radius: 14px; flex-shrink: 0; }
.lock-submit .ic { width: 22px; height: 22px; }
.lock-card .alert { margin: 16px 0 0; }
.is-viewer .alert-error { background: rgba(220, 38, 38, .12); color: #fca5a5; border-color: rgba(248, 113, 113, .25); }

.vw-top { position: sticky; top: 0; z-index: 30; background: rgba(11, 12, 15, .82); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.vw-top-in { max-width: 1480px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.vw-top form { margin: 0; }
.vw-brand { display: flex; align-items: center; gap: 11px; min-width: 0; font-weight: 700; font-size: 16px; }
.vw-brand .brand-mark { width: 30px; height: 30px; }
.vw-brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vw-main { max-width: 1480px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 24px; align-items: start; }
.vw-stage { min-width: 0; }
.vw-player {
    position: relative; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: #000;
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .04);
    --plyr-color-main: #ef5a3c;
    --plyr-font-family: var(--font);
    --plyr-video-background: #000;
    --plyr-menu-background: rgba(24, 26, 31, .96);
    --plyr-menu-color: #e5e7eb;
    --plyr-menu-arrow-color: #e5e7eb;
    --plyr-menu-border-shadow-color: transparent;
    --plyr-menu-back-border-color: #2a2e36;
    --plyr-menu-back-border-shadow-color: transparent;
}
.vw-player .plyr, .vw-player video { width: 100%; height: 100%; }
.vw-player video { object-fit: contain; }
.vw-player .plyr__poster { background-size: cover; }

.vw-info { margin-top: 22px; }
.vw-info-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.vw-part { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--accent); }
.vw-info h1 { margin: 2px 0 0; font-size: 22px; font-weight: 800; line-height: 1.6; }
.vw-desc { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 15px; line-height: 2.05; overflow-wrap: anywhere; }
.vw-desc:empty { display: none; }

.vw-list { position: sticky; top: 86px; display: flex; flex-direction: column; max-height: calc(100vh - 110px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.vw-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14.5px; }
.vw-list-head > span:first-child { display: flex; align-items: center; gap: 8px; }
.vw-list-head .ic { color: var(--muted); }
.vw-items { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.vw-item { position: relative; display: flex; align-items: center; border-radius: 13px; transition: background-color .15s; }
.vw-item + .vw-item { margin-top: 2px; }
.vw-item:hover { background: var(--surface-2); }
.vw-item.is-active { background: rgba(239, 90, 60, .11); }
.vw-item-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; border: 0; background: none; text-align: right; cursor: pointer; border-radius: 13px; }
.vw-thumb { position: relative; width: 124px; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: #1b1e24; flex-shrink: 0; }
.vw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vw-thumb-ph { display: grid; place-items: center; height: 100%; color: #4b515c; }
.vw-thumb-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .38); color: #fff; opacity: 0; transition: opacity .15s; }
.vw-thumb-play .ic { width: 22px; height: 22px; fill: currentColor; }
.vw-item:hover .vw-thumb-play, .vw-item.is-active .vw-thumb-play { opacity: 1; }
.vw-item.is-active .vw-thumb { box-shadow: 0 0 0 2px var(--accent); }
.vw-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.vw-num { font-size: 12px; font-weight: 700; color: var(--muted); }
.vw-item.is-active .vw-num { color: var(--accent); }
.vw-title { font-size: 14px; font-weight: 600; line-height: 1.65; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vw-size { font-size: 12px; color: var(--muted); }
.vw-item-dl { margin-left: 6px; flex-shrink: 0; }

/* ========== واکنش‌گرایی ========== */
@media (max-width: 1180px) {
    .vw-main { grid-template-columns: minmax(0, 1fr) 330px; }
    .vw-thumb { width: 108px; }
}

@media (max-width: 1080px) {
    .edit-layout, .edit-layout.is-page { grid-template-columns: minmax(0, 1fr); }
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
    .sidebar { transform: translateX(100%); box-shadow: none; }
    .sidebar.is-open { transform: none; box-shadow: -20px 0 60px rgba(0, 0, 0, .3); }
    .backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(15, 17, 21, .45); opacity: 0; pointer-events: none; transition: opacity .25s; display: block; }
    .backdrop.is-open { opacity: 1; pointer-events: auto; }
    .main { margin-right: 0; }
    .menu-btn { display: inline-grid; margin-right: -8px; }
    .topbar { padding: 10px 16px; min-height: 64px; }
    .topbar h1 { font-size: 18px; }
    .content { padding: 4px 16px 40px; }
    .grid-2, .settings-grid { grid-template-columns: minmax(0, 1fr); }
    .grid-2 .card, .settings-grid .card { margin-bottom: 0; }
    .grid-2, .settings-grid { gap: 16px; }

    .vw-main { grid-template-columns: minmax(0, 1fr); padding: 0 0 32px; gap: 0; }
    .vw-player { border-radius: 0; box-shadow: none; }
    .vw-info { padding: 0 16px; margin-top: 18px; }
    .vw-list { position: static; max-height: none; margin: 22px 16px 0; }
    .vw-top-in { padding: 10px 16px; }
}

@media (max-width: 720px) {
    .stats { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .stat { padding: 14px 16px; }
    .card { padding: 16px; border-radius: 14px; }
    .form-grid, .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
    .span-2, .span-3 { grid-column: 1 / -1; }
    .vrow { grid-template-columns: 20px 92px minmax(0, 1fr); gap: 10px; padding: 10px; }
    .vrow-order { display: none; }
    .vrow-thumb { width: 92px; }
    .vrow-actions { grid-column: 2 / -1; justify-content: flex-end; margin-top: -4px; }
    .vrow-text p { display: none; }
    .page-cards { grid-template-columns: minmax(0, 1fr); }
    .topbar-actions .btn span { display: none; }
    .topbar-actions .btn { width: 40px; padding: 0; }
    .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; }
    .vw-info h1 { font-size: 18px; }
    .vw-desc { font-size: 14.5px; }
}

@media (max-width: 420px) {
    .vw-info-head .btn span { display: none; }
    .vw-info-head .btn { width: 44px; padding: 0; }
    .vw-thumb { width: 96px; }
    .auth-card, .lock-card { padding: 28px 20px 22px; }
    .specs { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
