/* =====================================================================
   سامانه‌ساز هیراد – سیستم طراحی
   طراحی و توسعه: شرکت ایده گستر هیراد خاورمیانه – ۰۹۱۲۷۷۸۴۷۲۲
   ===================================================================== */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-UI-FD-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-UI-FD-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-UI-FD-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-UI-FD-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
    --bg: #f4f5fb;
    --bg-soft: #eceefa;
    --surface: #ffffff;
    --surface-2: #f8f9fe;
    --border: #e3e6f2;
    --border-strong: #cfd4e8;
    --text: #151a33;
    --text-2: #4a5175;
    --muted: #7c84a8;
    --primary: #5b4cf0;
    --primary-2: #8b5cf6;
    --primary-soft: #eeebff;
    --primary-ink: #ffffff;
    --success: #10b981; --success-soft: #e3f8ef;
    --danger: #ef4444; --danger-soft: #fde8e8;
    --warning: #f59e0b; --warning-soft: #fef3dc;
    --info: #0ea5e9; --info-soft: #e0f3fd;
    --sidebar: #0f1330;
    --sidebar-2: #171c45;
    --sidebar-text: #b9bfe6;
    --shadow-sm: 0 1px 2px rgba(20, 24, 60, .06);
    --shadow: 0 6px 24px -8px rgba(30, 30, 90, .14), 0 1px 3px rgba(30, 30, 90, .05);
    --shadow-lg: 0 24px 60px -20px rgba(40, 30, 120, .35);
    --radius: 16px;
    --radius-sm: 10px;
    --grad: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0a0d1f;
    --bg-soft: #10142c;
    --surface: #131833;
    --surface-2: #181e3d;
    --border: #252c55;
    --border-strong: #343c6d;
    --text: #eef0ff;
    --text-2: #c2c7ea;
    --muted: #8a91bd;
    --primary-soft: #241f5c;
    --success-soft: #0f3328; --danger-soft: #3d1620; --warning-soft: #3a2b0c; --info-soft: #0c2c3d;
    --sidebar: #080b1a;
    --sidebar-2: #0f1330;
    --shadow: 0 8px 30px -10px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: "Vazirmatn", Tahoma, sans-serif; font-size: 14.5px; line-height: 1.75;
    color: var(--text); background: var(--bg);
    background-image: radial-gradient(1200px 500px at 100% -10%, rgba(139, 92, 246, .08), transparent 60%),
                      radial-gradient(900px 400px at 0% 0%, rgba(91, 76, 240, .07), transparent 60%);
    background-attachment: fixed;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.4; font-weight: 800; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ltr { direction: ltr; unicode-bidi: embed; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: .85rem; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%); color: var(--sidebar-text);
    display: flex; flex-direction: column; padding: 18px 14px; z-index: 40;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 18px; color: #fff; text-decoration: none !important; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: rgba(255,255,255,.06); padding: 4px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.4; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--sidebar-text); font-size: .78rem; opacity: .8; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: .72rem; letter-spacing: .02em; color: #7d84b8; margin: 16px 10px 6px; font-weight: 700; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--sidebar-text);
    font-weight: 500; transition: background .15s, color .15s; text-decoration: none !important;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -8px rgba(124, 92, 246, .8); }
.sidebar-foot { display: flex; gap: 8px; align-items: center; font-size: .75rem; color: #7d84b8; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.06); margin-top: 12px; }
.backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px 28px;
    background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.2rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 0; color: var(--muted); font-size: .82rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2); cursor: pointer; position: relative; text-decoration: none !important;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.bell .dot {
    position: absolute; top: -6px; left: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
    background: var(--danger); color: #fff; font-size: .72rem; display: grid; place-items: center; font-weight: 700;
    box-shadow: 0 0 0 3px var(--bg);
}
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px 4px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; }
.usermenu .menu {
    position: absolute; left: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
}
.usermenu .menu a, .usermenu .menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text);
    background: none; border: 0; font: inherit; cursor: pointer; text-align: right; text-decoration: none !important;
}
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--primary-soft); color: var(--primary); }
.usermenu .menu form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

.content { padding: 26px 28px 40px; flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; }
.footer {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 28px; font-size: .82rem;
    color: var(--muted); border-top: 1px solid var(--border); background: var(--surface);
}
.footer strong { color: var(--text-2); }
.footer .sep { margin: 0 6px; opacity: .5; }
.footer-phone { color: var(--primary); font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.footer-meta { display: flex; align-items: center; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 18px 22px 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }

/* ---------- Stats ---------- */
.stat { position: relative; overflow: hidden; display: flex; gap: 16px; align-items: center; }
.stat .stat-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 10px 20px -10px rgba(91,76,240,.8); }
.stat .stat-icon.green { background: linear-gradient(135deg, #10b981, #34d399); box-shadow: 0 10px 20px -10px rgba(16,185,129,.8); }
.stat .stat-icon.amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); box-shadow: 0 10px 20px -10px rgba(245,158,11,.8); }
.stat .stat-icon.sky { background: linear-gradient(135deg, #0ea5e9, #38bdf8); box-shadow: 0 10px 20px -10px rgba(14,165,233,.8); }
.stat .value { font-size: 1.7rem; font-weight: 800; line-height: 1.2; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat::after { content: ""; position: absolute; left: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--primary-soft); opacity: .6; }

.hero {
    position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; color: #fff; margin-bottom: 20px;
    background: linear-gradient(120deg, #3b2fd9 0%, #6d4cf0 50%, #a855f7 100%); box-shadow: var(--shadow-lg);
}
.hero h2 { font-size: 1.45rem; margin-bottom: 4px; }
.hero p { margin: 0; opacity: .9; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.12); }
.hero::before { width: 260px; height: 260px; left: -60px; top: -120px; }
.hero::after { width: 160px; height: 160px; left: 140px; bottom: -90px; }
.hero .hero-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; font-size: .82rem; opacity: .95; position: relative; z-index: 1; }
.hero .hero-meta span { display: inline-flex; gap: 6px; align-items: center; background: rgba(255,255,255,.14); padding: 4px 12px; border-radius: 999px; }

/* ---------- App tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile {
    display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--border); color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s; text-decoration: none !important;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.tile .tile-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.tile h3 { margin: 0; }
.tile p { margin: 0; color: var(--muted); font-size: .85rem; }
.c-indigo { background: linear-gradient(135deg, #4f46e5, #818cf8); }
.c-violet { background: linear-gradient(135deg, #7c3aed, #c084fc); }
.c-sky { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.c-emerald { background: linear-gradient(135deg, #059669, #34d399); }
.c-amber { background: linear-gradient(135deg, #d97706, #fbbf24); }
.c-rose { background: linear-gradient(135deg, #e11d48, #fb7185); }
.c-slate { background: linear-gradient(135deg, #334155, #64748b); }
.c-teal { background: linear-gradient(135deg, #0d9488, #2dd4bf); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; border-radius: 12px;
    border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap;
    transition: transform .1s, box-shadow .15s, background .15s; text-decoration: none !important; line-height: 1.6;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(91,76,240,.8); }
.btn-primary:hover { box-shadow: 0 10px 24px -8px rgba(91,76,240,.95); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #1f1300; }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: .8rem; border-radius: 10px; }
.btn-lg { padding: 12px 26px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 18px; }
.fg { grid-column: span 6; display: flex; flex-direction: column; gap: 6px; }
.fg.w-half { grid-column: span 3; }
.fg.w-third { grid-column: span 2; }
.fg-section { grid-column: span 6; margin-top: 8px; padding-bottom: 6px; border-bottom: 2px solid var(--primary-soft); font-weight: 800; color: var(--primary); display: flex; gap: 8px; align-items: center; }
label, .label { font-weight: 700; font-size: .87rem; color: var(--text-2); }
.req::after { content: " *"; color: var(--danger); }
.input, select.input, textarea.input {
    width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2);
    color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { min-height: 110px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); background: var(--surface); }
.input.is-invalid { border-color: var(--danger); }
.help { color: var(--muted); font-size: .8rem; }
.error, .field-validation-error { color: var(--danger); font-size: .8rem; font-weight: 500; }
.validation-summary-errors ul, .alert ul { margin: 0; padding-right: 18px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0; }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-select label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); cursor: pointer; font-weight: 500; background: var(--surface-2); }
.chips-select input { accent-color: var(--primary); }
.input-group { display: flex; gap: 8px; }
.filebox { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.filebox input { width: 100%; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: #b45309; }
.alert-info { background: var(--info-soft); color: #0369a1; }
[data-theme="dark"] .alert-warning { color: #fbbf24; }
[data-theme="dark"] .alert-info { color: #7dd3fc; }
.validation-summary-valid { display: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: right; font-size: .8rem; color: var(--muted); font-weight: 700; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { justify-content: flex-end; flex-wrap: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: #b45309; }
.badge-info { background: var(--info-soft); color: #0284c7; }
.badge-muted { background: var(--bg-soft); color: var(--muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); padding: 0 10px; text-decoration: none !important; }
.pager .current { background: var(--grad); color: #fff; border-color: transparent; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.toolbar .input { max-width: 320px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .empty-icon { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }

/* ---------- Toast ---------- */
.toast {
    position: fixed; z-index: 100; top: 84px; left: 50%; transform: translateX(-50%); min-width: 280px; max-width: 92vw;
    padding: 12px 20px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 700; animation: toastIn .3s ease;
    background: var(--surface); border: 1px solid var(--border); border-right: 5px solid var(--success);
}
.toast-error { border-right-color: var(--danger); }
.toast-warning { border-right-color: var(--warning); }
.toast.hide { opacity: 0; transition: opacity .4s; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Key/Value & timeline ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.kv .item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.kv .item .k { color: var(--muted); font-size: .78rem; }
.kv .item .v { font-weight: 700; word-break: break-word; white-space: pre-line; }
.kv .item.full { grid-column: 1 / -1; }
.timeline { position: relative; padding-right: 22px; }
.timeline::before { content: ""; position: absolute; right: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl { position: relative; padding: 0 0 18px; }
.tl::before { content: ""; position: absolute; right: -21px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); }
.tl.pending::before { border-color: var(--warning); animation: pulse 1.6s infinite; }
.tl.cancel::before { border-color: var(--muted); }
.tl .t-title { font-weight: 800; }
.tl .t-meta { color: var(--muted); font-size: .8rem; }
.tl .t-comment { margin-top: 6px; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); white-space: pre-line; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.5); } 50% { box-shadow: 0 0 0 6px rgba(245,158,11,0); } }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .li-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.list .li-body { flex: 1; min-width: 0; }
.list .li-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .li-meta { color: var(--muted); font-size: .8rem; }
.list li.unread .li-title::before { content: "●"; color: var(--primary); margin-left: 6px; }

/* ---------- Bar chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar i { display: block; width: 100%; max-width: 30px; border-radius: 8px 8px 4px 4px; background: var(--grad); min-height: 4px; transition: height .6s ease; }
.bars .bar.zero i { background: var(--border); }
.bars .bar span { font-size: .68rem; color: var(--muted); }
.bars .bar b { font-size: .72rem; color: var(--text-2); }

/* ---------- Login & install ---------- */
body.bare { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.bare-main { flex: 1; display: grid; place-items: center; padding: 30px 16px; position: relative; z-index: 1; }
.bare .footer { background: transparent; border: 0; justify-content: center; text-align: center; position: relative; z-index: 1; }
.aurora { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.aurora span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.aurora span:nth-child(1) { width: 520px; height: 520px; background: #6d5cf6; top: -160px; right: -120px; }
.aurora span:nth-child(2) { width: 460px; height: 460px; background: #c084fc; bottom: -180px; left: -100px; opacity: .4; }
.aurora span:nth-child(3) { width: 300px; height: 300px; background: #38bdf8; top: 40%; left: 40%; opacity: .25; }
.auth {
    width: 100%; max-width: 980px; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface);
    border-radius: 26px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.auth-side { background: linear-gradient(150deg, #24198f 0%, #5b3ff0 55%, #a855f7 100%); color: #fff; padding: 44px 40px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.auth-side::after { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; border: 50px solid rgba(255,255,255,.07); left: -120px; bottom: -120px; }
.auth-side img { width: 70px; height: 70px; border-radius: 18px; background: rgba(255,255,255,.12); padding: 8px; }
.auth-side h1 { font-size: 1.9rem; margin: 22px 0 6px; }
.auth-side p { opacity: .88; }
.auth-feats { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }
.auth-feats li { display: flex; gap: 10px; align-items: center; }
.auth-feats li .icon { background: rgba(255,255,255,.15); border-radius: 9px; padding: 4px; width: 28px; height: 28px; }
.auth-form { padding: 44px 40px; }
.auth-form h2 { font-size: 1.5rem; margin-bottom: 4px; }
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row img { height: 46px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.banner { font-size: .78rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-top: 16px; display: flex; gap: 8px; }

.wizard { width: 100%; max-width: 860px; }
.wizard .card { padding: 30px; border-radius: 22px; box-shadow: var(--shadow-lg); }
.steps { display: flex; gap: 6px; margin-bottom: 26px; }
.steps .st { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: .78rem; color: var(--muted); font-weight: 700; }
.steps .st i { height: 6px; border-radius: 6px; background: var(--border); display: block; }
.steps .st.on { color: var(--primary); }
.steps .st.on i { background: var(--grad); }
.wstep { display: none; }
.wstep.on { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Designers ---------- */
.designer { display: grid; grid-template-columns: 230px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.palette { position: sticky; top: 88px; }
.palette .pal-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface-2); cursor: grab; margin-bottom: 8px; font-weight: 500; user-select: none; width: 100%; font: inherit; color: var(--text); text-align: right;
}
.palette .pal-item:hover { border-color: var(--primary); color: var(--primary); }
.canvas { min-height: 520px; }
.canvas-drop { min-height: 420px; border: 2px dashed var(--border-strong); border-radius: 14px; padding: 14px; background: var(--surface-2); }
.canvas-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.fd-field {
    position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); margin-bottom: 10px;
    cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.fd-field:hover { border-color: var(--border-strong); }
.fd-field.sel { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.fd-field.dragging { opacity: .4; }
.fd-field .fd-top { display: flex; align-items: center; gap: 8px; }
.fd-field .fd-label { font-weight: 700; flex: 1; }
.fd-field .fd-type { font-size: .72rem; }
.fd-field .fd-preview { margin-top: 8px; pointer-events: none; opacity: .8; }
.fd-field .fd-tools { display: flex; gap: 4px; }
.fd-row { display: flex; flex-wrap: wrap; gap: 10px; }
.fd-row > .fd-field { flex: 1 1 100%; }
.fd-row > .fd-field.w-half { flex: 1 1 calc(50% - 10px); }
.fd-row > .fd-field.w-third { flex: 1 1 calc(33.3% - 10px); }
.props { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto; }
.props .fg { margin-bottom: 12px; }
.props textarea.input { min-height: 90px; }

.pd-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }
.pd-canvas { position: relative; overflow: auto; height: 640px; border-radius: 14px; border: 1px solid var(--border); background-color: var(--surface-2);
    background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 22px 22px; }
.pd-canvas svg { display: block; }
.pd-node { cursor: grab; }
.pd-node rect { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.pd-node.sel rect, .pd-node.sel circle { stroke: var(--primary); stroke-width: 3; }
.pd-node.src rect, .pd-node.src circle { stroke: var(--warning); stroke-width: 3; stroke-dasharray: 5 4; }
.pd-node text { fill: var(--text); font-family: Vazirmatn, Tahoma; font-size: 13px; font-weight: 700; }
.pd-node text.sub { font-weight: 500; font-size: 11px; fill: var(--muted); }
.pd-node .start { fill: #10b981; stroke: #059669; }
.pd-node .end-ok { fill: #6366f1; stroke: #4f46e5; }
.pd-node .end-no { fill: #ef4444; stroke: #dc2626; }
.pd-node .bar { fill: url(#pdGrad); stroke: none; }
.pd-edge { fill: none; stroke: var(--muted); stroke-width: 2; cursor: pointer; }
.pd-edge.approve { stroke: #10b981; } .pd-edge.reject { stroke: #ef4444; } .pd-edge.return { stroke: #f59e0b; }
.pd-edge.sel { stroke-width: 4; }
.pd-edge-label { font-family: Vazirmatn, Tahoma; font-size: 11.5px; font-weight: 700; fill: var(--text-2); paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; }
.pd-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mode-on { background: var(--warning) !important; color: #1f1300 !important; border-color: var(--warning) !important; }
.errlist { margin: 0; padding-right: 18px; color: var(--danger); font-size: .85rem; }

.qr { background: #fff; padding: 12px; border-radius: 14px; display: inline-block; border: 1px solid var(--border); }
.qr img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }
.secret { font-family: Consolas, monospace; font-size: 1.05rem; letter-spacing: .1em; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 8px 14px; border-radius: 10px; direction: ltr; display: inline-block; }

/* ---------- Datepicker ---------- */
.dp { position: absolute; z-index: 90; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px; width: 290px; }
.dp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 800; }
.dp-head button { border: 0; background: var(--surface-2); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; color: var(--text); font: inherit; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.dp-grid .wd { font-size: .72rem; color: var(--muted); font-weight: 700; }
.dp-grid button { border: 0; background: none; border-radius: 8px; height: 34px; cursor: pointer; font: inherit; color: var(--text); }
.dp-grid button:hover { background: var(--primary-soft); color: var(--primary); }
.dp-grid button.today { border: 1px solid var(--primary); }
.dp-grid button.sel { background: var(--grad); color: #fff; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; }

.status-page { text-align: center; padding: 60px 20px; max-width: 520px; margin: 0 auto; }
.status-page .code { font-size: 5rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* ---------- Responsive ---------- */
.only-mobile { display: none; }
@media (max-width: 1200px) {
    .designer { grid-template-columns: 200px minmax(0, 1fr); }
    .designer .props { grid-column: 1 / -1; position: static; max-height: none; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
    .sidebar { position: fixed; right: 0; top: 0; transform: translateX(105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(5, 8, 25, .5); z-index: 35; }
    .only-mobile { display: inline-grid; }
    .only-desktop { display: none; }
    .content { padding: 18px 16px 30px; }
    .topbar { padding: 12px 16px; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .auth { grid-template-columns: 1fr; }
    .auth-side { padding: 28px; }
    .auth-feats { display: none; }
    .pd-wrap { grid-template-columns: minmax(0, 1fr); }
    .designer { grid-template-columns: minmax(0, 1fr); }
    .palette { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
    .palette .pal-item { width: auto; margin: 0; }
}
@media (max-width: 640px) {
    .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .fg.w-half, .fg.w-third { grid-column: span 6; }
    .footer { justify-content: center; text-align: center; }
    .auth-form { padding: 26px 20px; }
}
@media print {
    .sidebar, .topbar, .footer .footer-meta, .actions, .btn { display: none !important; }
    .content { padding: 0; }
    .card { box-shadow: none; }
}
.narrow { max-width: 460px; width: 100%; }
.big-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; color: #fff; }
.swatch { width: 22px; height: 22px; border-radius: 7px; display: inline-block; }
.pd-node text.on-dark { fill: #fff; font-size: 16px; }
.grid > .card, .grid > * > .card:first-child, .row > .card { margin-top: 0; }
.stat > * { position: relative; z-index: 1; }
.stat::after { z-index: 0; }
.fd-row > .fd-field { min-width: 0; }
.fd-field .fd-top { flex-wrap: wrap; }
.fd-field .fd-label { min-width: 0; }
.fd-field .fd-tools .btn { padding: 3px 8px; }
.pd-canvas { direction: ltr; }
