:root {
    --grad: linear-gradient(135deg, #f472b6 0%, #a855f7 55%, #6366f1 100%);
    --grad-soft: linear-gradient(135deg, rgba(244,114,182,.14), rgba(168,85,247,.14));
    --accent: #a855f7;
    --accent-2: #f472b6;
    --accent-cyan: #22d3ee;
    color-scheme: light;
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --muted-light: #94a3b8;
    --line: #e6eaf0;
    --line-strong: #cdd6e2;
    --canvas: #f1f4f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --sidebar: #0b1020;
    --sidebar-soft: #12182b;
    --sidebar-hover: #1a2237;
    --sidebar-active: rgba(168,85,247,.16);
    --green: #0ea5a2;
    --green-dark: #0b7c7a;
    --green-soft: #e3f7f5;
    --blue: #3b82f6;
    --blue-soft: #eef4fe;
    --violet: #8b5cf6;
    --violet-soft: #f2eefe;
    --amber: #d97706;
    --amber-soft: #fdf3e3;
    --coral: #ec4899;
    --coral-soft: #fdeef5;
    --danger: #e11d48;
    --danger-soft: #fdecef;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.06);
    --shadow-md: 0 14px 40px rgba(15,23,42,.10);
    --shadow-glow: 0 8px 26px rgba(168,85,247,.28);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "ALKATIP Basma Tom", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body, button, input, select, textarea { letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
svg { width: 18px; height: 18px; flex: none; stroke-width: 1.6; }
img { max-width: 100%; }
bdi, code, .money, time { unicode-bidi: isolate; }
:focus-visible { outline: 3px solid rgba(168,85,247,.22); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; clip-path: inset(50%) !important; border: 0 !important; white-space: nowrap !important; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar { position: sticky; z-index: 20; top: 0; height: 100vh; padding: 22px 16px 16px; display: flex; flex-direction: column; overflow-y: auto; background: radial-gradient(1200px 500px at -20% -10%, rgba(168,85,247,.25), transparent 55%), radial-gradient(1000px 500px at 120% 10%, rgba(34,211,238,.14), transparent 55%), var(--sidebar); color: #cbd5e1; scrollbar-color: #2a3550 transparent; border-right: 1px solid rgba(255,255,255,.04); }
.logo { min-height: 54px; margin: 0 6px 18px; padding: 6px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 12px; }
.logo-mark, .login-brand-icon, .login-mark { display: grid; place-items: center; background: var(--grad); color: #fff; }
.logo-mark { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 6px 16px rgba(168,85,247,.45), inset 0 0 0 1px rgba(255,255,255,.18); }
.logo strong, .logo small { display: block; }
.logo strong { color: #fff; font-size: 19px; line-height: 1.1; letter-spacing: .04em; }
.logo small { margin-top: 4px; color: #7c8aa8; font-size: 9px; letter-spacing: .16em; }
.nav-label { margin: 18px 12px 8px; color: #5d6c8d; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.nav { display: grid; gap: 3px; }
.nav > a { min-height: 42px; padding: 10px 12px; border-radius: 11px; display: flex; align-items: center; gap: 11px; color: #9aa9c4; font-size: 13px; font-weight: 500; position: relative; transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav > a svg { width: 18px; height: 18px; color: #6b7aa3; transition: color .16s ease; }
.nav > a:hover { background: var(--sidebar-hover); color: #fff; transform: translateX(2px); }
.nav > a:hover svg { color: #a5b4fc; }
.nav > a.active { background: var(--sidebar-active); color: #fff; font-weight: 650; box-shadow: inset 0 0 0 1px rgba(168,85,247,.25); }
.nav > a.active::before { position: absolute; inset-block: 11px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--grad); content: ""; box-shadow: 0 0 12px rgba(244,114,182,.8); }
.nav > a.active svg { color: #f472b6; }
.user { min-height: 64px; margin-top: auto; padding: 15px 8px 0; border-top: 1px solid rgba(255,255,255,.07); display: grid; grid-template-columns: 36px minmax(0, 1fr) 34px; align-items: center; gap: 9px; color: #dbe4f0; }
.user-avatar-admin { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg,#1e293b,#0f172a); color: #a5b4fc; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.user-avatar-admin svg { width: 17px; height: 17px; }
.user-info { min-width: 0; }
.user-info strong, .user-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info strong { color: #fff; font-size: 12px; }
.user-info small { color: #7c8aa8; font-size: 10px; }
.logout-link { width: 34px; height: 34px; margin: 0; border-radius: 9px; display: grid !important; place-items: center; color: #8a98b8 !important; }
.logout-link:hover { background: rgba(168,85,247,.14); color: #fff !important; }
.logout-link svg { width: 16px; height: 16px; }

.content { width: 100%; max-width: 1720px; min-width: 0; margin: 0 auto; padding: 30px clamp(22px, 3vw, 50px) 60px; }
.top { min-height: 74px; margin-bottom: 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.top-heading { min-width: 0; display: flex; align-items: flex-start; gap: 12px; }
.top h1 { margin: 4px 0 0; color: var(--ink); font-size: 27px; line-height: 1.22; letter-spacing: -.015em; }
.top p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.breadcrumb { min-height: 18px; display: flex; align-items: center; gap: 5px; color: var(--muted-light); font-size: 10px; font-weight: 650; letter-spacing: .03em; }
.breadcrumb svg { width: 11px; height: 11px; }
.breadcrumb strong { color: var(--muted); font-weight: 650; }
.top-actions { padding-top: 4px; display: flex; align-items: center; gap: 9px; }
.mobile-nav-toggle, .sidebar-overlay, .sidebar-close { display: none; }
.icon-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.language-toggle { min-height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); display: flex; align-items: center; box-shadow: var(--shadow-sm); }
.language-toggle a { min-width: 38px; height: 32px; padding: 0 9px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 12px; transition: background .15s ease, color .15s ease; }
.language-toggle a.active { background: var(--grad); color: #fff; }

.button, .muted-button, .danger { min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 650; line-height: 1.35; vertical-align: middle; transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.button { background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); }
.button:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(168,85,247,.36); filter: saturate(1.08); }
.muted-button { border-color: var(--line); background: var(--surface); color: var(--ink-soft); }
.muted-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.danger { border-color: #f6ced6; background: var(--danger-soft); color: var(--danger); }
.danger:hover { border-color: #f2b6c1; background: #fbdde4; }
.button:disabled, .muted-button:disabled, .danger:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.notice, .error { margin-bottom: 18px; padding: 14px 16px; border: 1px solid; border-inline-start-width: 4px; border-radius: var(--radius-sm); }
.notice { border-color: #bfe3e1; border-inline-start-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.error { border-color: #f5ccd4; border-inline-start-color: var(--danger); background: var(--danger-soft); color: #a4294c; }

.panel, .table-wrap, .dashboard-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel { margin-bottom: 20px; padding: 24px; }
.panel h2 { margin: 0 0 17px; color: var(--ink); font-size: 17px; line-height: 1.4; letter-spacing: -.01em; }
.panel p { color: var(--muted); }
.panel > p:first-of-type { margin-top: -7px; }
.panel > :last-child { margin-bottom: 0; }
.panel .table-wrap { border: 0; box-shadow: none; }
.help-text, .inline-note, .section-intro { color: var(--muted); }
.help-text { font-size: 12px; }
.inline-note { margin-inline-start: 18px; }
.section-intro { margin: -8px 0 18px; }
.warning-text { color: #a4294c !important; }
.empty-value { color: var(--muted-light); }
.section-gap { margin-bottom: 24px; }
.action-row, .work-jump-details, .action-offset { margin-top: 8px; }
.work-jump-form { min-width: 360px; }
.table-wrap { margin-bottom: 20px; overflow: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: transparent; }
th, td { padding: 13px 15px; border-bottom: 1px solid #eef1f5; text-align: start; vertical-align: top; }
th { position: sticky; z-index: 2; top: 0; background: #fafcfe; color: #64748b; font-size: 11px; font-weight: 800; white-space: nowrap; letter-spacing: .04em; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #fbffff; }
tbody tr:last-child td { border-bottom: 0; }
td.actions { min-width: 150px; white-space: nowrap; }
.mobile-cell-value { display: contents; }
.status { min-height: 25px; padding: 3px 9px; border: 1px solid #bfe3e1; border-radius: 999px; display: inline-flex; align-items: center; background: var(--green-soft); color: var(--green-dark); font-size: 11px; font-weight: 700; white-space: nowrap; }
.status.off { border-color: #e2e8f0; background: #f1f5f9; color: #64748b; }
.record-link, .text-link { display: inline-flex; align-items: center; gap: 5px; color: var(--violet); font-weight: 650; }
.record-link svg, .text-link svg { width: 14px; height: 14px; }
.miniapp-article-guide { margin: 0 0 16px; padding: 16px 17px; border: 1px solid #e3e0f5; border-radius: var(--radius); display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.7fr); align-items: center; gap: 18px; background: linear-gradient(135deg,#f7f5ff,#fdf5f9); }
.miniapp-guide-copy strong, .miniapp-guide-copy p { display: block; }
.miniapp-guide-copy strong { margin-top: 3px; color: var(--ink); font-size: 15px; }
.miniapp-guide-copy p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.miniapp-guide-values { min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.miniapp-guide-value { min-width: 0; }
.miniapp-guide-value > span { margin-bottom: 5px; display: block; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.copy-value-row, .category-path-copy { min-width: 0; display: flex; align-items: center; gap: 6px; }
.copy-value-row code, .category-path-copy code { min-width: 0; min-height: 36px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); display: block; flex: 1; overflow: hidden; background: #fff; color: var(--ink-soft); font-size: 10px; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; }
.copy-text-button { min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none; background: #fff; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.copy-text-button:hover, .copy-text-button.copied { border-color: #c9b7f5; background: var(--violet-soft); color: var(--violet); }
.copy-text-button:disabled { cursor: not-allowed; opacity: .5; }
.copy-text-button svg { width: 14px; height: 14px; }
.category-path-cell { min-width: 330px; }
.category-path-copy code { background: var(--surface-soft); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { margin-bottom: 7px; display: block; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea, .search-form input, td input { width: 100% !important; max-width: 100%; min-height: 44px; margin: 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fbfdff; color: var(--ink); outline: none; box-sizing: border-box !important; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.field input:focus, .field select:focus, .field textarea:focus, .search-form input:focus, td input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(168,85,247,.12); }
.field input[readonly] { background: #f1f5f9; color: var(--muted); }
.field textarea { min-height: 140px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.65; }
.field input[type="file"] { padding: 8px; background: #fff; }
.field input[type="color"] { min-height: 44px; padding: 5px; }
.secret-input { -webkit-text-security: disc; }
.field small { margin-top: 6px; display: block; color: var(--muted); font-size: 11px; }
.check { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); display: flex; align-items: center; gap: 9px; background: var(--surface-soft); color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.check input { width: 17px !important; height: 17px; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.form-actions { margin-top: 20px; padding-top: 18px; border-top: 1px solid #eef1f5; display: flex; align-items: center; gap: 8px; }
.inline { display: inline-flex; }
.search-form { margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 9px; }
.search-form input { width: min(420px, 70vw) !important; }
.payload, code { border-radius: 8px; background: #f1f5f9; color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.payload { max-width: 380px; max-height: 130px; padding: 10px; overflow: auto; font-size: 11px; }
code { padding: 2px 6px; font-size: .9em; }
details { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
summary { padding: 8px 10px; color: var(--violet); cursor: pointer; font-weight: 650; }
details form { padding: 0 10px 10px; }
.thumb { width: 66px; height: 86px; object-fit: cover; }
.preview-cover { margin-top: 9px; border-radius: 10px; }
.banner-thumb { width: 150px; height: 68px; object-fit: cover; }
.background-thumb { width: 76px; height: 100px; object-fit: cover; }
.thumb, .banner-thumb, .background-thumb, .user-avatar, .user-avatar-empty { border-radius: 10px; background: #eef2f7; }
.music-url { max-width: 320px; display: block; overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.background-editor-panel { scroll-margin-top: 20px; }
.background-editor-heading { margin-bottom: 17px; }
.background-editor-heading > div { min-width: 0; }
.background-editor-heading h2 { margin-bottom: 3px; }
.background-editor-heading p { margin: 0; }
.background-editor-heading .muted-button { flex: none; }
.background-editor-actions { justify-content: space-between; }
.background-editor-actions .check { min-width: 180px; }
.background-editor-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: start; gap: 22px; }
.background-editor-preview-column, .background-editor-fields { min-width: 0; }
.background-editor-preview { position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; background: #eef2f7; }
.background-editor-preview > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; transition: opacity .16s ease; }
.background-editor-preview > img[hidden] { display: none; }
.background-editor-preview.is-loading > img { opacity: .35; }
.background-editor-preview.is-error > img { display: none; }
.background-editor-preview-empty { padding: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.background-editor-preview.has-image .background-editor-preview-empty { display: none; }
.background-editor-preview.is-error .background-editor-preview-empty { display: flex; }
.background-editor-preview-empty svg { width: 28px; height: 28px; margin-bottom: 8px; color: #8b9cf5; }
.background-editor-preview-empty strong { color: var(--ink-soft); font-size: 12px; }
.background-editor-preview-empty span { margin-top: 3px; font-size: 10px; }
.background-editor-preview-badge { position: absolute; z-index: 2; top: 9px; inset-inline-end: 9px; min-height: 24px; padding: 4px 9px; border-radius: 999px; background: rgba(15,23,42,.72); color: #fff; font-size: 10px; font-weight: 700; backdrop-filter: blur(8px); }
.background-editor-preview-meta { margin-top: 8px; }
.background-editor-preview-meta strong, .background-editor-preview-meta small { display: block; }
.background-editor-preview-meta strong { color: var(--ink-soft); font-size: 12px; }
.background-editor-preview-meta small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.background-editor-fields .background-editor-actions { margin-bottom: 0; }
.background-library-section { margin-top: 0; }
.background-editor-panel + .background-library-section { margin-top: 26px; }
.library-section-heading { margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.library-section-heading h2 { margin: 2px 0 0; font-size: 18px; line-height: 1.4; }
.library-section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.library-filters { margin-bottom: 10px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: minmax(180px, .8fr) minmax(135px, .45fr) minmax(260px, 1.35fr) auto; align-items: end; gap: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.library-filter-actions { display: flex; align-items: center; gap: 7px; }
.library-filter-actions .button, .library-filter-actions .muted-button { min-height: 44px; }
.library-batch-bar { min-height: 50px; margin-bottom: 12px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius); display: flex; align-items: center; gap: 12px; background: var(--surface-soft); }
.batch-select-all { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 700; cursor: pointer; }
.batch-selected-count { margin-inline-start: auto; color: var(--muted); font-size: 11px; }
.library-batch-bar .danger { min-height: 34px; padding: 6px 10px; }
.library-checkbox, .batch-select-all input { width: 17px !important; height: 17px; min-height: 0 !important; margin: 0; padding: 0 !important; flex: none; accent-color: var(--accent); cursor: pointer; }
.background-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 15px; }
.background-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.background-card:hover { border-color: #c9b7f5; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.background-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168,85,247,.14), var(--shadow-sm); }
.background-card-media { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: #eef2f7; }
.background-card-media > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.background-card-selector { position: absolute; z-index: 3; top: 10px; inset-inline-start: 10px; width: 32px; height: 32px; border: 1px solid rgba(15,23,42,.1); border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.94); box-shadow: 0 3px 12px rgba(15,23,42,.12); cursor: pointer; }
.background-card-status { position: absolute; z-index: 2; top: 10px; inset-inline-end: 10px; box-shadow: 0 3px 10px rgba(15,23,42,.08); }
.background-card-open { position: absolute; z-index: 2; inset-inline-end: 10px; bottom: 10px; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.36); border-radius: 9px; display: grid; place-items: center; background: rgba(15,23,42,.7); color: #fff; backdrop-filter: blur(8px); }
.background-card-open:hover { background: rgba(15,23,42,.9); }
.background-card-open svg { width: 16px; height: 16px; }
.background-card-body { padding: 13px; }
.background-card-title { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.background-card-title > div { min-width: 0; }
.background-card-title strong, .background-card-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.background-card-title strong { color: var(--ink); font-size: 13px; }
.background-card-title small { margin-top: 2px; color: var(--muted-light); font-size: 10px; }
.background-card-title > span { flex: none; color: var(--muted); font: 700 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.background-card-meta { margin-top: 9px; padding-top: 8px; border-top: 1px solid #eef1f5; display: flex; align-items: center; justify-content: space-between; gap: 7px; color: var(--muted-light); font-size: 9px; }
.background-card-meta time { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.background-card-meta span { flex: none; }
.background-card-actions { margin-top: 11px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.background-card-actions form { min-width: 0; }
.background-card-actions .muted-button, .background-card-actions .danger { width: 100%; min-height: 36px; padding: 7px 9px; }
.background-card-actions svg { width: 14px; height: 14px; }
.pagination { min-height: 60px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.pagination > :last-child { justify-self: end; }
.pagination strong { color: var(--muted); font-size: 12px; }
.library-empty { min-height: 240px; border-top: 1px solid var(--line); }
.user-cell { min-width: 185px; display: flex; align-items: center; gap: 10px; }
.user-avatar, .user-avatar-empty { width: 40px; height: 40px; flex: none; object-fit: cover; }
.user-avatar-empty { display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.user-name { min-width: 0; }
.user-name strong, .user-name small { display: block; }
.user-name strong { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name small, .copywriting-meta { color: var(--muted-light); font-size: 11px; }
.money { font-weight: 750; white-space: nowrap; }
.copywriting-preview { max-width: 520px; white-space: pre-wrap; overflow-wrap: anywhere; }
audio { width: 220px; height: 34px; }

.dashboard-welcome { min-height: 112px; margin-bottom: 16px; padding: 23px 25px; border: 1px solid #e6e0f7; border-radius: var(--radius); display: flex; align-items: center; justify-content: space-between; gap: 18px; background: linear-gradient(120deg, #fdf4f8 0%, #f3f0ff 100%); position: relative; overflow: hidden; }
.dashboard-welcome::after { position: absolute; inset-inline-end: -40px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(244,114,182,.28), transparent 65%); content: ""; pointer-events: none; }
.dashboard-welcome h2 { margin: 4px 0 4px; font-size: 23px; letter-spacing: -.01em; }
.dashboard-welcome p { margin: 0; color: var(--muted); }
.welcome-kicker, .panel-kicker { color: var(--violet); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.welcome-date { padding: 9px 12px; border: 1px solid #e3ddf7; border-radius: 11px; display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.72); color: var(--ink-soft); font-size: 12px; white-space: nowrap; box-shadow: var(--shadow-sm); }
.welcome-date svg { width: 16px; height: 16px; }
.stats { margin-bottom: 16px; display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 12px; }
.stat { position: relative; min-width: 0; min-height: 156px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .16s ease, transform .16s ease; }
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat::after { position: absolute; inset-inline-end: -40px; bottom: -50px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, rgba(139,92,246,.12), transparent 60%); content: ""; pointer-events: none; }
.stat-head { min-height: 34px; margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.stat-icon svg { width: 18px; height: 18px; }
.stat-green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-blue .stat-icon { background: var(--blue-soft); color: var(--blue); }
.stat-violet .stat-icon { background: var(--violet-soft); color: var(--violet); }
.stat-amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat-coral .stat-icon { background: var(--coral-soft); color: var(--coral); }
.stat-teal .stat-icon { background: #e8f6fb; color: #1592c9; }
.stat > strong { display: block; overflow: hidden; color: var(--ink); font-size: 26px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.stat-label { margin-top: 5px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.stat small { margin-top: auto; padding-top: 8px; overflow: hidden; color: var(--muted-light); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.metric-change { padding: 3px 6px; border-radius: 7px; display: inline-flex; align-items: center; gap: 3px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; font-weight: 800; }
.metric-change.down { color: var(--danger); background: var(--danger-soft); }
.metric-change svg { width: 11px; height: 11px; }
.dashboard-grid { margin-bottom: 16px; display: grid; gap: 16px; }
.dashboard-grid-primary { grid-template-columns: minmax(0, 1.75fr) minmax(300px, .75fr); }
.dashboard-grid-secondary { grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr); }
.dashboard-panel { min-width: 0; padding: 20px; }
.panel-heading { min-height: 42px; margin-bottom: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading h2 { margin: 2px 0 0; font-size: 16px; line-height: 1.35; }
.panel-note { color: var(--muted-light); font-size: 10px; }
.chart-frame { position: relative; height: 290px; }
.chart-frame canvas { position: relative; z-index: 2; }
.chart-empty { position: absolute; z-index: 1; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted-light); text-align: center; }
.chart-empty svg { width: 28px; height: 28px; margin-bottom: 9px; }
.chart-empty strong { color: var(--ink-soft); font-size: 13px; }
.chart-empty span { margin-top: 3px; font-size: 11px; }
.chart-frame.has-data .chart-empty { display: none; }
.chart-frame:not(.has-data) canvas { visibility: hidden; }
.task-count { min-width: 27px; height: 27px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 800; }
.task-list { display: grid; gap: 5px; }
.task-item { min-height: 55px; padding: 8px 7px; border-bottom: 1px solid #eef1f5; display: grid; grid-template-columns: 9px minmax(0,1fr) 16px; align-items: center; gap: 9px; }
.task-item:last-child { border-bottom: 0; }
.task-item:hover { background: var(--surface-soft); border-radius: 9px; }
.task-item > span:nth-child(2) { min-width: 0; }
.task-item strong, .task-item small { display: block; }
.task-item strong { font-size: 12px; }
.task-item small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.task-item > svg { width: 14px; height: 14px; color: var(--muted-light); }
.task-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.task-warning .task-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(217,119,6,.12); }
.task-danger .task-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(225,29,72,.12); }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.quick-actions a { min-height: 80px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--surface-soft); color: var(--ink-soft); text-align: center; font-size: 11px; font-weight: 650; transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease; }
.quick-actions a:hover { border-color: #c9b7f5; background: var(--grad-soft); color: var(--violet); transform: translateY(-2px); }
.quick-actions svg { width: 20px; height: 20px; }
.activity-list { display: grid; }
.activity-item { min-height: 54px; padding: 7px 0; border-bottom: 1px solid #eef1f5; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.activity-icon svg { width: 15px; height: 15px; }
.activity-copy { min-width: 0; }
.activity-copy strong, .activity-copy small { display: block; }
.activity-copy strong { font-size: 11px; }
.activity-copy small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.activity-item time { color: var(--muted-light); font-size: 9px; white-space: nowrap; }
.recent-panel { margin-bottom: 0; }
.recent-panel .table-wrap { margin: 0 -20px -20px; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
.empty-state { min-height: 170px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.empty-state.compact { min-height: 210px; }
.empty-state svg { width: 28px; height: 28px; margin-bottom: 9px; color: #8b9cf5; }
.empty-state strong { color: var(--ink-soft); }
.empty-state span { margin-top: 4px; font-size: 11px; }

.login-page { min-height: 100vh; padding: 28px; display: grid; place-items: center; background: radial-gradient(1200px 700px at 20% 0%, rgba(168,85,247,.35), transparent 55%), radial-gradient(1000px 700px at 90% 100%, rgba(34,211,238,.22), transparent 55%), #0b1020; overflow: auto; }
.login-shell { width: min(920px, 100%); min-height: 540px; border: 1px solid rgba(255,255,255,.1); border-radius: 20px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); overflow: hidden; background: #131a2e; box-shadow: 0 35px 90px rgba(0,0,0,.4); }
.login-intro { padding: clamp(45px, 7vw, 82px); display: flex; flex-direction: column; justify-content: center; color: #ccd7ee; background: #131a2e; }
.login-mark { width: 50px; height: 50px; margin-bottom: 28px; border-radius: 13px; }
.login-mark svg { width: 24px; height: 24px; }
.login-eyebrow { margin: 0 0 12px; color: #a5b4fc; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.login-intro h1 { max-width: 410px; margin: 0; color: #fff; font-size: 32px; line-height: 1.3; }
.login-intro > p:not(.login-eyebrow) { max-width: 390px; margin: 16px 0 0; color: #8e9cc0; line-height: 1.8; }
.login-signal { margin-top: 80px; display: flex; align-items: center; gap: 8px; color: #7484a8; font-size: 11px; }
.login-signal span { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.14); }
.login { position: relative; width: auto; padding: 52px 42px; display: flex; flex-direction: column; justify-content: center; background: #fff; }
.login-language { position: absolute; top: 22px; inset-inline-end: 22px; }
.login-brand { margin-bottom: 34px; display: flex; align-items: center; gap: 11px; }
.login-brand-icon { width: 40px; height: 40px; border-radius: 11px; }
.login-brand-icon svg { width: 19px; height: 19px; }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { font-size: 20px; line-height: 1.1; }
.login-brand small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.login-field { margin-top: 17px; }
.input-with-icon { position: relative; }
.input-with-icon > svg { position: absolute; z-index: 2; top: 50%; inset-inline-start: 12px; width: 16px; height: 16px; color: #8290a8; transform: translateY(-50%); }
.input-with-icon input { padding-inline-start: 40px !important; }
.login-submit { width: 100%; min-height: 46px; margin-top: 25px; }
.login .error { margin: 0 0 4px; }

html[dir="rtl"] body { font-family: "ALKATIP Basma Tom", Tahoma, Arial, sans-serif; }
html[dir="rtl"] .breadcrumb svg, html[dir="rtl"] .task-item > svg, html[dir="rtl"] .text-link svg { transform: scaleX(-1); }
html[dir="rtl"] th, html[dir="rtl"] td { text-align: right; }
html[dir="rtl"] input:not([dir]), html[dir="rtl"] textarea:not([dir]) { text-align: right; }
html[dir="rtl"] input[type="url"], html[dir="rtl"] input[name*="url"], html[dir="rtl"] input[name*="appid"], html[dir="rtl"] input[name*="secret"] { direction: ltr; text-align: left; }

@media (max-width: 1380px) {
    .stats { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
    .stat { min-height: 138px; }
}

@media (max-width: 1100px) {
    .layout { grid-template-columns: 230px minmax(0, 1fr); }
    .content { padding-inline: 24px; }
    .dashboard-grid-primary, .dashboard-grid-secondary { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
    body { min-height: 100dvh; }
    body.nav-open { overflow: hidden; }
    .layout { display: block; }
    .sidebar { position: fixed; z-index: 1001; inset-block: 0; inset-inline-start: 0; width: min(88vw, 340px); height: 100dvh; padding: calc(20px + env(safe-area-inset-top)) 16px calc(15px + env(safe-area-inset-bottom)); transform: translateX(-105%); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
    html[dir="rtl"] .sidebar { transform: translateX(105%); }
    body.nav-open .sidebar { transform: translateX(0); }
    .sidebar-overlay { position: fixed; z-index: 1000; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; display: block; background: rgba(9,15,28,.6); opacity: 0; pointer-events: none; transition: opacity .18s ease; }
    body.nav-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
    .logo { margin-bottom: 14px; }
    .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
    .nav > a { min-height: 44px; padding: 9px 10px; border: 1px solid rgba(255,255,255,.03); background: rgba(255,255,255,.02); }
    .nav > a.active { border-color: rgba(168,85,247,.28); }
    .nav > a:hover { transform: none; }
    .nav-label { grid-column: 1 / -1; margin: 15px 6px 6px; }
    .content { padding: calc(14px + env(safe-area-inset-top)) 14px calc(36px + env(safe-area-inset-bottom)); }
    .top { position: sticky; z-index: 900; top: 0; min-height: 66px; margin: calc(-14px - env(safe-area-inset-top)) -14px 17px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); box-shadow: 0 6px 20px rgba(15,23,42,.07); backdrop-filter: blur(14px); }
    .top-heading { flex: 1; align-items: center; gap: 10px; }
    .top-heading > div { min-width: 0; }
    .top h1 { margin: 0; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
    .top p, .breadcrumb { display: none; }
    .top-actions { padding: 0; flex: none; gap: 6px; }
    .mobile-nav-toggle { width: auto; min-width: 74px; height: 40px; margin: 0; padding: 0 12px; border: 0; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: none; background: var(--grad); color: #fff; font-size: 12px; font-weight: 750; box-shadow: var(--shadow-glow); }
    .mobile-nav-toggle svg { width: 17px; height: 17px; }
    .sidebar-close { position: absolute; z-index: 2; top: calc(18px + env(safe-area-inset-top)); inset-inline-end: 15px; width: 36px; height: 36px; padding: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.05); color: #d9e3f0; }
    .sidebar-close svg { width: 17px; height: 17px; }
    .sidebar .logo { padding-inline-end: 46px; }
    .top-actions > .button { width: 40px; height: 38px; min-height: 38px; padding: 0; }
    .top-actions > .button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .language-toggle { min-height: 36px; padding: 2px; box-shadow: none; }
    .language-toggle a { min-width: 33px; height: 30px; padding: 0 7px; }
    .dashboard-welcome { min-height: 0; padding: 18px; align-items: flex-start; }
    .dashboard-welcome h2 { font-size: 19px; }
    .dashboard-welcome p { font-size: 12px; }
    .welcome-date { display: none; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .stat { min-height: 132px; padding: 14px; }
    .stat > strong { font-size: 23px; }
    .dashboard-grid { gap: 13px; }
    .dashboard-panel { padding: 16px; }
    .chart-frame { height: 240px; }
    .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .recent-panel .table-wrap { margin: 0 -16px -16px; }
    .panel { margin-bottom: 15px; padding: 18px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .field.full { grid-column: auto; }
    .field input, .field select, .field textarea { min-height: 48px; }
    .check { min-height: 48px; }
    .form-actions { margin-top: 17px; padding-top: 15px; }
    .form-actions .button { width: 100%; min-height: 46px; }
    .background-editor-heading { align-items: center; }
    .background-editor-heading .muted-button { min-height: 38px; padding: 7px 10px; }
    .background-editor-actions { flex-direction: column; align-items: stretch; }
    .background-editor-actions .check { width: 100%; min-width: 0; }
    .background-editor-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .background-editor-preview-column { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 12px; }
    .background-editor-preview-meta { margin-top: 0; }
    .miniapp-article-guide { grid-template-columns: minmax(0, 1fr); align-items: start; }
    .miniapp-guide-values { grid-template-columns: minmax(0, 1fr); }
    .category-path-cell { min-width: 0; }
    .category-path-copy { width: 100%; }
    .library-section-heading { align-items: flex-start; }
    .library-filters { padding: 13px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .library-search-field, .library-filter-actions { grid-column: 1 / -1; }
    .library-filter-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .library-filter-actions .button, .library-filter-actions .muted-button { width: 100%; }
    .library-batch-bar { flex-wrap: wrap; }
    .batch-selected-count { margin-inline-start: 0; }
    .library-batch-bar .danger { margin-inline-start: auto; }
    .background-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 11px; }
    .pagination { min-height: 62px; }
    html[dir="rtl"] .pagination svg { transform: scaleX(-1); }
    .search-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .search-form input { width: 100% !important; grid-column: 1 / -1; }
    .search-form .button, .search-form .muted-button { min-height: 44px; }
    .table-wrap { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
    table { min-width: 0 !important; display: block; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
    tbody { display: grid; gap: 10px; }
    tbody tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
    td { min-width: 0 !important; padding: 11px 13px; display: grid; grid-template-columns: minmax(70px, 27%) minmax(0, 1fr); align-items: start; gap: 10px; border-bottom: 1px solid #eef1f5; overflow-wrap: anywhere; }
    td::before { color: var(--muted-light); content: attr(data-label); font-size: 9px; font-weight: 800; line-height: 1.6; text-align: start; text-transform: uppercase; }
    td:last-child { border-bottom: 0; }
    td:empty { display: none; }
    .mobile-cell-value { min-width: 0; display: block; text-align: start; overflow-wrap: anywhere; }
    td.actions { min-width: 0; white-space: normal; }
    td.actions .mobile-cell-value { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
    td.actions .inline { margin: 0; }
    td.actions .button, td.actions .muted-button, td.actions .danger { min-height: 38px; margin: 0; padding: 8px 11px; }
    td form:not(.inline) .button, td form:not(.inline) .muted-button, td form:not(.inline) .danger { margin-top: 7px; }
    .panel .table-wrap tbody tr { box-shadow: none; }
    .banner-thumb { width: min(100%, 220px); height: auto; aspect-ratio: 20 / 9; }
    .music-url, .copywriting-preview, .payload { max-width: 100%; }
    .payload { max-height: 180px; }
    audio { width: min(100%, 280px); }
    details form { min-width: 0 !important; }
    .login-page { padding: 0; }
    .login-shell { width: 100%; min-height: 100dvh; border: 0; border-radius: 0; display: block; background: #fff; }
    .login-intro { display: none; }
    .login { min-height: 100dvh; padding: calc(72px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
    .content { padding-inline: 12px; }
    .top { margin-inline: -12px; padding-inline: 12px; }
    .top h1 { font-size: 18px; }
    .language-toggle a { min-width: 30px; padding: 0 5px; }
    .stats { gap: 8px; }
    .stat { min-height: 126px; padding: 13px; }
    .stat > strong { font-size: 21px; }
    .stat small { font-size: 9px; }
    .quick-actions { gap: 6px; }
    .quick-actions a { min-height: 72px; padding-inline: 5px; font-size: 10px; }
    .activity-item { grid-template-columns: 30px minmax(0,1fr); }
    .activity-item time { display: none; }
    td { grid-template-columns: minmax(68px, 27%) minmax(0, 1fr); }
    .library-filters { grid-template-columns: minmax(0, 1fr); }
    .library-search-field, .library-filter-actions { grid-column: auto; }
    .background-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .background-card-body { padding: 10px; }
    .background-card-selector { top: 8px; inset-inline-start: 8px; }
    .background-card-status { top: 8px; inset-inline-end: 8px; }
    .background-card-open { inset-inline-end: 8px; bottom: 8px; }
    .background-card-meta { align-items: flex-start; flex-direction: column; gap: 2px; }
    .background-card-actions { gap: 5px; }
    .background-card-actions .muted-button, .background-card-actions .danger { padding-inline: 5px; font-size: 11px; }
    .background-editor-heading { align-items: flex-start; }
    .background-editor-heading .muted-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .background-editor-preview-column { grid-template-columns: 96px minmax(0, 1fr); }
    .background-editor-preview-empty { padding: 9px; }
    .background-editor-preview-empty svg { width: 22px; height: 22px; }
    .background-editor-preview-badge { top: 6px; inset-inline-end: 6px; }
    .login { padding-inline: 21px; }
}

@media (max-width: 350px) {
    .stats { grid-template-columns: 1fr; }
    .stat { min-height: 118px; }
    .nav { grid-template-columns: 1fr; }
}

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